aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Application/Application.cs2
-rw-r--r--OpenSim/Region/Application/ConfigurationLoader.cs24
-rw-r--r--OpenSim/Region/Application/IApplicationPlugin.cs2
-rw-r--r--OpenSim/Region/Application/OpenSim.cs315
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs95
-rw-r--r--OpenSim/Region/Application/Properties/AssemblyInfo.cs (renamed from OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Properties/AssemblyInfo.cs)13
-rw-r--r--OpenSim/Region/ClientStack/ClientStackManager.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/AgentPreferencesModule.cs182
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs125
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs4
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs77
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs9
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs91
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs20
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetDisplayNamesModule.cs144
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs55
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs29
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs111
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/Tests/WebFetchInvDescModuleTests.cs159
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs196
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs148
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs546
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs139
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs424
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServerCommands.cs901
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs95
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs108
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs1
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Tests/PacketHandlerTests.cs1
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs170
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs427
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs13
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs286
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs19
-rw-r--r--OpenSim/Region/ClientStack/RegionApplicationBase.cs5
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs6
-rw-r--r--OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs28
-rw-r--r--OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs9
-rw-r--r--OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs99
-rw-r--r--OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs89
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs25
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs414
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs96
-rw-r--r--OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs201
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs30
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Chat/Tests/ChatModuleTests.cs285
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs8
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs30
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs26
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs15
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs8
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs18
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs169
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs12
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs117
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs102
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs103
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs25
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs9
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs13
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs7
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs29
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/Tests/InventoryTransferModuleTests.cs9
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs15
-rw-r--r--OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs359
-rw-r--r--OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs586
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferStateMachine.cs5
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs267
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs215
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs125
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs107
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/HGAssetMapperTests.cs146
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/Library/LocalInventoryService.cs48
-rw-r--r--OpenSim/Region/CoreModules/Framework/Search/BasicSearchModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Framework/ServiceThrottle/ServiceThrottleModule.cs2
-rwxr-xr-xOpenSim/Region/CoreModules/Framework/Statistics/Logging/LogWriter.cs4
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs12
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/Tests/HGUserManagementModuleTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs458
-rw-r--r--OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Properties/AssemblyInfo.cs6
-rw-r--r--OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs134
-rw-r--r--OpenSim/Region/CoreModules/Scripting/HttpRequest/Tests/ScriptsHttpRequestsTests.cs7
-rw-r--r--OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs53
-rw-r--r--OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs15
-rw-r--r--OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs15
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/AgentPreferences/LocalAgentPreferencesServiceConnector.cs153
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/AgentPreferences/RemoteAgentPreferencesServiceConnector.cs116
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs45
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs11
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs34
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs53
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs37
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs9
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs23
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs124
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs24
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs35
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs24
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs83
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs3
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs35
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs21
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs10
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs7
-rw-r--r--OpenSim/Region/CoreModules/World/Access/AccessModule.cs10
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs95
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs41
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs32
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs9
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs6
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs14
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs395
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs12
-rw-r--r--OpenSim/Region/CoreModules/World/Land/DwellModule.cs20
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs515
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs166
-rw-r--r--OpenSim/Region/CoreModules/World/Land/Tests/LandManagementModuleTests.cs266
-rw-r--r--OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs103
-rw-r--r--OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs32
-rw-r--r--OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs3
-rw-r--r--OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs90
-rw-r--r--OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs160
-rw-r--r--OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs30
-rw-r--r--OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs517
-rw-r--r--OpenSim/Region/CoreModules/World/Sun/SunModule.cs181
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs235
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs14
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/ITerrainFeature.cs60
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/ITerrainModifier.cs77
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/Modifiers/FillModifier.cs93
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/Modifiers/LowerModifier.cs92
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/Modifiers/MaxModifier.cs92
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/Modifiers/MinModifier.cs92
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/Modifiers/NoiseModifier.cs108
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/Modifiers/RaiseModifier.cs92
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/Modifiers/SmoothModifier.cs131
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/TerrainModifier.cs378
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/TerrainModifierData.cs17
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs709
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainModuleTests.cs (renamed from OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs)74
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs12
-rw-r--r--OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs341
-rw-r--r--OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs214
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs77
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs413
-rw-r--r--OpenSim/Region/DataSnapshot/DataSnapshotManager.cs85
-rw-r--r--OpenSim/Region/DataSnapshot/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAgentStatefulModule.cs61
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs7
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEstateDataService.cs115
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs120
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEstateModule.cs7
-rw-r--r--OpenSim/Region/Framework/Interfaces/IGroupsMessagingModule.cs26
-rw-r--r--OpenSim/Region/Framework/Interfaces/IHttpRequests.cs46
-rw-r--r--OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs4
-rw-r--r--OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs32
-rw-r--r--OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs10
-rw-r--r--OpenSim/Region/Framework/Interfaces/IMapImageUploadModule.cs11
-rw-r--r--OpenSim/Region/Framework/Interfaces/IMessageTransferModule.cs20
-rw-r--r--OpenSim/Region/Framework/Interfaces/INPCModule.cs37
-rw-r--r--OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs5
-rw-r--r--OpenSim/Region/Framework/Interfaces/IRegionModuleBase.cs1
-rw-r--r--OpenSim/Region/Framework/Interfaces/ITerrainModule.cs12
-rw-r--r--OpenSim/Region/Framework/Interfaces/IUserManagement.cs96
-rw-r--r--OpenSim/Region/Framework/Interfaces/IWindModelPlugin.cs3
-rw-r--r--OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs4
-rw-r--r--OpenSim/Region/Framework/Properties/AssemblyInfo.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/BinBVHAnimation.cs49
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs84
-rw-r--r--OpenSim/Region/Framework/Scenes/KeyframeMotion.cs172
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs412
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs28
-rwxr-xr-x[-rw-r--r--]OpenSim/Region/Framework/Scenes/Scene.cs1225
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs1835
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs47
-rwxr-xr-x[-rw-r--r--]OpenSim/Region/Framework/Scenes/SceneGraph.cs126
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs415
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs196
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs21
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs1032
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs87
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs480
-rwxr-xr-x[-rw-r--r--]OpenSim/Region/Framework/Scenes/SimStatsReporter.cs260
-rw-r--r--OpenSim/Region/Framework/Scenes/TerrainChannel.cs33
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs347
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs259
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs38
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectSerializationTests.cs136
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs20
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs183
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs76
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneStatisticsTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneTelehubTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs24
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SharedRegionModuleTests.cs249
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs15
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs91
-rw-r--r--OpenSim/Region/Framework/Scenes/UuidGatherer.cs493
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs4
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs66
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs194
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs18
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs289
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs82
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs148
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs19
-rw-r--r--OpenSim/Region/OptionalModules/Example/BareBonesNonShared/BareBonesNonSharedModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs38
-rw-r--r--OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs93
-rw-r--r--OpenSim/Region/OptionalModules/Properties/AssemblyInfo.cs6
-rwxr-xr-xOpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs98
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs4
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs136
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs7
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs8
-rw-r--r--OpenSim/Region/OptionalModules/ViewerSupport/CameraOnlyModeModule.cs176
-rw-r--r--OpenSim/Region/OptionalModules/ViewerSupport/DynamicMenuModule.cs3
-rw-r--r--OpenSim/Region/OptionalModules/ViewerSupport/GodNamesModule.cs144
-rw-r--r--OpenSim/Region/OptionalModules/ViewerSupport/SimulatorFeaturesHelper.cs171
-rw-r--r--OpenSim/Region/OptionalModules/ViewerSupport/SpecialUIModule.cs165
-rw-r--r--OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs123
-rw-r--r--OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModuleState.cs14
-rw-r--r--OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs17
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs66
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs131
-rw-r--r--OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs140
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs3
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs1
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs4
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs5
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs76
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSActorHover.cs1
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSActorLockAxis.cs140
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSActorMoveToTarget.cs1
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSActorSetForce.cs1
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSActorSetTorque.cs1
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSActors.cs4
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs19
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs92
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs140
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs28
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs90
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs40
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSParam.cs104
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs84
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs345
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs2
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs213
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs34
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSShapes.cs219
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs4
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs19
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs13
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/Properties/AssemblyInfo.cs2
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/Tests/BulletSimTestsUtil.cs19
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/Tests/HullCreation.cs205
-rw-r--r--OpenSim/Region/Physics/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/Physics/Manager/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/Physics/Manager/NullPhysicsScene.cs3
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsActor.cs10
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs4
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsScene.cs18
-rw-r--r--OpenSim/Region/Physics/Meshing/Meshmerizer.cs15
-rw-r--r--OpenSim/Region/Physics/Meshing/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs4
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs15
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdeScene.cs8
-rw-r--r--OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/Physics/POSPlugin/POSCharacter.cs7
-rw-r--r--OpenSim/Region/Physics/POSPlugin/POSPrim.cs1
-rw-r--r--OpenSim/Region/Physics/POSPlugin/POSScene.cs3
-rw-r--r--OpenSim/Region/RegionCombinerModule/Properties/AssemblyInfo.cs5
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs2
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs2
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionData.cs1
-rw-r--r--OpenSim/Region/RegionCombinerModule/Resources/RegionCombinerModule.addin.xml14
-rw-r--r--OpenSim/Region/ScriptEngine/Interfaces/ICompiler.cs31
-rw-r--r--OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs27
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs24
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs4618
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs373
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs320
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs24
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs10
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs5
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs45
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Atom.cs218
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/BagofAnswers.cs239
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/FindallAnswers.cs108
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor.cs196
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor1.cs124
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor2.cs163
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor3.cs141
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/IndexedAnswers.cs385
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/ListPair.cs166
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Parser.cs4575
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/PrologException.cs159
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/UndefinedPredicateException.cs62
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Variable.cs222
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YP.cs2701
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YPCompiler.cs6382
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs239
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs124
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/YP2CSConverter.cs117
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/lsl.lexer.cs3433
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/lsl.parser.cs18352
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs560
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs186
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs158
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs7
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs131
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs53
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs5
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs11
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiObjectTests.cs13
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiUserTests.cs157
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs7
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs27
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs19
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/Properties/AssemblyInfo.cs5
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/Resources/XEngine.addin.xml13
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineBasicTests.cs7
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineCrossingTests.cs195
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/Tests/XEnginePersistenceTests.cs152
-rwxr-xr-x[-rw-r--r--]OpenSim/Region/ScriptEngine/XEngine/XEngine.cs529
-rw-r--r--OpenSim/Region/UserStatistics/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/UserStatistics/SimStatsAJAX.cs6
-rw-r--r--OpenSim/Region/UserStatistics/WebStatsModule.cs4
380 files changed, 42493 insertions, 33366 deletions
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs
index 6215055..e441cc8 100644
--- a/OpenSim/Region/Application/Application.cs
+++ b/OpenSim/Region/Application/Application.cs
@@ -130,7 +130,7 @@ namespace OpenSim
130 if (workerThreads < workerThreadsMin) 130 if (workerThreads < workerThreadsMin)
131 { 131 {
132 workerThreads = workerThreadsMin; 132 workerThreads = workerThreadsMin;
133 m_log.InfoFormat("[OPENSIM MAIN]: Bumping up to max worker threads to {0}",workerThreads); 133 m_log.InfoFormat("[OPENSIM MAIN]: Bumping up max worker threads to {0}",workerThreads);
134 } 134 }
135 if (workerThreads > workerThreadsMax) 135 if (workerThreads > workerThreadsMax)
136 { 136 {
diff --git a/OpenSim/Region/Application/ConfigurationLoader.cs b/OpenSim/Region/Application/ConfigurationLoader.cs
index 52e520c..b19e549 100644
--- a/OpenSim/Region/Application/ConfigurationLoader.cs
+++ b/OpenSim/Region/Application/ConfigurationLoader.cs
@@ -82,8 +82,7 @@ namespace OpenSim
82 82
83 List<string> sources = new List<string>(); 83 List<string> sources = new List<string>();
84 84
85 string masterFileName = 85 string masterFileName = startupConfig.GetString("inimaster", "OpenSimDefaults.ini");
86 startupConfig.GetString("inimaster", "OpenSimDefaults.ini");
87 86
88 if (masterFileName == "none") 87 if (masterFileName == "none")
89 masterFileName = String.Empty; 88 masterFileName = String.Empty;
@@ -207,25 +206,14 @@ namespace OpenSim
207 Environment.Exit(1); 206 Environment.Exit(1);
208 } 207 }
209 208
209 // Merge OpSys env vars
210 m_log.Info("[CONFIG]: Loading environment variables for Config");
211 Util.MergeEnvironmentToConfig(m_config.Source);
212
210 // Make sure command line options take precedence 213 // Make sure command line options take precedence
211 m_config.Source.Merge(argvSource); 214 m_config.Source.Merge(argvSource);
212 215
213 IConfig enVars = m_config.Source.Configs["Environment"]; 216 m_config.Source.ReplaceKeyValues();
214
215 if( enVars != null )
216 {
217 string[] env_keys = enVars.GetKeys();
218
219 foreach ( string key in env_keys )
220 {
221 envConfigSource.AddEnv(key, string.Empty);
222 }
223
224 envConfigSource.LoadEnv();
225 m_config.Source.Merge(envConfigSource);
226 }
227
228 m_config.Source.ExpandKeyValues();
229 217
230 ReadConfigSettings(); 218 ReadConfigSettings();
231 219
diff --git a/OpenSim/Region/Application/IApplicationPlugin.cs b/OpenSim/Region/Application/IApplicationPlugin.cs
index 6e6d48c..a3fa66c 100644
--- a/OpenSim/Region/Application/IApplicationPlugin.cs
+++ b/OpenSim/Region/Application/IApplicationPlugin.cs
@@ -26,12 +26,14 @@
26 */ 26 */
27 27
28using OpenSim.Framework; 28using OpenSim.Framework;
29using Mono.Addins;
29 30
30namespace OpenSim 31namespace OpenSim
31{ 32{
32 /// <summary> 33 /// <summary>
33 /// OpenSimulator Application Plugin framework interface 34 /// OpenSimulator Application Plugin framework interface
34 /// </summary> 35 /// </summary>
36 [TypeExtensionPoint(NodeName="Plugin", NodeType = typeof(PluginExtensionNode), Path="/OpenSim/Startup")]
35 public interface IApplicationPlugin : IPlugin 37 public interface IApplicationPlugin : IPlugin
36 { 38 {
37 /// <summary> 39 /// <summary>
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 1e6ef3b..a350510 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -45,6 +45,7 @@ using OpenSim.Framework.Servers;
45using OpenSim.Framework.Monitoring; 45using OpenSim.Framework.Monitoring;
46using OpenSim.Region.Framework.Interfaces; 46using OpenSim.Region.Framework.Interfaces;
47using OpenSim.Region.Framework.Scenes; 47using OpenSim.Region.Framework.Scenes;
48using OpenSim.Services.Interfaces;
48 49
49namespace OpenSim 50namespace OpenSim
50{ 51{
@@ -114,8 +115,13 @@ namespace OpenSim
114 if (!String.IsNullOrEmpty(asyncCallMethodStr) && Utils.EnumTryParse<FireAndForgetMethod>(asyncCallMethodStr, out asyncCallMethod)) 115 if (!String.IsNullOrEmpty(asyncCallMethodStr) && Utils.EnumTryParse<FireAndForgetMethod>(asyncCallMethodStr, out asyncCallMethod))
115 Util.FireAndForgetMethod = asyncCallMethod; 116 Util.FireAndForgetMethod = asyncCallMethod;
116 117
118<<<<<<< HEAD
119 stpMinThreads = startupConfig.GetInt("MinPoolThreads", 15);
120 stpMaxThreads = startupConfig.GetInt("MaxPoolThreads", 300);
121=======
117 stpMinThreads = startupConfig.GetInt("MinPoolThreads", 2 ); 122 stpMinThreads = startupConfig.GetInt("MinPoolThreads", 2 );
118 stpMaxThreads = startupConfig.GetInt("MaxPoolThreads", 25); 123 stpMaxThreads = startupConfig.GetInt("MaxPoolThreads", 25);
124>>>>>>> avn/ubitvar
119 m_consolePrompt = startupConfig.GetString("ConsolePrompt", @"Region (\R) "); 125 m_consolePrompt = startupConfig.GetString("ConsolePrompt", @"Region (\R) ");
120 } 126 }
121 127
@@ -155,7 +161,7 @@ namespace OpenSim
155 ((RemoteConsole)m_console).ReadConfig(Config); 161 ((RemoteConsole)m_console).ReadConfig(Config);
156 break; 162 break;
157 default: 163 default:
158 m_console = new LocalConsole("Region"); 164 m_console = new LocalConsole("Region", Config.Configs["Startup"]);
159 break; 165 break;
160 } 166 }
161 } 167 }
@@ -267,13 +273,20 @@ namespace OpenSim
267 SavePrimsXml2); 273 SavePrimsXml2);
268 274
269 m_console.Commands.AddCommand("Archiving", false, "load oar", 275 m_console.Commands.AddCommand("Archiving", false, "load oar",
276<<<<<<< HEAD
277=======
270 278
279>>>>>>> avn/ubitvar
271 "load oar [--merge] [--skip-assets]" 280 "load oar [--merge] [--skip-assets]"
272 + " [--default-user \"User Name\"]" 281 + " [--default-user \"User Name\"]"
273 + " [--force-terrain] [--force-parcels]" 282 + " [--force-terrain] [--force-parcels]"
274 + " [--no-objects]" 283 + " [--no-objects]"
275 + " [--rotation degrees] [--rotation-center \"<x,y,z>\"]" 284 + " [--rotation degrees] [--rotation-center \"<x,y,z>\"]"
285<<<<<<< HEAD
286 + " [--displacement \"<x,y,z>\"]"
287=======
276 + " [--displacement \"<x,y,z>\"]" 288 + " [--displacement \"<x,y,z>\"]"
289>>>>>>> avn/ubitvar
277 + " [<OAR path>]", 290 + " [<OAR path>]",
278 "Load a region's data from an OAR archive.", 291 "Load a region's data from an OAR archive.",
279 "--merge will merge the OAR with the existing scene (suppresses terrain and parcel info loading).\n" 292 "--merge will merge the OAR with the existing scene (suppresses terrain and parcel info loading).\n"
@@ -386,7 +399,7 @@ namespace OpenSim
386 399
387 m_console.Commands.AddCommand("Regions", false, "restart", 400 m_console.Commands.AddCommand("Regions", false, "restart",
388 "restart", 401 "restart",
389 "Restart all sims in this instance", 402 "Restart the currently selected region(s) in this instance",
390 RunCommand); 403 RunCommand);
391 404
392 m_console.Commands.AddCommand("General", false, "command-script", 405 m_console.Commands.AddCommand("General", false, "command-script",
@@ -403,6 +416,27 @@ namespace OpenSim
403 "delete-region <name>", 416 "delete-region <name>",
404 "Delete a region from disk", 417 "Delete a region from disk",
405 RunCommand); 418 RunCommand);
419
420 m_console.Commands.AddCommand("Estates", false, "estate create",
421 "estate create <owner UUID> <estate name>",
422 "Creates a new estate with the specified name, owned by the specified user."
423 + " Estate name must be unique.",
424 CreateEstateCommand);
425
426 m_console.Commands.AddCommand("Estates", false, "estate set owner",
427 "estate set owner <estate-id>[ <UUID> | <Firstname> <Lastname> ]",
428 "Sets the owner of the specified estate to the specified UUID or user. ",
429 SetEstateOwnerCommand);
430
431 m_console.Commands.AddCommand("Estates", false, "estate set name",
432 "estate set name <estate-id> <new name>",
433 "Sets the name of the specified estate to the specified value. New name must be unique.",
434 SetEstateNameCommand);
435
436 m_console.Commands.AddCommand("Estates", false, "estate link region",
437 "estate link region <estate ID> <region ID>",
438 "Attaches the specified region to the specified estate.",
439 EstateLinkRegionCommand);
406 } 440 }
407 441
408 protected override void ShutdownSpecific() 442 protected override void ShutdownSpecific()
@@ -563,7 +597,7 @@ namespace OpenSim
563 { 597 {
564 scene.ForEachSOG(delegate(SceneObjectGroup sog) 598 scene.ForEachSOG(delegate(SceneObjectGroup sog)
565 { 599 {
566 if (sog.AttachmentPoint == 0) 600 if (!sog.IsAttachment)
567 { 601 {
568 sog.RootPart.UpdateRotation(rot * sog.GroupRotation); 602 sog.RootPart.UpdateRotation(rot * sog.GroupRotation);
569 Vector3 offset = sog.AbsolutePosition - center; 603 Vector3 offset = sog.AbsolutePosition - center;
@@ -592,7 +626,7 @@ namespace OpenSim
592 { 626 {
593 scene.ForEachSOG(delegate(SceneObjectGroup sog) 627 scene.ForEachSOG(delegate(SceneObjectGroup sog)
594 { 628 {
595 if (sog.AttachmentPoint == 0) 629 if (!sog.IsAttachment)
596 { 630 {
597 if (sog.RootPart.AbsolutePosition.Z < minZ) 631 if (sog.RootPart.AbsolutePosition.Z < minZ)
598 minZ = sog.RootPart.AbsolutePosition.Z; 632 minZ = sog.RootPart.AbsolutePosition.Z;
@@ -604,7 +638,7 @@ namespace OpenSim
604 { 638 {
605 scene.ForEachSOG(delegate(SceneObjectGroup sog) 639 scene.ForEachSOG(delegate(SceneObjectGroup sog)
606 { 640 {
607 if (sog.AttachmentPoint == 0) 641 if (!sog.IsAttachment)
608 { 642 {
609 Vector3 tmpRootPos = sog.RootPart.AbsolutePosition; 643 Vector3 tmpRootPos = sog.RootPart.AbsolutePosition;
610 tmpRootPos.Z -= minZ; 644 tmpRootPos.Z -= minZ;
@@ -644,7 +678,7 @@ namespace OpenSim
644 { 678 {
645 scene.ForEachSOG(delegate(SceneObjectGroup sog) 679 scene.ForEachSOG(delegate(SceneObjectGroup sog)
646 { 680 {
647 if (sog.AttachmentPoint == 0) 681 if (!sog.IsAttachment)
648 sog.UpdateGroupPosition(sog.AbsolutePosition + offset); 682 sog.UpdateGroupPosition(sog.AbsolutePosition + offset);
649 }); 683 });
650 }); 684 });
@@ -711,7 +745,9 @@ namespace OpenSim
711 CreateRegion(regInfo, true, out scene); 745 CreateRegion(regInfo, true, out scene);
712 746
713 if (changed) 747 if (changed)
714 regInfo.EstateSettings.Save(); 748 m_estateDataService.StoreEstateSettings(regInfo.EstateSettings);
749
750 scene.Start();
715 } 751 }
716 752
717 /// <summary> 753 /// <summary>
@@ -902,7 +938,7 @@ namespace OpenSim
902 938
903 foreach (IRegionModuleBase module in scene.RegionModules.Values) 939 foreach (IRegionModuleBase module in scene.RegionModules.Values)
904 { 940 {
905 if (module.GetType().GetInterface("ISharedRegionModule") != null) 941 if (module.GetType().GetInterface("ISharedRegionModule") == null)
906 nonSharedModules.Add(module); 942 nonSharedModules.Add(module);
907 else 943 else
908 sharedModules.Add(module); 944 sharedModules.Add(module);
@@ -920,17 +956,30 @@ namespace OpenSim
920 break; 956 break;
921 957
922 case "regions": 958 case "regions":
959 ConsoleDisplayTable cdt = new ConsoleDisplayTable();
960 cdt.AddColumn("Name", ConsoleDisplayUtil.RegionNameSize);
961 cdt.AddColumn("ID", ConsoleDisplayUtil.UuidSize);
962 cdt.AddColumn("Position", ConsoleDisplayUtil.CoordTupleSize);
963 cdt.AddColumn("Size", 11);
964 cdt.AddColumn("Port", ConsoleDisplayUtil.PortSize);
965 cdt.AddColumn("Ready?", 6);
966 cdt.AddColumn("Estate", ConsoleDisplayUtil.EstateNameSize);
923 SceneManager.ForEachScene( 967 SceneManager.ForEachScene(
924 delegate(Scene scene) 968 scene =>
925 { 969 {
926 MainConsole.Instance.Output(String.Format( 970 RegionInfo ri = scene.RegionInfo;
927 "Region Name: {0}, Region XLoc: {1}, Region YLoc: {2}, Region Port: {3}, Estate Name: {4}", 971 cdt.AddRow(
928 scene.RegionInfo.RegionName, 972 ri.RegionName,
929 scene.RegionInfo.RegionLocX, 973 ri.RegionID,
930 scene.RegionInfo.RegionLocY, 974 string.Format("{0},{1}", ri.RegionLocX, ri.RegionLocY),
931 scene.RegionInfo.InternalEndPoint.Port, 975 string.Format("{0}x{1}", ri.RegionSizeX, ri.RegionSizeY),
932 scene.RegionInfo.EstateSettings.EstateName)); 976 ri.InternalEndPoint.Port,
933 }); 977 scene.Ready ? "Yes" : "No",
978 ri.EstateSettings.EstateName);
979 }
980 );
981
982 MainConsole.Instance.Output(cdt.ToString());
934 break; 983 break;
935 984
936 case "ratings": 985 case "ratings":
@@ -979,7 +1028,7 @@ namespace OpenSim
979 aCircuit.child ? "child" : "root", 1028 aCircuit.child ? "child" : "root",
980 aCircuit.circuitcode.ToString(), 1029 aCircuit.circuitcode.ToString(),
981 aCircuit.IPAddress != null ? aCircuit.IPAddress.ToString() : "not set", 1030 aCircuit.IPAddress != null ? aCircuit.IPAddress.ToString() : "not set",
982 aCircuit.Viewer); 1031 Util.GetViewerName(aCircuit));
983 }); 1032 });
984 1033
985 MainConsole.Instance.Output(cdt.ToString()); 1034 MainConsole.Instance.Output(cdt.ToString());
@@ -1172,6 +1221,232 @@ namespace OpenSim
1172 SceneManager.SaveCurrentSceneToArchive(cmdparams); 1221 SceneManager.SaveCurrentSceneToArchive(cmdparams);
1173 } 1222 }
1174 1223
1224 protected void CreateEstateCommand(string module, string[] args)
1225 {
1226 string response = null;
1227 UUID userID;
1228
1229 if (args.Length == 2)
1230 {
1231 response = "No user specified.";
1232 }
1233 else if (!UUID.TryParse(args[2], out userID))
1234 {
1235 response = String.Format("{0} is not a valid UUID", args[2]);
1236 }
1237 else if (args.Length == 3)
1238 {
1239 response = "No estate name specified.";
1240 }
1241 else
1242 {
1243 Scene scene = SceneManager.CurrentOrFirstScene;
1244
1245 // TODO: Is there a better choice here?
1246 UUID scopeID = UUID.Zero;
1247 UserAccount account = scene.UserAccountService.GetUserAccount(scopeID, userID);
1248 if (account == null)
1249 {
1250 response = String.Format("Could not find user {0}", userID);
1251 }
1252 else
1253 {
1254 // concatenate it all to "name"
1255 StringBuilder sb = new StringBuilder(args[3]);
1256 for (int i = 4; i < args.Length; i++)
1257 sb.Append (" " + args[i]);
1258 string estateName = sb.ToString().Trim();
1259
1260 // send it off for processing.
1261 IEstateModule estateModule = scene.RequestModuleInterface<IEstateModule>();
1262 response = estateModule.CreateEstate(estateName, userID);
1263 if (response == String.Empty)
1264 {
1265 List<int> estates = scene.EstateDataService.GetEstates(estateName);
1266 response = String.Format("Estate {0} created as \"{1}\"", estates.ElementAt(0), estateName);
1267 }
1268 }
1269 }
1270
1271 // give the user some feedback
1272 if (response != null)
1273 MainConsole.Instance.Output(response);
1274 }
1275
1276 protected void SetEstateOwnerCommand(string module, string[] args)
1277 {
1278 string response = null;
1279
1280 Scene scene = SceneManager.CurrentOrFirstScene;
1281 IEstateModule estateModule = scene.RequestModuleInterface<IEstateModule>();
1282
1283 if (args.Length == 3)
1284 {
1285 response = "No estate specified.";
1286 }
1287 else
1288 {
1289 int estateId;
1290 if (!int.TryParse(args[3], out estateId))
1291 {
1292 response = String.Format("\"{0}\" is not a valid ID for an Estate", args[3]);
1293 }
1294 else
1295 {
1296 if (args.Length == 4)
1297 {
1298 response = "No user specified.";
1299 }
1300 else
1301 {
1302 UserAccount account = null;
1303
1304 // TODO: Is there a better choice here?
1305 UUID scopeID = UUID.Zero;
1306
1307 string s1 = args[4];
1308 if (args.Length == 5)
1309 {
1310 // attempt to get account by UUID
1311 UUID u;
1312 if (UUID.TryParse(s1, out u))
1313 {
1314 account = scene.UserAccountService.GetUserAccount(scopeID, u);
1315 if (account == null)
1316 response = String.Format("Could not find user {0}", s1);
1317 }
1318 else
1319 {
1320 response = String.Format("Invalid UUID {0}", s1);
1321 }
1322 }
1323 else
1324 {
1325 // attempt to get account by Firstname, Lastname
1326 string s2 = args[5];
1327 account = scene.UserAccountService.GetUserAccount(scopeID, s1, s2);
1328 if (account == null)
1329 response = String.Format("Could not find user {0} {1}", s1, s2);
1330 }
1331
1332 // If it's valid, send it off for processing.
1333 if (account != null)
1334 response = estateModule.SetEstateOwner(estateId, account);
1335
1336 if (response == String.Empty)
1337 {
1338 response = String.Format("Estate owner changed to {0} ({1} {2})", account.PrincipalID, account.FirstName, account.LastName);
1339 }
1340 }
1341 }
1342 }
1343
1344 // give the user some feedback
1345 if (response != null)
1346 MainConsole.Instance.Output(response);
1347 }
1348
1349 protected void SetEstateNameCommand(string module, string[] args)
1350 {
1351 string response = null;
1352
1353 Scene scene = SceneManager.CurrentOrFirstScene;
1354 IEstateModule estateModule = scene.RequestModuleInterface<IEstateModule>();
1355
1356 if (args.Length == 3)
1357 {
1358 response = "No estate specified.";
1359 }
1360 else
1361 {
1362 int estateId;
1363 if (!int.TryParse(args[3], out estateId))
1364 {
1365 response = String.Format("\"{0}\" is not a valid ID for an Estate", args[3]);
1366 }
1367 else
1368 {
1369 if (args.Length == 4)
1370 {
1371 response = "No name specified.";
1372 }
1373 else
1374 {
1375 // everything after the estate ID is "name"
1376 StringBuilder sb = new StringBuilder(args[4]);
1377 for (int i = 5; i < args.Length; i++)
1378 sb.Append (" " + args[i]);
1379
1380 string estateName = sb.ToString();
1381
1382 // send it off for processing.
1383 response = estateModule.SetEstateName(estateId, estateName);
1384
1385 if (response == String.Empty)
1386 {
1387 response = String.Format("Estate {0} renamed to \"{1}\"", estateId, estateName);
1388 }
1389 }
1390 }
1391 }
1392
1393 // give the user some feedback
1394 if (response != null)
1395 MainConsole.Instance.Output(response);
1396 }
1397
1398 private void EstateLinkRegionCommand(string module, string[] args)
1399 {
1400 int estateId =-1;
1401 UUID regionId = UUID.Zero;
1402 Scene scene = null;
1403 string response = null;
1404
1405 if (args.Length == 3)
1406 {
1407 response = "No estate specified.";
1408 }
1409 else if (!int.TryParse(args [3], out estateId))
1410 {
1411 response = String.Format("\"{0}\" is not a valid ID for an Estate", args [3]);
1412 }
1413 else if (args.Length == 4)
1414 {
1415 response = "No region specified.";
1416 }
1417 else if (!UUID.TryParse(args[4], out regionId))
1418 {
1419 response = String.Format("\"{0}\" is not a valid UUID for a Region", args [4]);
1420 }
1421 else if (!SceneManager.TryGetScene(regionId, out scene))
1422 {
1423 // region may exist, but on a different sim.
1424 response = String.Format("No access to Region \"{0}\"", args [4]);
1425 }
1426
1427 if (response != null)
1428 {
1429 MainConsole.Instance.Output(response);
1430 return;
1431 }
1432
1433 // send it off for processing.
1434 IEstateModule estateModule = scene.RequestModuleInterface<IEstateModule>();
1435 response = estateModule.SetRegionEstate(scene.RegionInfo, estateId);
1436 if (response == String.Empty)
1437 {
1438 estateModule.TriggerRegionInfoChange();
1439 estateModule.sendRegionHandshakeToAll();
1440 response = String.Format ("Region {0} is now attached to estate {1}", regionId, estateId);
1441 }
1442
1443 // give the user some feedback
1444 if (response != null)
1445 MainConsole.Instance.Output (response);
1446 }
1447
1448 #endregion
1449
1175 private static string CombineParams(string[] commandParams, int pos) 1450 private static string CombineParams(string[] commandParams, int pos)
1176 { 1451 {
1177 string result = String.Empty; 1452 string result = String.Empty;
@@ -1182,7 +1457,5 @@ namespace OpenSim
1182 result = result.TrimEnd(' '); 1457 result = result.TrimEnd(' ');
1183 return result; 1458 return result;
1184 } 1459 }
1185
1186 #endregion
1187 } 1460 }
1188} 1461}
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index e8cf7cc..760decd 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -71,6 +71,20 @@ namespace OpenSim
71 // OpenSim.ini Section name for ESTATES Settings 71 // OpenSim.ini Section name for ESTATES Settings
72 public const string ESTATE_SECTION_NAME = "Estates"; 72 public const string ESTATE_SECTION_NAME = "Estates";
73 73
74 /// <summary>
75 /// Allow all plugin loading to be disabled for tests/debug.
76 /// </summary>
77 /// <remarks>
78 /// true by default
79 /// </remarks>
80 public bool EnableInitialPluginLoad { get; set; }
81
82 /// <summary>
83 /// Control whether we attempt to load an estate data service.
84 /// </summary>
85 /// <remarks>For tests/debugging</remarks>
86 public bool LoadEstateDataService { get; set; }
87
74 protected string proxyUrl; 88 protected string proxyUrl;
75 protected int proxyOffset = 0; 89 protected int proxyOffset = 0;
76 90
@@ -96,7 +110,7 @@ namespace OpenSim
96 110
97 public ConsoleCommand CreateAccount = null; 111 public ConsoleCommand CreateAccount = null;
98 112
99 protected List<IApplicationPlugin> m_plugins = new List<IApplicationPlugin>(); 113 public List<IApplicationPlugin> m_plugins = new List<IApplicationPlugin>();
100 114
101 private List<string> m_permsModules; 115 private List<string> m_permsModules;
102 116
@@ -139,6 +153,8 @@ namespace OpenSim
139 /// <param name="configSource"></param> 153 /// <param name="configSource"></param>
140 public OpenSimBase(IConfigSource configSource) : base() 154 public OpenSimBase(IConfigSource configSource) : base()
141 { 155 {
156 EnableInitialPluginLoad = true;
157 LoadEstateDataService = true;
142 LoadConfigSettings(configSource); 158 LoadConfigSettings(configSource);
143 } 159 }
144 160
@@ -158,14 +174,37 @@ namespace OpenSim
158 proxyUrl = networkConfig.GetString("proxy_url", ""); 174 proxyUrl = networkConfig.GetString("proxy_url", "");
159 proxyOffset = Int32.Parse(networkConfig.GetString("proxy_offset", "0")); 175 proxyOffset = Int32.Parse(networkConfig.GetString("proxy_offset", "0"));
160 } 176 }
177
178 IConfig startupConfig = Config.Configs["Startup"];
179 if (startupConfig != null)
180 {
181 Util.LogOverloads = startupConfig.GetBoolean("LogOverloads", true);
182 }
161 } 183 }
162 184
163 protected virtual void LoadPlugins() 185 protected virtual void LoadPlugins()
164 { 186 {
165 using (PluginLoader<IApplicationPlugin> loader = new PluginLoader<IApplicationPlugin>(new ApplicationPluginInitialiser(this))) 187 IConfig startupConfig = Config.Configs["Startup"];
188 string registryLocation = (startupConfig != null) ? startupConfig.GetString("RegistryLocation", String.Empty) : String.Empty;
189
190 // The location can also be specified in the environment. If there
191 // is no location in the configuration, we must call the constructor
192 // without a location parameter to allow that to happen.
193 if (registryLocation == String.Empty)
166 { 194 {
167 loader.Load("/OpenSim/Startup"); 195 using (PluginLoader<IApplicationPlugin> loader = new PluginLoader<IApplicationPlugin>(new ApplicationPluginInitialiser(this)))
168 m_plugins = loader.Plugins; 196 {
197 loader.Load("/OpenSim/Startup");
198 m_plugins = loader.Plugins;
199 }
200 }
201 else
202 {
203 using (PluginLoader<IApplicationPlugin> loader = new PluginLoader<IApplicationPlugin>(new ApplicationPluginInitialiser(this), registryLocation))
204 {
205 loader.Load("/OpenSim/Startup");
206 m_plugins = loader.Plugins;
207 }
169 } 208 }
170 } 209 }
171 210
@@ -221,23 +260,29 @@ namespace OpenSim
221 module)); 260 module));
222 261
223 // Load the estate data service 262 // Load the estate data service
224 IConfig estateDataConfig = Config.Configs["EstateDataStore"]; 263 module = Util.GetConfigVarFromSections<string>(Config, "LocalServiceModule", new string[]{"EstateDataStore", "EstateService"}, String.Empty);
225 if (estateDataConfig == null)
226 throw new Exception("Configuration file is missing the [EstateDataStore] section. Have you copied OpenSim.ini.example to OpenSim.ini to reference config-include/ files?");
227
228 module = estateDataConfig.GetString("LocalServiceModule", String.Empty);
229 if (String.IsNullOrEmpty(module)) 264 if (String.IsNullOrEmpty(module))
230 throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [EstateDataStore] section"); 265 throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [EstateDataStore] or [EstateService] section");
231 266
232 m_estateDataService = ServerUtils.LoadPlugin<IEstateDataService>(module, new object[] { Config }); 267 if (LoadEstateDataService)
233 if (m_estateDataService == null) 268 {
234 throw new Exception( 269 m_estateDataService = ServerUtils.LoadPlugin<IEstateDataService>(module, new object[] { Config });
235 string.Format( 270 if (m_estateDataService == null)
236 "Could not load an IEstateDataService implementation from {0}, as configured in the LocalServiceModule parameter of the [EstateDataStore] config section.", 271 throw new Exception(
237 module)); 272 string.Format(
273 "Could not load an IEstateDataService implementation from {0}, as configured in the LocalServiceModule parameter of the [EstateDataStore] config section.",
274 module));
275 }
238 276
239 base.StartupSpecific(); 277 base.StartupSpecific();
240 278
279<<<<<<< HEAD
280 if (EnableInitialPluginLoad)
281 LoadPlugins();
282
283 // We still want to post initalize any plugins even if loading has been disabled since a test may have
284 // inserted them manually.
285=======
241 LoadPlugins(); 286 LoadPlugins();
242 287
243 if (m_plugins.Count == 0) // We failed to load any modules. Mono Addins glitch! 288 if (m_plugins.Count == 0) // We failed to load any modules. Mono Addins glitch!
@@ -245,10 +290,9 @@ namespace OpenSim
245 Environment.Exit(1); 290 Environment.Exit(1);
246 } 291 }
247 292
293>>>>>>> avn/ubitvar
248 foreach (IApplicationPlugin plugin in m_plugins) 294 foreach (IApplicationPlugin plugin in m_plugins)
249 {
250 plugin.PostInitialise(); 295 plugin.PostInitialise();
251 }
252 296
253 if (m_console != null) 297 if (m_console != null)
254 AddPluginCommands(m_console); 298 AddPluginCommands(m_console);
@@ -315,6 +359,10 @@ namespace OpenSim
315 { 359 {
316 // Called from base.StartUp() 360 // Called from base.StartUp()
317 361
362 IConfig startupConfig = Config.Configs["Startup"];
363 if (startupConfig == null || startupConfig.GetBoolean("JobEngineEnabled", true))
364 WorkManager.JobEngine.Start();
365
318 m_httpServerPort = m_networkServersInfo.HttpListenerPort; 366 m_httpServerPort = m_networkServersInfo.HttpListenerPort;
319 SceneManager.OnRestartSim += HandleRestartRegion; 367 SceneManager.OnRestartSim += HandleRestartRegion;
320 368
@@ -604,7 +652,7 @@ namespace OpenSim
604 else 652 else
605 { 653 {
606 regionInfo.EstateSettings.EstateOwner = account.PrincipalID; 654 regionInfo.EstateSettings.EstateOwner = account.PrincipalID;
607 regionInfo.EstateSettings.Save(); 655 m_estateDataService.StoreEstateSettings(regionInfo.EstateSettings);
608 } 656 }
609 } 657 }
610 658
@@ -784,6 +832,10 @@ namespace OpenSim
784 { 832 {
785 Vector3 regionExtent = new Vector3(regionInfo.RegionSizeX, regionInfo.RegionSizeY, regionInfo.RegionSizeZ); 833 Vector3 regionExtent = new Vector3(regionInfo.RegionSizeX, regionInfo.RegionSizeY, regionInfo.RegionSizeZ);
786 PhysicsScene physicsScene = GetPhysicsScene(regionInfo.RegionName, regionExtent); 834 PhysicsScene physicsScene = GetPhysicsScene(regionInfo.RegionName, regionExtent);
835<<<<<<< HEAD
836
837=======
838>>>>>>> avn/ubitvar
787 SceneCommunicationService sceneGridService = new SceneCommunicationService(); 839 SceneCommunicationService sceneGridService = new SceneCommunicationService();
788 840
789 return new Scene( 841 return new Scene(
@@ -932,6 +984,9 @@ namespace OpenSim
932 try 984 try
933 { 985 {
934 SceneManager.Close(); 986 SceneManager.Close();
987
988 foreach (IApplicationPlugin plugin in m_plugins)
989 plugin.Dispose();
935 } 990 }
936 catch (Exception e) 991 catch (Exception e)
937 { 992 {
@@ -1004,7 +1059,7 @@ namespace OpenSim
1004 // back to the default. The reloading of estate settings by scene could be eliminated if it 1059 // back to the default. The reloading of estate settings by scene could be eliminated if it
1005 // knows that the passed in settings in RegionInfo are already valid. Also, it might be 1060 // knows that the passed in settings in RegionInfo are already valid. Also, it might be
1006 // possible to eliminate some additional later saves made by callers of this method. 1061 // possible to eliminate some additional later saves made by callers of this method.
1007 regInfo.EstateSettings.Save(); 1062 EstateDataService.StoreEstateSettings(regInfo.EstateSettings);
1008 1063
1009 return true; 1064 return true;
1010 } 1065 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Properties/AssemblyInfo.cs b/OpenSim/Region/Application/Properties/AssemblyInfo.cs
index 342dbff..8652312 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/Application/Properties/AssemblyInfo.cs
@@ -1,12 +1,13 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.CompilerServices; 2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices; 3using System.Runtime.InteropServices;
4using Mono.Addins;
4 5
5// General Information about an assembly is controlled through the following 6// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information 7// set of attributes. Change these attribute values to modify the information
7// associated with an assembly. 8// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Region.ScriptEngine.Shared.YieldProlog")] 9[assembly: AssemblyTitle("OpenSim")]
9[assembly: AssemblyDescription("")] 10[assembly: AssemblyDescription("The executable for for simulator")]
10[assembly: AssemblyConfiguration("")] 11[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")] 12[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")] 13[assembly: AssemblyProduct("OpenSim")]
@@ -20,7 +21,7 @@ using System.Runtime.InteropServices;
20[assembly: ComVisible(false)] 21[assembly: ComVisible(false)]
21 22
22// The following GUID is for the ID of the typelib if this project is exposed to COM 23// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("8df98e6b-0425-44d6-8d91-2b3b4c56acdf")] 24[assembly: Guid("f6700ed5-1e6f-44d8-8397-e5eac42b3856")]
24 25
25// Version information for an assembly consists of the following four values: 26// Version information for an assembly consists of the following four values:
26// 27//
@@ -29,5 +30,7 @@ using System.Runtime.InteropServices;
29// Build Number 30// Build Number
30// Revision 31// Revision
31// 32//
32[assembly: AssemblyVersion("0.7.6.*")] 33[assembly: AssemblyVersion("0.8.2.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 34
35[assembly: AddinRoot("OpenSim", OpenSim.VersionInfo.VersionNumber)]
36[assembly: ImportAddinAssembly("OpenSim.Framework.dll")]
diff --git a/OpenSim/Region/ClientStack/ClientStackManager.cs b/OpenSim/Region/ClientStack/ClientStackManager.cs
index 299aabd..3ec968f 100644
--- a/OpenSim/Region/ClientStack/ClientStackManager.cs
+++ b/OpenSim/Region/ClientStack/ClientStackManager.cs
@@ -67,7 +67,7 @@ namespace OpenSim.Region.ClientStack
67 { 67 {
68 if (pluginType.IsPublic) 68 if (pluginType.IsPublic)
69 { 69 {
70 Type typeInterface = pluginType.GetInterface("IClientNetworkServer", true); 70 Type typeInterface = pluginType.GetInterface("IClientNetworkServer");
71 71
72 if (typeInterface != null) 72 if (typeInterface != null)
73 { 73 {
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/AgentPreferencesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/AgentPreferencesModule.cs
new file mode 100644
index 0000000..aabdb51
--- /dev/null
+++ b/OpenSim/Region/ClientStack/Linden/Caps/AgentPreferencesModule.cs
@@ -0,0 +1,182 @@
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
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using System.IO;
32using log4net;
33using Mono.Addins;
34using Nini.Config;
35using OpenMetaverse;
36using OpenMetaverse.StructuredData;
37using OpenSim.Framework.Console;
38using OpenSim.Framework.Servers;
39using OpenSim.Framework.Servers.HttpServer;
40using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Region.Framework.Scenes;
42using OpenSim.Services.Interfaces;
43using Caps = OpenSim.Framework.Capabilities.Caps;
44using OpenSim.Capabilities.Handlers;
45
46namespace OpenSim.Region.ClientStack.LindenCaps
47{
48 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AgentPreferencesModule")]
49 public class AgentPreferencesModule : ISharedRegionModule
50 {
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52
53 private List<Scene> m_scenes = new List<Scene>();
54
55 public void Initialise(IConfigSource source)
56 {
57
58 }
59
60 #region Region module
61
62 public void AddRegion(Scene scene)
63 {
64 lock (m_scenes) m_scenes.Add(scene);
65 }
66
67 public void RemoveRegion(Scene scene)
68 {
69 lock (m_scenes) m_scenes.Remove(scene);
70 scene.EventManager.OnRegisterCaps -= RegisterCaps;
71 scene = null;
72 }
73
74 public void RegionLoaded(Scene scene)
75 {
76 scene.EventManager.OnRegisterCaps += delegate(UUID agentID, OpenSim.Framework.Capabilities.Caps caps)
77 {
78 RegisterCaps(agentID, caps);
79 };
80 }
81
82 public void PostInitialise() {}
83
84 public void Close() {}
85
86 public string Name { get { return "AgentPreferencesModule"; } }
87
88 public Type ReplaceableInterface
89 {
90 get { return null; }
91 }
92
93 public void RegisterCaps(UUID agent, Caps caps)
94 {
95 UUID capId = UUID.Random();
96 caps.RegisterHandler("AgentPreferences",
97 new RestStreamHandler("POST", "/CAPS/" + capId,
98 delegate(string request, string path, string param,
99 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
100 {
101 return UpdateAgentPreferences(request, path, param, agent);
102 }));
103 caps.RegisterHandler("UpdateAgentLanguage",
104 new RestStreamHandler("POST", "/CAPS/" + capId,
105 delegate(string request, string path, string param,
106 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
107 {
108 return UpdateAgentPreferences(request, path, param, agent);
109 }));
110 caps.RegisterHandler("UpdateAgentInformation",
111 new RestStreamHandler("POST", "/CAPS/" + capId,
112 delegate(string request, string path, string param,
113 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
114 {
115 return UpdateAgentPreferences(request, path, param, agent);
116 }));
117 }
118
119 public string UpdateAgentPreferences(string request, string path, string param, UUID agent)
120 {
121 OSDMap resp = new OSDMap();
122 // The viewer doesn't do much with the return value, so for now, if there is no preference service,
123 // we'll return a null llsd block for debugging purposes. This may change if someone knows what the
124 // correct server response would be here.
125 if (m_scenes[0].AgentPreferencesService == null)
126 {
127 return OSDParser.SerializeLLSDXmlString(resp);
128 }
129 m_log.DebugFormat("[AgentPrefs]: UpdateAgentPreferences for {0}", agent.ToString());
130 OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
131 AgentPrefs data = m_scenes[0].AgentPreferencesService.GetAgentPreferences(agent);
132 if (data == null)
133 {
134 data = new AgentPrefs(agent);
135 }
136
137 if (req.ContainsKey("access_prefs"))
138 {
139 OSDMap accessPrefs = (OSDMap)req["access_prefs"]; // We could check with ContainsKey...
140 data.AccessPrefs = accessPrefs["max"].AsString();
141 }
142 if (req.ContainsKey("default_object_perm_masks"))
143 {
144 OSDMap permsMap = (OSDMap)req["default_object_perm_masks"];
145 data.PermEveryone = permsMap["Everyone"].AsInteger();
146 data.PermGroup = permsMap["Group"].AsInteger();
147 data.PermNextOwner = permsMap["NextOwner"].AsInteger();
148 }
149 if (req.ContainsKey("hover_height"))
150 {
151 data.HoverHeight = req["hover_height"].AsReal();
152 }
153 if (req.ContainsKey("language"))
154 {
155 data.Language = req["language"].AsString();
156 }
157 if (req.ContainsKey("language_is_public"))
158 {
159 data.LanguageIsPublic = req["language_is_public"].AsBoolean();
160 }
161 m_scenes[0].AgentPreferencesService.StoreAgentPreferences(data);
162 OSDMap respAccessPrefs = new OSDMap();
163 respAccessPrefs["max"] = data.AccessPrefs;
164 resp["access_prefs"] = respAccessPrefs;
165 OSDMap respDefaultPerms = new OSDMap();
166 respDefaultPerms["Everyone"] = data.PermEveryone;
167 respDefaultPerms["Group"] = data.PermGroup;
168 respDefaultPerms["NextOwner"] = data.PermNextOwner;
169 resp["default_object_perm_masks"] = respDefaultPerms;
170 resp["god_level"] = 0; // *TODO: Add this
171 resp["hover_height"] = data.HoverHeight;
172 resp["language"] = data.Language;
173 resp["language_is_public"] = data.LanguageIsPublic;
174
175 string response = OSDParser.SerializeLLSDXmlString(resp);
176 return response;
177 }
178
179 #endregion Region module
180 }
181}
182
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index ab8f0c9..4e6d196 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -45,6 +45,7 @@ using OpenSim.Region.Framework.Scenes;
45using OpenSim.Region.Framework.Scenes.Serialization; 45using OpenSim.Region.Framework.Scenes.Serialization;
46using OpenSim.Framework.Servers; 46using OpenSim.Framework.Servers;
47using OpenSim.Framework.Servers.HttpServer; 47using OpenSim.Framework.Servers.HttpServer;
48using OpenSim.Framework.Client;
48using OpenSim.Services.Interfaces; 49using OpenSim.Services.Interfaces;
49 50
50using Caps = OpenSim.Framework.Capabilities.Caps; 51using Caps = OpenSim.Framework.Capabilities.Caps;
@@ -359,8 +360,8 @@ namespace OpenSim.Region.ClientStack.Linden
359 public string SeedCapRequest(string request, string path, string param, 360 public string SeedCapRequest(string request, string path, string param,
360 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 361 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
361 { 362 {
362 m_log.DebugFormat( 363// m_log.DebugFormat(
363 "[CAPS]: Received SEED caps request in {0} for agent {1}", m_regionName, m_HostCapsObj.AgentID); 364// "[CAPS]: Received SEED caps request in {0} for agent {1}", m_regionName, m_HostCapsObj.AgentID);
364 365
365 if (!m_HostCapsObj.WaitForActivation()) 366 if (!m_HostCapsObj.WaitForActivation())
366 return string.Empty; 367 return string.Empty;
@@ -788,10 +789,99 @@ namespace OpenSim.Region.ClientStack.Linden
788 } 789 }
789 else if (inventoryType == "object") 790 else if (inventoryType == "object")
790 { 791 {
792<<<<<<< HEAD
793 inType = (sbyte)InventoryType.Object;
794 assType = (sbyte)AssetType.Object;
795
796 List<Vector3> positions = new List<Vector3>();
797 List<Quaternion> rotations = new List<Quaternion>();
798 OSDMap request = (OSDMap)OSDParser.DeserializeLLSDXml(data);
799 OSDArray instance_list = (OSDArray)request["instance_list"];
800 OSDArray mesh_list = (OSDArray)request["mesh_list"];
801 OSDArray texture_list = (OSDArray)request["texture_list"];
802 SceneObjectGroup grp = null;
803
804 InventoryFolderBase textureUploadFolder = null;
805
806 List<InventoryFolderBase> foldersToUpdate = new List<InventoryFolderBase>();
807 List<InventoryItemBase> itemsToUpdate = new List<InventoryItemBase>();
808 IClientInventory clientInv = null;
809
810 if (texture_list.Count > 0)
811 {
812 ScenePresence avatar = null;
813 m_Scene.TryGetScenePresence(m_HostCapsObj.AgentID, out avatar);
814
815 if (avatar != null)
816 {
817 IClientCore core = (IClientCore)avatar.ControllingClient;
818
819 if (core.TryGet<IClientInventory>(out clientInv))
820 {
821 var systemTextureFolder = m_Scene.InventoryService.GetFolderForType(m_HostCapsObj.AgentID, FolderType.Texture);
822 textureUploadFolder = new InventoryFolderBase(UUID.Random(), assetName, m_HostCapsObj.AgentID, (short)FolderType.None, systemTextureFolder.ID, 1);
823 if (m_Scene.InventoryService.AddFolder(textureUploadFolder))
824 {
825 foldersToUpdate.Add(textureUploadFolder);
826
827 m_log.DebugFormat(
828 "[BUNCH OF CAPS]: Created new folder '{0}' ({1}) for textures uploaded with mesh object {2}",
829 textureUploadFolder.Name, textureUploadFolder.ID, assetName);
830 }
831 else
832 {
833 textureUploadFolder = null;
834 }
835 }
836 }
837 }
838
839 List<UUID> textures = new List<UUID>();
840 for (int i = 0; i < texture_list.Count; i++)
841 {
842 AssetBase textureAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Texture, "");
843 textureAsset.Data = texture_list[i].AsBinary();
844 m_assetService.Store(textureAsset);
845 textures.Add(textureAsset.FullID);
846
847 if (textureUploadFolder != null)
848 {
849 InventoryItemBase textureItem = new InventoryItemBase();
850 textureItem.Owner = m_HostCapsObj.AgentID;
851 textureItem.CreatorId = m_HostCapsObj.AgentID.ToString();
852 textureItem.CreatorData = String.Empty;
853 textureItem.ID = UUID.Random();
854 textureItem.AssetID = textureAsset.FullID;
855 textureItem.Description = assetDescription;
856 textureItem.Name = assetName + " - Texture " + (i + 1).ToString();
857 textureItem.AssetType = (int)AssetType.Texture;
858 textureItem.InvType = (int)InventoryType.Texture;
859 textureItem.Folder = textureUploadFolder.ID;
860 textureItem.CurrentPermissions
861 = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer | PermissionMask.Export);
862 textureItem.BasePermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export;
863 textureItem.EveryOnePermissions = 0;
864 textureItem.NextPermissions = (uint)PermissionMask.All;
865 textureItem.CreationDate = Util.UnixTimeSinceEpoch();
866 m_Scene.InventoryService.AddItem(textureItem);
867 itemsToUpdate.Add(textureItem);
868
869 m_log.DebugFormat(
870 "[BUNCH OF CAPS]: Created new inventory item '{0}' ({1}) for texture uploaded with mesh object {2}",
871 textureItem.Name, textureItem.ID, assetName);
872 }
873 }
874
875 if (clientInv != null && (foldersToUpdate.Count > 0 || itemsToUpdate.Count > 0))
876 {
877 clientInv.SendBulkUpdateInventory(foldersToUpdate.ToArray(), itemsToUpdate.ToArray());
878 }
879=======
791 if (assetType == "mesh") // this code for now is for mesh models uploads only 880 if (assetType == "mesh") // this code for now is for mesh models uploads only
792 { 881 {
793 inType = (sbyte)InventoryType.Object; 882 inType = (sbyte)InventoryType.Object;
794 assType = (sbyte)AssetType.Object; 883 assType = (sbyte)AssetType.Object;
884>>>>>>> avn/ubitvar
795 885
796 List<Vector3> positions = new List<Vector3>(); 886 List<Vector3> positions = new List<Vector3>();
797 List<Quaternion> rotations = new List<Quaternion>(); 887 List<Quaternion> rotations = new List<Quaternion>();
@@ -1375,18 +1465,26 @@ namespace OpenSim.Region.ClientStack.Linden
1375 item = m_Scene.InventoryService.GetItem(new InventoryItemBase(itemID)); 1465 item = m_Scene.InventoryService.GetItem(new InventoryItemBase(itemID));
1376 if (item != null) 1466 if (item != null)
1377 { 1467 {
1378 copyItem = m_Scene.GiveInventoryItem(m_HostCapsObj.AgentID, item.Owner, itemID, folderID); 1468 string message;
1379 if (copyItem != null && client != null) 1469 copyItem = m_Scene.GiveInventoryItem(m_HostCapsObj.AgentID, item.Owner, itemID, folderID, out message);
1470 if (client != null)
1380 { 1471 {
1381 m_log.InfoFormat("[CAPS]: CopyInventoryFromNotecard, ItemID:{0}, FolderID:{1}", copyItem.ID, copyItem.Folder); 1472 if (copyItem != null)
1382 client.SendBulkUpdateInventory(copyItem); 1473 {
1474 m_log.InfoFormat("[CAPS]: CopyInventoryFromNotecard, ItemID:{0}, FolderID:{1}", copyItem.ID, copyItem.Folder);
1475 client.SendBulkUpdateInventory(copyItem);
1476 }
1477 else
1478 {
1479 client.SendAgentAlertMessage(message, false);
1480 }
1383 } 1481 }
1384 } 1482 }
1385 else 1483 else
1386 { 1484 {
1387 m_log.ErrorFormat("[CAPS]: CopyInventoryFromNotecard - Failed to retrieve item {0} from notecard {1}", itemID, notecardID); 1485 m_log.ErrorFormat("[CAPS]: CopyInventoryFromNotecard - Failed to retrieve item {0} from notecard {1}", itemID, notecardID);
1388 if (client != null) 1486 if (client != null)
1389 client.SendAlertMessage("Failed to retrieve item"); 1487 client.SendAgentAlertMessage("Failed to retrieve item", false);
1390 } 1488 }
1391 } 1489 }
1392 catch (Exception e) 1490 catch (Exception e)
@@ -1558,13 +1656,14 @@ namespace OpenSim.Region.ClientStack.Linden
1558 string param, IOSHttpRequest httpRequest, 1656 string param, IOSHttpRequest httpRequest,
1559 IOSHttpResponse httpResponse) 1657 IOSHttpResponse httpResponse)
1560 { 1658 {
1561// OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request); 1659 OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
1562 OSDMap resp = new OSDMap(); 1660 OSDMap accessPrefs = (OSDMap)req["access_prefs"];
1563 1661 string desiredMaturity = accessPrefs["max"];
1564 OSDMap accessPrefs = new OSDMap();
1565 accessPrefs["max"] = "A";
1566 1662
1567 resp["access_prefs"] = accessPrefs; 1663 OSDMap resp = new OSDMap();
1664 OSDMap respAccessPrefs = new OSDMap();
1665 respAccessPrefs["max"] = desiredMaturity; // echoing the maturity back means success
1666 resp["access_prefs"] = respAccessPrefs;
1568 1667
1569 string response = OSDParser.SerializeLLSDXmlString(resp); 1668 string response = OSDParser.SerializeLLSDXmlString(resp);
1570 return response; 1669 return response;
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs
index b735dfa..c241075 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs
@@ -40,8 +40,8 @@ using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
41using Caps = OpenSim.Framework.Capabilities.Caps; 41using Caps = OpenSim.Framework.Capabilities.Caps;
42 42
43[assembly: Addin("LindenCaps", "0.1")] 43[assembly: Addin("LindenCaps", OpenSim.VersionInfo.VersionNumber)]
44[assembly: AddinDependency("OpenSim", "0.5")] 44[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)]
45namespace OpenSim.Region.ClientStack.Linden 45namespace OpenSim.Region.ClientStack.Linden
46{ 46{
47 47
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
index 51535a6..5fb028c 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
@@ -100,7 +100,7 @@ namespace OpenSim.Region.ClientStack.Linden
100 "debug eq [0|1|2]", 100 "debug eq [0|1|2]",
101 "Turn on event queue debugging\n" 101 "Turn on event queue debugging\n"
102 + " <= 0 - turns off all event queue logging\n" 102 + " <= 0 - turns off all event queue logging\n"
103 + " >= 1 - turns on outgoing event logging\n" 103 + " >= 1 - turns on event queue setup and outgoing event logging\n"
104 + " >= 2 - turns on poll notification", 104 + " >= 2 - turns on poll notification",
105 HandleDebugEq); 105 HandleDebugEq);
106 106
@@ -177,6 +177,32 @@ namespace OpenSim.Region.ClientStack.Linden
177 } 177 }
178 178
179 /// <summary> 179 /// <summary>
180<<<<<<< HEAD
181 /// Always returns a valid queue
182 /// </summary>
183 /// <param name="agentId"></param>
184 /// <returns></returns>
185 private Queue<OSD> TryGetQueue(UUID agentId)
186 {
187 lock (queues)
188 {
189 if (!queues.ContainsKey(agentId))
190 {
191 if (DebugLevel > 0)
192 m_log.DebugFormat(
193 "[EVENTQUEUE]: Adding new queue for agent {0} in region {1}",
194 agentId, m_scene.RegionInfo.RegionName);
195
196 queues[agentId] = new Queue<OSD>();
197 }
198
199 return queues[agentId];
200 }
201 }
202
203 /// <summary>
204=======
205>>>>>>> avn/ubitvar
180 /// May return a null queue 206 /// May return a null queue
181 /// </summary> 207 /// </summary>
182 /// <param name="agentId"></param> 208 /// <param name="agentId"></param>
@@ -207,12 +233,18 @@ namespace OpenSim.Region.ClientStack.Linden
207 lock (queue) 233 lock (queue)
208 queue.Enqueue(ev); 234 queue.Enqueue(ev);
209 } 235 }
210 else 236 else if (DebugLevel > 0)
211 { 237 {
212 OSDMap evMap = (OSDMap)ev; 238 ScenePresence sp = m_scene.GetScenePresence(avatarID);
213 m_log.WarnFormat( 239
214 "[EVENTQUEUE]: (Enqueue) No queue found for agent {0} when placing message {1} in region {2}", 240 // This assumes that an NPC should never have a queue.
215 avatarID, evMap["message"], m_scene.Name); 241 if (sp != null && sp.PresenceType != PresenceType.Npc)
242 {
243 OSDMap evMap = (OSDMap)ev;
244 m_log.WarnFormat(
245 "[EVENTQUEUE]: (Enqueue) No queue found for agent {0} {1} when placing message {2} in region {3}",
246 sp.Name, sp.UUID, evMap["message"], m_scene.Name);
247 }
216 } 248 }
217 } 249 }
218 catch (NullReferenceException e) 250 catch (NullReferenceException e)
@@ -258,9 +290,17 @@ namespace OpenSim.Region.ClientStack.Linden
258 public void OnRegisterCaps(UUID agentID, Caps caps) 290 public void OnRegisterCaps(UUID agentID, Caps caps)
259 { 291 {
260 // Register an event queue for the client 292 // Register an event queue for the client
293<<<<<<< HEAD
294
295 if (DebugLevel > 0)
296 m_log.DebugFormat(
297 "[EVENTQUEUE]: OnRegisterCaps: agentID {0} caps {1} region {2}",
298 agentID, caps, m_scene.RegionInfo.RegionName);
299=======
261 m_log.DebugFormat( 300 m_log.DebugFormat(
262 "[EVENTQUEUE]: OnRegisterCaps: agentID {0} caps {1} region {2}", 301 "[EVENTQUEUE]: OnRegisterCaps: agentID {0} caps {1} region {2}",
263 agentID, caps, m_scene.RegionInfo.RegionName); 302 agentID, caps, m_scene.RegionInfo.RegionName);
303>>>>>>> avn/ubitvar
264 304
265 UUID eventQueueGetUUID; 305 UUID eventQueueGetUUID;
266 Queue<OSD> queue; 306 Queue<OSD> queue;
@@ -479,8 +519,14 @@ namespace OpenSim.Region.ClientStack.Linden
479 519
480 public virtual void EnableSimulator(ulong handle, IPEndPoint endPoint, UUID avatarID, int regionSizeX, int regionSizeY) 520 public virtual void EnableSimulator(ulong handle, IPEndPoint endPoint, UUID avatarID, int regionSizeX, int regionSizeY)
481 { 521 {
522<<<<<<< HEAD
523 if (DebugLevel > 0)
524 m_log.DebugFormat("{0} EnableSimulator. handle={1}, endPoint={2}, avatarID={3}",
525 LogHeader, handle, endPoint, avatarID, regionSizeX, regionSizeY);
526=======
482 m_log.DebugFormat("{0} EnableSimulator. handle={1}, avatarID={2}, regionSize={3},{4}>", 527 m_log.DebugFormat("{0} EnableSimulator. handle={1}, avatarID={2}, regionSize={3},{4}>",
483 LogHeader, handle, avatarID, regionSizeX, regionSizeY); 528 LogHeader, handle, avatarID, regionSizeX, regionSizeY);
529>>>>>>> avn/ubitvar
484 530
485 OSD item = EventQueueHelper.EnableSimulator(handle, endPoint, regionSizeX, regionSizeY); 531 OSD item = EventQueueHelper.EnableSimulator(handle, endPoint, regionSizeX, regionSizeY);
486 Enqueue(item, avatarID); 532 Enqueue(item, avatarID);
@@ -489,8 +535,15 @@ namespace OpenSim.Region.ClientStack.Linden
489 public virtual void EstablishAgentCommunication(UUID avatarID, IPEndPoint endPoint, string capsPath, 535 public virtual void EstablishAgentCommunication(UUID avatarID, IPEndPoint endPoint, string capsPath,
490 ulong regionHandle, int regionSizeX, int regionSizeY) 536 ulong regionHandle, int regionSizeX, int regionSizeY)
491 { 537 {
538<<<<<<< HEAD
539 if (DebugLevel > 0)
540 m_log.DebugFormat("{0} EstablishAgentCommunication. handle={1}, endPoint={2}, avatarID={3}",
541 LogHeader, regionHandle, endPoint, avatarID, regionSizeX, regionSizeY);
542
543=======
492 m_log.DebugFormat("{0} EstablishAgentCommunication. handle={1}, avatarID={2}, regionSize={3},{4}>", 544 m_log.DebugFormat("{0} EstablishAgentCommunication. handle={1}, avatarID={2}, regionSize={3},{4}>",
493 LogHeader, regionHandle, avatarID, regionSizeX, regionSizeY); 545 LogHeader, regionHandle, avatarID, regionSizeX, regionSizeY);
546>>>>>>> avn/ubitvar
494 OSD item = EventQueueHelper.EstablishAgentCommunication(avatarID, endPoint.ToString(), capsPath, regionHandle, regionSizeX, regionSizeY); 547 OSD item = EventQueueHelper.EstablishAgentCommunication(avatarID, endPoint.ToString(), capsPath, regionHandle, regionSizeX, regionSizeY);
495 Enqueue(item, avatarID); 548 Enqueue(item, avatarID);
496 } 549 }
@@ -500,8 +553,14 @@ namespace OpenSim.Region.ClientStack.Linden
500 uint locationID, uint flags, string capsURL, 553 uint locationID, uint flags, string capsURL,
501 UUID avatarID, int regionSizeX, int regionSizeY) 554 UUID avatarID, int regionSizeX, int regionSizeY)
502 { 555 {
556<<<<<<< HEAD
557 if (DebugLevel > 0)
558 m_log.DebugFormat("{0} TeleportFinishEvent. handle={1}, endPoint={2}, avatarID={3}",
559 LogHeader, regionHandle, regionExternalEndPoint, avatarID, regionSizeX, regionSizeY);
560=======
503 m_log.DebugFormat("{0} TeleportFinishEvent. handle={1}, avatarID={2}, regionSize={3},{4}>", 561 m_log.DebugFormat("{0} TeleportFinishEvent. handle={1}, avatarID={2}, regionSize={3},{4}>",
504 LogHeader, regionHandle, avatarID, regionSizeX, regionSizeY); 562 LogHeader, regionHandle, avatarID, regionSizeX, regionSizeY);
563>>>>>>> avn/ubitvar
505 564
506 OSD item = EventQueueHelper.TeleportFinishEvent(regionHandle, simAccess, regionExternalEndPoint, 565 OSD item = EventQueueHelper.TeleportFinishEvent(regionHandle, simAccess, regionExternalEndPoint,
507 locationID, flags, capsURL, avatarID, regionSizeX, regionSizeY); 566 locationID, flags, capsURL, avatarID, regionSizeX, regionSizeY);
@@ -512,8 +571,14 @@ namespace OpenSim.Region.ClientStack.Linden
512 IPEndPoint newRegionExternalEndPoint, 571 IPEndPoint newRegionExternalEndPoint,
513 string capsURL, UUID avatarID, UUID sessionID, int regionSizeX, int regionSizeY) 572 string capsURL, UUID avatarID, UUID sessionID, int regionSizeX, int regionSizeY)
514 { 573 {
574<<<<<<< HEAD
575 if (DebugLevel > 0)
576 m_log.DebugFormat("{0} CrossRegion. handle={1}, avatarID={2}, regionSize={3},{4}>",
577 LogHeader, handle, avatarID, regionSizeX, regionSizeY);
578=======
515 m_log.DebugFormat("{0} CrossRegion. handle={1}, avatarID={2}, regionSize={3},{4}>", 579 m_log.DebugFormat("{0} CrossRegion. handle={1}, avatarID={2}, regionSize={3},{4}>",
516 LogHeader, handle, avatarID, regionSizeX, regionSizeY); 580 LogHeader, handle, avatarID, regionSizeX, regionSizeY);
581>>>>>>> avn/ubitvar
517 582
518 OSD item = EventQueueHelper.CrossRegion(handle, pos, lookAt, newRegionExternalEndPoint, 583 OSD item = EventQueueHelper.CrossRegion(handle, pos, lookAt, newRegionExternalEndPoint,
519 capsURL, avatarID, sessionID, regionSizeX, regionSizeY); 584 capsURL, avatarID, sessionID, regionSizeX, regionSizeY);
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs
index 50e22f5..8b7e4c1 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs
@@ -77,8 +77,13 @@ namespace OpenSim.Region.ClientStack.Linden
77 llsdSimInfo.Add("Handle", new OSDBinary(ulongToByteArray(handle))); 77 llsdSimInfo.Add("Handle", new OSDBinary(ulongToByteArray(handle)));
78 llsdSimInfo.Add("IP", new OSDBinary(endPoint.Address.GetAddressBytes())); 78 llsdSimInfo.Add("IP", new OSDBinary(endPoint.Address.GetAddressBytes()));
79 llsdSimInfo.Add("Port", new OSDInteger(endPoint.Port)); 79 llsdSimInfo.Add("Port", new OSDInteger(endPoint.Port));
80<<<<<<< HEAD
81 llsdSimInfo.Add("RegionSizeX", OSD.FromUInteger((uint) regionSizeX));
82 llsdSimInfo.Add("RegionSizeY", OSD.FromUInteger((uint) regionSizeY));
83=======
80 llsdSimInfo.Add("RegionSizeX", OSD.FromUInteger((uint)regionSizeX)); 84 llsdSimInfo.Add("RegionSizeX", OSD.FromUInteger((uint)regionSizeX));
81 llsdSimInfo.Add("RegionSizeY", OSD.FromUInteger((uint)regionSizeY)); 85 llsdSimInfo.Add("RegionSizeY", OSD.FromUInteger((uint)regionSizeY));
86>>>>>>> avn/ubitvar
82 87
83 OSDArray arr = new OSDArray(1); 88 OSDArray arr = new OSDArray(1);
84 arr.Add(llsdSimInfo); 89 arr.Add(llsdSimInfo);
@@ -171,8 +176,12 @@ namespace OpenSim.Region.ClientStack.Linden
171 info.Add("SimAccess", OSD.FromInteger(simAccess)); 176 info.Add("SimAccess", OSD.FromInteger(simAccess));
172 info.Add("SimIP", OSD.FromBinary(regionExternalEndPoint.Address.GetAddressBytes())); 177 info.Add("SimIP", OSD.FromBinary(regionExternalEndPoint.Address.GetAddressBytes()));
173 info.Add("SimPort", OSD.FromInteger(regionExternalEndPoint.Port)); 178 info.Add("SimPort", OSD.FromInteger(regionExternalEndPoint.Port));
179<<<<<<< HEAD
180 info.Add("TeleportFlags", OSD.FromULong(1L << 4)); // AgentManager.TeleportFlags.ViaLocation
181=======
174// info.Add("TeleportFlags", OSD.FromULong(1L << 4)); // AgentManager.TeleportFlags.ViaLocation 182// info.Add("TeleportFlags", OSD.FromULong(1L << 4)); // AgentManager.TeleportFlags.ViaLocation
175 info.Add("TeleportFlags", OSD.FromUInteger(flags)); 183 info.Add("TeleportFlags", OSD.FromUInteger(flags));
184>>>>>>> avn/ubitvar
176 info.Add("RegionSizeX", OSD.FromUInteger((uint)regionSizeX)); 185 info.Add("RegionSizeX", OSD.FromUInteger((uint)regionSizeX));
177 info.Add("RegionSizeY", OSD.FromUInteger((uint)regionSizeY)); 186 info.Add("RegionSizeY", OSD.FromUInteger((uint)regionSizeY));
178 187
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs
index 9e24bce..16a902d 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections;
29using System.Collections.Generic; 30using System.Collections.Generic;
30using System.Net; 31using System.Net;
31using log4net.Config; 32using log4net.Config;
@@ -33,13 +34,15 @@ using Nini.Config;
33using NUnit.Framework; 34using NUnit.Framework;
34using OpenMetaverse; 35using OpenMetaverse;
35using OpenMetaverse.Packets; 36using OpenMetaverse.Packets;
37using OpenMetaverse.StructuredData;
36using OpenSim.Framework; 38using OpenSim.Framework;
37using OpenSim.Framework.Servers; 39using OpenSim.Framework.Servers;
38using OpenSim.Framework.Servers.HttpServer; 40using OpenSim.Framework.Servers.HttpServer;
39using OpenSim.Region.ClientStack.Linden; 41using OpenSim.Region.ClientStack.Linden;
40using OpenSim.Region.CoreModules.Framework; 42using OpenSim.Region.CoreModules.Framework;
43using OpenSim.Region.Framework.Scenes;
44using OpenSim.Region.OptionalModules.World.NPC;
41using OpenSim.Tests.Common; 45using OpenSim.Tests.Common;
42using OpenSim.Tests.Common.Mock;
43 46
44namespace OpenSim.Region.ClientStack.Linden.Tests 47namespace OpenSim.Region.ClientStack.Linden.Tests
45{ 48{
@@ -47,6 +50,8 @@ namespace OpenSim.Region.ClientStack.Linden.Tests
47 public class EventQueueTests : OpenSimTestCase 50 public class EventQueueTests : OpenSimTestCase
48 { 51 {
49 private TestScene m_scene; 52 private TestScene m_scene;
53 private EventQueueGetModule m_eqgMod;
54 private NPCModule m_npcMod;
50 55
51 [SetUp] 56 [SetUp]
52 public override void SetUp() 57 public override void SetUp()
@@ -69,10 +74,15 @@ namespace OpenSim.Region.ClientStack.Linden.Tests
69 config.Configs["Startup"].Set("EventQueue", "true"); 74 config.Configs["Startup"].Set("EventQueue", "true");
70 75
71 CapabilitiesModule capsModule = new CapabilitiesModule(); 76 CapabilitiesModule capsModule = new CapabilitiesModule();
72 EventQueueGetModule eqgModule = new EventQueueGetModule(); 77 m_eqgMod = new EventQueueGetModule();
78
79 // For NPC test support
80 config.AddConfig("NPC");
81 config.Configs["NPC"].Set("Enabled", "true");
82 m_npcMod = new NPCModule();
73 83
74 m_scene = new SceneHelpers().SetupScene(); 84 m_scene = new SceneHelpers().SetupScene();
75 SceneHelpers.SetupSceneModules(m_scene, config, capsModule, eqgModule); 85 SceneHelpers.SetupSceneModules(m_scene, config, capsModule, m_eqgMod, m_npcMod);
76 } 86 }
77 87
78 [Test] 88 [Test]
@@ -101,5 +111,80 @@ namespace OpenSim.Region.ClientStack.Linden.Tests
101 // TODO: Add more assertions for the other aspects of event queues 111 // TODO: Add more assertions for the other aspects of event queues
102 Assert.That(MainServer.Instance.GetPollServiceHandlerKeys().Count, Is.EqualTo(0)); 112 Assert.That(MainServer.Instance.GetPollServiceHandlerKeys().Count, Is.EqualTo(0));
103 } 113 }
114
115 [Test]
116 public void TestEnqueueMessage()
117 {
118 TestHelpers.InMethod();
119// log4net.Config.XmlConfigurator.Configure();
120
121 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
122
123 string messageName = "TestMessage";
124
125 m_eqgMod.Enqueue(m_eqgMod.BuildEvent(messageName, new OSDMap()), sp.UUID);
126
127 Hashtable eventsResponse = m_eqgMod.GetEvents(UUID.Zero, sp.UUID);
128
129 Assert.That((int)eventsResponse["int_response_code"], Is.EqualTo((int)HttpStatusCode.OK));
130
131// Console.WriteLine("Response [{0}]", (string)eventsResponse["str_response_string"]);
132
133 OSDMap rawOsd = (OSDMap)OSDParser.DeserializeLLSDXml((string)eventsResponse["str_response_string"]);
134 OSDArray eventsOsd = (OSDArray)rawOsd["events"];
135
136 bool foundUpdate = false;
137 foreach (OSD osd in eventsOsd)
138 {
139 OSDMap eventOsd = (OSDMap)osd;
140
141 if (eventOsd["message"] == messageName)
142 foundUpdate = true;
143 }
144
145 Assert.That(foundUpdate, Is.True, string.Format("Did not find {0} in response", messageName));
146 }
147
148 /// <summary>
149 /// Test an attempt to put a message on the queue of a user that is not in the region.
150 /// </summary>
151 [Test]
152 public void TestEnqueueMessageNoUser()
153 {
154 TestHelpers.InMethod();
155 TestHelpers.EnableLogging();
156
157 string messageName = "TestMessage";
158
159 m_eqgMod.Enqueue(m_eqgMod.BuildEvent(messageName, new OSDMap()), TestHelpers.ParseTail(0x1));
160
161 Hashtable eventsResponse = m_eqgMod.GetEvents(UUID.Zero, TestHelpers.ParseTail(0x1));
162
163 Assert.That((int)eventsResponse["int_response_code"], Is.EqualTo((int)HttpStatusCode.BadGateway));
164 }
165
166 /// <summary>
167 /// NPCs do not currently have an event queue but a caller may try to send a message anyway, so check behaviour.
168 /// </summary>
169 [Test]
170 public void TestEnqueueMessageToNpc()
171 {
172 TestHelpers.InMethod();
173// TestHelpers.EnableLogging();
174
175 UUID npcId
176 = m_npcMod.CreateNPC(
177 "John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, new AvatarAppearance());
178
179 ScenePresence npc = m_scene.GetScenePresence(npcId);
180
181 string messageName = "TestMessage";
182
183 m_eqgMod.Enqueue(m_eqgMod.BuildEvent(messageName, new OSDMap()), npc.UUID);
184
185 Hashtable eventsResponse = m_eqgMod.GetEvents(UUID.Zero, npc.UUID);
186
187 Assert.That((int)eventsResponse["int_response_code"], Is.EqualTo((int)HttpStatusCode.BadGateway));
188 }
104 } 189 }
105} \ No newline at end of file 190} \ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs b/OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs
index 87d3d1c..e0a11cc 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs
@@ -25,20 +25,16 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
29using System.Collections;
30using System.Reflection;
31using log4net;
32using Nini.Config;
33using Mono.Addins; 28using Mono.Addins;
29using Nini.Config;
34using OpenMetaverse; 30using OpenMetaverse;
35using OpenSim.Framework; 31using OpenSim.Capabilities.Handlers;
36using OpenSim.Framework.Servers.HttpServer; 32using OpenSim.Framework.Servers.HttpServer;
37using OpenSim.Region.Framework.Interfaces; 33using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
39using OpenSim.Services.Interfaces; 35using OpenSim.Services.Interfaces;
36using System;
40using Caps = OpenSim.Framework.Capabilities.Caps; 37using Caps = OpenSim.Framework.Capabilities.Caps;
41using OpenSim.Capabilities.Handlers;
42 38
43namespace OpenSim.Region.ClientStack.Linden 39namespace OpenSim.Region.ClientStack.Linden
44{ 40{
@@ -58,8 +54,6 @@ namespace OpenSim.Region.ClientStack.Linden
58 54
59 private string m_fetchInventory2Url; 55 private string m_fetchInventory2Url;
60 56
61 private FetchInventory2Handler m_fetchHandler;
62
63 #region ISharedRegionModule Members 57 #region ISharedRegionModule Members
64 58
65 public void Initialise(IConfigSource source) 59 public void Initialise(IConfigSource source)
@@ -98,10 +92,6 @@ namespace OpenSim.Region.ClientStack.Linden
98 92
99 m_inventoryService = m_scene.InventoryService; 93 m_inventoryService = m_scene.InventoryService;
100 94
101 // We'll reuse the same handler for all requests.
102 if (m_fetchInventory2Url == "localhost")
103 m_fetchHandler = new FetchInventory2Handler(m_inventoryService);
104
105 m_scene.EventManager.OnRegisterCaps += RegisterCaps; 95 m_scene.EventManager.OnRegisterCaps += RegisterCaps;
106 } 96 }
107 97
@@ -131,9 +121,11 @@ namespace OpenSim.Region.ClientStack.Linden
131 { 121 {
132 capUrl = "/CAPS/" + UUID.Random(); 122 capUrl = "/CAPS/" + UUID.Random();
133 123
124 FetchInventory2Handler fetchHandler = new FetchInventory2Handler(m_inventoryService, agentID);
125
134 IRequestHandler reqHandler 126 IRequestHandler reqHandler
135 = new RestStreamHandler( 127 = new RestStreamHandler(
136 "POST", capUrl, m_fetchHandler.FetchInventoryRequest, capName, agentID.ToString()); 128 "POST", capUrl, fetchHandler.FetchInventoryRequest, capName, agentID.ToString());
137 129
138 caps.RegisterHandler(capName, reqHandler); 130 caps.RegisterHandler(capName, reqHandler);
139 } 131 }
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetDisplayNamesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetDisplayNamesModule.cs
new file mode 100644
index 0000000..6617bbc
--- /dev/null
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetDisplayNamesModule.cs
@@ -0,0 +1,144 @@
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
28using System;
29using System.Collections;
30using System.Collections.Specialized;
31using System.Drawing;
32using System.Drawing.Imaging;
33using System.Reflection;
34using System.IO;
35using System.Web;
36using log4net;
37using Nini.Config;
38using Mono.Addins;
39using OpenMetaverse;
40using OpenMetaverse.StructuredData;
41using OpenMetaverse.Imaging;
42using OpenSim.Framework;
43using OpenSim.Framework.Servers;
44using OpenSim.Framework.Servers.HttpServer;
45using OpenSim.Region.Framework.Interfaces;
46using OpenSim.Region.Framework.Scenes;
47using OpenSim.Services.Interfaces;
48using Caps = OpenSim.Framework.Capabilities.Caps;
49using OpenSim.Capabilities.Handlers;
50
51namespace OpenSim.Region.ClientStack.Linden
52{
53
54 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GetDisplayNamesModule")]
55 public class GetDisplayNamesModule : INonSharedRegionModule
56 {
57 private static readonly ILog m_log =
58 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
59
60 private Scene m_scene;
61 private IUserManagement m_UserManager;
62
63 private bool m_Enabled = false;
64
65 private string m_URL;
66
67 #region ISharedRegionModule Members
68
69 public void Initialise(IConfigSource source)
70 {
71 IConfig config = source.Configs["ClientStack.LindenCaps"];
72 if (config == null)
73 return;
74
75 m_URL = config.GetString("Cap_GetDisplayNames", string.Empty);
76 if (m_URL != string.Empty)
77 m_Enabled = true;
78 }
79
80 public void AddRegion(Scene s)
81 {
82 if (!m_Enabled)
83 return;
84
85 m_scene = s;
86 }
87
88 public void RemoveRegion(Scene s)
89 {
90 if (!m_Enabled)
91 return;
92
93 m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
94 m_scene = null;
95 }
96
97 public void RegionLoaded(Scene s)
98 {
99 if (!m_Enabled)
100 return;
101
102 m_UserManager = m_scene.RequestModuleInterface<IUserManagement>();
103 m_scene.EventManager.OnRegisterCaps += RegisterCaps;
104 }
105
106 public void PostInitialise()
107 {
108 }
109
110 public void Close() { }
111
112 public string Name { get { return "GetDisplayNamesModule"; } }
113
114 public Type ReplaceableInterface
115 {
116 get { return null; }
117 }
118
119 #endregion
120
121 public void RegisterCaps(UUID agentID, Caps caps)
122 {
123 UUID capID = UUID.Random();
124
125 if (m_URL == "localhost")
126 {
127 m_log.DebugFormat("[GET_DISPLAY_NAMES]: /CAPS/agents/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
128 caps.RegisterHandler(
129 "GetDisplayNames",
130 new GetDisplayNamesHandler("/CAPS/agents" + capID + "/", m_UserManager, "GetDisplayNames", agentID.ToString()));
131 }
132 else
133 {
134// m_log.DebugFormat("[GETTEXTURE]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName);
135 IExternalCapsModule handler = m_scene.RequestModuleInterface<IExternalCapsModule>();
136 if (handler != null)
137 handler.RegisterExternalUserCapsHandler(agentID,caps,"GetDisplayNames", m_URL);
138 else
139 caps.RegisterHandler("GetDisplayNames", m_URL);
140 }
141 }
142
143 }
144}
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
index a381a1b..91efe8a 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs
@@ -60,6 +60,11 @@ namespace OpenSim.Region.ClientStack.Linden
60 private IAssetService m_AssetService; 60 private IAssetService m_AssetService;
61 private bool m_Enabled = true; 61 private bool m_Enabled = true;
62 private string m_URL; 62 private string m_URL;
63<<<<<<< HEAD
64 private string m_URL2;
65 private string m_RedirectURL = null;
66 private string m_RedirectURL2 = null;
67=======
63 68
64 struct aPollRequest 69 struct aPollRequest
65 { 70 {
@@ -89,6 +94,7 @@ namespace OpenSim.Region.ClientStack.Linden
89 new OpenMetaverse.BlockingQueue<aPollRequest>(); 94 new OpenMetaverse.BlockingQueue<aPollRequest>();
90 95
91 private Dictionary<UUID, PollServiceMeshEventArgs> m_pollservices = new Dictionary<UUID, PollServiceMeshEventArgs>(); 96 private Dictionary<UUID, PollServiceMeshEventArgs> m_pollservices = new Dictionary<UUID, PollServiceMeshEventArgs>();
97>>>>>>> avn/ubitvar
92 98
93 #region Region Module interfaceBase Members 99 #region Region Module interfaceBase Members
94 100
@@ -113,8 +119,22 @@ namespace OpenSim.Region.ClientStack.Linden
113 m_URL = config.GetString("Cap_GetMesh", string.Empty); 119 m_URL = config.GetString("Cap_GetMesh", string.Empty);
114 // Cap doesn't exist 120 // Cap doesn't exist
115 if (m_URL != string.Empty) 121 if (m_URL != string.Empty)
122 {
123 m_Enabled = true;
124 m_RedirectURL = config.GetString("GetMeshRedirectURL");
125 }
126
127 m_URL2 = config.GetString("Cap_GetMesh2", string.Empty);
128 // Cap doesn't exist
129 if (m_URL2 != string.Empty)
130 {
116 m_Enabled = true; 131 m_Enabled = true;
132<<<<<<< HEAD
133 m_RedirectURL2 = config.GetString("GetMesh2RedirectURL");
134 }
135=======
117 136
137>>>>>>> avn/ubitvar
118 } 138 }
119 139
120 public void AddRegion(Scene pScene) 140 public void AddRegion(Scene pScene)
@@ -316,6 +336,21 @@ namespace OpenSim.Region.ClientStack.Linden
316 336
317 public void RegisterCaps(UUID agentID, Caps caps) 337 public void RegisterCaps(UUID agentID, Caps caps)
318 { 338 {
339<<<<<<< HEAD
340 UUID capID = UUID.Random();
341 bool getMeshRegistered = false;
342
343 if (m_URL == string.Empty)
344 {
345
346 }
347 else if (m_URL == "localhost")
348 {
349 getMeshRegistered = true;
350 caps.RegisterHandler(
351 "GetMesh",
352 new GetMeshHandler("/CAPS/" + capID + "/", m_AssetService, "GetMesh", agentID.ToString(), m_RedirectURL));
353=======
319// UUID capID = UUID.Random(); 354// UUID capID = UUID.Random();
320 if (m_URL == "localhost") 355 if (m_URL == "localhost")
321 { 356 {
@@ -343,12 +378,30 @@ namespace OpenSim.Region.ClientStack.Linden
343 378
344 379
345 380
381>>>>>>> avn/ubitvar
346 } 382 }
347 else 383 else
348 { 384 {
349// m_log.DebugFormat("[GETMESH]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName);
350 caps.RegisterHandler("GetMesh", m_URL); 385 caps.RegisterHandler("GetMesh", m_URL);
351 } 386 }
387
388 if(m_URL2 == string.Empty)
389 {
390
391 }
392 else if (m_URL2 == "localhost")
393 {
394 if (!getMeshRegistered)
395 {
396 caps.RegisterHandler(
397 "GetMesh2",
398 new GetMeshHandler("/CAPS/" + capID + "/", m_AssetService, "GetMesh2", agentID.ToString(), m_RedirectURL2));
399 }
400 }
401 else
402 {
403 caps.RegisterHandler("GetMesh2", m_URL2);
404 }
352 } 405 }
353 private void DeregisterCaps(UUID agentID, Caps caps) 406 private void DeregisterCaps(UUID agentID, Caps caps)
354 { 407 {
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
index 99ccd4b..b9396b7 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs
@@ -82,7 +82,12 @@ namespace OpenSim.Region.ClientStack.Linden
82 private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue = 82 private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue =
83 new OpenMetaverse.BlockingQueue<aPollRequest>(); 83 new OpenMetaverse.BlockingQueue<aPollRequest>();
84 84
85<<<<<<< HEAD
86 // TODO: Change this to a config option
87 private string m_RedirectURL = null;
88=======
85 private Dictionary<UUID,PollServiceTextureEventArgs> m_pollservices = new Dictionary<UUID,PollServiceTextureEventArgs>(); 89 private Dictionary<UUID,PollServiceTextureEventArgs> m_pollservices = new Dictionary<UUID,PollServiceTextureEventArgs>();
90>>>>>>> avn/ubitvar
86 91
87 private string m_URL; 92 private string m_URL;
88 93
@@ -91,8 +96,21 @@ namespace OpenSim.Region.ClientStack.Linden
91 public void Initialise(IConfigSource source) 96 public void Initialise(IConfigSource source)
92 { 97 {
93 IConfig config = source.Configs["ClientStack.LindenCaps"]; 98 IConfig config = source.Configs["ClientStack.LindenCaps"];
99<<<<<<< HEAD
100 if (config == null)
101 return;
102
103 m_URL = config.GetString("Cap_GetTexture", string.Empty);
104 // Cap doesn't exist
105 if (m_URL != string.Empty)
106 {
107 m_Enabled = true;
108 m_RedirectURL = config.GetString("GetTextureRedirectURL");
109 }
110=======
94 if (config != null) 111 if (config != null)
95 m_Url = config.GetString("Cap_GetTexture", "localhost"); 112 m_Url = config.GetString("Cap_GetTexture", "localhost");
113>>>>>>> avn/ubitvar
96 } 114 }
97 115
98 public void AddRegion(Scene s) 116 public void AddRegion(Scene s)
@@ -219,6 +237,12 @@ namespace OpenSim.Region.ClientStack.Linden
219 public PollServiceTextureEventArgs(UUID pId, Scene scene) : 237 public PollServiceTextureEventArgs(UUID pId, Scene scene) :
220 base(null, "", null, null, null, pId, int.MaxValue) 238 base(null, "", null, null, null, pId, int.MaxValue)
221 { 239 {
240<<<<<<< HEAD
241// m_log.DebugFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
242 caps.RegisterHandler(
243 "GetTexture",
244 new GetTextureHandler("/CAPS/" + capID + "/", m_assetService, "GetTexture", agentID.ToString(), m_RedirectURL));
245=======
222 m_scene = scene; 246 m_scene = scene;
223 // x is request id, y is userid 247 // x is request id, y is userid
224 HasEvents = (x, y) => 248 HasEvents = (x, y) =>
@@ -288,6 +312,7 @@ namespace OpenSim.Region.ClientStack.Linden
288 312
289 return response; 313 return response;
290 }; 314 };
315>>>>>>> avn/ubitvar
291 } 316 }
292 317
293 public void Process(aPollRequest requestinfo) 318 public void Process(aPollRequest requestinfo)
@@ -377,7 +402,11 @@ namespace OpenSim.Region.ClientStack.Linden
377 } 402 }
378 IExternalCapsModule handler = m_scene.RequestModuleInterface<IExternalCapsModule>(); 403 IExternalCapsModule handler = m_scene.RequestModuleInterface<IExternalCapsModule>();
379 if (handler != null) 404 if (handler != null)
405<<<<<<< HEAD
406 handler.RegisterExternalUserCapsHandler(agentID,caps,"GetTexture", m_URL);
407=======
380 handler.RegisterExternalUserCapsHandler(agentID, caps, "GetTexture", capUrl); 408 handler.RegisterExternalUserCapsHandler(agentID, caps, "GetTexture", capUrl);
409>>>>>>> avn/ubitvar
381 else 410 else
382 caps.RegisterHandler("GetTexture", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl)); 411 caps.RegisterHandler("GetTexture", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl));
383 m_pollservices[agentID] = args; 412 m_pollservices[agentID] = args;
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/Properties/AssemblyInfo.cs b/OpenSim/Region/ClientStack/Linden/Caps/Properties/AssemblyInfo.cs
index 112608b..264eaa3 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.8.0.*")] 32[assembly: AssemblyVersion("0.8.2.*")]
33 33
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
index bedec80..54542c9 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic;
30using System.Reflection; 31using System.Reflection;
31using log4net; 32using log4net;
32using Nini.Config; 33using Nini.Config;
@@ -37,7 +38,7 @@ using OpenSim.Framework;
37using OpenSim.Framework.Servers.HttpServer; 38using OpenSim.Framework.Servers.HttpServer;
38using OpenSim.Region.Framework.Interfaces; 39using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
40using OpenSim.Services.Interfaces; 41// using OpenSim.Services.Interfaces;
41using Caps = OpenSim.Framework.Capabilities.Caps; 42using Caps = OpenSim.Framework.Capabilities.Caps;
42 43
43namespace OpenSim.Region.ClientStack.Linden 44namespace OpenSim.Region.ClientStack.Linden
@@ -56,8 +57,8 @@ namespace OpenSim.Region.ClientStack.Linden
56 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SimulatorFeaturesModule")] 57 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SimulatorFeaturesModule")]
57 public class SimulatorFeaturesModule : ISharedRegionModule, ISimulatorFeaturesModule 58 public class SimulatorFeaturesModule : ISharedRegionModule, ISimulatorFeaturesModule
58 { 59 {
59// private static readonly ILog m_log = 60 private static readonly ILog m_log =
60// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 61 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
61 62
62 public event SimulatorFeaturesRequestDelegate OnSimulatorFeaturesRequest; 63 public event SimulatorFeaturesRequestDelegate OnSimulatorFeaturesRequest;
63 64
@@ -69,18 +70,39 @@ namespace OpenSim.Region.ClientStack.Linden
69 private OSDMap m_features = new OSDMap(); 70 private OSDMap m_features = new OSDMap();
70 71
71 private string m_SearchURL = string.Empty; 72 private string m_SearchURL = string.Empty;
73 private string m_DestinationGuideURL = string.Empty;
72 private bool m_ExportSupported = false; 74 private bool m_ExportSupported = false;
75 private string m_GridName = string.Empty;
76 private string m_GridURL = string.Empty;
73 77
74 #region ISharedRegionModule Members 78 #region ISharedRegionModule Members
75 79
76 public void Initialise(IConfigSource source) 80 public void Initialise(IConfigSource source)
77 { 81 {
78 IConfig config = source.Configs["SimulatorFeatures"]; 82 IConfig config = source.Configs["SimulatorFeatures"];
83
79 if (config != null) 84 if (config != null)
80 { 85 {
81 m_SearchURL = config.GetString("SearchServerURI", string.Empty); 86 //
87 // All this is obsolete since getting these features from the grid service!!
88 // Will be removed after the next release
89 //
90 m_SearchURL = config.GetString("SearchServerURI", m_SearchURL);
91
92 m_DestinationGuideURL = config.GetString ("DestinationGuideURI", m_DestinationGuideURL);
93
94 if (m_DestinationGuideURL == string.Empty) // Make this consistent with the variable in the LoginService config
95 m_DestinationGuideURL = config.GetString("DestinationGuide", m_DestinationGuideURL);
82 96
83 m_ExportSupported = config.GetBoolean("ExportSupported", m_ExportSupported); 97 m_ExportSupported = config.GetBoolean("ExportSupported", m_ExportSupported);
98
99 m_GridURL = Util.GetConfigVarFromSections<string>(
100 source, "GatekeeperURI", new string[] { "Startup", "Hypergrid", "SimulatorFeatures" }, String.Empty);
101
102 m_GridName = config.GetString("GridName", string.Empty);
103 if (m_GridName == string.Empty)
104 m_GridName = Util.GetConfigVarFromSections<string>(
105 source, "gridname", new string[] { "GridInfo", "SimulatorFeatures" }, String.Empty);
84 } 106 }
85 107
86 AddDefaultFeatures(); 108 AddDefaultFeatures();
@@ -101,6 +123,7 @@ namespace OpenSim.Region.ClientStack.Linden
101 123
102 public void RegionLoaded(Scene s) 124 public void RegionLoaded(Scene s)
103 { 125 {
126 GetGridExtraFeatures(s);
104 } 127 }
105 128
106 public void PostInitialise() 129 public void PostInitialise()
@@ -126,6 +149,7 @@ namespace OpenSim.Region.ClientStack.Linden
126 /// </remarks> 149 /// </remarks>
127 private void AddDefaultFeatures() 150 private void AddDefaultFeatures()
128 { 151 {
152
129 lock (m_features) 153 lock (m_features)
130 { 154 {
131 m_features["MeshRezEnabled"] = true; 155 m_features["MeshRezEnabled"] = true;
@@ -133,14 +157,29 @@ namespace OpenSim.Region.ClientStack.Linden
133 m_features["MeshXferEnabled"] = true; 157 m_features["MeshXferEnabled"] = true;
134 158
135 m_features["PhysicsMaterialsEnabled"] = true; 159 m_features["PhysicsMaterialsEnabled"] = true;
160<<<<<<< HEAD
161
162=======
136 163
164>>>>>>> avn/ubitvar
137 OSDMap typesMap = new OSDMap(); 165 OSDMap typesMap = new OSDMap();
138 typesMap["convex"] = true; 166 typesMap["convex"] = true;
139 typesMap["none"] = true; 167 typesMap["none"] = true;
140 typesMap["prim"] = true; 168 typesMap["prim"] = true;
141 m_features["PhysicsShapeTypes"] = typesMap; 169 m_features["PhysicsShapeTypes"] = typesMap;
142 170
143 // Extra information for viewers that want to use it 171 // Extra information for viewers that want to use it
172<<<<<<< HEAD
173 // TODO: Take these out of here into their respective modules, like map-server-url
174 OSDMap extrasMap;
175 if(m_features.ContainsKey("OpenSimExtras"))
176 {
177 extrasMap = (OSDMap)m_features["OpenSimExtras"];
178 }
179 else
180 extrasMap = new OSDMap();
181
182=======
144 183
145 OSDMap extrasMap = new OSDMap(); 184 OSDMap extrasMap = new OSDMap();
146 185
@@ -148,13 +187,25 @@ namespace OpenSim.Region.ClientStack.Linden
148 extrasMap["AnimationSet"] = true; 187 extrasMap["AnimationSet"] = true;
149 188
150 // TODO: Take these out of here into their respective modules, like map-server-url 189 // TODO: Take these out of here into their respective modules, like map-server-url
190>>>>>>> avn/ubitvar
151 if (m_SearchURL != string.Empty) 191 if (m_SearchURL != string.Empty)
152 extrasMap["search-server-url"] = m_SearchURL; 192 extrasMap["search-server-url"] = m_SearchURL;
193 if (!string.IsNullOrEmpty(m_DestinationGuideURL))
194 extrasMap["destination-guide-url"] = m_DestinationGuideURL;
153 if (m_ExportSupported) 195 if (m_ExportSupported)
154 extrasMap["ExportSupported"] = true; 196 extrasMap["ExportSupported"] = true;
155 197 if (m_GridURL != string.Empty)
198 extrasMap["GridURL"] = m_GridURL;
199 if (m_GridName != string.Empty)
200 extrasMap["GridName"] = m_GridName;
201
202<<<<<<< HEAD
203 if (extrasMap.Count > 0)
204 m_features["OpenSimExtras"] = extrasMap;
205=======
156 m_features["OpenSimExtras"] = extrasMap; 206 m_features["OpenSimExtras"] = extrasMap;
157 207
208>>>>>>> avn/ubitvar
158 } 209 }
159 } 210 }
160 211
@@ -208,7 +259,12 @@ namespace OpenSim.Region.ClientStack.Linden
208 259
209 OSDMap copy = DeepCopy(); 260 OSDMap copy = DeepCopy();
210 261
262 // Let's add the agentID to the destination guide, if it is expecting that.
263 if (copy.ContainsKey("OpenSimExtras") && ((OSDMap)(copy["OpenSimExtras"])).ContainsKey("destination-guide-url"))
264 ((OSDMap)copy["OpenSimExtras"])["destination-guide-url"] = Replace(((OSDMap)copy["OpenSimExtras"])["destination-guide-url"], "[USERID]", agentID.ToString());
265
211 SimulatorFeaturesRequestDelegate handlerOnSimulatorFeaturesRequest = OnSimulatorFeaturesRequest; 266 SimulatorFeaturesRequestDelegate handlerOnSimulatorFeaturesRequest = OnSimulatorFeaturesRequest;
267
212 if (handlerOnSimulatorFeaturesRequest != null) 268 if (handlerOnSimulatorFeaturesRequest != null)
213 handlerOnSimulatorFeaturesRequest(agentID, ref copy); 269 handlerOnSimulatorFeaturesRequest(agentID, ref copy);
214 270
@@ -222,5 +278,46 @@ namespace OpenSim.Region.ClientStack.Linden
222 278
223 return responsedata; 279 return responsedata;
224 } 280 }
281
282 /// <summary>
283 /// Gets the grid extra features.
284 /// </summary>
285 /// <param name='featuresURI'>
286 /// The URI Robust uses to handle the get_extra_features request
287 /// </param>
288 private void GetGridExtraFeatures(Scene scene)
289 {
290 Dictionary<string, object> extraFeatures = scene.GridService.GetExtraFeatures();
291 if (extraFeatures.ContainsKey("Result") && extraFeatures["Result"] != null && extraFeatures["Result"].ToString() == "Failure")
292 {
293 m_log.WarnFormat("[SIMULATOR FEATURES MODULE]: Unable to retrieve grid-wide features");
294 return;
295 }
296
297 lock (m_features)
298 {
299 OSDMap extrasMap = new OSDMap();
300
301 foreach(string key in extraFeatures.Keys)
302 {
303 extrasMap[key] = (string)extraFeatures[key];
304
305 if (key == "ExportSupported")
306 {
307 bool.TryParse(extraFeatures[key].ToString(), out m_ExportSupported);
308 }
309 }
310 m_features["OpenSimExtras"] = extrasMap;
311
312 }
313 }
314
315 private string Replace(string url, string substring, string replacement)
316 {
317 if (!String.IsNullOrEmpty(url) && url.Contains(substring))
318 return url.Replace(substring, replacement);
319
320 return url;
321 }
225 } 322 }
226} 323}
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/Tests/WebFetchInvDescModuleTests.cs b/OpenSim/Region/ClientStack/Linden/Caps/Tests/WebFetchInvDescModuleTests.cs
new file mode 100644
index 0000000..dd4a691
--- /dev/null
+++ b/OpenSim/Region/ClientStack/Linden/Caps/Tests/WebFetchInvDescModuleTests.cs
@@ -0,0 +1,159 @@
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
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.IO;
32using System.Net;
33using System.Text;
34using HttpServer;
35using log4net.Config;
36using Nini.Config;
37using NUnit.Framework;
38using OpenMetaverse;
39using OpenMetaverse.Packets;
40using OpenMetaverse.StructuredData;
41using OpenSim.Framework;
42using OpenSim.Framework.Capabilities;
43using OpenSim.Framework.Servers;
44using OpenSim.Framework.Servers.HttpServer;
45using OpenSim.Region.ClientStack.Linden;
46using OpenSim.Region.CoreModules.Framework;
47using OpenSim.Region.Framework.Scenes;
48using OpenSim.Services.Interfaces;
49using OpenSim.Tests.Common;
50using OSDArray = OpenMetaverse.StructuredData.OSDArray;
51using OSDMap = OpenMetaverse.StructuredData.OSDMap;
52
53namespace OpenSim.Region.ClientStack.Linden.Caps.Tests
54{
55 [TestFixture]
56 public class WebFetchInvDescModuleTests : OpenSimTestCase
57 {
58 [TestFixtureSetUp]
59 public void TestFixtureSetUp()
60 {
61 // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread.
62 Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest;
63 }
64
65 [TestFixtureTearDown]
66 public void TestFixureTearDown()
67 {
68 // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple
69 // threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression
70 // tests really shouldn't).
71 Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
72 }
73
74 [SetUp]
75 public override void SetUp()
76 {
77 base.SetUp();
78
79 // This is an unfortunate bit of clean up we have to do because MainServer manages things through static
80 // variables and the VM is not restarted between tests.
81 uint port = 9999;
82 MainServer.RemoveHttpServer(port);
83
84 BaseHttpServer server = new BaseHttpServer(port, false, 0, "");
85 MainServer.AddHttpServer(server);
86 MainServer.Instance = server;
87
88 server.Start(false);
89 }
90
91 [Test]
92 public void TestInventoryDescendentsFetch()
93 {
94 TestHelpers.InMethod();
95 TestHelpers.EnableLogging();
96
97 BaseHttpServer httpServer = MainServer.Instance;
98 Scene scene = new SceneHelpers().SetupScene();
99
100 CapabilitiesModule capsModule = new CapabilitiesModule();
101 WebFetchInvDescModule wfidModule = new WebFetchInvDescModule(false);
102
103 IConfigSource config = new IniConfigSource();
104 config.AddConfig("ClientStack.LindenCaps");
105 config.Configs["ClientStack.LindenCaps"].Set("Cap_FetchInventoryDescendents2", "localhost");
106
107 SceneHelpers.SetupSceneModules(scene, config, capsModule, wfidModule);
108
109 UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(0x1));
110
111 // We need a user present to have any capabilities set up
112 SceneHelpers.AddScenePresence(scene, ua.PrincipalID);
113
114 TestHttpRequest req = new TestHttpRequest();
115 OpenSim.Framework.Capabilities.Caps userCaps = capsModule.GetCapsForUser(ua.PrincipalID);
116 PollServiceEventArgs pseArgs;
117 userCaps.TryGetPollHandler("FetchInventoryDescendents2", out pseArgs);
118 req.UriPath = pseArgs.Url;
119 req.Uri = new Uri("file://" + req.UriPath);
120
121 // Retrieve root folder details directly so that we can request
122 InventoryFolderBase folder = scene.InventoryService.GetRootFolder(ua.PrincipalID);
123
124 OSDMap osdFolder = new OSDMap();
125 osdFolder["folder_id"] = folder.ID;
126 osdFolder["owner_id"] = ua.PrincipalID;
127 osdFolder["fetch_folders"] = true;
128 osdFolder["fetch_items"] = true;
129 osdFolder["sort_order"] = 0;
130
131 OSDArray osdFoldersArray = new OSDArray();
132 osdFoldersArray.Add(osdFolder);
133
134 OSDMap osdReqMap = new OSDMap();
135 osdReqMap["folders"] = osdFoldersArray;
136
137 req.Body = new MemoryStream(OSDParser.SerializeLLSDXmlBytes(osdReqMap));
138
139 TestHttpClientContext context = new TestHttpClientContext(false);
140
141 // WARNING: This results in a caught exception, because queryString is null
142 MainServer.Instance.OnRequest(context, new RequestEventArgs(req));
143
144 // Drive processing of the queued inventory request synchronously.
145 wfidModule.WaitProcessQueuedInventoryRequest();
146 MainServer.Instance.PollServiceRequestManager.WaitPerformResponse();
147
148// System.Threading.Thread.Sleep(10000);
149
150 OSDMap responseOsd = (OSDMap)OSDParser.DeserializeLLSDXml(context.ResponseBody);
151 OSDArray foldersOsd = (OSDArray)responseOsd["folders"];
152 OSDMap folderOsd = (OSDMap)foldersOsd[0];
153
154 // A sanity check that the response has the expected number of descendents for a default inventory
155 // TODO: Need a more thorough check.
156 Assert.That((int)folderOsd["descendents"], Is.EqualTo(16));
157 }
158 }
159} \ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs
index 50e9275..c27d101 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs
@@ -64,18 +64,13 @@ namespace OpenSim.Region.ClientStack.Linden
64 64
65 private Scene m_scene; 65 private Scene m_scene;
66 private bool m_persistBakedTextures; 66 private bool m_persistBakedTextures;
67 private string m_URL; 67
68 private IBakedTextureModule m_BakedTextureModule;
68 69
69 private IBakedTextureModule m_BakedTextureModule; 70 private IBakedTextureModule m_BakedTextureModule;
70 71
71 public void Initialise(IConfigSource source) 72 public void Initialise(IConfigSource source)
72 { 73 {
73 IConfig config = source.Configs["ClientStack.LindenCaps"];
74 if (config == null)
75 return;
76
77 m_URL = config.GetString("Cap_UploadBakedTexture", string.Empty);
78
79 IConfig appearanceConfig = source.Configs["Appearance"]; 74 IConfig appearanceConfig = source.Configs["Appearance"];
80 if (appearanceConfig != null) 75 if (appearanceConfig != null)
81 m_persistBakedTextures = appearanceConfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures); 76 m_persistBakedTextures = appearanceConfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures);
@@ -96,7 +91,13 @@ namespace OpenSim.Region.ClientStack.Linden
96 s.EventManager.OnRemovePresence -= DeRegisterPresence; 91 s.EventManager.OnRemovePresence -= DeRegisterPresence;
97 m_BakedTextureModule = null; 92 m_BakedTextureModule = null;
98 m_scene = null; 93 m_scene = null;
94<<<<<<< HEAD
95 }
96=======
99 } 97 }
98>>>>>>> avn/ubitvar
99
100
100 101
101 public void RegionLoaded(Scene s) 102 public void RegionLoaded(Scene s)
102 { 103 {
@@ -108,12 +109,173 @@ namespace OpenSim.Region.ClientStack.Linden
108 109
109 private void DeRegisterPresence(UUID agentId) 110 private void DeRegisterPresence(UUID agentId)
110 { 111 {
112<<<<<<< HEAD
113 ScenePresence presence = null;
114 if (m_scene.TryGetScenePresence(agentId, out presence))
115 {
116 presence.ControllingClient.OnSetAppearance -= CaptureAppearanceSettings;
117 }
118
119 }
120
121 private void RegisterNewPresence(ScenePresence presence)
122 {
123 presence.ControllingClient.OnSetAppearance += CaptureAppearanceSettings;
124
125 }
126
127 private void CaptureAppearanceSettings(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize, WearableCacheItem[] cacheItems)
128 {
129 int maxCacheitemsLoop = cacheItems.Length;
130 if (maxCacheitemsLoop > AvatarWearable.MAX_WEARABLES)
131 {
132 maxCacheitemsLoop = AvatarWearable.MAX_WEARABLES;
133 m_log.WarnFormat("[CACHEDBAKES]: Too Many Cache items Provided {0}, the max is {1}. Truncating!", cacheItems.Length, AvatarWearable.MAX_WEARABLES);
134 }
135
136 m_BakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
137 if (cacheItems.Length > 0)
138 {
139// m_log.Debug("[Cacheitems]: " + cacheItems.Length);
140// for (int iter = 0; iter < maxCacheitemsLoop; iter++)
141// {
142// m_log.Debug("[Cacheitems] {" + iter + "/" + cacheItems[iter].TextureIndex + "}: c-" + cacheItems[iter].CacheId + ", t-" +
143// cacheItems[iter].TextureID);
144// }
145
146 ScenePresence p = null;
147 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out p))
148 {
149
150 WearableCacheItem[] existingitems = p.Appearance.WearableCacheItems;
151 if (existingitems == null)
152 {
153 if (m_BakedTextureModule != null)
154 {
155 WearableCacheItem[] savedcache = null;
156 try
157 {
158 if (p.Appearance.WearableCacheItemsDirty)
159 {
160 savedcache = m_BakedTextureModule.Get(p.UUID);
161 p.Appearance.WearableCacheItems = savedcache;
162 p.Appearance.WearableCacheItemsDirty = false;
163 }
164
165 }
166 /*
167 * The following Catch types DO NOT WORK with m_BakedTextureModule.Get
168 * it jumps to the General Packet Exception Handler if you don't catch Exception!
169 *
170 catch (System.Net.Sockets.SocketException)
171 {
172 cacheItems = null;
173 }
174 catch (WebException)
175 {
176 cacheItems = null;
177 }
178 catch (InvalidOperationException)
179 {
180 cacheItems = null;
181 } */
182 catch (Exception)
183 {
184 // The service logs a sufficient error message.
185 }
186
187
188 if (savedcache != null)
189 existingitems = savedcache;
190 }
191 }
192 // Existing items null means it's a fully new appearance
193 if (existingitems == null)
194 {
195
196 for (int i = 0; i < maxCacheitemsLoop; i++)
197 {
198 if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex)
199 {
200 Primitive.TextureEntryFace face = textureEntry.FaceTextures[cacheItems[i].TextureIndex];
201 if (face == null)
202 {
203 textureEntry.CreateFace(cacheItems[i].TextureIndex);
204 textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID =
205 AppearanceManager.DEFAULT_AVATAR_TEXTURE;
206 continue;
207 }
208 cacheItems[i].TextureID =face.TextureID;
209 if (m_scene.AssetService != null)
210 cacheItems[i].TextureAsset =
211 m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString());
212 }
213 else
214 {
215 m_log.WarnFormat("[CACHEDBAKES]: Invalid Texture Index Provided, Texture doesn't exist or hasn't been uploaded yet {0}, the max is {1}. Skipping!", cacheItems[i].TextureIndex, textureEntry.FaceTextures.Length);
216 }
217
218
219 }
220 }
221 else
222
223
224 {
225 // for each uploaded baked texture
226 for (int i = 0; i < maxCacheitemsLoop; i++)
227 {
228 if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex)
229 {
230 Primitive.TextureEntryFace face = textureEntry.FaceTextures[cacheItems[i].TextureIndex];
231 if (face == null)
232 {
233 textureEntry.CreateFace(cacheItems[i].TextureIndex);
234 textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID =
235 AppearanceManager.DEFAULT_AVATAR_TEXTURE;
236 continue;
237 }
238 cacheItems[i].TextureID =
239 face.TextureID;
240 }
241 else
242 {
243 m_log.WarnFormat("[CACHEDBAKES]: Invalid Texture Index Provided, Texture doesn't exist or hasn't been uploaded yet {0}, the max is {1}. Skipping!", cacheItems[i].TextureIndex, textureEntry.FaceTextures.Length);
244 }
245 }
246
247 for (int i = 0; i < maxCacheitemsLoop; i++)
248 {
249 if (cacheItems[i].TextureAsset == null)
250 {
251 cacheItems[i].TextureAsset =
252 m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString());
253 }
254 }
255 }
256
257
258
259 p.Appearance.WearableCacheItems = cacheItems;
260
261
262
263 if (m_BakedTextureModule != null)
264 {
265 m_BakedTextureModule.Store(remoteClient.AgentId, cacheItems);
266 p.Appearance.WearableCacheItemsDirty = true;
267
268 }
269 }
270 }
271=======
111// ScenePresence presence = null; 272// ScenePresence presence = null;
112// if (m_scene.TryGetScenePresence(agentId, out presence)) 273// if (m_scene.TryGetScenePresence(agentId, out presence))
113 { 274 {
114// presence.ControllingClient.OnSetAppearance -= CaptureAppearanceSettings; 275// presence.ControllingClient.OnSetAppearance -= CaptureAppearanceSettings;
115 } 276 }
116 277
278>>>>>>> avn/ubitvar
117 } 279 }
118 280
119 private void RegisterNewPresence(ScenePresence presence) 281 private void RegisterNewPresence(ScenePresence presence)
@@ -279,8 +441,25 @@ namespace OpenSim.Region.ClientStack.Linden
279 441
280 public void RegisterCaps(UUID agentID, Caps caps) 442 public void RegisterCaps(UUID agentID, Caps caps)
281 { 443 {
282// UUID capID = UUID.Random(); 444 UploadBakedTextureHandler avatarhandler = new UploadBakedTextureHandler(
445 caps, m_scene.AssetService, m_persistBakedTextures);
446
447<<<<<<< HEAD
448
449
450 caps.RegisterHandler(
451 "UploadBakedTexture",
452 new RestStreamHandler(
453 "POST",
454 "/CAPS/" + caps.CapsObjectPath + m_uploadBakedTexturePath,
455 avatarhandler.UploadBakedTexture,
456 "UploadBakedTexture",
457 agentID.ToString()));
458
459
460
283 461
462=======
284 //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); 463 //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture));
285 if (m_URL == "localhost") 464 if (m_URL == "localhost")
286 { 465 {
@@ -301,6 +480,7 @@ namespace OpenSim.Region.ClientStack.Linden
301 { 480 {
302 caps.RegisterHandler("UploadBakedTexture", m_URL); 481 caps.RegisterHandler("UploadBakedTexture", m_URL);
303 } 482 }
483>>>>>>> avn/ubitvar
304 } 484 }
305 } 485 }
306} 486}
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
index 6fc35cd..92f8c51 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
@@ -64,9 +64,32 @@ namespace OpenSim.Region.ClientStack.Linden
64 public List<UUID> folders; 64 public List<UUID> folders;
65 } 65 }
66 66
67<<<<<<< HEAD
68 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
69=======
67 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 70 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
71>>>>>>> avn/ubitvar
68 72
69 private Scene m_scene; 73 /// <summary>
74 /// Control whether requests will be processed asynchronously.
75 /// </summary>
76 /// <remarks>
77 /// Defaults to true. Can currently not be changed once a region has been added to the module.
78 /// </remarks>
79 public bool ProcessQueuedRequestsAsync { get; private set; }
80
81 /// <summary>
82 /// Number of inventory requests processed by this module.
83 /// </summary>
84 /// <remarks>
85 /// It's the PollServiceRequestManager that actually sends completed requests back to the requester.
86 /// </remarks>
87 public static int ProcessedRequestsCount { get; set; }
88
89 private static Stat s_queuedRequestsStat;
90 private static Stat s_processedRequestsStat;
91
92 public Scene Scene { get; private set; }
70 93
71 private IInventoryService m_InventoryService; 94 private IInventoryService m_InventoryService;
72 private ILibraryService m_LibraryService; 95 private ILibraryService m_LibraryService;
@@ -76,7 +99,7 @@ namespace OpenSim.Region.ClientStack.Linden
76 private string m_fetchInventoryDescendents2Url; 99 private string m_fetchInventoryDescendents2Url;
77 private string m_webFetchInventoryDescendentsUrl; 100 private string m_webFetchInventoryDescendentsUrl;
78 101
79 private static WebFetchInvDescHandler m_webFetchHandler; 102 private static FetchInvDescHandler m_webFetchHandler;
80 103
81 private static Thread[] m_workerThreads = null; 104 private static Thread[] m_workerThreads = null;
82 105
@@ -85,6 +108,13 @@ namespace OpenSim.Region.ClientStack.Linden
85 108
86 #region ISharedRegionModule Members 109 #region ISharedRegionModule Members
87 110
111 public WebFetchInvDescModule() : this(true) {}
112
113 public WebFetchInvDescModule(bool processQueuedResultsAsync)
114 {
115 ProcessQueuedRequestsAsync = processQueuedResultsAsync;
116 }
117
88 public void Initialise(IConfigSource source) 118 public void Initialise(IConfigSource source)
89 { 119 {
90 IConfig config = source.Configs["ClientStack.LindenCaps"]; 120 IConfig config = source.Configs["ClientStack.LindenCaps"];
@@ -105,7 +135,7 @@ namespace OpenSim.Region.ClientStack.Linden
105 if (!m_Enabled) 135 if (!m_Enabled)
106 return; 136 return;
107 137
108 m_scene = s; 138 Scene = s;
109 } 139 }
110 140
111 public void RemoveRegion(Scene s) 141 public void RemoveRegion(Scene s)
@@ -113,12 +143,23 @@ namespace OpenSim.Region.ClientStack.Linden
113 if (!m_Enabled) 143 if (!m_Enabled)
114 return; 144 return;
115 145
116 m_scene.EventManager.OnRegisterCaps -= RegisterCaps; 146 Scene.EventManager.OnRegisterCaps -= RegisterCaps;
117 147
118 foreach (Thread t in m_workerThreads) 148 StatsManager.DeregisterStat(s_processedRequestsStat);
119 Watchdog.AbortThread(t.ManagedThreadId); 149 StatsManager.DeregisterStat(s_queuedRequestsStat);
120 150
121 m_scene = null; 151 if (ProcessQueuedRequestsAsync)
152 {
153 if (m_workerThreads != null)
154 {
155 foreach (Thread t in m_workerThreads)
156 Watchdog.AbortThread(t.ManagedThreadId);
157
158 m_workerThreads = null;
159 }
160 }
161
162 Scene = null;
122 } 163 }
123 164
124 public void RegionLoaded(Scene s) 165 public void RegionLoaded(Scene s)
@@ -126,21 +167,53 @@ namespace OpenSim.Region.ClientStack.Linden
126 if (!m_Enabled) 167 if (!m_Enabled)
127 return; 168 return;
128 169
129 m_InventoryService = m_scene.InventoryService; 170 if (s_processedRequestsStat == null)
130 m_LibraryService = m_scene.LibraryService; 171 s_processedRequestsStat =
172 new Stat(
173 "ProcessedFetchInventoryRequests",
174 "Number of processed fetch inventory requests",
175 "These have not necessarily yet been dispatched back to the requester.",
176 "",
177 "inventory",
178 "httpfetch",
179 StatType.Pull,
180 MeasuresOfInterest.AverageChangeOverTime,
181 stat => { stat.Value = ProcessedRequestsCount; },
182 StatVerbosity.Debug);
183
184 if (s_queuedRequestsStat == null)
185 s_queuedRequestsStat =
186 new Stat(
187 "QueuedFetchInventoryRequests",
188 "Number of fetch inventory requests queued for processing",
189 "",
190 "",
191 "inventory",
192 "httpfetch",
193 StatType.Pull,
194 MeasuresOfInterest.AverageChangeOverTime,
195 stat => { stat.Value = m_queue.Count; },
196 StatVerbosity.Debug);
197
198 StatsManager.RegisterStat(s_processedRequestsStat);
199 StatsManager.RegisterStat(s_queuedRequestsStat);
200
201 m_InventoryService = Scene.InventoryService;
202 m_LibraryService = Scene.LibraryService;
131 203
132 // We'll reuse the same handler for all requests. 204 // We'll reuse the same handler for all requests.
133 m_webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService); 205 m_webFetchHandler = new FetchInvDescHandler(m_InventoryService, m_LibraryService, Scene);
134 206
135 m_scene.EventManager.OnRegisterCaps += RegisterCaps; 207 Scene.EventManager.OnRegisterCaps += RegisterCaps;
136 208
137 if (m_workerThreads == null) 209 int nworkers = 2; // was 2
210 if (ProcessQueuedRequestsAsync && m_workerThreads == null)
138 { 211 {
139 m_workerThreads = new Thread[2]; 212 m_workerThreads = new Thread[nworkers];
140 213
141 for (uint i = 0; i < 2; i++) 214 for (uint i = 0; i < nworkers; i++)
142 { 215 {
143 m_workerThreads[i] = Watchdog.StartThread(DoInventoryRequests, 216 m_workerThreads[i] = WorkManager.StartThread(DoInventoryRequests,
144 String.Format("InventoryWorkerThread{0}", i), 217 String.Format("InventoryWorkerThread{0}", i),
145 ThreadPriority.Normal, 218 ThreadPriority.Normal,
146 false, 219 false,
@@ -173,12 +246,12 @@ namespace OpenSim.Region.ClientStack.Linden
173 private Dictionary<UUID, Hashtable> responses = 246 private Dictionary<UUID, Hashtable> responses =
174 new Dictionary<UUID, Hashtable>(); 247 new Dictionary<UUID, Hashtable>();
175 248
176 private Scene m_scene; 249 private WebFetchInvDescModule m_module;
177 250
178 public PollServiceInventoryEventArgs(Scene scene, string url, UUID pId) : 251 public PollServiceInventoryEventArgs(WebFetchInvDescModule module, string url, UUID pId) :
179 base(null, url, null, null, null, pId, int.MaxValue) 252 base(null, url, null, null, null, pId, int.MaxValue)
180 { 253 {
181 m_scene = scene; 254 m_module = module;
182 255
183 HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); }; 256 HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); };
184 GetEvents = (x, y) => 257 GetEvents = (x, y) =>
@@ -198,12 +271,7 @@ namespace OpenSim.Region.ClientStack.Linden
198 271
199 Request = (x, y) => 272 Request = (x, y) =>
200 { 273 {
201 ScenePresence sp = m_scene.GetScenePresence(Id); 274 ScenePresence sp = m_module.Scene.GetScenePresence(Id);
202 if (sp == null)
203 {
204 m_log.ErrorFormat("[INVENTORY]: Unable to find ScenePresence for {0}", Id);
205 return;
206 }
207 275
208 aPollRequest reqinfo = new aPollRequest(); 276 aPollRequest reqinfo = new aPollRequest();
209 reqinfo.thepoll = this; 277 reqinfo.thepoll = this;
@@ -298,7 +366,13 @@ namespace OpenSim.Region.ClientStack.Linden
298 requestinfo.request["body"].ToString(), String.Empty, String.Empty, null, null); 366 requestinfo.request["body"].ToString(), String.Empty, String.Empty, null, null);
299 367
300 lock (responses) 368 lock (responses)
369 {
370 if (responses.ContainsKey(requestID))
371 m_log.WarnFormat("[FETCH INVENTORY DESCENDENTS2 MODULE]: Caught in the act of loosing responses! Please report this on mantis #7054");
301 responses[requestID] = response; 372 responses[requestID] = response;
373 }
374
375 WebFetchInvDescModule.ProcessedRequestsCount++;
302 } 376 }
303 } 377 }
304 378
@@ -322,7 +396,7 @@ namespace OpenSim.Region.ClientStack.Linden
322 capUrl = "/CAPS/" + UUID.Random() + "/"; 396 capUrl = "/CAPS/" + UUID.Random() + "/";
323 397
324 // Register this as a poll service 398 // Register this as a poll service
325 PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(m_scene, capUrl, agentID); 399 PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(this, capUrl, agentID);
326 args.Type = PollServiceEventArgs.EventType.Inventory; 400 args.Type = PollServiceEventArgs.EventType.Inventory;
327 401
328 caps.RegisterPollHandler(capName, args); 402 caps.RegisterPollHandler(capName, args);
@@ -331,7 +405,7 @@ namespace OpenSim.Region.ClientStack.Linden
331 else 405 else
332 { 406 {
333 capUrl = url; 407 capUrl = url;
334 IExternalCapsModule handler = m_scene.RequestModuleInterface<IExternalCapsModule>(); 408 IExternalCapsModule handler = Scene.RequestModuleInterface<IExternalCapsModule>();
335 if (handler != null) 409 if (handler != null)
336 handler.RegisterExternalUserCapsHandler(agentID,caps,capName,capUrl); 410 handler.RegisterExternalUserCapsHandler(agentID,caps,capName,capUrl);
337 else 411 else
@@ -360,10 +434,26 @@ namespace OpenSim.Region.ClientStack.Linden
360 { 434 {
361 Watchdog.UpdateThread(); 435 Watchdog.UpdateThread();
362 436
363 aPollRequest poolreq = m_queue.Dequeue(); 437 WaitProcessQueuedInventoryRequest();
438 }
439 }
440
441 public void WaitProcessQueuedInventoryRequest()
442 {
443 aPollRequest poolreq = m_queue.Dequeue();
364 444
365 if (poolreq != null && poolreq.thepoll != null) 445 if (poolreq != null && poolreq.thepoll != null)
446 {
447 try
448 {
366 poolreq.thepoll.Process(poolreq); 449 poolreq.thepoll.Process(poolreq);
450 }
451 catch (Exception e)
452 {
453 m_log.ErrorFormat(
454 "[INVENTORY]: Failed to process queued inventory request {0} for {1} in {2}. Exception {3}",
455 poolreq.reqID, poolreq.presence != null ? poolreq.presence.Name : "unknown", Scene.Name, e);
456 }
367 } 457 }
368 } 458 }
369 } 459 }
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 56069a3..806269f 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -34,11 +34,13 @@ using System.Text;
34using System.Threading; 34using System.Threading;
35using System.Timers; 35using System.Timers;
36using System.Xml; 36using System.Xml;
37
37using log4net; 38using log4net;
38using OpenMetaverse; 39using OpenMetaverse;
39using OpenMetaverse.Packets; 40using OpenMetaverse.Packets;
40using OpenMetaverse.Messages.Linden; 41using OpenMetaverse.Messages.Linden;
41using OpenMetaverse.StructuredData; 42using OpenMetaverse.StructuredData;
43
42using OpenSim.Framework; 44using OpenSim.Framework;
43using OpenSim.Framework.Client; 45using OpenSim.Framework.Client;
44using OpenSim.Framework.Monitoring; 46using OpenSim.Framework.Monitoring;
@@ -48,7 +50,6 @@ using OpenSim.Services.Interfaces;
48using Timer = System.Timers.Timer; 50using Timer = System.Timers.Timer;
49using AssetLandmark = OpenSim.Framework.AssetLandmark; 51using AssetLandmark = OpenSim.Framework.AssetLandmark;
50using RegionFlags = OpenMetaverse.RegionFlags; 52using RegionFlags = OpenMetaverse.RegionFlags;
51using Nini.Config;
52 53
53using System.IO; 54using System.IO;
54using PermissionMask = OpenSim.Framework.PermissionMask; 55using PermissionMask = OpenSim.Framework.PermissionMask;
@@ -70,7 +71,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
70 71
71 #region Events 72 #region Events
72 73
73 public event GenericMessage OnGenericMessage;
74 public event BinaryGenericMessage OnBinaryGenericMessage; 74 public event BinaryGenericMessage OnBinaryGenericMessage;
75 public event Action<IClientAPI> OnLogout; 75 public event Action<IClientAPI> OnLogout;
76 public event ObjectPermissions OnObjectPermissions; 76 public event ObjectPermissions OnObjectPermissions;
@@ -78,13 +78,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
78 public event ViewerEffectEventHandler OnViewerEffect; 78 public event ViewerEffectEventHandler OnViewerEffect;
79 public event ImprovedInstantMessage OnInstantMessage; 79 public event ImprovedInstantMessage OnInstantMessage;
80 public event ChatMessage OnChatFromClient; 80 public event ChatMessage OnChatFromClient;
81 public event TextureRequest OnRequestTexture;
82 public event RezObject OnRezObject; 81 public event RezObject OnRezObject;
83 public event DeRezObject OnDeRezObject; 82 public event DeRezObject OnDeRezObject;
84 public event ModifyTerrain OnModifyTerrain; 83 public event ModifyTerrain OnModifyTerrain;
85 public event Action<IClientAPI> OnRegionHandShakeReply; 84 public event Action<IClientAPI> OnRegionHandShakeReply;
86 public event GenericCall1 OnRequestWearables; 85 public event GenericCall1 OnRequestWearables;
87 public event CachedTextureRequest OnCachedTextureRequest;
88 public event SetAppearance OnSetAppearance; 86 public event SetAppearance OnSetAppearance;
89 public event AvatarNowWearing OnAvatarNowWearing; 87 public event AvatarNowWearing OnAvatarNowWearing;
90 public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; 88 public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
@@ -139,15 +137,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
139 public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation; 137 public event UpdatePrimGroupRotation OnUpdatePrimGroupMouseRotation;
140 public event UpdateVector OnUpdatePrimScale; 138 public event UpdateVector OnUpdatePrimScale;
141 public event UpdateVector OnUpdatePrimGroupScale; 139 public event UpdateVector OnUpdatePrimGroupScale;
142 public event StatusChange OnChildAgentStatus;
143 public event GenericCall2 OnStopMovement;
144 public event Action<UUID> OnRemoveAvatar;
145 public event RequestMapBlocks OnRequestMapBlocks; 140 public event RequestMapBlocks OnRequestMapBlocks;
146 public event RequestMapName OnMapNameRequest; 141 public event RequestMapName OnMapNameRequest;
147 public event TeleportLocationRequest OnTeleportLocationRequest; 142 public event TeleportLocationRequest OnTeleportLocationRequest;
148 public event TeleportLandmarkRequest OnTeleportLandmarkRequest; 143 public event TeleportLandmarkRequest OnTeleportLandmarkRequest;
149 public event TeleportCancel OnTeleportCancel; 144 public event TeleportCancel OnTeleportCancel;
150 public event DisconnectUser OnDisconnectUser;
151 public event RequestAvatarProperties OnRequestAvatarProperties; 145 public event RequestAvatarProperties OnRequestAvatarProperties;
152 public event SetAlwaysRun OnSetAlwaysRun; 146 public event SetAlwaysRun OnSetAlwaysRun;
153 public event FetchInventory OnAgentDataUpdateRequest; 147 public event FetchInventory OnAgentDataUpdateRequest;
@@ -178,7 +172,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
178 public event UpdateTaskInventory OnUpdateTaskInventory; 172 public event UpdateTaskInventory OnUpdateTaskInventory;
179 public event MoveTaskInventory OnMoveTaskItem; 173 public event MoveTaskInventory OnMoveTaskItem;
180 public event RemoveTaskInventory OnRemoveTaskItem; 174 public event RemoveTaskInventory OnRemoveTaskItem;
181 public event RequestAsset OnRequestAsset;
182 public event UUIDNameRequest OnNameFromUUIDRequest; 175 public event UUIDNameRequest OnNameFromUUIDRequest;
183 public event ParcelAccessListRequest OnParcelAccessListRequest; 176 public event ParcelAccessListRequest OnParcelAccessListRequest;
184 public event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest; 177 public event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest;
@@ -209,7 +202,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
209 public event RequestPayPrice OnRequestPayPrice; 202 public event RequestPayPrice OnRequestPayPrice;
210 public event ObjectSaleInfo OnObjectSaleInfo; 203 public event ObjectSaleInfo OnObjectSaleInfo;
211 public event ObjectBuy OnObjectBuy; 204 public event ObjectBuy OnObjectBuy;
212 public event BuyObjectInventory OnBuyObjectInventory;
213 public event AgentSit OnUndo; 205 public event AgentSit OnUndo;
214 public event AgentSit OnRedo; 206 public event AgentSit OnRedo;
215 public event LandUndo OnLandUndo; 207 public event LandUndo OnLandUndo;
@@ -218,7 +210,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
218 public event RequestObjectPropertiesFamily OnObjectGroupRequest; 210 public event RequestObjectPropertiesFamily OnObjectGroupRequest;
219 public event DetailedEstateDataRequest OnDetailedEstateDataRequest; 211 public event DetailedEstateDataRequest OnDetailedEstateDataRequest;
220 public event SetEstateFlagsRequest OnSetEstateFlagsRequest; 212 public event SetEstateFlagsRequest OnSetEstateFlagsRequest;
221 public event SetEstateTerrainBaseTexture OnSetEstateTerrainBaseTexture;
222 public event SetEstateTerrainDetailTexture OnSetEstateTerrainDetailTexture; 213 public event SetEstateTerrainDetailTexture OnSetEstateTerrainDetailTexture;
223 public event SetEstateTerrainTextureHeights OnSetEstateTerrainTextureHeights; 214 public event SetEstateTerrainTextureHeights OnSetEstateTerrainTextureHeights;
224 public event CommitEstateTerrainTextureRequest OnCommitEstateTerrainTextureRequest; 215 public event CommitEstateTerrainTextureRequest OnCommitEstateTerrainTextureRequest;
@@ -241,7 +232,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
241 public event GetScriptRunning OnGetScriptRunning; 232 public event GetScriptRunning OnGetScriptRunning;
242 public event SetScriptRunning OnSetScriptRunning; 233 public event SetScriptRunning OnSetScriptRunning;
243 public event Action<Vector3, bool, bool> OnAutoPilotGo; 234 public event Action<Vector3, bool, bool> OnAutoPilotGo;
244 public event TerrainUnacked OnUnackedTerrain;
245 public event ActivateGesture OnActivateGesture; 235 public event ActivateGesture OnActivateGesture;
246 public event DeactivateGesture OnDeactivateGesture; 236 public event DeactivateGesture OnDeactivateGesture;
247 public event ObjectOwner OnObjectOwner; 237 public event ObjectOwner OnObjectOwner;
@@ -301,6 +291,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
301 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; 291 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate;
302 public event GenericCall2 OnUpdateThrottles; 292 public event GenericCall2 OnUpdateThrottles;
303 293
294#pragma warning disable 0067
295 public event GenericMessage OnGenericMessage;
296 public event TextureRequest OnRequestTexture;
297 public event StatusChange OnChildAgentStatus;
298 public event GenericCall2 OnStopMovement;
299 public event Action<UUID> OnRemoveAvatar;
300 public event DisconnectUser OnDisconnectUser;
301 public event RequestAsset OnRequestAsset;
302 public event BuyObjectInventory OnBuyObjectInventory;
303 public event SetEstateTerrainBaseTexture OnSetEstateTerrainBaseTexture;
304 public event TerrainUnacked OnUnackedTerrain;
305 public event CachedTextureRequest OnCachedTextureRequest;
306#pragma warning restore 0067
307
304 #endregion Events 308 #endregion Events
305 309
306 #region Class Members 310 #region Class Members
@@ -413,9 +417,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
413 } 417 }
414 public UUID AgentId { get { return m_agentId; } } 418 public UUID AgentId { get { return m_agentId; } }
415 public ISceneAgent SceneAgent { get; set; } 419 public ISceneAgent SceneAgent { get; set; }
416 public UUID ActiveGroupId { get { return m_activeGroupID; } } 420 public UUID ActiveGroupId { get { return m_activeGroupID; } private set { m_activeGroupID = value; } }
417 public string ActiveGroupName { get { return m_activeGroupName; } } 421 public string ActiveGroupName { get { return m_activeGroupName; } private set { m_activeGroupName = value; } }
418 public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } } 422 public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } private set { m_activeGroupPowers = value; } }
419 public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); } 423 public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); }
420 424
421 public int PingTimeMS 425 public int PingTimeMS
@@ -482,7 +486,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
482 486
483// ~LLClientView() 487// ~LLClientView()
484// { 488// {
485// m_log.DebugFormat("[LLCLIENTVIEW]: Destructor called for {0}, circuit code {1}", Name, CircuitCode); 489// m_log.DebugFormat("{0} Destructor called for {1}, circuit code {2}", LogHeader, Name, CircuitCode);
486// } 490// }
487 491
488 /// <summary> 492 /// <summary>
@@ -553,9 +557,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
553 // there is some unidentified connection problem, not where we have issues due to deadlock 557 // there is some unidentified connection problem, not where we have issues due to deadlock
554 if (!IsActive && !force) 558 if (!IsActive && !force)
555 { 559 {
556 m_log.DebugFormat( 560 m_log.DebugFormat( "{0} Not attempting to close inactive client {1} in {2} since force flag is not set",
557 "[CLIENT]: Not attempting to close inactive client {0} in {1} since force flag is not set", 561 LogHeader, Name, m_scene.Name);
558 Name, m_scene.Name);
559 562
560 return; 563 return;
561 } 564 }
@@ -720,7 +723,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
720 if (!m_packetHandlers.ContainsKey(packetType)) 723 if (!m_packetHandlers.ContainsKey(packetType))
721 { 724 {
722 m_packetHandlers.Add( 725 m_packetHandlers.Add(
726<<<<<<< HEAD
727 packetType, new PacketProcessor() { method = handler, Async = doAsync, InEngine = inEngine });
728=======
723 packetType, new PacketProcessor() { method = handler, Async = doAsync }); 729 packetType, new PacketProcessor() { method = handler, Async = doAsync });
730>>>>>>> avn/ubitvar
724 result = true; 731 result = true;
725 } 732 }
726 } 733 }
@@ -755,21 +762,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP
755 PacketProcessor pprocessor; 762 PacketProcessor pprocessor;
756 if (m_packetHandlers.TryGetValue(packet.Type, out pprocessor)) 763 if (m_packetHandlers.TryGetValue(packet.Type, out pprocessor))
757 { 764 {
765 ClientInfo cinfo = UDPClient.GetClientInfo();
766
758 //there is a local handler for this packet type 767 //there is a local handler for this packet type
759 if (pprocessor.Async) 768 if (pprocessor.Async)
760 { 769 {
761 ClientInfo cinfo = UDPClient.GetClientInfo();
762 if (!cinfo.AsyncRequests.ContainsKey(packet.Type.ToString())) 770 if (!cinfo.AsyncRequests.ContainsKey(packet.Type.ToString()))
763 cinfo.AsyncRequests[packet.Type.ToString()] = 0; 771 cinfo.AsyncRequests[packet.Type.ToString()] = 0;
764 cinfo.AsyncRequests[packet.Type.ToString()]++; 772 cinfo.AsyncRequests[packet.Type.ToString()]++;
765 773
766 object obj = new AsyncPacketProcess(this, pprocessor.method, packet); 774 object obj = new AsyncPacketProcess(this, pprocessor.method, packet);
767 Util.FireAndForget(ProcessSpecificPacketAsync, obj); 775
776 if (pprocessor.InEngine)
777 m_udpServer.IpahEngine.QueueJob(packet.Type.ToString(), () => ProcessSpecificPacketAsync(obj));
778 else
779 Util.FireAndForget(ProcessSpecificPacketAsync, obj, packet.Type.ToString());
780
768 result = true; 781 result = true;
769 } 782 }
770 else 783 else
771 { 784 {
772 ClientInfo cinfo = UDPClient.GetClientInfo();
773 if (!cinfo.SyncRequests.ContainsKey(packet.Type.ToString())) 785 if (!cinfo.SyncRequests.ContainsKey(packet.Type.ToString()))
774 cinfo.SyncRequests[packet.Type.ToString()] = 0; 786 cinfo.SyncRequests[packet.Type.ToString()] = 0;
775 cinfo.SyncRequests[packet.Type.ToString()]++; 787 cinfo.SyncRequests[packet.Type.ToString()]++;
@@ -810,9 +822,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
810 catch (Exception e) 822 catch (Exception e)
811 { 823 {
812 // Make sure that we see any exception caused by the asynchronous operation. 824 // Make sure that we see any exception caused by the asynchronous operation.
813 m_log.ErrorFormat( 825 m_log.Error(
814 "[LLCLIENTVIEW]: Caught exception while processing {0} for {1}, {2} {3}", 826 string.Format(
815 packetObject.Pack, Name, e.Message, e.StackTrace); 827 "[LLCLIENTVIEW]: Caught exception while processing {0} for {1} ", packetObject.Pack, Name),
828 e);
816 } 829 }
817 } 830 }
818 831
@@ -1215,11 +1228,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1215 /// <param name="map">heightmap</param> 1228 /// <param name="map">heightmap</param>
1216 public virtual void SendLayerData(float[] map) 1229 public virtual void SendLayerData(float[] map)
1217 { 1230 {
1231<<<<<<< HEAD
1232 Util.FireAndForget(DoSendLayerData, m_scene.Heightmap.GetTerrainData(), "LLClientView.DoSendLayerData");
1233=======
1218 Util.FireAndForget(DoSendLayerData, m_scene.Heightmap.GetTerrainData()); 1234 Util.FireAndForget(DoSendLayerData, m_scene.Heightmap.GetTerrainData());
1219 1235
1220 // Send it sync, and async. It's not that much data 1236 // Send it sync, and async. It's not that much data
1221 // and it improves user experience just so much! 1237 // and it improves user experience just so much!
1222// DoSendLayerData(map); 1238// DoSendLayerData(map);
1239>>>>>>> avn/ubitvar
1223 } 1240 }
1224 1241
1225 /// <summary> 1242 /// <summary>
@@ -1233,6 +1250,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1233 try 1250 try
1234 { 1251 {
1235 // Send LayerData in typerwriter pattern 1252 // Send LayerData in typerwriter pattern
1253<<<<<<< HEAD
1254 //for (int y = 0; y < 16; y++)
1255 //{
1256 // for (int x = 0; x < 16; x++)
1257 // {
1258 // SendLayerData(x, y, map);
1259 // }
1260 //}
1261
1262 // Send LayerData in a spiral pattern. Fun!
1263 SendLayerTopRight(map, 0, 0, map.SizeX/Constants.TerrainPatchSize-1, map.SizeY/Constants.TerrainPatchSize-1);
1264=======
1236 for (int y = 0; y < 16; y++) 1265 for (int y = 0; y < 16; y++)
1237 { 1266 {
1238 for (int x = 0; x < 16; x++) 1267 for (int x = 0; x < 16; x++)
@@ -1240,6 +1269,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1240 SendLayerData(x, y, map); 1269 SendLayerData(x, y, map);
1241 } 1270 }
1242 } 1271 }
1272>>>>>>> avn/ubitvar
1243 } 1273 }
1244 catch (Exception e) 1274 catch (Exception e)
1245 { 1275 {
@@ -1247,6 +1277,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1247 } 1277 }
1248 } 1278 }
1249 1279
1280<<<<<<< HEAD
1281 private void SendLayerTopRight(TerrainData map, int x1, int y1, int x2, int y2)
1282=======
1250 // Legacy form of invocation that passes around a bare data array. 1283 // Legacy form of invocation that passes around a bare data array.
1251 // Just ignore what was passed and use the real terrain info that is part of the scene. 1284 // Just ignore what was passed and use the real terrain info that is part of the scene.
1252 // As a HORRIBLE kludge in an attempt to not change the definition of IClientAPI, 1285 // As a HORRIBLE kludge in an attempt to not change the definition of IClientAPI,
@@ -1256,6 +1289,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1256 // as -2 and map= [3, 5, 8, 4] would mean to send two terrain heightmap patches 1289 // as -2 and map= [3, 5, 8, 4] would mean to send two terrain heightmap patches
1257 // and the patches to send are <3,5> and <8,4>. 1290 // and the patches to send are <3,5> and <8,4>.
1258 public void SendLayerData(int px, int py, float[] map) 1291 public void SendLayerData(int px, int py, float[] map)
1292>>>>>>> avn/ubitvar
1259 { 1293 {
1260 if (px >= 0) 1294 if (px >= 0)
1261 { 1295 {
@@ -1274,6 +1308,92 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1274 1308
1275 // DebugSendingPatches("SendLayerData", xPatches, yPatches); 1309 // DebugSendingPatches("SendLayerData", xPatches, yPatches);
1276 1310
1311<<<<<<< HEAD
1312 if (x2 - x1 > 0 && y2 - y1 > 0)
1313 SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2);
1314 }
1315
1316 void SendLayerBottomLeft(TerrainData map, int x1, int y1, int x2, int y2)
1317 {
1318 // Row in reverse
1319 for (int i = x2; i >= x1; i--)
1320 SendLayerData(i, y2, map);
1321
1322 // Column in reverse
1323 for (int j = y2 - 1; j >= y1; j--)
1324 SendLayerData(x1, j, map);
1325
1326 if (x2 - x1 > 0 && y2 - y1 > 0)
1327 SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1);
1328 }
1329
1330 /// <summary>
1331 /// Sends a set of four patches (x, x+1, ..., x+3) to the client
1332 /// </summary>
1333 /// <param name="map">heightmap</param>
1334 /// <param name="px">X coordinate for patches 0..12</param>
1335 /// <param name="py">Y coordinate for patches 0..15</param>
1336 // private void SendLayerPacket(float[] map, int y, int x)
1337 // {
1338 // int[] patches = new int[4];
1339 // patches[0] = x + 0 + y * 16;
1340 // patches[1] = x + 1 + y * 16;
1341 // patches[2] = x + 2 + y * 16;
1342 // patches[3] = x + 3 + y * 16;
1343
1344 // Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches);
1345 // OutPacket(layerpack, ThrottleOutPacketType.Land);
1346 // }
1347
1348 // Legacy form of invocation that passes around a bare data array.
1349 // Just ignore what was passed and use the real terrain info that is part of the scene.
1350 // As a HORRIBLE kludge in an attempt to not change the definition of IClientAPI,
1351 // there is a special form for specifying multiple terrain patches to send.
1352 // The form is to pass 'px' as negative the number of patches to send and to
1353 // pass the float array as pairs of patch X and Y coordinates. So, passing 'px'
1354 // as -2 and map= [3, 5, 8, 4] would mean to send two terrain heightmap patches
1355 // and the patches to send are <3,5> and <8,4>.
1356 public void SendLayerData(int px, int py, float[] map)
1357 {
1358 if (px >= 0)
1359 {
1360 SendLayerData(px, py, m_scene.Heightmap.GetTerrainData());
1361 }
1362 else
1363 {
1364 int numPatches = -px;
1365 int[] xPatches = new int[numPatches];
1366 int[] yPatches = new int[numPatches];
1367 for (int pp = 0; pp < numPatches; pp++)
1368 {
1369 xPatches[pp] = (int)map[pp * 2];
1370 yPatches[pp] = (int)map[pp * 2 + 1];
1371 }
1372
1373 // DebugSendingPatches("SendLayerData", xPatches, yPatches);
1374
1375 SendLayerData(xPatches, yPatches, m_scene.Heightmap.GetTerrainData());
1376 }
1377 }
1378
1379 private void DebugSendingPatches(string pWho, int[] pX, int[] pY)
1380 {
1381 if (m_log.IsDebugEnabled)
1382 {
1383 int numPatches = pX.Length;
1384 string Xs = "";
1385 string Ys = "";
1386 for (int pp = 0; pp < numPatches; pp++)
1387 {
1388 Xs += String.Format("{0}", (int)pX[pp]) + ",";
1389 Ys += String.Format("{0}", (int)pY[pp]) + ",";
1390 }
1391 m_log.DebugFormat("{0} {1}: numPatches={2}, X={3}, Y={4}", LogHeader, pWho, numPatches, Xs, Ys);
1392 }
1393 }
1394
1395 /// <summary>
1396=======
1277 SendLayerData(xPatches, yPatches, m_scene.Heightmap.GetTerrainData()); 1397 SendLayerData(xPatches, yPatches, m_scene.Heightmap.GetTerrainData());
1278 } 1398 }
1279 } 1399 }
@@ -1295,6 +1415,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1295 } 1415 }
1296 1416
1297 /// <summary> 1417 /// <summary>
1418>>>>>>> avn/ubitvar
1298 /// Sends a terrain packet for the point specified. 1419 /// Sends a terrain packet for the point specified.
1299 /// This is a legacy call that has refarbed the terrain into a flat map of floats. 1420 /// This is a legacy call that has refarbed the terrain into a flat map of floats.
1300 /// We just use the terrain from the region we know about. 1421 /// We just use the terrain from the region we know about.
@@ -1337,6 +1458,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1337 1458
1338 SendTheLayerPacket(layerpack); 1459 SendTheLayerPacket(layerpack);
1339 } 1460 }
1461 // LayerDataPacket layerpack = OpenSimTerrainCompressor.CreateLandPacket(terrData, px, py);
1462
1340 } 1463 }
1341 catch (Exception e) 1464 catch (Exception e)
1342 { 1465 {
@@ -1344,9 +1467,40 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1344 } 1467 }
1345 } 1468 }
1346 1469
1470<<<<<<< HEAD
1471 // When a user edits the terrain, so much data is sent, the data queues up fast and presents a
1472 // sub optimal editing experience. To alleviate this issue, when the user edits the terrain, we
1473 // start skipping the queues until they're done editing the terrain. We also make them
1474 // unreliable because it's extremely likely that multiple packets will be sent for a terrain patch
1475 // area invalidating previous packets for that area.
1476
1477 // It's possible for an editing user to flood themselves with edited packets but the majority
1478 // of use cases are such that only a tiny percentage of users will be editing the terrain.
1479 // Other, non-editing users will see the edits much slower.
1480
1481 // One last note on this topic, by the time users are going to be editing the terrain, it's
1482 // extremely likely that the sim will have rezzed already and therefore this is not likely going
1483 // to cause any additional issues with lost packets, objects or terrain patches.
1484
1485 // m_justEditedTerrain is volatile, so test once and duplicate two affected statements so we
1486 // only have one cache miss.
1487 private void SendTheLayerPacket(LayerDataPacket layerpack)
1488 {
1489 if (m_justEditedTerrain)
1490 {
1491 layerpack.Header.Reliable = false;
1492 OutPacket(layerpack, ThrottleOutPacketType.Unknown );
1493 }
1494 else
1495 {
1496 layerpack.Header.Reliable = true;
1497 OutPacket(layerpack, ThrottleOutPacketType.Land);
1498 }
1499=======
1347 private void SendTheLayerPacket(LayerDataPacket layerpack) 1500 private void SendTheLayerPacket(LayerDataPacket layerpack)
1348 { 1501 {
1349 OutPacket(layerpack, ThrottleOutPacketType.Land); 1502 OutPacket(layerpack, ThrottleOutPacketType.Land);
1503>>>>>>> avn/ubitvar
1350 } 1504 }
1351 1505
1352 /// <summary> 1506 /// <summary>
@@ -1355,7 +1509,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1355 /// <param name="windSpeeds">16x16 array of wind speeds</param> 1509 /// <param name="windSpeeds">16x16 array of wind speeds</param>
1356 public virtual void SendWindData(Vector2[] windSpeeds) 1510 public virtual void SendWindData(Vector2[] windSpeeds)
1357 { 1511 {
1358 Util.FireAndForget(DoSendWindData, windSpeeds); 1512 Util.FireAndForget(DoSendWindData, windSpeeds, "LLClientView.SendWindData");
1359 } 1513 }
1360 1514
1361 /// <summary> 1515 /// <summary>
@@ -1364,7 +1518,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1364 /// <param name="windSpeeds">16x16 array of cloud densities</param> 1518 /// <param name="windSpeeds">16x16 array of cloud densities</param>
1365 public virtual void SendCloudData(float[] cloudDensity) 1519 public virtual void SendCloudData(float[] cloudDensity)
1366 { 1520 {
1367 Util.FireAndForget(DoSendCloudData, cloudDensity); 1521 Util.FireAndForget(DoSendCloudData, cloudDensity, "LLClientView.SendCloudData");
1368 } 1522 }
1369 1523
1370 /// <summary> 1524 /// <summary>
@@ -1807,6 +1961,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1807 newBlock.Name = Util.StringToBytes256(folder.Name); 1961 newBlock.Name = Util.StringToBytes256(folder.Name);
1808 newBlock.ParentID = folder.ParentID; 1962 newBlock.ParentID = folder.ParentID;
1809 newBlock.Type = (sbyte)folder.Type; 1963 newBlock.Type = (sbyte)folder.Type;
1964 //if (newBlock.Type == InventoryItemBase.SUITCASE_FOLDER_TYPE)
1965 // newBlock.Type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE;
1810 1966
1811 return newBlock; 1967 return newBlock;
1812 } 1968 }
@@ -2056,8 +2212,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2056 2212
2057 folderBlock.FolderID = folder.ID; 2213 folderBlock.FolderID = folder.ID;
2058 folderBlock.ParentID = folder.ParentID; 2214 folderBlock.ParentID = folder.ParentID;
2059 //folderBlock.Type = -1;
2060 folderBlock.Type = (sbyte)folder.Type; 2215 folderBlock.Type = (sbyte)folder.Type;
2216 // Leaving this here for now, just in case we need to do this for a while
2217 //if (folderBlock.Type == InventoryItemBase.SUITCASE_FOLDER_TYPE)
2218 // folderBlock.Type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE;
2061 folderBlock.Name = Util.StringToBytes256(folder.Name); 2219 folderBlock.Name = Util.StringToBytes256(folder.Name);
2062 2220
2063 return folderBlock; 2221 return folderBlock;
@@ -2332,9 +2490,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2332 { 2490 {
2333 if (agentid == AgentId) 2491 if (agentid == AgentId)
2334 { 2492 {
2493<<<<<<< HEAD
2494 ActiveGroupId = activegroupid;
2495 ActiveGroupName = groupname;
2496 ActiveGroupPowers = grouppowers;
2497=======
2335 m_activeGroupID = activegroupid; 2498 m_activeGroupID = activegroupid;
2336 m_activeGroupName = groupname; 2499 m_activeGroupName = groupname;
2337 m_activeGroupPowers = grouppowers; 2500 m_activeGroupPowers = grouppowers;
2501>>>>>>> avn/ubitvar
2338 } 2502 }
2339 2503
2340 AgentDataUpdatePacket sendAgentDataUpdate = (AgentDataUpdatePacket)PacketPool.Instance.GetPacket(PacketType.AgentDataUpdate); 2504 AgentDataUpdatePacket sendAgentDataUpdate = (AgentDataUpdatePacket)PacketPool.Instance.GetPacket(PacketType.AgentDataUpdate);
@@ -2842,8 +3006,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2842 { 3006 {
2843 if (req.AssetInf.Data == null) 3007 if (req.AssetInf.Data == null)
2844 { 3008 {
2845 m_log.ErrorFormat("Cannot send asset {0} ({1}), asset data is null", 3009 m_log.ErrorFormat("{0} Cannot send asset {1} ({2}), asset data is null",
2846 req.AssetInf.ID, req.AssetInf.Metadata.ContentType); 3010 LogHeader, req.AssetInf.ID, req.AssetInf.Metadata.ContentType);
2847 return; 3011 return;
2848 } 3012 }
2849 int WearableOut = 0; 3013 int WearableOut = 0;
@@ -3724,11 +3888,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3724 avp.Sender.IsTrial = false; 3888 avp.Sender.IsTrial = false;
3725 avp.Sender.ID = agentID; 3889 avp.Sender.ID = agentID;
3726 avp.AppearanceData = new AvatarAppearancePacket.AppearanceDataBlock[0]; 3890 avp.AppearanceData = new AvatarAppearancePacket.AppearanceDataBlock[0];
3891<<<<<<< HEAD
3892 avp.AppearanceHover = new AvatarAppearancePacket.AppearanceHoverBlock[0];
3893=======
3727 3894
3728 // this need be use in future 3895 // this need be use in future
3729 // avp.AppearanceData[0].AppearanceVersion = 0; 3896 // avp.AppearanceData[0].AppearanceVersion = 0;
3730 // avp.AppearanceData[0].CofVersion = 0; 3897 // avp.AppearanceData[0].CofVersion = 0;
3731 3898
3899>>>>>>> avn/ubitvar
3732 //m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); 3900 //m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString());
3733 OutPacket(avp, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); 3901 OutPacket(avp, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority);
3734 } 3902 }
@@ -3846,6 +4014,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3846 /// </summary> 4014 /// </summary>
3847 public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) 4015 public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags)
3848 { 4016 {
4017<<<<<<< HEAD
4018 if (entity.UUID == m_agentId && !updateFlags.HasFlag(PrimUpdateFlags.FullUpdate))
4019 {
4020 ImprovedTerseObjectUpdatePacket packet
4021 = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
4022=======
3849 if (entity is SceneObjectPart) 4023 if (entity is SceneObjectPart)
3850 { 4024 {
3851 SceneObjectPart e = (SceneObjectPart)entity; 4025 SceneObjectPart e = (SceneObjectPart)entity;
@@ -3855,9 +4029,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3855 } 4029 }
3856 4030
3857 uint priority = m_prioritizer.GetUpdatePriority(this, entity); 4031 uint priority = m_prioritizer.GetUpdatePriority(this, entity);
4032>>>>>>> avn/ubitvar
3858 4033
3859 lock (m_entityUpdates.SyncRoot) 4034 packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
3860 m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags, m_scene.TimeDilation)); 4035 packet.RegionData.TimeDilation = Utils.FloatToUInt16(1, 0.0f, 1.0f);
4036 packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
4037 packet.ObjectData[0] = CreateImprovedTerseBlock(entity, false);
4038 OutPacket(packet, ThrottleOutPacketType.Unknown, true);
4039 }
4040 else
4041 {
4042 //double priority = m_prioritizer.GetUpdatePriority(this, entity);
4043 uint priority = m_prioritizer.GetUpdatePriority(this, entity);
4044
4045 lock (m_entityUpdates.SyncRoot)
4046 m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags, m_scene.TimeDilation));
4047 }
3861 } 4048 }
3862 4049
3863 4050
@@ -4198,6 +4385,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4198 4385
4199 OutPacket(packet, ThrottleOutPacketType.Task, true); 4386 OutPacket(packet, ThrottleOutPacketType.Task, true);
4200 } 4387 }
4388<<<<<<< HEAD
4389
4390// m_log.DebugFormat(
4391// "[LLCLIENTVIEW]: Sent {0} updates in ProcessEntityUpdates() for {1} {2} in {3}",
4392// updatesThisCall, Name, SceneAgent.IsChildAgent ? "child" : "root", Scene.Name);
4393//
4394 #endregion Packet Sending
4395=======
4396>>>>>>> avn/ubitvar
4201 } 4397 }
4202 4398
4203 public void ReprioritizeUpdates() 4399 public void ReprioritizeUpdates()
@@ -5164,6 +5360,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5164 { 5360 {
5165 ScenePresence presence = (ScenePresence)entity; 5361 ScenePresence presence = (ScenePresence)entity;
5166 5362
5363<<<<<<< HEAD
5364// m_log.DebugFormat(
5365// "[LLCLIENTVIEW]: Sending terse update to {0} with pos {1}, vel {2} in {3}",
5366// Name, presence.OffsetPosition, presence.Velocity, m_scene.Name);
5367=======
5167 position = presence.OffsetPosition; 5368 position = presence.OffsetPosition;
5168 rotation = presence.Rotation; 5369 rotation = presence.Rotation;
5169 angularVelocity = presence.AngularVelocity; 5370 angularVelocity = presence.AngularVelocity;
@@ -5172,6 +5373,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5172 attachPoint = 0; 5373 attachPoint = 0;
5173// m_log.DebugFormat( 5374// m_log.DebugFormat(
5174// "[LLCLIENTVIEW]: Sending terse update to {0} with position {1} in {2}", Name, presence.OffsetPosition, m_scene.Name); 5375// "[LLCLIENTVIEW]: Sending terse update to {0} with position {1} in {2}", Name, presence.OffsetPosition, m_scene.Name);
5376>>>>>>> avn/ubitvar
5175 5377
5176 // attachPoint = presence.State; // Core: commented 5378 // attachPoint = presence.State; // Core: commented
5177 collisionPlane = presence.CollisionPlane; 5379 collisionPlane = presence.CollisionPlane;
@@ -5290,9 +5492,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5290 uint parentID = data.ParentID; 5492 uint parentID = data.ParentID;
5291 5493
5292// m_log.DebugFormat( 5494// m_log.DebugFormat(
5293// "[LLCLIENTVIEW]: Sending full update to {0} with position {1} in {2}", Name, data.OffsetPosition, m_scene.Name); 5495// "[LLCLIENTVIEW]: Sending full update to {0} with pos {1}, vel {2} in {3}", Name, data.OffsetPosition, data.Velocity, m_scene.Name);
5294 5496
5295 byte[] objectData = new byte[76]; 5497 byte[] objectData = new byte[76];
5498<<<<<<< HEAD
5499
5500 data.CollisionPlane.ToBytes(objectData, 0);
5501 data.OffsetPosition.ToBytes(objectData, 16);
5502 data.Velocity.ToBytes(objectData, 28);
5503// data.Acceleration.ToBytes(objectData, 40);
5504
5505 // Whilst not in mouselook, an avatar will transmit only the Z rotation as this is the only axis
5506 // it rotates around.
5507 // In mouselook, X and Y co-ordinate will also be sent but when used in Rotation, these cause unwanted
5508 // excessive up and down movements of the camera when looking up and down.
5509 // See http://opensimulator.org/mantis/view.php?id=3274
5510 // This does not affect head movement, since this is controlled entirely by camera movement rather than
5511 // body rotation. We still need to transmit X and Y for sitting avatars but mouselook does not change
5512 // the rotation in this case.
5513 Quaternion rot = data.Rotation;
5514=======
5515>>>>>>> avn/ubitvar
5296 5516
5297 Vector3 velocity = new Vector3(0, 0, 0); 5517 Vector3 velocity = new Vector3(0, 0, 0);
5298 Vector3 acceleration = new Vector3(0, 0, 0); 5518 Vector3 acceleration = new Vector3(0, 0, 0);
@@ -5376,11 +5596,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5376 //update.JointType = 0; 5596 //update.JointType = 0;
5377 update.Material = data.Material; 5597 update.Material = data.Material;
5378 update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim 5598 update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim
5599<<<<<<< HEAD
5600
5601=======
5379/* 5602/*
5603>>>>>>> avn/ubitvar
5380 if (data.ParentGroup.IsAttachment) 5604 if (data.ParentGroup.IsAttachment)
5381 { 5605 {
5382 update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.ParentGroup.FromItemID); 5606 update.NameValue
5607 = Util.StringToBytes256(
5608 string.Format("AttachItemID STRING RW SV {0}", data.ParentGroup.FromItemID));
5609
5383 update.State = (byte)((data.ParentGroup.AttachmentPoint % 16) * 16 + (data.ParentGroup.AttachmentPoint / 16)); 5610 update.State = (byte)((data.ParentGroup.AttachmentPoint % 16) * 16 + (data.ParentGroup.AttachmentPoint / 16));
5611
5612// m_log.DebugFormat(
5613// "[LLCLIENTVIEW]: Sending NameValue {0} for {1} {2} to {3}",
5614// Util.UTF8.GetString(update.NameValue), data.Name, data.LocalId, Name);
5615//
5616// m_log.DebugFormat(
5617// "[LLCLIENTVIEW]: Sending state {0} for {1} {2} to {3}",
5618// update.State, data.Name, data.LocalId, Name);
5384 } 5619 }
5385 else 5620 else
5386 { 5621 {
@@ -5411,10 +5646,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5411 } 5646 }
5412 5647
5413 5648
5414// m_log.DebugFormat(
5415// "[LLCLIENTVIEW]: Sending state {0} for {1} {2} to {3}",
5416// update.State, data.Name, data.LocalId, Name);
5417
5418 update.ObjectData = objectData; 5649 update.ObjectData = objectData;
5419 update.ParentID = data.ParentID; 5650 update.ParentID = data.ParentID;
5420 update.PathBegin = data.Shape.PathBegin; 5651 update.PathBegin = data.Shape.PathBegin;
@@ -5514,8 +5745,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5514 5745
5515 public ulong GetGroupPowers(UUID groupID) 5746 public ulong GetGroupPowers(UUID groupID)
5516 { 5747 {
5517 if (groupID == m_activeGroupID) 5748 if (groupID == ActiveGroupId)
5518 return m_activeGroupPowers; 5749 return ActiveGroupPowers;
5519 5750
5520 if (m_groupPowers.ContainsKey(groupID)) 5751 if (m_groupPowers.ContainsKey(groupID))
5521 return m_groupPowers[groupID]; 5752 return m_groupPowers[groupID];
@@ -5545,10 +5776,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5545 AddLocalPacketHandler(PacketType.ParcelBuy, HandleParcelBuyRequest, false); 5776 AddLocalPacketHandler(PacketType.ParcelBuy, HandleParcelBuyRequest, false);
5546 AddLocalPacketHandler(PacketType.UUIDGroupNameRequest, HandleUUIDGroupNameRequest); 5777 AddLocalPacketHandler(PacketType.UUIDGroupNameRequest, HandleUUIDGroupNameRequest);
5547 AddLocalPacketHandler(PacketType.ObjectGroup, HandleObjectGroupRequest); 5778 AddLocalPacketHandler(PacketType.ObjectGroup, HandleObjectGroupRequest);
5548 AddLocalPacketHandler(PacketType.GenericMessage, HandleGenericMessage); 5779 AddLocalPacketHandler(PacketType.GenericMessage, HandleGenericMessage, true, true);
5549 AddLocalPacketHandler(PacketType.AvatarPropertiesRequest, HandleAvatarPropertiesRequest); 5780 AddLocalPacketHandler(PacketType.AvatarPropertiesRequest, HandleAvatarPropertiesRequest, true, true);
5550 AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); 5781 AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer);
5551 AddLocalPacketHandler(PacketType.AvatarPropertiesUpdate, HandlerAvatarPropertiesUpdate); 5782 AddLocalPacketHandler(PacketType.AvatarPropertiesUpdate, HandlerAvatarPropertiesUpdate, true, true);
5552 AddLocalPacketHandler(PacketType.ScriptDialogReply, HandlerScriptDialogReply); 5783 AddLocalPacketHandler(PacketType.ScriptDialogReply, HandlerScriptDialogReply);
5553 AddLocalPacketHandler(PacketType.ImprovedInstantMessage, HandlerImprovedInstantMessage); 5784 AddLocalPacketHandler(PacketType.ImprovedInstantMessage, HandlerImprovedInstantMessage);
5554 AddLocalPacketHandler(PacketType.AcceptFriendship, HandlerAcceptFriendship); 5785 AddLocalPacketHandler(PacketType.AcceptFriendship, HandlerAcceptFriendship);
@@ -5734,8 +5965,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5734 AddLocalPacketHandler(PacketType.PickDelete, HandlePickDelete); 5965 AddLocalPacketHandler(PacketType.PickDelete, HandlePickDelete);
5735 AddLocalPacketHandler(PacketType.PickGodDelete, HandlePickGodDelete); 5966 AddLocalPacketHandler(PacketType.PickGodDelete, HandlePickGodDelete);
5736 AddLocalPacketHandler(PacketType.PickInfoUpdate, HandlePickInfoUpdate); 5967 AddLocalPacketHandler(PacketType.PickInfoUpdate, HandlePickInfoUpdate);
5737 AddLocalPacketHandler(PacketType.AvatarNotesUpdate, HandleAvatarNotesUpdate); 5968 AddLocalPacketHandler(PacketType.AvatarNotesUpdate, HandleAvatarNotesUpdate, true, true);
5738 AddLocalPacketHandler(PacketType.AvatarInterestsUpdate, HandleAvatarInterestsUpdate); 5969 AddLocalPacketHandler(PacketType.AvatarInterestsUpdate, HandleAvatarInterestsUpdate, true, true);
5739 AddLocalPacketHandler(PacketType.GrantUserRights, HandleGrantUserRights); 5970 AddLocalPacketHandler(PacketType.GrantUserRights, HandleGrantUserRights);
5740 AddLocalPacketHandler(PacketType.PlacesQuery, HandlePlacesQuery); 5971 AddLocalPacketHandler(PacketType.PlacesQuery, HandlePlacesQuery);
5741 AddLocalPacketHandler(PacketType.UpdateMuteListEntry, HandleUpdateMuteListEntry); 5972 AddLocalPacketHandler(PacketType.UpdateMuteListEntry, HandleUpdateMuteListEntry);
@@ -7332,7 +7563,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7332 { 7563 {
7333 handlerObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset, 7564 handlerObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset,
7334 dupe.SharedData.DuplicateFlags, AgentId, 7565 dupe.SharedData.DuplicateFlags, AgentId,
7335 m_activeGroupID); 7566 ActiveGroupId);
7336 } 7567 }
7337 } 7568 }
7338 7569
@@ -7949,7 +8180,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7949 if (handlerObjectDuplicateOnRay != null) 8180 if (handlerObjectDuplicateOnRay != null)
7950 { 8181 {
7951 handlerObjectDuplicateOnRay(dupeOnRay.ObjectData[i].ObjectLocalID, dupeOnRay.AgentData.DuplicateFlags, 8182 handlerObjectDuplicateOnRay(dupeOnRay.ObjectData[i].ObjectLocalID, dupeOnRay.AgentData.DuplicateFlags,
7952 AgentId, m_activeGroupID, dupeOnRay.AgentData.RayTargetID, dupeOnRay.AgentData.RayEnd, 8183 AgentId, ActiveGroupId, dupeOnRay.AgentData.RayTargetID, dupeOnRay.AgentData.RayEnd,
7953 dupeOnRay.AgentData.RayStart, dupeOnRay.AgentData.BypassRaycast, dupeOnRay.AgentData.RayEndIsIntersection, 8184 dupeOnRay.AgentData.RayStart, dupeOnRay.AgentData.BypassRaycast, dupeOnRay.AgentData.RayEndIsIntersection,
7954 dupeOnRay.AgentData.CopyCenters, dupeOnRay.AgentData.CopyRotates); 8185 dupeOnRay.AgentData.CopyCenters, dupeOnRay.AgentData.CopyRotates);
7955 } 8186 }
@@ -8154,7 +8385,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8154 { 8385 {
8155 // This requests the asset if needed 8386 // This requests the asset if needed
8156 HandleSimInventoryTransferRequestWithPermsCheck(sender, transfer); 8387 HandleSimInventoryTransferRequestWithPermsCheck(sender, transfer);
8157 }); 8388 }, null, "LLClientView.HandleTransferRequest");
8389
8158 return true; 8390 return true;
8159 } 8391 }
8160 } 8392 }
@@ -9103,7 +9335,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9103 if (aCircuit != null && aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI")) 9335 if (aCircuit != null && aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI"))
9104 { 9336 {
9105 string assetServer = aCircuit.ServiceURLs["AssetServerURI"].ToString(); 9337 string assetServer = aCircuit.ServiceURLs["AssetServerURI"].ToString();
9106 return ((Scene)Scene).AssetService.Get(assetServer + "/" + id); 9338 if (!string.IsNullOrEmpty(assetServer))
9339 return ((Scene)Scene).AssetService.Get(assetServer + "/" + id);
9107 } 9340 }
9108 9341
9109 return null; 9342 return null;
@@ -9132,7 +9365,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9132 if ((locX >= m_scene.RegionInfo.WorldLocX) 9365 if ((locX >= m_scene.RegionInfo.WorldLocX)
9133 && (locX < (m_scene.RegionInfo.WorldLocX + m_scene.RegionInfo.RegionSizeX)) 9366 && (locX < (m_scene.RegionInfo.WorldLocX + m_scene.RegionInfo.RegionSizeX))
9134 && (locY >= m_scene.RegionInfo.WorldLocY) 9367 && (locY >= m_scene.RegionInfo.WorldLocY)
9368<<<<<<< HEAD
9369 && (locY < (m_scene.RegionInfo.WorldLocY + m_scene.RegionInfo.RegionSizeY)) )
9370=======
9135 && (locY < (m_scene.RegionInfo.WorldLocY + m_scene.RegionInfo.RegionSizeY))) 9371 && (locY < (m_scene.RegionInfo.WorldLocY + m_scene.RegionInfo.RegionSizeY)))
9372>>>>>>> avn/ubitvar
9136 { 9373 {
9137 tpLocReq.Info.RegionHandle = m_scene.RegionInfo.RegionHandle; 9374 tpLocReq.Info.RegionHandle = m_scene.RegionInfo.RegionHandle;
9138 tpLocReq.Info.Position.X += locX - m_scene.RegionInfo.WorldLocX; 9375 tpLocReq.Info.Position.X += locX - m_scene.RegionInfo.WorldLocX;
@@ -9977,6 +10214,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9977 } 10214 }
9978 return true; 10215 return true;
9979 10216
10217 case "kickestate":
10218
10219 if(((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
10220 {
10221 UUID invoice = messagePacket.MethodData.Invoice;
10222 UUID SenderID = messagePacket.AgentData.AgentID;
10223 UUID Prey;
10224
10225 UUID.TryParse(Utils.BytesToString(messagePacket.ParamList[0].Parameter), out Prey);
10226
10227 OnEstateTeleportOneUserHomeRequest(this, invoice, SenderID, Prey);
10228 }
10229 return true;
10230
9980 default: 10231 default:
9981 m_log.WarnFormat( 10232 m_log.WarnFormat(
9982 "[LLCLIENTVIEW]: EstateOwnerMessage: Unknown method {0} requested for {1} in {2}", 10233 "[LLCLIENTVIEW]: EstateOwnerMessage: Unknown method {0} requested for {1} in {2}",
@@ -10654,7 +10905,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
10654 handlerDirFindQuery(this, 10905 handlerDirFindQuery(this,
10655 dirFindQueryPacket.QueryData.QueryID, 10906 dirFindQueryPacket.QueryData.QueryID,
10656 Utils.BytesToString( 10907 Utils.BytesToString(
10657 dirFindQueryPacket.QueryData.QueryText), 10908 dirFindQueryPacket.QueryData.QueryText).Trim(),
10658 dirFindQueryPacket.QueryData.QueryFlags, 10909 dirFindQueryPacket.QueryData.QueryFlags,
10659 dirFindQueryPacket.QueryData.QueryStart); 10910 dirFindQueryPacket.QueryData.QueryStart);
10660 } 10911 }
@@ -12037,22 +12288,79 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12037 /*protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) 12288 /*protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet)
12038 { 12289 {
12039 AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet; 12290 AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet;
12291 AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse);
12040 12292
12041 if (cachedtex.AgentData.SessionID != SessionId) 12293 if (cachedtex.AgentData.SessionID != SessionId)
12042 return false; 12294 return false;
12043 12295
12044 12296
12045 List<CachedTextureRequestArg> requestArgs = new List<CachedTextureRequestArg>();
12046 12297
12047 for (int i = 0; i < cachedtex.WearableData.Length; i++) 12298 // TODO: don't create new blocks if recycling an old packet
12299 cachedresp.AgentData.AgentID = AgentId;
12300 cachedresp.AgentData.SessionID = m_sessionId;
12301 cachedresp.AgentData.SerialNum = m_cachedTextureSerial;
12302 m_cachedTextureSerial++;
12303 cachedresp.WearableData =
12304 new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length];
12305
12306 int maxWearablesLoop = cachedtex.WearableData.Length;
12307 if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES)
12308 maxWearablesLoop = AvatarWearable.MAX_WEARABLES;
12309
12310 // Find the cached baked textures for this user, if they're available
12311
12312 IAssetService cache = m_scene.AssetService;
12313 IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
12314
12315 WearableCacheItem[] cacheItems = null;
12316
12317 if (bakedTextureModule != null && cache != null)
12048 { 12318 {
12049 CachedTextureRequestArg arg = new CachedTextureRequestArg(); 12319 ScenePresence p = m_scene.GetScenePresence(AgentId);
12050 arg.BakedTextureIndex = cachedtex.WearableData[i].TextureIndex; 12320 if (p.Appearance != null)
12051 arg.WearableHashID = cachedtex.WearableData[i].ID; 12321 {
12052 12322 if (p.Appearance.WearableCacheItems == null || p.Appearance.WearableCacheItemsDirty)
12053 requestArgs.Add(arg); 12323 {
12324 try
12325 {
12326 cacheItems = bakedTextureModule.Get(AgentId);
12327 p.Appearance.WearableCacheItems = cacheItems;
12328 p.Appearance.WearableCacheItemsDirty = false;
12329 }
12330 catch (Exception)
12331 {
12332 cacheItems = null;
12333 }
12334
12335 }
12336 else if (p.Appearance.WearableCacheItems != null)
12337 {
12338 cacheItems = p.Appearance.WearableCacheItems;
12339 }
12340 }
12054 } 12341 }
12055 12342
12343<<<<<<< HEAD
12344 if (cacheItems != null)
12345 {
12346 // We need to make sure the asset stored in the bake is available on this server also by its assetid before we map it to a Cacheid.
12347 // Copy the baked textures to the sim's assets cache (local only).
12348 foreach (WearableCacheItem item in cacheItems)
12349 {
12350 if (cache.GetCached(item.TextureID.ToString()) == null)
12351 {
12352 item.TextureAsset.Temporary = true;
12353 item.TextureAsset.Local = true;
12354 cache.Store(item.TextureAsset);
12355 }
12356 }
12357
12358 // Return the cached textures
12359 for (int i = 0; i < maxWearablesLoop; i++)
12360 {
12361 WearableCacheItem item =
12362 WearableCacheItem.SearchTextureIndex(cachedtex.WearableData[i].TextureIndex, cacheItems);
12363=======
12056 CachedTextureRequest handlerCachedTextureRequest = OnCachedTextureRequest; 12364 CachedTextureRequest handlerCachedTextureRequest = OnCachedTextureRequest;
12057 if (handlerCachedTextureRequest != null) 12365 if (handlerCachedTextureRequest != null)
12058 { 12366 {
@@ -12100,14 +12408,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12100 for (int i = 0; i < maxWearablesLoop; i++) 12408 for (int i = 0; i < maxWearablesLoop; i++)
12101 { 12409 {
12102 int idx = cachedtex.WearableData[i].TextureIndex; 12410 int idx = cachedtex.WearableData[i].TextureIndex;
12411>>>>>>> avn/ubitvar
12103 12412
12104 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); 12413 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
12105 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; 12414 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
12106 cachedresp.WearableData[i].HostName = new byte[0]; 12415 cachedresp.WearableData[i].HostName = new byte[0];
12416<<<<<<< HEAD
12417 if (item != null && cachedtex.WearableData[i].ID == item.CacheId)
12418 {
12419 cachedresp.WearableData[i].TextureID = item.TextureID;
12420=======
12107 if (cachedtex.WearableData[i].ID == cacheItems[idx].CacheId) 12421 if (cachedtex.WearableData[i].ID == cacheItems[idx].CacheId)
12108 { 12422 {
12109 cachedresp.WearableData[i].TextureID = cacheItems[idx].TextureID; 12423 cachedresp.WearableData[i].TextureID = cacheItems[idx].TextureID;
12110 cacheHits++; 12424 cacheHits++;
12425>>>>>>> avn/ubitvar
12111 } 12426 }
12112 else 12427 else
12113 { 12428 {
@@ -12117,11 +12432,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12117 } 12432 }
12118 else 12433 else
12119 { 12434 {
12435<<<<<<< HEAD
12436 // Cached textures not available
12437=======
12438>>>>>>> avn/ubitvar
12120 for (int i = 0; i < maxWearablesLoop; i++) 12439 for (int i = 0; i < maxWearablesLoop; i++)
12121 { 12440 {
12122 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); 12441 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
12123 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; 12442 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
12124 cachedresp.WearableData[i].TextureID = UUID.Zero; 12443 cachedresp.WearableData[i].TextureID = UUID.Zero;
12444<<<<<<< HEAD
12445 cachedresp.WearableData[i].HostName = new byte[0];
12446 }
12447 }
12448
12449=======
12125 //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); 12450 //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
12126 cachedresp.WearableData[i].HostName = new byte[0]; 12451 cachedresp.WearableData[i].HostName = new byte[0];
12127 } 12452 }
@@ -12129,6 +12454,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12129 12454
12130 m_log.DebugFormat("texture cached: hits {0}", cacheHits); 12455 m_log.DebugFormat("texture cached: hits {0}", cacheHits);
12131 12456
12457>>>>>>> avn/ubitvar
12132 cachedresp.Header.Zerocoded = true; 12458 cachedresp.Header.Zerocoded = true;
12133 OutPacket(cachedresp, ThrottleOutPacketType.Task); 12459 OutPacket(cachedresp, ThrottleOutPacketType.Task);
12134 12460
@@ -12483,6 +12809,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12483 /// provide your own method.</param> 12809 /// provide your own method.</param>
12484 protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting, UnackedPacketMethod method) 12810 protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting, UnackedPacketMethod method)
12485 { 12811 {
12812 if (m_outPacketsToDrop != null)
12813 if (m_outPacketsToDrop.Contains(packet.Type.ToString()))
12814 return;
12815
12486 if (DebugPacketLevel > 0) 12816 if (DebugPacketLevel > 0)
12487 { 12817 {
12488 bool logPacket = true; 12818 bool logPacket = true;
@@ -12541,6 +12871,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12541 /// <param name="Pack">OpenMetaverse.packet</param> 12871 /// <param name="Pack">OpenMetaverse.packet</param>
12542 public void ProcessInPacket(Packet packet) 12872 public void ProcessInPacket(Packet packet)
12543 { 12873 {
12874 if (m_inPacketsToDrop != null)
12875 if (m_inPacketsToDrop.Contains(packet.Type.ToString()))
12876 return;
12877
12544 if (DebugPacketLevel > 0) 12878 if (DebugPacketLevel > 0)
12545 { 12879 {
12546 bool logPacket = true; 12880 bool logPacket = true;
@@ -12831,16 +13165,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12831 13165
12832 if (asset == null) 13166 if (asset == null)
12833 { 13167 {
12834 req.AssetInf = null; 13168 // Try the user's asset server
12835 req.AssetRequestSource = source; 13169 IInventoryAccessModule inventoryAccessModule = Scene.RequestModuleInterface<IInventoryAccessModule>();
12836 req.IsTextureRequest = false; 13170
12837 req.NumPackets = 0; 13171 string assetServerURL = string.Empty;
12838 req.Params = transferRequest.TransferInfo.Params; 13172 if (inventoryAccessModule.IsForeignUser(AgentId, out assetServerURL) && !string.IsNullOrEmpty(assetServerURL))
12839 req.RequestAssetID = requestID; 13173 {
12840 req.TransferRequestID = transferRequest.TransferInfo.TransferID; 13174 if (!assetServerURL.EndsWith("/") && !assetServerURL.EndsWith("="))
13175 assetServerURL = assetServerURL + "/";
13176
13177 //m_log.DebugFormat("[LLCLIENTVIEW]: asset {0} not found in local storage. Trying user's storage.", assetServerURL + id);
13178 asset = m_scene.AssetService.Get(assetServerURL + id);
13179 }
13180
13181 if (asset == null)
13182 {
13183 req.AssetInf = null;
13184 req.AssetRequestSource = source;
13185 req.IsTextureRequest = false;
13186 req.NumPackets = 0;
13187 req.Params = transferRequest.TransferInfo.Params;
13188 req.RequestAssetID = requestID;
13189 req.TransferRequestID = transferRequest.TransferInfo.TransferID;
13190
13191 SendAssetNotFound(req);
13192 return;
13193 }
12841 13194
12842 SendAssetNotFound(req);
12843 return;
12844 } 13195 }
12845 13196
12846 if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset) 13197 if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset)
@@ -12907,8 +13258,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12907 13258
12908 public struct PacketProcessor 13259 public struct PacketProcessor
12909 { 13260 {
12910 public PacketMethod method; 13261 /// <summary>
12911 public bool Async; 13262 /// Packet handling method.
13263 /// </summary>
13264 public PacketMethod method { get; set; }
13265
13266 /// <summary>
13267 /// Should this packet be handled asynchronously?
13268 /// </summary>
13269 public bool Async { get; set; }
13270
13271 /// <summary>
13272 /// If async is true, should this packet be handled in the async engine or given directly to a threadpool
13273 /// thread?
13274 /// </summary>
13275 public bool InEngine { get; set; }
12912 } 13276 }
12913 13277
12914 public class AsyncPacketProcess 13278 public class AsyncPacketProcess
@@ -13252,5 +13616,51 @@ namespace OpenSim.Region.ClientStack.LindenUDP
13252 eq.Enqueue(BuildEvent("BulkUpdateInventory", 13616 eq.Enqueue(BuildEvent("BulkUpdateInventory",
13253 llsd), AgentId); 13617 llsd), AgentId);
13254 } 13618 }
13619
13620 private HashSet<string> m_outPacketsToDrop;
13621
13622 public bool AddOutPacketToDropSet(string packetName)
13623 {
13624 if (m_outPacketsToDrop == null)
13625 m_outPacketsToDrop = new HashSet<string>();
13626
13627 return m_outPacketsToDrop.Add(packetName);
13628 }
13629
13630 public bool RemoveOutPacketFromDropSet(string packetName)
13631 {
13632 if (m_outPacketsToDrop == null)
13633 return false;
13634
13635 return m_outPacketsToDrop.Remove(packetName);
13636 }
13637
13638 public HashSet<string> GetOutPacketDropSet()
13639 {
13640 return new HashSet<string>(m_outPacketsToDrop);
13641 }
13642
13643 private HashSet<string> m_inPacketsToDrop;
13644
13645 public bool AddInPacketToDropSet(string packetName)
13646 {
13647 if (m_inPacketsToDrop == null)
13648 m_inPacketsToDrop = new HashSet<string>();
13649
13650 return m_inPacketsToDrop.Add(packetName);
13651 }
13652
13653 public bool RemoveInPacketFromDropSet(string packetName)
13654 {
13655 if (m_inPacketsToDrop == null)
13656 return false;
13657
13658 return m_inPacketsToDrop.Remove(packetName);
13659 }
13660
13661 public HashSet<string> GetInPacketDropSet()
13662 {
13663 return new HashSet<string>(m_inPacketsToDrop);
13664 }
13255 } 13665 }
13256} 13666}
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
index 4b541e6..9293882 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
@@ -76,6 +76,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP
76 /// or removed, this number must also change</summary> 76 /// or removed, this number must also change</summary>
77 const int THROTTLE_CATEGORY_COUNT = 8; 77 const int THROTTLE_CATEGORY_COUNT = 8;
78 78
79 /// <summary>
80 /// Controls whether information is logged about each outbound packet immediately before it is sent. For debug purposes.
81 /// </summary>
82 /// <remarks>Any level above 0 will turn on logging.</remarks>
83 public int DebugDataOutLevel { get; set; }
84
85 /// <summary>
86 /// Controls whether information is logged about each outbound packet immediately before it is sent. For debug purposes.
87 /// </summary>
88 /// <remarks>Any level above 0 will turn on logging.</remarks>
89 public int ThrottleDebugLevel
90 {
91 get
92 {
93 return m_throttleDebugLevel;
94 }
95
96 set
97 {
98 m_throttleDebugLevel = value;
99 m_throttleClient.DebugLevel = m_throttleDebugLevel;
100 foreach (TokenBucket tb in m_throttleCategories)
101 tb.DebugLevel = m_throttleDebugLevel;
102 }
103 }
104 private int m_throttleDebugLevel;
105
79 /// <summary>Fired when updated networking stats are produced for this client</summary> 106 /// <summary>Fired when updated networking stats are produced for this client</summary>
80 public event PacketStats OnPacketStats; 107 public event PacketStats OnPacketStats;
81 /// <summary>Fired when the queue for a packet category is empty. This event can be 108 /// <summary>Fired when the queue for a packet category is empty. This event can be
@@ -92,8 +119,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
92 public readonly uint CircuitCode; 119 public readonly uint CircuitCode;
93 /// <summary>Sequence numbers of packets we've received (for duplicate checking)</summary> 120 /// <summary>Sequence numbers of packets we've received (for duplicate checking)</summary>
94 public readonly IncomingPacketHistoryCollection PacketArchive = new IncomingPacketHistoryCollection(200); 121 public readonly IncomingPacketHistoryCollection PacketArchive = new IncomingPacketHistoryCollection(200);
122
123 /// <summary>
124 /// If true then we take action in response to unacked reliably sent packets such as resending the packet.
125 /// </summary>
126 public bool ProcessUnackedSends { get; set; }
127
95 /// <summary>Packets we have sent that need to be ACKed by the client</summary> 128 /// <summary>Packets we have sent that need to be ACKed by the client</summary>
96 public readonly UnackedPacketCollection NeedAcks = new UnackedPacketCollection(); 129 public readonly UnackedPacketCollection NeedAcks = new UnackedPacketCollection();
130
97 /// <summary>ACKs that are queued up, waiting to be sent to the client</summary> 131 /// <summary>ACKs that are queued up, waiting to be sent to the client</summary>
98 public readonly DoubleLocklessQueue<uint> PendingAcks = new DoubleLocklessQueue<uint>(); 132 public readonly DoubleLocklessQueue<uint> PendingAcks = new DoubleLocklessQueue<uint>();
99 133
@@ -216,11 +250,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
216 if (maxRTO != 0) 250 if (maxRTO != 0)
217 m_maxRTO = maxRTO; 251 m_maxRTO = maxRTO;
218 252
253<<<<<<< HEAD
254 ProcessUnackedSends = true;
255
256 // Create a token bucket throttle for this client that has the scene token bucket as a parent
257 m_throttleClient
258 = new AdaptiveTokenBucket(
259 string.Format("adaptive throttle for {0} in {1}", AgentID, server.Scene.Name),
260 parentThrottle, 0, rates.Total, rates.MinimumAdaptiveThrottleRate, rates.AdaptiveThrottlesEnabled);
261
262=======
219 m_burstTime = rates.BrustTime; 263 m_burstTime = rates.BrustTime;
220 float m_burst = rates.ClientMaxRate * m_burstTime; 264 float m_burst = rates.ClientMaxRate * m_burstTime;
221 265
222 // Create a token bucket throttle for this client that has the scene token bucket as a parent 266 // Create a token bucket throttle for this client that has the scene token bucket as a parent
223 m_throttleClient = new AdaptiveTokenBucket(parentThrottle, rates.ClientMaxRate, m_burst, rates.AdaptiveThrottlesEnabled); 267 m_throttleClient = new AdaptiveTokenBucket(parentThrottle, rates.ClientMaxRate, m_burst, rates.AdaptiveThrottlesEnabled);
268>>>>>>> avn/ubitvar
224 // Create an array of token buckets for this clients different throttle categories 269 // Create an array of token buckets for this clients different throttle categories
225 m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT]; 270 m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT];
226 271
@@ -233,9 +278,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
233 ThrottleOutPacketType type = (ThrottleOutPacketType)i; 278 ThrottleOutPacketType type = (ThrottleOutPacketType)i;
234 279
235 // Initialize the packet outboxes, where packets sit while they are waiting for tokens 280 // Initialize the packet outboxes, where packets sit while they are waiting for tokens
281<<<<<<< HEAD
282 m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>();
283
284 // Initialize the token buckets that control the throttling for each category
285 m_throttleCategories[i]
286 = new TokenBucket(
287 string.Format("{0} throttle for {1} in {2}", type, AgentID, server.Scene.Name),
288 m_throttleClient, rates.GetRate(type), 0);
289=======
236 m_packetOutboxes[i] = new DoubleLocklessQueue<OutgoingPacket>(); 290 m_packetOutboxes[i] = new DoubleLocklessQueue<OutgoingPacket>();
237 // Initialize the token buckets that control the throttling for each category 291 // Initialize the token buckets that control the throttling for each category
238 m_throttleCategories[i] = new TokenBucket(m_throttleClient, rates.GetRate(type), m_burst); 292 m_throttleCategories[i] = new TokenBucket(m_throttleClient, rates.GetRate(type), m_burst);
293>>>>>>> avn/ubitvar
239 } 294 }
240 295
241 // Default the retransmission timeout to one second 296 // Default the retransmission timeout to one second
@@ -282,6 +337,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
282 m_info.assetThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Asset].DripRate; 337 m_info.assetThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Asset].DripRate;
283 m_info.textureThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Texture].DripRate; 338 m_info.textureThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Texture].DripRate;
284 m_info.totalThrottle = (int)m_throttleClient.DripRate; 339 m_info.totalThrottle = (int)m_throttleClient.DripRate;
340<<<<<<< HEAD
341 m_info.targetThrottle = (int)m_throttleClient.TargetDripRate;
342 m_info.maxThrottle = (int)m_throttleClient.MaxDripRate;
343=======
344>>>>>>> avn/ubitvar
285 345
286 return m_info; 346 return m_info;
287 } 347 }
@@ -299,6 +359,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP
299 } 359 }
300 360
301 /// <summary> 361 /// <summary>
362 /// Get the total number of pakcets queued for this client.
363 /// </summary>
364 /// <returns></returns>
365 public int GetTotalPacketsQueuedCount()
366 {
367 int total = 0;
368
369 for (int i = 0; i <= (int)ThrottleOutPacketType.Asset; i++)
370 total += m_packetOutboxes[i].Count;
371
372 return total;
373 }
374
375 /// <summary>
376 /// Get the number of packets queued for the given throttle type.
377 /// </summary>
378 /// <returns></returns>
379 /// <param name="throttleType"></param>
380 public int GetPacketsQueuedCount(ThrottleOutPacketType throttleType)
381 {
382 if ((int)throttleType > 0)
383 return m_packetOutboxes[(int)throttleType].Count;
384 else
385 return 0;
386 }
387
388 /// <summary>
302 /// Return statistics information about client packet queues. 389 /// Return statistics information about client packet queues.
303 /// </summary> 390 /// </summary>
304 /// <remarks> 391 /// <remarks>
@@ -373,6 +460,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
373 int texture = (int)(BitConverter.ToSingle(adjData, pos) * scale); pos += 4; 460 int texture = (int)(BitConverter.ToSingle(adjData, pos) * scale); pos += 4;
374 int asset = (int)(BitConverter.ToSingle(adjData, pos) * scale); 461 int asset = (int)(BitConverter.ToSingle(adjData, pos) * scale);
375 462
463 if (ThrottleDebugLevel > 0)
464 {
465 long total = resend + land + wind + cloud + task + texture + asset;
466 m_log.DebugFormat(
467 "[LLUDPCLIENT]: {0} is setting throttles in {1} to Resend={2}, Land={3}, Wind={4}, Cloud={5}, Task={6}, Texture={7}, Asset={8}, TOTAL = {9}",
468 AgentID, m_udpServer.Scene.Name, resend, land, wind, cloud, task, texture, asset, total);
469 }
470
376 // Make sure none of the throttles are set below our packet MTU, 471 // Make sure none of the throttles are set below our packet MTU,
377 // otherwise a throttle could become permanently clogged 472 // otherwise a throttle could become permanently clogged
378 473
@@ -391,6 +486,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
391 // the task queue (e.g. object updates) 486 // the task queue (e.g. object updates)
392 task = task + (int)(m_cannibalrate * texture); 487 task = task + (int)(m_cannibalrate * texture);
393 texture = (int)((1 - m_cannibalrate) * texture); 488 texture = (int)((1 - m_cannibalrate) * texture);
489<<<<<<< HEAD
490
491 //int total = resend + land + wind + cloud + task + texture + asset;
492
493 if (ThrottleDebugLevel > 0)
494 {
495 long total = resend + land + wind + cloud + task + texture + asset;
496 m_log.DebugFormat(
497 "[LLUDPCLIENT]: {0} is setting throttles in {1} to Resend={2}, Land={3}, Wind={4}, Cloud={5}, Task={6}, Texture={7}, Asset={8}, TOTAL = {9}",
498 AgentID, m_udpServer.Scene.Name, resend, land, wind, cloud, task, texture, asset, total);
499 }
500=======
394 501
395 int total = resend + land + wind + cloud + task + texture + asset; 502 int total = resend + land + wind + cloud + task + texture + asset;
396 503
@@ -398,8 +505,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
398 505
399 //m_log.DebugFormat("[LLUDPCLIENT]: {0} is setting throttles. Resend={1}, Land={2}, Wind={3}, Cloud={4}, Task={5}, Texture={6}, Asset={7}, Total={8}", 506 //m_log.DebugFormat("[LLUDPCLIENT]: {0} is setting throttles. Resend={1}, Land={2}, Wind={3}, Cloud={4}, Task={5}, Texture={6}, Asset={7}, Total={8}",
400 // AgentID, resend, land, wind, cloud, task, texture, asset, total); 507 // AgentID, resend, land, wind, cloud, task, texture, asset, total);
508>>>>>>> avn/ubitvar
401 509
402 // Update the token buckets with new throttle values 510 // Update the token buckets with new throttle values
511 if (m_throttleClient.AdaptiveEnabled)
512 {
513 long total = resend + land + wind + cloud + task + texture + asset;
514 m_throttleClient.TargetDripRate = total;
515 }
516
403 TokenBucket bucket; 517 TokenBucket bucket;
404 518
405 bucket = m_throttleCategories[(int)ThrottleOutPacketType.Resend]; 519 bucket = m_throttleCategories[(int)ThrottleOutPacketType.Resend];
@@ -744,8 +858,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
744 858
745 if (HasUpdates(categories)) 859 if (HasUpdates(categories))
746 { 860 {
747 // Asynchronously run the callback 861 if (!m_udpServer.OqrEngine.IsRunning)
748 Util.FireAndForget(FireQueueEmpty, categories); 862 {
863 // Asynchronously run the callback
864 Util.FireAndForget(FireQueueEmpty, categories, "LLUDPClient.BeginFireQueueEmpty");
865 }
866 else
867 {
868 m_udpServer.OqrEngine.QueueJob(AgentID.ToString(), () => FireQueueEmpty(categories));
869 }
749 } 870 }
750 else 871 else
751 { 872 {
@@ -764,10 +885,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
764 /// <param name="o">Throttle categories to fire the callback for, 885 /// <param name="o">Throttle categories to fire the callback for,
765 /// stored as an object to match the WaitCallback delegate 886 /// stored as an object to match the WaitCallback delegate
766 /// signature</param> 887 /// signature</param>
767 private void FireQueueEmpty(object o) 888 public void FireQueueEmpty(object o)
768 { 889 {
890<<<<<<< HEAD
891// m_log.DebugFormat("[LLUDPCLIENT]: FireQueueEmpty for {0} in {1}", AgentID, m_udpServer.Scene.Name);
892
893// int start = Environment.TickCount & Int32.MaxValue;
894// const int MIN_CALLBACK_MS = 30;
895
896// if (m_udpServer.IsRunningOutbound)
897// {
898 ThrottleOutPacketTypeFlags categories = (ThrottleOutPacketTypeFlags)o;
899 QueueEmpty callback = OnQueueEmpty;
900=======
769 ThrottleOutPacketTypeFlags categories = (ThrottleOutPacketTypeFlags)o; 901 ThrottleOutPacketTypeFlags categories = (ThrottleOutPacketTypeFlags)o;
770 QueueEmpty callback = OnQueueEmpty; 902 QueueEmpty callback = OnQueueEmpty;
903>>>>>>> avn/ubitvar
771 904
772 if (callback != null) 905 if (callback != null)
773 { 906 {
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index b5f9da8..41e19fd 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -34,7 +34,6 @@ using System.Net.Sockets;
34using System.Reflection; 34using System.Reflection;
35using System.Threading; 35using System.Threading;
36using log4net; 36using log4net;
37using NDesk.Options;
38using Nini.Config; 37using Nini.Config;
39using OpenMetaverse.Packets; 38using OpenMetaverse.Packets;
40using OpenSim.Framework; 39using OpenSim.Framework;
@@ -181,9 +180,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
181 scene.Name, 180 scene.Name,
182 StatType.Pull, 181 StatType.Pull,
183 MeasuresOfInterest.None, 182 MeasuresOfInterest.None,
184 stat => stat.Value = m_udpServer.AverageReceiveTicksForLastSamplePeriod / TimeSpan.TicksPerMillisecond, 183 stat => stat.Value = m_udpServer.AverageReceiveTicksForLastSamplePeriod,
185// stat => 184// stat =>
186// stat.Value = Math.Round(m_udpServer.AverageReceiveTicksForLastSamplePeriod / TimeSpan.TicksPerMillisecond, 7), 185// stat.Value = Math.Round(m_udpServer.AverageReceiveTicksForLastSamplePeriod, 7),
187 StatVerbosity.Debug)); 186 StatVerbosity.Debug));
188 } 187 }
189 188
@@ -222,6 +221,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
222 /// </summary> 221 /// </summary>
223 public int DefaultClientPacketDebugLevel { get; set; } 222 public int DefaultClientPacketDebugLevel { get; set; }
224 223
224 /// <summary>
225 /// If set then all inbound agent updates are discarded. For debugging purposes.
226 /// discard agent update.
227 /// </summary>
228 public bool DiscardInboundAgentUpdates { get; set; }
229
225 /// <summary>The measured resolution of Environment.TickCount</summary> 230 /// <summary>The measured resolution of Environment.TickCount</summary>
226 public readonly float TickCountResolution; 231 public readonly float TickCountResolution;
227 232
@@ -240,19 +245,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
240 245
241 private DoubleQueue<IncomingPacket> packetInbox = new DoubleQueue<IncomingPacket>(); 246 private DoubleQueue<IncomingPacket> packetInbox = new DoubleQueue<IncomingPacket>();
242 247
243 /// <summary></summary>
244 //private UDPClientCollection m_clients = new UDPClientCollection();
245 /// <summary>Bandwidth throttle for this UDP server</summary> 248 /// <summary>Bandwidth throttle for this UDP server</summary>
246 protected TokenBucket m_throttle; 249 public TokenBucket Throttle { get; private set; }
247 250
248 /// <summary>Bandwidth throttle rates for this UDP server</summary> 251 /// <summary>Per client throttle rates enforced by this server</summary>
252 /// <remarks>
253 /// If the total rate is non-zero, then this is the maximum total throttle setting that any client can ever have.
254 /// The other rates (resend, asset, etc.) are the defaults for a new client and can be changed (and usually
255 /// do get changed immediately). They do not need to sum to the total.
256 /// </remarks>
249 public ThrottleRates ThrottleRates { get; private set; } 257 public ThrottleRates ThrottleRates { get; private set; }
250 258
251 /// <summary>Manages authentication for agent circuits</summary> 259 /// <summary>Manages authentication for agent circuits</summary>
252 private AgentCircuitManager m_circuitManager; 260 private AgentCircuitManager m_circuitManager;
253 261
254 /// <summary>Reference to the scene this UDP server is attached to</summary> 262 /// <summary>Reference to the scene this UDP server is attached to</summary>
255 protected Scene m_scene; 263 public Scene Scene { get; private set; }
256 264
257 /// <summary>The X/Y coordinates of the scene this UDP server is attached to</summary> 265 /// <summary>The X/Y coordinates of the scene this UDP server is attached to</summary>
258 private Location m_location; 266 private Location m_location;
@@ -375,6 +383,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
375 /// </summary> 383 /// </summary>
376 private IClientAPI m_currentIncomingClient; 384 private IClientAPI m_currentIncomingClient;
377 385
386 /// <summary>
387 /// Queue some low priority but potentially high volume async requests so that they don't overwhelm available
388 /// threadpool threads.
389 /// </summary>
390 public JobEngine IpahEngine { get; private set; }
391
392 /// <summary>
393 /// Run queue empty processing within a single persistent thread.
394 /// </summary>
395 /// <remarks>
396 /// This is the alternative to having every
397 /// connection schedule its own job in the threadpool which causes performance problems when there are many
398 /// connections.
399 /// </remarks>
400 public JobEngine OqrEngine { get; private set; }
401
378 public LLUDPServer( 402 public LLUDPServer(
379 IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, 403 IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port,
380 IConfigSource configSource, AgentCircuitManager circuitManager) 404 IConfigSource configSource, AgentCircuitManager circuitManager)
@@ -449,7 +473,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
449 } 473 }
450 #endregion BinaryStats 474 #endregion BinaryStats
451 475
476<<<<<<< HEAD
477 // FIXME: Can't add info here because don't know scene yet.
478// m_throttle
479// = new TokenBucket(
480// string.Format("server throttle bucket for {0}", Scene.Name), null, sceneThrottleBps);
481
482 Throttle = new TokenBucket("server throttle bucket", null, 0, sceneThrottleBps);
483
484=======
452 m_throttle = new TokenBucket(null, sceneThrottleBps, sceneThrottleBps * 10e-3f); 485 m_throttle = new TokenBucket(null, sceneThrottleBps, sceneThrottleBps * 10e-3f);
486>>>>>>> avn/ubitvar
453 ThrottleRates = new ThrottleRates(configSource); 487 ThrottleRates = new ThrottleRates(configSource);
454 488
455 Random rnd = new Random(Util.EnvironmentTickCount()); 489 Random rnd = new Random(Util.EnvironmentTickCount());
@@ -463,11 +497,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
463 { 497 {
464 StartInbound(); 498 StartInbound();
465 StartOutbound(); 499 StartOutbound();
500 IpahEngine.Start();
501 OqrEngine.Start();
466 502
467 m_elapsedMSSinceLastStatReport = Environment.TickCount; 503 m_elapsedMSSinceLastStatReport = Environment.TickCount;
468 } 504 }
469 505
470 private void StartInbound() 506 public void StartInbound()
471 { 507 {
472 m_log.InfoFormat( 508 m_log.InfoFormat(
473 "[LLUDPSERVER]: Starting inbound packet processing for the LLUDP server in {0} mode with UsePools = {1}", 509 "[LLUDPSERVER]: Starting inbound packet processing for the LLUDP server in {0} mode with UsePools = {1}",
@@ -476,9 +512,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
476 base.StartInbound(m_recvBufferSize, m_asyncPacketHandling); 512 base.StartInbound(m_recvBufferSize, m_asyncPacketHandling);
477 513
478 // This thread will process the packets received that are placed on the packetInbox 514 // This thread will process the packets received that are placed on the packetInbox
479 Watchdog.StartThread( 515 WorkManager.StartThread(
480 IncomingPacketHandler, 516 IncomingPacketHandler,
481 string.Format("Incoming Packets ({0})", m_scene.RegionInfo.RegionName), 517 string.Format("Incoming Packets ({0})", Scene.Name),
482 ThreadPriority.Normal, 518 ThreadPriority.Normal,
483 false, 519 false,
484 true, 520 true,
@@ -486,15 +522,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
486 Watchdog.DEFAULT_WATCHDOG_TIMEOUT_MS); 522 Watchdog.DEFAULT_WATCHDOG_TIMEOUT_MS);
487 } 523 }
488 524
489 private new void StartOutbound() 525 public override void StartOutbound()
490 { 526 {
491 m_log.Info("[LLUDPSERVER]: Starting outbound packet processing for the LLUDP server"); 527 m_log.Info("[LLUDPSERVER]: Starting outbound packet processing for the LLUDP server");
492 528
493 base.StartOutbound(); 529 base.StartOutbound();
494 530
495 Watchdog.StartThread( 531 WorkManager.StartThread(
496 OutgoingPacketHandler, 532 OutgoingPacketHandler,
497 string.Format("Outgoing Packets ({0})", m_scene.RegionInfo.RegionName), 533 string.Format("Outgoing Packets ({0})", Scene.Name),
498 ThreadPriority.Normal, 534 ThreadPriority.Normal,
499 false, 535 false,
500 true, 536 true,
@@ -504,12 +540,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
504 540
505 public void Stop() 541 public void Stop()
506 { 542 {
507 m_log.Info("[LLUDPSERVER]: Shutting down the LLUDP server for " + m_scene.RegionInfo.RegionName); 543 m_log.Info("[LLUDPSERVER]: Shutting down the LLUDP server for " + Scene.Name);
508 base.StopOutbound(); 544 base.StopOutbound();
509 base.StopInbound(); 545 base.StopInbound();
546 IpahEngine.Stop();
547 OqrEngine.Stop();
510 } 548 }
511 549
512 protected override bool EnablePools() 550 public override bool EnablePools()
513 { 551 {
514 if (!UsePools) 552 if (!UsePools)
515 { 553 {
@@ -523,7 +561,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
523 return false; 561 return false;
524 } 562 }
525 563
526 protected override bool DisablePools() 564 public override bool DisablePools()
527 { 565 {
528 if (UsePools) 566 if (UsePools)
529 { 567 {
@@ -543,7 +581,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
543 /// This is a seperate method so that it can be called once we have an m_scene to distinguish different scene 581 /// This is a seperate method so that it can be called once we have an m_scene to distinguish different scene
544 /// stats. 582 /// stats.
545 /// </summary> 583 /// </summary>
546 private void EnablePoolStats() 584 protected internal void EnablePoolStats()
547 { 585 {
548 m_poolCountStat 586 m_poolCountStat
549 = new Stat( 587 = new Stat(
@@ -552,7 +590,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
552 "The number of objects currently stored within the UDPPacketBuffer pool", 590 "The number of objects currently stored within the UDPPacketBuffer pool",
553 "", 591 "",
554 "clientstack", 592 "clientstack",
555 m_scene.Name, 593 Scene.Name,
556 StatType.Pull, 594 StatType.Pull,
557 stat => stat.Value = Pool.Count, 595 stat => stat.Value = Pool.Count,
558 StatVerbosity.Debug); 596 StatVerbosity.Debug);
@@ -566,7 +604,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
566 "The number of objects currently stored within the incoming packet pool", 604 "The number of objects currently stored within the incoming packet pool",
567 "", 605 "",
568 "clientstack", 606 "clientstack",
569 m_scene.Name, 607 Scene.Name,
570 StatType.Pull, 608 StatType.Pull,
571 stat => stat.Value = m_incomingPacketPool.Count, 609 stat => stat.Value = m_incomingPacketPool.Count,
572 StatVerbosity.Debug); 610 StatVerbosity.Debug);
@@ -577,7 +615,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
577 /// <summary> 615 /// <summary>
578 /// Disables pool stats. 616 /// Disables pool stats.
579 /// </summary> 617 /// </summary>
580 private void DisablePoolStats() 618 protected internal void DisablePoolStats()
581 { 619 {
582 StatsManager.DeregisterStat(m_poolCountStat); 620 StatsManager.DeregisterStat(m_poolCountStat);
583 m_poolCountStat = null; 621 m_poolCountStat = null;
@@ -610,7 +648,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
610 648
611 public void AddScene(IScene scene) 649 public void AddScene(IScene scene)
612 { 650 {
613 if (m_scene != null) 651 if (Scene != null)
614 { 652 {
615 m_log.Error("[LLUDPSERVER]: AddScene() called on an LLUDPServer that already has a scene"); 653 m_log.Error("[LLUDPSERVER]: AddScene() called on an LLUDPServer that already has a scene");
616 return; 654 return;
@@ -622,8 +660,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
622 return; 660 return;
623 } 661 }
624 662
625 m_scene = (Scene)scene; 663 Scene = (Scene)scene;
626 m_location = new Location(m_scene.RegionInfo.RegionHandle); 664 m_location = new Location(Scene.RegionInfo.RegionHandle);
665
666 IpahEngine
667 = new JobEngine(
668 string.Format("Incoming Packet Async Handling Engine ({0})", Scene.Name),
669 "INCOMING PACKET ASYNC HANDLING ENGINE");
670
671 OqrEngine
672 = new JobEngine(
673 string.Format("Outgoing Queue Refill Engine ({0})", Scene.Name),
674 "OUTGOING QUEUE REFILL ENGINE");
627 675
628 StatsManager.RegisterStat( 676 StatsManager.RegisterStat(
629 new Stat( 677 new Stat(
@@ -646,7 +694,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
646 "Packets reused", 694 "Packets reused",
647 "Number of packets reused out of all requests to the packet pool", 695 "Number of packets reused out of all requests to the packet pool",
648 "clientstack", 696 "clientstack",
649 m_scene.Name, 697 Scene.Name,
650 StatType.Pull, 698 StatType.Pull,
651 stat => 699 stat =>
652 { PercentageStat pstat = (PercentageStat)stat; 700 { PercentageStat pstat = (PercentageStat)stat;
@@ -660,7 +708,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
660 "Packet data blocks reused", 708 "Packet data blocks reused",
661 "Number of data blocks reused out of all requests to the packet pool", 709 "Number of data blocks reused out of all requests to the packet pool",
662 "clientstack", 710 "clientstack",
663 m_scene.Name, 711 Scene.Name,
664 StatType.Pull, 712 StatType.Pull,
665 stat => 713 stat =>
666 { PercentageStat pstat = (PercentageStat)stat; 714 { PercentageStat pstat = (PercentageStat)stat;
@@ -675,7 +723,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
675 "The number of objects currently stored within the packet pool", 723 "The number of objects currently stored within the packet pool",
676 "", 724 "",
677 "clientstack", 725 "clientstack",
678 m_scene.Name, 726 Scene.Name,
679 StatType.Pull, 727 StatType.Pull,
680 stat => stat.Value = PacketPool.Instance.PacketsPooled, 728 stat => stat.Value = PacketPool.Instance.PacketsPooled,
681 StatVerbosity.Debug)); 729 StatVerbosity.Debug));
@@ -687,16 +735,59 @@ namespace OpenSim.Region.ClientStack.LindenUDP
687 "The number of objects currently stored within the packet data block pool", 735 "The number of objects currently stored within the packet data block pool",
688 "", 736 "",
689 "clientstack", 737 "clientstack",
690 m_scene.Name, 738 Scene.Name,
691 StatType.Pull, 739 StatType.Pull,
692 stat => stat.Value = PacketPool.Instance.BlocksPooled, 740 stat => stat.Value = PacketPool.Instance.BlocksPooled,
693 StatVerbosity.Debug)); 741 StatVerbosity.Debug));
742
743 StatsManager.RegisterStat(
744 new Stat(
745 "OutgoingPacketsQueuedCount",
746 "Packets queued for outgoing send",
747 "Number of queued outgoing packets across all connections",
748 "",
749 "clientstack",
750 Scene.Name,
751 StatType.Pull,
752 MeasuresOfInterest.AverageChangeOverTime,
753 stat => stat.Value = GetTotalQueuedOutgoingPackets(),
754 StatVerbosity.Info));
755
756 StatsManager.RegisterStat(
757 new Stat(
758 "IncomingPacketAsyncRequestsWaiting",
759 "Number of incoming packets waiting for async processing in engine.",
760 "",
761 "",
762 "clientstack",
763 Scene.Name,
764 StatType.Pull,
765 MeasuresOfInterest.None,
766 stat => stat.Value = IpahEngine.JobsWaiting,
767 StatVerbosity.Debug));
768
769 StatsManager.RegisterStat(
770 new Stat(
771 "OQRERequestsWaiting",
772 "Number of outgong queue refill requests waiting for processing.",
773 "",
774 "",
775 "clientstack",
776 Scene.Name,
777 StatType.Pull,
778 MeasuresOfInterest.None,
779 stat => stat.Value = OqrEngine.JobsWaiting,
780 StatVerbosity.Debug));
694 781
695 // We delay enabling pool stats to AddScene() instead of Initialize() so that we can distinguish pool stats by 782 // We delay enabling pool stats to AddScene() instead of Initialize() so that we can distinguish pool stats by
696 // scene name 783 // scene name
697 if (UsePools) 784 if (UsePools)
698 EnablePoolStats(); 785 EnablePoolStats();
699 786
787<<<<<<< HEAD
788 LLUDPServerCommands commands = new LLUDPServerCommands(MainConsole.Instance, this);
789 commands.Register();
790=======
700 MainConsole.Instance.Commands.AddCommand( 791 MainConsole.Instance.Commands.AddCommand(
701 "Debug", false, "debug lludp packet", 792 "Debug", false, "debug lludp packet",
702 "debug lludp packet [--default] <level> [<avatar-first-name> <avatar-last-name>]", 793 "debug lludp packet [--default] <level> [<avatar-first-name> <avatar-last-name>]",
@@ -837,96 +928,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
837 928
838 if (subCommand == "out" || subCommand == "all") 929 if (subCommand == "out" || subCommand == "all")
839 StartOutbound(); 930 StartOutbound();
931>>>>>>> avn/ubitvar
840 } 932 }
841 933
842 private void HandleStopCommand(string module, string[] args) 934 public bool HandlesRegion(Location x)
843 { 935 {
844 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene) 936 return x == m_location;
845 return;
846
847 if (args.Length != 4)
848 {
849 MainConsole.Instance.Output("Usage: debug lludp stop <in|out|all>");
850 return;
851 }
852
853 string subCommand = args[3];
854
855 if (subCommand == "in" || subCommand == "all")
856 StopInbound();
857
858 if (subCommand == "out" || subCommand == "all")
859 StopOutbound();
860 } 937 }
861 938
862 private void HandlePoolCommand(string module, string[] args) 939 public int GetTotalQueuedOutgoingPackets()
863 { 940 {
864 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene) 941 int total = 0;
865 return;
866 942
867 if (args.Length != 4) 943 foreach (ScenePresence sp in Scene.GetScenePresences())
868 {
869 MainConsole.Instance.Output("Usage: debug lludp pool <on|off>");
870 return;
871 }
872
873 string enabled = args[3];
874
875 if (enabled == "on")
876 {
877 if (EnablePools())
878 {
879 EnablePoolStats();
880 MainConsole.Instance.OutputFormat("Packet pools enabled on {0}", m_scene.Name);
881 }
882 }
883 else if (enabled == "off")
884 { 944 {
885 if (DisablePools()) 945 // XXX: Need a better way to determine which IClientAPIs have UDPClients (NPCs do not, for instance).
946 if (sp.ControllingClient is LLClientView)
886 { 947 {
887 DisablePoolStats(); 948 LLUDPClient udpClient = ((LLClientView)sp.ControllingClient).UDPClient;
888 MainConsole.Instance.OutputFormat("Packet pools disabled on {0}", m_scene.Name); 949 total += udpClient.GetTotalPacketsQueuedCount();
889 } 950 }
890 } 951 }
891 else
892 {
893 MainConsole.Instance.Output("Usage: debug lludp pool <on|off>");
894 }
895 }
896
897 bool m_discardAgentUpdates;
898
899 private void HandleAgentUpdateCommand(string module, string[] args)
900 {
901 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene)
902 return;
903
904 m_discardAgentUpdates = !m_discardAgentUpdates;
905
906 MainConsole.Instance.OutputFormat(
907 "Discard AgentUpdates now {0} for {1}", m_discardAgentUpdates, m_scene.Name);
908 }
909
910 private void HandleStatusCommand(string module, string[] args)
911 {
912 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene)
913 return;
914
915 MainConsole.Instance.OutputFormat(
916 "IN LLUDP packet processing for {0} is {1}", m_scene.Name, IsRunningInbound ? "enabled" : "disabled");
917 952
918 MainConsole.Instance.OutputFormat( 953 return total;
919 "OUT LLUDP packet processing for {0} is {1}", m_scene.Name, IsRunningOutbound ? "enabled" : "disabled");
920
921 MainConsole.Instance.OutputFormat("LLUDP pools in {0} are {1}", m_scene.Name, UsePools ? "on" : "off");
922
923 MainConsole.Instance.OutputFormat(
924 "Packet debug level for new clients is {0}", DefaultClientPacketDebugLevel);
925 }
926
927 public bool HandlesRegion(Location x)
928 {
929 return x == m_location;
930 } 954 }
931 955
932// public void BroadcastPacket(Packet packet, ThrottleOutPacketType category, bool sendToPausedAgents, bool allowSplitting) 956// public void BroadcastPacket(Packet packet, ThrottleOutPacketType category, bool sendToPausedAgents, bool allowSplitting)
@@ -999,7 +1023,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
999 for (int i = 0; i < packetCount; i++) 1023 for (int i = 0; i < packetCount; i++)
1000 { 1024 {
1001 byte[] data = datas[i]; 1025 byte[] data = datas[i];
1002
1003 if (!SendPacketData(udpClient, data, packet.Type, category, method)) 1026 if (!SendPacketData(udpClient, data, packet.Type, category, method))
1004 packetQueued = true; 1027 packetQueued = true;
1005 } 1028 }
@@ -1007,7 +1030,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1007 else 1030 else
1008 { 1031 {
1009 byte[] data = packet.ToBytes(); 1032 byte[] data = packet.ToBytes();
1010 packetQueued = SendPacketData(udpClient, data, packet.Type, category, method); 1033 if (!SendPacketData(udpClient, data, packet.Type, category, method))
1034 packetQueued = true;
1011 } 1035 }
1012 1036
1013 PacketPool.Instance.ReturnPacket(packet); 1037 PacketPool.Instance.ReturnPacket(packet);
@@ -1094,20 +1118,44 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1094 } 1118 }
1095 1119
1096 OutgoingPacket outgoingPacket = new OutgoingPacket(udpClient, buffer, category, null); 1120 OutgoingPacket outgoingPacket = new OutgoingPacket(udpClient, buffer, category, null);
1121
1097 // If we were not provided a method for handling unacked, use the UDPServer default method 1122 // If we were not provided a method for handling unacked, use the UDPServer default method
1098 outgoingPacket.UnackedMethod = ((method == null) ? delegate(OutgoingPacket oPacket) { ResendUnacked(oPacket); } : method); 1123 if ((outgoingPacket.Buffer.Data[0] & Helpers.MSG_RELIABLE) != 0)
1124 outgoingPacket.UnackedMethod = ((method == null) ? delegate(OutgoingPacket oPacket) { ResendUnacked(oPacket); } : method);
1099 1125
1100 // If a Linden Lab 1.23.5 client receives an update packet after a kill packet for an object, it will 1126 // If a Linden Lab 1.23.5 client receives an update packet after a kill packet for an object, it will
1101 // continue to display the deleted object until relog. Therefore, we need to always queue a kill object 1127 // continue to display the deleted object until relog. Therefore, we need to always queue a kill object
1102 // packet so that it isn't sent before a queued update packet. 1128 // packet so that it isn't sent before a queued update packet.
1129<<<<<<< HEAD
1130 bool forceQueue = (type == PacketType.KillObject);
1131
1132// if (type == PacketType.ImprovedTerseObjectUpdate)
1133// {
1134// m_log.DebugFormat("Direct send ITOU to {0} in {1}", udpClient.AgentID, Scene.Name);
1135// SendPacketFinal(outgoingPacket);
1136// return false;
1137// }
1138// else
1139// {
1140 if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, forceQueue))
1141=======
1103 bool requestQueue = type == PacketType.KillObject; 1142 bool requestQueue = type == PacketType.KillObject;
1104 if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue, highPriority)) 1143 if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue, highPriority))
1144>>>>>>> avn/ubitvar
1105 { 1145 {
1106 SendPacketFinal(outgoingPacket); 1146 SendPacketFinal(outgoingPacket);
1107 return true; 1147 return true;
1108 } 1148 }
1149<<<<<<< HEAD
1150 else
1151 {
1152 return false;
1153 }
1154// }
1155=======
1109 1156
1110 return false; 1157 return false;
1158>>>>>>> avn/ubitvar
1111 1159
1112 #endregion Queue or Send 1160 #endregion Queue or Send
1113 } 1161 }
@@ -1184,7 +1232,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1184 // Fire this out on a different thread so that we don't hold up outgoing packet processing for 1232 // Fire this out on a different thread so that we don't hold up outgoing packet processing for
1185 // everybody else if this is being called due to an ack timeout. 1233 // everybody else if this is being called due to an ack timeout.
1186 // This is the same as processing as the async process of a logout request. 1234 // This is the same as processing as the async process of a logout request.
1187 Util.FireAndForget(o => DeactivateClientDueToTimeout(client, timeoutTicks)); 1235 Util.FireAndForget(
1236 o => DeactivateClientDueToTimeout(client, timeoutTicks), null, "LLUDPServer.DeactivateClientDueToTimeout");
1188 1237
1189 return; 1238 return;
1190 } 1239 }
@@ -1280,7 +1329,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1280 Utils.UIntToBytesBig(sequenceNumber, buffer.Data, 1); 1329 Utils.UIntToBytesBig(sequenceNumber, buffer.Data, 1);
1281 outgoingPacket.SequenceNumber = sequenceNumber; 1330 outgoingPacket.SequenceNumber = sequenceNumber;
1282 1331
1283 if (isReliable) 1332 if (udpClient.ProcessUnackedSends && isReliable)
1284 { 1333 {
1285 // Add this packet to the list of ACK responses we are waiting on from the server 1334 // Add this packet to the list of ACK responses we are waiting on from the server
1286 udpClient.NeedAcks.Add(outgoingPacket); 1335 udpClient.NeedAcks.Add(outgoingPacket);
@@ -1304,6 +1353,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1304 // is 100% correct 1353 // is 100% correct
1305 PacketsSentCount++; 1354 PacketsSentCount++;
1306 1355
1356 if (udpClient.DebugDataOutLevel > 0)
1357 m_log.DebugFormat(
1358 "[LLUDPSERVER]: Sending packet #{0} (rel: {1}, res: {2}) to {3} from {4}",
1359 outgoingPacket.SequenceNumber, isReliable, isResend, udpClient.AgentID, Scene.Name);
1360
1307 // Put the UDP payload on the wire 1361 // Put the UDP payload on the wire
1308 AsyncBeginSend(buffer); 1362 AsyncBeginSend(buffer);
1309 1363
@@ -1419,8 +1473,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1419 if (m_pendingCache.Contains(endPoint)) 1473 if (m_pendingCache.Contains(endPoint))
1420 return; 1474 return;
1421 1475
1476<<<<<<< HEAD
1477 Util.FireAndForget(HandleUseCircuitCode, array, "LLUDPServer.HandleUseCircuitCode");
1478=======
1422 m_pendingCache.AddOrUpdate(endPoint, new Queue<UDPPacketBuffer>(), 60); 1479 m_pendingCache.AddOrUpdate(endPoint, new Queue<UDPPacketBuffer>(), 60);
1423 } 1480 }
1481>>>>>>> avn/ubitvar
1424 1482
1425 // We need to copy the endpoint so that it doesn't get changed when another thread reuses the 1483 // We need to copy the endpoint so that it doesn't get changed when another thread reuses the
1426 // buffer. 1484 // buffer.
@@ -1449,9 +1507,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1449 // Send ack straight away to let the viewer know that we got it. 1507 // Send ack straight away to let the viewer know that we got it.
1450 SendAckImmediate(endPoint, packet.Header.Sequence); 1508 SendAckImmediate(endPoint, packet.Header.Sequence);
1451 1509
1510<<<<<<< HEAD
1511 Util.FireAndForget(
1512 HandleCompleteMovementIntoRegion, array, "LLUDPServer.HandleCompleteMovementIntoRegion");
1513=======
1452 // We need to copy the endpoint so that it doesn't get changed when another thread reuses the 1514 // We need to copy the endpoint so that it doesn't get changed when another thread reuses the
1453 // buffer. 1515 // buffer.
1454 object[] array = new object[] { new IPEndPoint(endPoint.Address, endPoint.Port), packet }; 1516 object[] array = new object[] { new IPEndPoint(endPoint.Address, endPoint.Port), packet };
1517>>>>>>> avn/ubitvar
1455 1518
1456 Util.FireAndForget(HandleCompleteMovementIntoRegion, array); 1519 Util.FireAndForget(HandleCompleteMovementIntoRegion, array);
1457 1520
@@ -1461,7 +1524,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1461 } 1524 }
1462 1525
1463 // Determine which agent this packet came from 1526 // Determine which agent this packet came from
1527<<<<<<< HEAD
1528 IClientAPI client;
1529 if (!Scene.TryGetClient(endPoint, out client) || !(client is LLClientView))
1530=======
1464 if (client == null || !(client is LLClientView)) 1531 if (client == null || !(client is LLClientView))
1532>>>>>>> avn/ubitvar
1465 { 1533 {
1466 //m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); 1534 //m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName);
1467 1535
@@ -1493,30 +1561,37 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1493 1561
1494 #region ACK Receiving 1562 #region ACK Receiving
1495 1563
1496 // Handle appended ACKs 1564 if (udpClient.ProcessUnackedSends)
1497 if (packet.Header.AppendedAcks && packet.Header.AckList != null)
1498 { 1565 {
1499// m_log.DebugFormat( 1566 // Handle appended ACKs
1500// "[LLUDPSERVER]: Handling {0} appended acks from {1} in {2}", 1567 if (packet.Header.AppendedAcks && packet.Header.AckList != null)
1501// packet.Header.AckList.Length, client.Name, m_scene.Name); 1568 {
1569 // m_log.DebugFormat(
1570 // "[LLUDPSERVER]: Handling {0} appended acks from {1} in {2}",
1571 // packet.Header.AckList.Length, client.Name, m_scene.Name);
1502 1572
1503 for (int i = 0; i < packet.Header.AckList.Length; i++) 1573 for (int i = 0; i < packet.Header.AckList.Length; i++)
1504 udpClient.NeedAcks.Acknowledge(packet.Header.AckList[i], now, packet.Header.Resent); 1574 udpClient.NeedAcks.Acknowledge(packet.Header.AckList[i], now, packet.Header.Resent);
1505 } 1575 }
1506 1576
1507 // Handle PacketAck packets 1577 // Handle PacketAck packets
1508 if (packet.Type == PacketType.PacketAck) 1578 if (packet.Type == PacketType.PacketAck)
1509 { 1579 {
1510 PacketAckPacket ackPacket = (PacketAckPacket)packet; 1580 PacketAckPacket ackPacket = (PacketAckPacket)packet;
1511 1581
1512// m_log.DebugFormat( 1582 // m_log.DebugFormat(
1513// "[LLUDPSERVER]: Handling {0} packet acks for {1} in {2}", 1583 // "[LLUDPSERVER]: Handling {0} packet acks for {1} in {2}",
1514// ackPacket.Packets.Length, client.Name, m_scene.Name); 1584 // ackPacket.Packets.Length, client.Name, m_scene.Name);
1515 1585
1516 for (int i = 0; i < ackPacket.Packets.Length; i++) 1586 for (int i = 0; i < ackPacket.Packets.Length; i++)
1517 udpClient.NeedAcks.Acknowledge(ackPacket.Packets[i].ID, now, packet.Header.Resent); 1587 udpClient.NeedAcks.Acknowledge(ackPacket.Packets[i].ID, now, packet.Header.Resent);
1518 1588
1519 // We don't need to do anything else with PacketAck packets 1589 // We don't need to do anything else with PacketAck packets
1590 return;
1591 }
1592 }
1593 else if (packet.Type == PacketType.PacketAck)
1594 {
1520 return; 1595 return;
1521 } 1596 }
1522 1597
@@ -1577,7 +1652,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1577 LogPacketHeader(true, udpClient.CircuitCode, 0, packet.Type, (ushort)packet.Length); 1652 LogPacketHeader(true, udpClient.CircuitCode, 0, packet.Type, (ushort)packet.Length);
1578 #endregion BinaryStats 1653 #endregion BinaryStats
1579 1654
1655<<<<<<< HEAD
1656 if (packet.Type == PacketType.AgentUpdate)
1657 {
1658 if (DiscardInboundAgentUpdates)
1659 return;
1660
1661 ((LLClientView)client).TotalAgentUpdates++;
1662
1663 AgentUpdatePacket agentUpdate = (AgentUpdatePacket)packet;
1664
1665 LLClientView llClient = client as LLClientView;
1666 if (agentUpdate.AgentData.SessionID != client.SessionId
1667 || agentUpdate.AgentData.AgentID != client.AgentId
1668 || !(llClient == null || llClient.CheckAgentUpdateSignificance(agentUpdate.AgentData)) )
1669 {
1670 PacketPool.Instance.ReturnPacket(packet);
1671 return;
1672 }
1673 }
1674=======
1580// AgentUpdate mess removed from here 1675// AgentUpdate mess removed from here
1676>>>>>>> avn/ubitvar
1581 1677
1582 #region Ping Check Handling 1678 #region Ping Check Handling
1583 1679
@@ -1752,7 +1848,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1752 1848
1753 m_log.DebugFormat( 1849 m_log.DebugFormat(
1754 "[LLUDPSERVER]: Handling UseCircuitCode request for circuit {0} to {1} from IP {2}", 1850 "[LLUDPSERVER]: Handling UseCircuitCode request for circuit {0} to {1} from IP {2}",
1755 uccp.CircuitCode.Code, m_scene.RegionInfo.RegionName, endPoint); 1851 uccp.CircuitCode.Code, Scene.RegionInfo.RegionName, endPoint);
1756 1852
1757 AuthenticateResponse sessionInfo; 1853 AuthenticateResponse sessionInfo;
1758 if (IsClientAuthorized(uccp, out sessionInfo)) 1854 if (IsClientAuthorized(uccp, out sessionInfo))
@@ -1812,10 +1908,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1812 // We only want to send initial data to new clients, not ones which are being converted from child to root. 1908 // We only want to send initial data to new clients, not ones which are being converted from child to root.
1813 if (client != null) 1909 if (client != null)
1814 { 1910 {
1911<<<<<<< HEAD
1912 AgentCircuitData aCircuit = Scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code);
1913=======
1914>>>>>>> avn/ubitvar
1815 bool tp = (aCircuit.teleportFlags > 0); 1915 bool tp = (aCircuit.teleportFlags > 0);
1816 // Let's delay this for TP agents, otherwise the viewer doesn't know where to get resources from 1916 // Let's delay this for TP agents, otherwise the viewer doesn't know where to get resources from
1817 if (!tp) 1917 if (!tp && !client.SceneAgent.SentInitialDataToClient)
1818 client.SceneAgent.SendInitialDataToMe(); 1918 client.SceneAgent.SendInitialDataToClient();
1819 } 1919 }
1820 } 1920 }
1821 else 1921 else
@@ -1823,11 +1923,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1823 // Don't create clients for unauthorized requesters. 1923 // Don't create clients for unauthorized requesters.
1824 m_log.WarnFormat( 1924 m_log.WarnFormat(
1825 "[LLUDPSERVER]: Ignoring connection request for {0} to {1} with unknown circuit code {2} from IP {3}", 1925 "[LLUDPSERVER]: Ignoring connection request for {0} to {1} with unknown circuit code {2} from IP {3}",
1926<<<<<<< HEAD
1927 uccp.CircuitCode.ID, Scene.RegionInfo.RegionName, uccp.CircuitCode.Code, endPoint);
1928 }
1929
1930=======
1826 uccp.CircuitCode.ID, m_scene.RegionInfo.RegionName, uccp.CircuitCode.Code, endPoint); 1931 uccp.CircuitCode.ID, m_scene.RegionInfo.RegionName, uccp.CircuitCode.Code, endPoint);
1827 1932
1828 lock (m_pendingCache) 1933 lock (m_pendingCache)
1829 m_pendingCache.Remove(endPoint); 1934 m_pendingCache.Remove(endPoint);
1830 } 1935 }
1936>>>>>>> avn/ubitvar
1831 // m_log.DebugFormat( 1937 // m_log.DebugFormat(
1832 // "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms", 1938 // "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms",
1833 // buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds); 1939 // buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds);
@@ -1857,7 +1963,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1857 CompleteAgentMovementPacket packet = (CompleteAgentMovementPacket)array[1]; 1963 CompleteAgentMovementPacket packet = (CompleteAgentMovementPacket)array[1];
1858 1964
1859 m_log.DebugFormat( 1965 m_log.DebugFormat(
1860 "[LLUDPSERVER]: Handling CompleteAgentMovement request from {0} in {1}", endPoint, m_scene.Name); 1966 "[LLUDPSERVER]: Handling CompleteAgentMovement request from {0} in {1}", endPoint, Scene.Name);
1861 1967
1862 // Determine which agent this packet came from 1968 // Determine which agent this packet came from
1863 // We need to wait here because in when using the OpenSimulator V2 teleport protocol to travel to a destination 1969 // We need to wait here because in when using the OpenSimulator V2 teleport protocol to travel to a destination
@@ -1868,7 +1974,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1868 int count = 40; 1974 int count = 40;
1869 while (count-- > 0) 1975 while (count-- > 0)
1870 { 1976 {
1871 if (m_scene.TryGetClient(endPoint, out client)) 1977 if (Scene.TryGetClient(endPoint, out client))
1872 { 1978 {
1873 if (!client.IsActive) 1979 if (!client.IsActive)
1874 { 1980 {
@@ -1877,7 +1983,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1877 // not yet been established). 1983 // not yet been established).
1878 m_log.DebugFormat( 1984 m_log.DebugFormat(
1879 "[LLUDPSERVER]: Received a CompleteAgentMovement from {0} for {1} in {2} but client is not active yet. Waiting.", 1985 "[LLUDPSERVER]: Received a CompleteAgentMovement from {0} for {1} in {2} but client is not active yet. Waiting.",
1880 endPoint, client.Name, m_scene.Name); 1986 endPoint, client.Name, Scene.Name);
1881 } 1987 }
1882 else if (client.SceneAgent == null) 1988 else if (client.SceneAgent == null)
1883 { 1989 {
@@ -1889,7 +1995,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1889 // the client manager 1995 // the client manager
1890 m_log.DebugFormat( 1996 m_log.DebugFormat(
1891 "[LLUDPSERVER]: Received a CompleteAgentMovement from {0} for {1} in {2} but client SceneAgent not set yet. Waiting.", 1997 "[LLUDPSERVER]: Received a CompleteAgentMovement from {0} for {1} in {2} but client SceneAgent not set yet. Waiting.",
1892 endPoint, client.Name, m_scene.Name); 1998 endPoint, client.Name, Scene.Name);
1893 } 1999 }
1894 else 2000 else
1895 { 2001 {
@@ -1900,7 +2006,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1900 { 2006 {
1901 m_log.DebugFormat( 2007 m_log.DebugFormat(
1902 "[LLUDPSERVER]: Received a CompleteAgentMovement from {0} in {1} but no client exists yet. Waiting.", 2008 "[LLUDPSERVER]: Received a CompleteAgentMovement from {0} in {1} but no client exists yet. Waiting.",
1903 endPoint, m_scene.Name); 2009 endPoint, Scene.Name);
1904 } 2010 }
1905 2011
1906 Thread.Sleep(200); 2012 Thread.Sleep(200);
@@ -1910,7 +2016,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1910 { 2016 {
1911 m_log.DebugFormat( 2017 m_log.DebugFormat(
1912 "[LLUDPSERVER]: No client found for CompleteAgentMovement from {0} in {1} after wait. Dropping.", 2018 "[LLUDPSERVER]: No client found for CompleteAgentMovement from {0} in {1} after wait. Dropping.",
1913 endPoint, m_scene.Name); 2019 endPoint, Scene.Name);
1914 2020
1915 return; 2021 return;
1916 } 2022 }
@@ -1922,7 +2028,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1922 // purposes. 2028 // purposes.
1923 m_log.DebugFormat( 2029 m_log.DebugFormat(
1924 "[LLUDPSERVER]: Received a CompleteAgentMovement from {0} for {1} in {2} but client is not active after wait. Dropping.", 2030 "[LLUDPSERVER]: Received a CompleteAgentMovement from {0} for {1} in {2} but client is not active after wait. Dropping.",
1925 endPoint, client.Name, m_scene.Name); 2031 endPoint, client.Name, Scene.Name);
1926 2032
1927 return; 2033 return;
1928 } 2034 }
@@ -2019,8 +2125,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2019 // consistently, this lock could probably be removed. 2125 // consistently, this lock could probably be removed.
2020 lock (this) 2126 lock (this)
2021 { 2127 {
2022 if (!m_scene.TryGetClient(agentID, out client)) 2128 if (!Scene.TryGetClient(agentID, out client))
2023 { 2129 {
2130<<<<<<< HEAD
2131 LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, Throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO);
2132=======
2024 createNew = true; 2133 createNew = true;
2025 } 2134 }
2026 else 2135 else
@@ -2035,8 +2144,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2035 if (createNew) 2144 if (createNew)
2036 { 2145 {
2037 LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO); 2146 LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO);
2147>>>>>>> avn/ubitvar
2038 2148
2039 client = new LLClientView(m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode); 2149 client = new LLClientView(Scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode);
2040 client.OnLogout += LogoutHandler; 2150 client.OnLogout += LogoutHandler;
2041 client.DebugPacketLevel = DefaultClientPacketDebugLevel; 2151 client.DebugPacketLevel = DefaultClientPacketDebugLevel;
2042 2152
@@ -2064,23 +2174,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2064 { 2174 {
2065 ClientLogoutsDueToNoReceives++; 2175 ClientLogoutsDueToNoReceives++;
2066 2176
2177<<<<<<< HEAD
2178 m_log.WarnFormat(
2179 "[LLUDPSERVER]: No packets received from {0} agent of {1} for {2}ms in {3}. Disconnecting.",
2180 client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, timeoutTicks, Scene.Name);
2181=======
2067 if (client.SceneAgent != null) 2182 if (client.SceneAgent != null)
2068 { 2183 {
2069 m_log.WarnFormat( 2184 m_log.WarnFormat(
2070 "[LLUDPSERVER]: No packets received from {0} agent of {1} for {2}ms in {3}. Disconnecting.", 2185 "[LLUDPSERVER]: No packets received from {0} agent of {1} for {2}ms in {3}. Disconnecting.",
2071 client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, timeoutTicks, m_scene.Name); 2186 client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, timeoutTicks, m_scene.Name);
2187>>>>>>> avn/ubitvar
2072 2188
2073 if (!client.SceneAgent.IsChildAgent) 2189 if (!client.SceneAgent.IsChildAgent)
2074 client.Kick("Simulator logged you out due to connection timeout."); 2190 client.Kick("Simulator logged you out due to connection timeout.");
2075 } 2191 }
2076 } 2192 }
2077 2193
2194<<<<<<< HEAD
2195 Scene.CloseAgent(client.AgentId, true);
2196=======
2078 if (!m_scene.CloseAgent(client.AgentId, true)) 2197 if (!m_scene.CloseAgent(client.AgentId, true))
2079 client.Close(true,true); 2198 client.Close(true,true);
2199>>>>>>> avn/ubitvar
2080 } 2200 }
2081 2201
2082 private void IncomingPacketHandler() 2202 private void IncomingPacketHandler()
2083 { 2203 {
2204 Thread.CurrentThread.Priority = ThreadPriority.Highest;
2205
2084 // Set this culture for the thread that incoming packets are received 2206 // Set this culture for the thread that incoming packets are received
2085 // on to en-US to avoid number parsing issues 2207 // on to en-US to avoid number parsing issues
2086 Culture.SetCurrentCulture(); 2208 Culture.SetCurrentCulture();
@@ -2127,6 +2249,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2127 2249
2128 private void OutgoingPacketHandler() 2250 private void OutgoingPacketHandler()
2129 { 2251 {
2252 Thread.CurrentThread.Priority = ThreadPriority.Highest;
2253
2130 // Set this culture for the thread that outgoing packets are sent 2254 // Set this culture for the thread that outgoing packets are sent
2131 // on to en-US to avoid number parsing issues 2255 // on to en-US to avoid number parsing issues
2132 Culture.SetCurrentCulture(); 2256 Culture.SetCurrentCulture();
@@ -2190,7 +2314,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2190 2314
2191 // Handle outgoing packets, resends, acknowledgements, and pings for each 2315 // Handle outgoing packets, resends, acknowledgements, and pings for each
2192 // client. m_packetSent will be set to true if a packet is sent 2316 // client. m_packetSent will be set to true if a packet is sent
2193 m_scene.ForEachClient(clientPacketHandler); 2317 Scene.ForEachClient(clientPacketHandler);
2194 2318
2195 m_currentOutgoingClient = null; 2319 m_currentOutgoingClient = null;
2196 2320
@@ -2227,7 +2351,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2227 2351
2228 if (udpClient.IsConnected) 2352 if (udpClient.IsConnected)
2229 { 2353 {
2230 if (m_resendUnacked) 2354 if (udpClient.ProcessUnackedSends && m_resendUnacked)
2231 HandleUnacked(llClient); 2355 HandleUnacked(llClient);
2232 2356
2233 if (m_sendAcks) 2357 if (m_sendAcks)
@@ -2356,7 +2480,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2356 watch1.Reset(); 2480 watch1.Reset();
2357 2481
2358 // reuse this -- it's every ~100ms 2482 // reuse this -- it's every ~100ms
2359 if (m_scene.EmergencyMonitoring && nticks % 100 == 0) 2483 if (Scene.EmergencyMonitoring && nticks % 100 == 0)
2360 { 2484 {
2361 m_log.InfoFormat("[LLUDPSERVER]: avg processing ticks: {0} avg unacked: {1} avg acks: {2} avg ping: {3} avg dequeue: {4} (TickCountRes: {5} sent: {6} notsent: {7})", 2485 m_log.InfoFormat("[LLUDPSERVER]: avg processing ticks: {0} avg unacked: {1} avg acks: {2} avg ping: {3} avg dequeue: {4} (TickCountRes: {5} sent: {6} notsent: {7})",
2362 avgProcessingTicks, avgResendUnackedTicks, avgSendAcksTicks, avgSendPingTicks, avgDequeueTicks, TickCountResolution, npacksSent, npackNotSent); 2486 avgProcessingTicks, avgResendUnackedTicks, avgSendAcksTicks, avgSendPingTicks, avgDequeueTicks, TickCountResolution, npacksSent, npackNotSent);
@@ -2400,6 +2524,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2400 { 2524 {
2401 m_currentIncomingClient = null; 2525 m_currentIncomingClient = null;
2402 } 2526 }
2527<<<<<<< HEAD
2528 }
2529 else
2530 {
2531 m_log.DebugFormat(
2532 "[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}",
2533 packet.Type, client.Name, Scene.RegionInfo.RegionName);
2534 }
2535=======
2403// } 2536// }
2404// else 2537// else
2405// { 2538// {
@@ -2407,6 +2540,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2407// "[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}", 2540// "[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}",
2408// packet.Type, client.Name, m_scene.RegionInfo.RegionName); 2541// packet.Type, client.Name, m_scene.RegionInfo.RegionName);
2409// } 2542// }
2543>>>>>>> avn/ubitvar
2410 2544
2411 IncomingPacketsProcessed++; 2545 IncomingPacketsProcessed++;
2412 } 2546 }
@@ -2418,7 +2552,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2418 if (!client.IsLoggingOut) 2552 if (!client.IsLoggingOut)
2419 { 2553 {
2420 client.IsLoggingOut = true; 2554 client.IsLoggingOut = true;
2421 m_scene.CloseAgent(client.AgentId, false); 2555 Scene.CloseAgent(client.AgentId, false);
2422 } 2556 }
2423 } 2557 }
2424 } 2558 }
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServerCommands.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServerCommands.cs
new file mode 100644
index 0000000..ac6c0b4
--- /dev/null
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServerCommands.cs
@@ -0,0 +1,901 @@
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
28using System;
29using System.Collections.Generic;
30using System.Text;
31using NDesk.Options;
32using OpenSim.Framework;
33using OpenSim.Framework.Console;
34using OpenSim.Region.Framework.Scenes;
35
36namespace OpenSim.Region.ClientStack.LindenUDP
37{
38 public class LLUDPServerCommands
39 {
40 private ICommandConsole m_console;
41 private LLUDPServer m_udpServer;
42
43 public LLUDPServerCommands(ICommandConsole console, LLUDPServer udpServer)
44 {
45 m_console = console;
46 m_udpServer = udpServer;
47 }
48
49 public void Register()
50 {
51 m_console.Commands.AddCommand(
52 "Comms", false, "show server throttles",
53 "show server throttles",
54 "Show information about server throttles",
55 HandleShowServerThrottlesCommand);
56
57 m_console.Commands.AddCommand(
58 "Debug", false, "debug lludp packet",
59 "debug lludp packet [--default | --all] <level> [<avatar-first-name> <avatar-last-name>]",
60 "Turn on packet debugging. This logs information when the client stack hands a processed packet off to downstream code or when upstream code first requests that a certain packet be sent.",
61 "If level > 255 then all incoming and outgoing packets are logged.\n"
62 + "If level <= 255 then incoming AgentUpdate and outgoing SimStats and SimulatorViewerTimeMessage packets are not logged.\n"
63 + "If level <= 200 then incoming RequestImage and outgoing ImagePacket, ImageData, LayerData and CoarseLocationUpdate packets are not logged.\n"
64 + "If level <= 100 then incoming ViewerEffect and AgentAnimation and outgoing ViewerEffect and AvatarAnimation packets are not logged.\n"
65 + "If level <= 50 then outgoing ImprovedTerseObjectUpdate packets are not logged.\n"
66 + "If level <= 0 then no packets are logged.\n"
67 + "If --default is specified then the level becomes the default logging level for all subsequent agents.\n"
68 + "If --all is specified then the level becomes the default logging level for all current and subsequent agents.\n"
69 + "In these cases, you cannot also specify an avatar name.\n"
70 + "If an avatar name is given then only packets from that avatar are logged.",
71 HandlePacketCommand);
72
73 m_console.Commands.AddCommand(
74 "Debug", false, "debug lludp data out",
75 "debug lludp data out <level> <avatar-first-name> <avatar-last-name>\"",
76 "Turn on debugging for final outgoing data to the given user's client.",
77 "This operates at a much lower level than the packet command and prints out available details when the data is actually sent.\n"
78 + "If level > 0 then information about all outgoing UDP data for this avatar is logged.\n"
79 + "If level <= 0 then no information about outgoing UDP data for this avatar is logged.",
80 HandleDataCommand);
81
82 m_console.Commands.AddCommand(
83 "Debug", false, "debug lludp drop",
84 "debug lludp drop <in|out> <add|remove> <packet-name>",
85 "Drop all in or outbound packets that match the given name",
86 "For test purposes.",
87 HandleDropCommand);
88
89 m_console.Commands.AddCommand(
90 "Debug",
91 false,
92 "debug lludp start",
93 "debug lludp start <in|out|all>",
94 "Control LLUDP packet processing.",
95 "No effect if packet processing has already started.\n"
96 + "in - start inbound processing.\n"
97 + "out - start outbound processing.\n"
98 + "all - start in and outbound processing.\n",
99 HandleStartCommand);
100
101 m_console.Commands.AddCommand(
102 "Debug",
103 false,
104 "debug lludp stop",
105 "debug lludp stop <in|out|all>",
106 "Stop LLUDP packet processing.",
107 "No effect if packet processing has already stopped.\n"
108 + "in - stop inbound processing.\n"
109 + "out - stop outbound processing.\n"
110 + "all - stop in and outbound processing.\n",
111 HandleStopCommand);
112
113 m_console.Commands.AddCommand(
114 "Debug",
115 false,
116 "debug lludp pool",
117 "debug lludp pool <on|off>",
118 "Turn object pooling within the lludp component on or off.",
119 HandlePoolCommand);
120
121 m_console.Commands.AddCommand(
122 "Debug",
123 false,
124 "debug lludp status",
125 "debug lludp status",
126 "Return status of LLUDP packet processing.",
127 HandleStatusCommand);
128
129 m_console.Commands.AddCommand(
130 "Debug",
131 false,
132 "debug lludp throttles log",
133 "debug lludp throttles log <level> [<avatar-first-name> <avatar-last-name>]",
134 "Change debug logging level for throttles.",
135 "If level >= 0 then throttle debug logging is performed.\n"
136 + "If level <= 0 then no throttle debug logging is performed.",
137 HandleThrottleCommand);
138
139 m_console.Commands.AddCommand(
140 "Debug",
141 false,
142 "debug lludp throttles get",
143 "debug lludp throttles get [<avatar-first-name> <avatar-last-name>]",
144 "Return debug settings for throttles.",
145 "adaptive - true/false, controls adaptive throttle setting.\n"
146 + "request - request drip rate in kbps.\n"
147 + "max - the max kbps throttle allowed for the specified existing clients. Use 'debug lludp get new-client-throttle-max' to see the setting for new clients.\n",
148 HandleThrottleGetCommand);
149
150 m_console.Commands.AddCommand(
151 "Debug",
152 false,
153 "debug lludp throttles set",
154 "debug lludp throttles set <param> <value> [<avatar-first-name> <avatar-last-name>]",
155 "Set a throttle parameter for the given client.",
156 "adaptive - true/false, controls adaptive throttle setting.\n"
157 + "current - current drip rate in kbps.\n"
158 + "request - requested drip rate in kbps.\n"
159 + "max - the max kbps throttle allowed for the specified existing clients. Use 'debug lludp set new-client-throttle-max' to change the settings for new clients.\n",
160 HandleThrottleSetCommand);
161
162 m_console.Commands.AddCommand(
163 "Debug",
164 false,
165 "debug lludp get",
166 "debug lludp get",
167 "Get debug parameters for the server.",
168 "max-scene-throttle - the current max cumulative kbps provided for this scene to clients.\n"
169 + "max-new-client-throttle - the max kbps throttle allowed to new clients. Use 'debug lludp throttles get max' to see the settings for existing clients.",
170 HandleGetCommand);
171
172 m_console.Commands.AddCommand(
173 "Debug",
174 false,
175 "debug lludp set",
176 "debug lludp set <param> <value>",
177 "Set a parameter for the server.",
178 "max-scene-throttle - the current max cumulative kbps provided for this scene to clients.\n"
179 + "max-new-client-throttle - the max kbps throttle allowed to each new client. Use 'debug lludp throttles set max' to set for existing clients.",
180 HandleSetCommand);
181
182 m_console.Commands.AddCommand(
183 "Debug",
184 false,
185 "debug lludp toggle agentupdate",
186 "debug lludp toggle agentupdate",
187 "Toggle whether agentupdate packets are processed or simply discarded.",
188 HandleAgentUpdateCommand);
189
190 MainConsole.Instance.Commands.AddCommand(
191 "Debug",
192 false,
193 "debug lludp oqre",
194 "debug lludp oqre <start|stop|status>",
195 "Start, stop or get status of OutgoingQueueRefillEngine.",
196 "If stopped then refill requests are processed directly via the threadpool.",
197 HandleOqreCommand);
198
199 m_console.Commands.AddCommand(
200 "Debug",
201 false,
202 "debug lludp client get",
203 "debug lludp client get [<avatar-first-name> <avatar-last-name>]",
204 "Get debug parameters for the client. If no name is given then all client information is returned.",
205 "process-unacked-sends - Do we take action if a sent reliable packet has not been acked.",
206 HandleClientGetCommand);
207
208 m_console.Commands.AddCommand(
209 "Debug",
210 false,
211 "debug lludp client set",
212 "debug lludp client set <param> <value> [<avatar-first-name> <avatar-last-name>]",
213 "Set a debug parameter for a particular client. If no name is given then the value is set on all clients.",
214 "process-unacked-sends - Do we take action if a sent reliable packet has not been acked.",
215 HandleClientSetCommand);
216 }
217
218 private void HandleShowServerThrottlesCommand(string module, string[] args)
219 {
220 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene)
221 return;
222
223 m_console.OutputFormat("Throttles for {0}", m_udpServer.Scene.Name);
224 ConsoleDisplayList cdl = new ConsoleDisplayList();
225 cdl.AddRow("Adaptive throttles", m_udpServer.ThrottleRates.AdaptiveThrottlesEnabled);
226
227 long maxSceneDripRate = m_udpServer.Throttle.MaxDripRate;
228 cdl.AddRow(
229 "Max scene throttle",
230 maxSceneDripRate != 0 ? string.Format("{0} kbps", maxSceneDripRate * 8 / 1000) : "unset");
231
232 int maxClientDripRate = m_udpServer.ThrottleRates.Total;
233 cdl.AddRow(
234 "Max new client throttle",
235 maxClientDripRate != 0 ? string.Format("{0} kbps", maxClientDripRate * 8 / 1000) : "unset");
236
237 m_console.Output(cdl.ToString());
238
239 m_console.OutputFormat("{0}\n", GetServerThrottlesReport(m_udpServer));
240 }
241
242 private string GetServerThrottlesReport(LLUDPServer udpServer)
243 {
244 StringBuilder report = new StringBuilder();
245
246 report.AppendFormat(
247 "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}\n",
248 "Total",
249 "Resend",
250 "Land",
251 "Wind",
252 "Cloud",
253 "Task",
254 "Texture",
255 "Asset");
256
257 report.AppendFormat(
258 "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}\n",
259 "kb/s",
260 "kb/s",
261 "kb/s",
262 "kb/s",
263 "kb/s",
264 "kb/s",
265 "kb/s",
266 "kb/s");
267
268 ThrottleRates throttleRates = udpServer.ThrottleRates;
269 report.AppendFormat(
270 "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}",
271 (throttleRates.Total * 8) / 1000,
272 (throttleRates.Resend * 8) / 1000,
273 (throttleRates.Land * 8) / 1000,
274 (throttleRates.Wind * 8) / 1000,
275 (throttleRates.Cloud * 8) / 1000,
276 (throttleRates.Task * 8) / 1000,
277 (throttleRates.Texture * 8) / 1000,
278 (throttleRates.Asset * 8) / 1000);
279
280 return report.ToString();
281 }
282
283 protected string GetColumnEntry(string entry, int maxLength, int columnPadding)
284 {
285 return string.Format(
286 "{0,-" + maxLength + "}{1,-" + columnPadding + "}",
287 entry.Length > maxLength ? entry.Substring(0, maxLength) : entry,
288 "");
289 }
290
291 private void HandleDataCommand(string module, string[] args)
292 {
293 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene)
294 return;
295
296 if (args.Length != 7)
297 {
298 MainConsole.Instance.OutputFormat("Usage: debug lludp data out <true|false> <avatar-first-name> <avatar-last-name>");
299 return;
300 }
301
302 int level;
303 if (!ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, args[4], out level))
304 return;
305
306 string firstName = args[5];
307 string lastName = args[6];
308
309 m_udpServer.Scene.ForEachScenePresence(sp =>
310 {
311 if (sp.Firstname == firstName && sp.Lastname == lastName)
312 {
313 MainConsole.Instance.OutputFormat(
314 "Data debug for {0} ({1}) set to {2} in {3}",
315 sp.Name, sp.IsChildAgent ? "child" : "root", level, m_udpServer.Scene.Name);
316
317 ((LLClientView)sp.ControllingClient).UDPClient.DebugDataOutLevel = level;
318 }
319 });
320 }
321
322 private void HandleThrottleCommand(string module, string[] args)
323 {
324 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene)
325 return;
326
327 bool all = args.Length == 5;
328 bool one = args.Length == 7;
329
330 if (!all && !one)
331 {
332 MainConsole.Instance.OutputFormat(
333 "Usage: debug lludp throttles log <level> [<avatar-first-name> <avatar-last-name>]");
334 return;
335 }
336
337 int level;
338 if (!ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, args[4], out level))
339 return;
340
341 string firstName = null;
342 string lastName = null;
343
344 if (one)
345 {
346 firstName = args[5];
347 lastName = args[6];
348 }
349
350 m_udpServer.Scene.ForEachScenePresence(sp =>
351 {
352 if (all || (sp.Firstname == firstName && sp.Lastname == lastName))
353 {
354 MainConsole.Instance.OutputFormat(
355 "Throttle log level for {0} ({1}) set to {2} in {3}",
356 sp.Name, sp.IsChildAgent ? "child" : "root", level, m_udpServer.Scene.Name);
357
358 ((LLClientView)sp.ControllingClient).UDPClient.ThrottleDebugLevel = level;
359 }
360 });
361 }
362
363 private void HandleThrottleSetCommand(string module, string[] args)
364 {
365 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene)
366 return;
367
368 bool all = args.Length == 6;
369 bool one = args.Length == 8;
370
371 if (!all && !one)
372 {
373 MainConsole.Instance.OutputFormat(
374 "Usage: debug lludp throttles set <param> <value> [<avatar-first-name> <avatar-last-name>]");
375 return;
376 }
377
378 string param = args[4];
379 string rawValue = args[5];
380
381 string firstName = null;
382 string lastName = null;
383
384 if (one)
385 {
386 firstName = args[6];
387 lastName = args[7];
388 }
389
390 if (param == "adaptive")
391 {
392 bool newValue;
393 if (!ConsoleUtil.TryParseConsoleBool(MainConsole.Instance, rawValue, out newValue))
394 return;
395
396 m_udpServer.Scene.ForEachScenePresence(sp =>
397 {
398 if (all || (sp.Firstname == firstName && sp.Lastname == lastName))
399 {
400 MainConsole.Instance.OutputFormat(
401 "Setting param {0} to {1} for {2} ({3}) in {4}",
402 param, newValue, sp.Name, sp.IsChildAgent ? "child" : "root", m_udpServer.Scene.Name);
403
404 LLUDPClient udpClient = ((LLClientView)sp.ControllingClient).UDPClient;
405 udpClient.FlowThrottle.AdaptiveEnabled = newValue;
406 // udpClient.FlowThrottle.MaxDripRate = 0;
407 // udpClient.FlowThrottle.AdjustedDripRate = 0;
408 }
409 });
410 }
411 else if (param == "request")
412 {
413 int newValue;
414 if (!ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, rawValue, out newValue))
415 return;
416
417 int newCurrentThrottleKbps = newValue * 1000 / 8;
418
419 m_udpServer.Scene.ForEachScenePresence(sp =>
420 {
421 if (all || (sp.Firstname == firstName && sp.Lastname == lastName))
422 {
423 MainConsole.Instance.OutputFormat(
424 "Setting param {0} to {1} for {2} ({3}) in {4}",
425 param, newValue, sp.Name, sp.IsChildAgent ? "child" : "root", m_udpServer.Scene.Name);
426
427 LLUDPClient udpClient = ((LLClientView)sp.ControllingClient).UDPClient;
428 udpClient.FlowThrottle.RequestedDripRate = newCurrentThrottleKbps;
429 }
430 });
431 }
432 else if (param == "max")
433 {
434 int newValue;
435 if (!ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, rawValue, out newValue))
436 return;
437
438 int newThrottleMaxKbps = newValue * 1000 / 8;
439
440 m_udpServer.Scene.ForEachScenePresence(sp =>
441 {
442 if (all || (sp.Firstname == firstName && sp.Lastname == lastName))
443 {
444 MainConsole.Instance.OutputFormat(
445 "Setting param {0} to {1} for {2} ({3}) in {4}",
446 param, newValue, sp.Name, sp.IsChildAgent ? "child" : "root", m_udpServer.Scene.Name);
447
448 LLUDPClient udpClient = ((LLClientView)sp.ControllingClient).UDPClient;
449 udpClient.FlowThrottle.MaxDripRate = newThrottleMaxKbps;
450 }
451 });
452 }
453 }
454
455 private void HandleThrottleGetCommand(string module, string[] args)
456 {
457 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene)
458 return;
459
460 bool all = args.Length == 4;
461 bool one = args.Length == 6;
462
463 if (!all && !one)
464 {
465 MainConsole.Instance.OutputFormat(
466 "Usage: debug lludp throttles get [<avatar-first-name> <avatar-last-name>]");
467 return;
468 }
469
470 string firstName = null;
471 string lastName = null;
472
473 if (one)
474 {
475 firstName = args[4];
476 lastName = args[5];
477 }
478
479 m_udpServer.Scene.ForEachScenePresence(sp =>
480 {
481 if (all || (sp.Firstname == firstName && sp.Lastname == lastName))
482 {
483 m_console.OutputFormat(
484 "Status for {0} ({1}) in {2}",
485 sp.Name, sp.IsChildAgent ? "child" : "root", m_udpServer.Scene.Name);
486
487 LLUDPClient udpClient = ((LLClientView)sp.ControllingClient).UDPClient;
488
489 ConsoleDisplayList cdl = new ConsoleDisplayList();
490 cdl.AddRow("adaptive", udpClient.FlowThrottle.AdaptiveEnabled);
491 cdl.AddRow("current", string.Format("{0} kbps", udpClient.FlowThrottle.DripRate * 8 / 1000));
492 cdl.AddRow("request", string.Format("{0} kbps", udpClient.FlowThrottle.RequestedDripRate * 8 / 1000));
493 cdl.AddRow("max", string.Format("{0} kbps", udpClient.FlowThrottle.MaxDripRate * 8 / 1000));
494
495 m_console.Output(cdl.ToString());
496 }
497 });
498 }
499
500 private void HandleGetCommand(string module, string[] args)
501 {
502 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene)
503 return;
504
505 m_console.OutputFormat("Debug settings for {0}", m_udpServer.Scene.Name);
506 ConsoleDisplayList cdl = new ConsoleDisplayList();
507
508 long maxSceneDripRate = m_udpServer.Throttle.MaxDripRate;
509 cdl.AddRow(
510 "max-scene-throttle",
511 maxSceneDripRate != 0 ? string.Format("{0} kbps", maxSceneDripRate * 8 / 1000) : "unset");
512
513 int maxClientDripRate = m_udpServer.ThrottleRates.Total;
514 cdl.AddRow(
515 "max-new-client-throttle",
516 maxClientDripRate != 0 ? string.Format("{0} kbps", maxClientDripRate * 8 / 1000) : "unset");
517
518 m_console.Output(cdl.ToString());
519 }
520
521 private void HandleSetCommand(string module, string[] args)
522 {
523 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene)
524 return;
525
526 if (args.Length != 5)
527 {
528 MainConsole.Instance.OutputFormat("Usage: debug lludp set <param> <value>");
529 return;
530 }
531
532 string param = args[3];
533 string rawValue = args[4];
534
535 int newValue;
536
537 if (param == "max-scene-throttle")
538 {
539 if (!ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, rawValue, out newValue))
540 return;
541
542 m_udpServer.Throttle.MaxDripRate = newValue * 1000 / 8;
543 }
544 else if (param == "max-new-client-throttle")
545 {
546 if (!ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, rawValue, out newValue))
547 return;
548
549 m_udpServer.ThrottleRates.Total = newValue * 1000 / 8;
550 }
551 else
552 {
553 return;
554 }
555
556 m_console.OutputFormat("{0} set to {1} in {2}", param, rawValue, m_udpServer.Scene.Name);
557 }
558
559 private void HandleClientGetCommand(string module, string[] args)
560 {
561 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene)
562 return;
563
564 if (args.Length != 4 && args.Length != 6)
565 {
566 MainConsole.Instance.OutputFormat("Usage: debug lludp client get [<avatar-first-name> <avatar-last-name>]");
567 return;
568 }
569
570 string name = null;
571
572 if (args.Length == 6)
573 name = string.Format("{0} {1}", args[4], args[5]);
574
575 m_udpServer.Scene.ForEachScenePresence(
576 sp =>
577 {
578 if ((name == null || sp.Name == name) && sp.ControllingClient is LLClientView)
579 {
580 LLUDPClient udpClient = ((LLClientView)sp.ControllingClient).UDPClient;
581
582 m_console.OutputFormat(
583 "Client debug parameters for {0} ({1}) in {2}",
584 sp.Name, sp.IsChildAgent ? "child" : "root", m_udpServer.Scene.Name);
585
586 ConsoleDisplayList cdl = new ConsoleDisplayList();
587 cdl.AddRow("process-unacked-sends", udpClient.ProcessUnackedSends);
588
589 m_console.Output(cdl.ToString());
590 }
591 });
592 }
593
594 private void HandleClientSetCommand(string module, string[] args)
595 {
596 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene)
597 return;
598
599 if (args.Length != 6 && args.Length != 8)
600 {
601 MainConsole.Instance.OutputFormat("Usage: debug lludp client set <param> <value> [<avatar-first-name> <avatar-last-name>]");
602 return;
603 }
604
605 string param = args[4];
606 string rawValue = args[5];
607
608 string name = null;
609
610 if (args.Length == 8)
611 name = string.Format("{0} {1}", args[6], args[7]);
612
613 if (param == "process-unacked-sends")
614 {
615 bool newValue;
616
617 if (!ConsoleUtil.TryParseConsoleBool(MainConsole.Instance, rawValue, out newValue))
618 return;
619
620 m_udpServer.Scene.ForEachScenePresence(
621 sp =>
622 {
623 if ((name == null || sp.Name == name) && sp.ControllingClient is LLClientView)
624 {
625 LLUDPClient udpClient = ((LLClientView)sp.ControllingClient).UDPClient;
626 udpClient.ProcessUnackedSends = newValue;
627
628 m_console.OutputFormat("{0} set to {1} for {2} in {3}", param, newValue, sp.Name, m_udpServer.Scene.Name);
629 }
630 });
631 }
632 }
633
634 private void HandlePacketCommand(string module, string[] args)
635 {
636 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene)
637 return;
638
639 bool setAsDefaultLevel = false;
640 bool setAll = false;
641 OptionSet optionSet = new OptionSet()
642 .Add("default", o => setAsDefaultLevel = (o != null))
643 .Add("all", o => setAll = (o != null));
644 List<string> filteredArgs = optionSet.Parse(args);
645
646 string name = null;
647
648 if (filteredArgs.Count == 6)
649 {
650 if (!(setAsDefaultLevel || setAll))
651 {
652 name = string.Format("{0} {1}", filteredArgs[4], filteredArgs[5]);
653 }
654 else
655 {
656 MainConsole.Instance.OutputFormat("ERROR: Cannot specify a user name when setting default/all logging level");
657 return;
658 }
659 }
660
661 if (filteredArgs.Count > 3)
662 {
663 int newDebug;
664 if (int.TryParse(filteredArgs[3], out newDebug))
665 {
666 if (setAsDefaultLevel || setAll)
667 {
668 m_udpServer.DefaultClientPacketDebugLevel = newDebug;
669
670 MainConsole.Instance.OutputFormat(
671 "Packet debug for {0} clients set to {1} in {2}",
672 (setAll ? "all" : "future"), m_udpServer.DefaultClientPacketDebugLevel, m_udpServer.Scene.Name);
673
674 if (setAll)
675 {
676 m_udpServer.Scene.ForEachScenePresence(sp =>
677 {
678 MainConsole.Instance.OutputFormat(
679 "Packet debug for {0} ({1}) set to {2} in {3}",
680 sp.Name, sp.IsChildAgent ? "child" : "root", newDebug, m_udpServer.Scene.Name);
681
682 sp.ControllingClient.DebugPacketLevel = newDebug;
683 });
684 }
685 }
686 else
687 {
688 m_udpServer.Scene.ForEachScenePresence(sp =>
689 {
690 if (name == null || sp.Name == name)
691 {
692 MainConsole.Instance.OutputFormat(
693 "Packet debug for {0} ({1}) set to {2} in {3}",
694 sp.Name, sp.IsChildAgent ? "child" : "root", newDebug, m_udpServer.Scene.Name);
695
696 sp.ControllingClient.DebugPacketLevel = newDebug;
697 }
698 });
699 }
700 }
701 else
702 {
703 MainConsole.Instance.Output("Usage: debug lludp packet [--default | --all] 0..255 [<first-name> <last-name>]");
704 }
705 }
706 }
707
708 private void HandleDropCommand(string module, string[] args)
709 {
710 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene)
711 return;
712
713 if (args.Length != 6)
714 {
715 MainConsole.Instance.Output("Usage: debug lludp drop <in|out> <add|remove> <packet-name>");
716 return;
717 }
718
719 string direction = args[3];
720 string subCommand = args[4];
721 string packetName = args[5];
722
723 if (subCommand == "add")
724 {
725 MainConsole.Instance.OutputFormat(
726 "Adding packet {0} to {1} drop list for all connections in {2}",
727 direction, packetName, m_udpServer.Scene.Name);
728
729 m_udpServer.Scene.ForEachScenePresence(
730 sp =>
731 {
732 LLClientView llcv = (LLClientView)sp.ControllingClient;
733
734 if (direction == "in")
735 llcv.AddInPacketToDropSet(packetName);
736 else if (direction == "out")
737 llcv.AddOutPacketToDropSet(packetName);
738 }
739 );
740 }
741 else if (subCommand == "remove")
742 {
743 MainConsole.Instance.OutputFormat(
744 "Removing packet {0} from {1} drop list for all connections in {2}",
745 direction, packetName, m_udpServer.Scene.Name);
746
747 m_udpServer.Scene.ForEachScenePresence(
748 sp =>
749 {
750 LLClientView llcv = (LLClientView)sp.ControllingClient;
751
752 if (direction == "in")
753 llcv.RemoveInPacketFromDropSet(packetName);
754 else if (direction == "out")
755 llcv.RemoveOutPacketFromDropSet(packetName);
756 }
757 );
758 }
759 }
760
761 private void HandleStartCommand(string module, string[] args)
762 {
763 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene)
764 return;
765
766 if (args.Length != 4)
767 {
768 MainConsole.Instance.Output("Usage: debug lludp start <in|out|all>");
769 return;
770 }
771
772 string subCommand = args[3];
773
774 if (subCommand == "in" || subCommand == "all")
775 m_udpServer.StartInbound();
776
777 if (subCommand == "out" || subCommand == "all")
778 m_udpServer.StartOutbound();
779 }
780
781 private void HandleStopCommand(string module, string[] args)
782 {
783 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene)
784 return;
785
786 if (args.Length != 4)
787 {
788 MainConsole.Instance.Output("Usage: debug lludp stop <in|out|all>");
789 return;
790 }
791
792 string subCommand = args[3];
793
794 if (subCommand == "in" || subCommand == "all")
795 m_udpServer.StopInbound();
796
797 if (subCommand == "out" || subCommand == "all")
798 m_udpServer.StopOutbound();
799 }
800
801 private void HandlePoolCommand(string module, string[] args)
802 {
803 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene)
804 return;
805
806 if (args.Length != 4)
807 {
808 MainConsole.Instance.Output("Usage: debug lludp pool <on|off>");
809 return;
810 }
811
812 string enabled = args[3];
813
814 if (enabled == "on")
815 {
816 if (m_udpServer.EnablePools())
817 {
818 m_udpServer.EnablePoolStats();
819 MainConsole.Instance.OutputFormat("Packet pools enabled on {0}", m_udpServer.Scene.Name);
820 }
821 }
822 else if (enabled == "off")
823 {
824 if (m_udpServer.DisablePools())
825 {
826 m_udpServer.DisablePoolStats();
827 MainConsole.Instance.OutputFormat("Packet pools disabled on {0}", m_udpServer.Scene.Name);
828 }
829 }
830 else
831 {
832 MainConsole.Instance.Output("Usage: debug lludp pool <on|off>");
833 }
834 }
835
836 private void HandleAgentUpdateCommand(string module, string[] args)
837 {
838 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene)
839 return;
840
841 m_udpServer.DiscardInboundAgentUpdates = !m_udpServer.DiscardInboundAgentUpdates;
842
843 MainConsole.Instance.OutputFormat(
844 "Discard AgentUpdates now {0} for {1}", m_udpServer.DiscardInboundAgentUpdates, m_udpServer.Scene.Name);
845 }
846
847 private void HandleStatusCommand(string module, string[] args)
848 {
849 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene)
850 return;
851
852 MainConsole.Instance.OutputFormat(
853 "IN LLUDP packet processing for {0} is {1}", m_udpServer.Scene.Name, m_udpServer.IsRunningInbound ? "enabled" : "disabled");
854
855 MainConsole.Instance.OutputFormat(
856 "OUT LLUDP packet processing for {0} is {1}", m_udpServer.Scene.Name, m_udpServer.IsRunningOutbound ? "enabled" : "disabled");
857
858 MainConsole.Instance.OutputFormat("LLUDP pools in {0} are {1}", m_udpServer.Scene.Name, m_udpServer.UsePools ? "on" : "off");
859
860 MainConsole.Instance.OutputFormat(
861 "Packet debug level for new clients is {0}", m_udpServer.DefaultClientPacketDebugLevel);
862 }
863
864 private void HandleOqreCommand(string module, string[] args)
865 {
866 if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_udpServer.Scene)
867 return;
868
869 if (args.Length != 4)
870 {
871 MainConsole.Instance.Output("Usage: debug lludp oqre <stop|start|status>");
872 return;
873 }
874
875 string subCommand = args[3];
876
877 if (subCommand == "stop")
878 {
879 m_udpServer.OqrEngine.Stop();
880 MainConsole.Instance.OutputFormat("Stopped OQRE for {0}", m_udpServer.Scene.Name);
881 }
882 else if (subCommand == "start")
883 {
884 m_udpServer.OqrEngine.Start();
885 MainConsole.Instance.OutputFormat("Started OQRE for {0}", m_udpServer.Scene.Name);
886 }
887 else if (subCommand == "status")
888 {
889 MainConsole.Instance.OutputFormat("OQRE in {0}", m_udpServer.Scene.Name);
890 MainConsole.Instance.OutputFormat("Running: {0}", m_udpServer.OqrEngine.IsRunning);
891 MainConsole.Instance.OutputFormat(
892 "Requests waiting: {0}",
893 m_udpServer.OqrEngine.IsRunning ? m_udpServer.OqrEngine.JobsWaiting.ToString() : "n/a");
894 }
895 else
896 {
897 MainConsole.Instance.OutputFormat("Unrecognized OQRE subcommand {0}", subCommand);
898 }
899 }
900 }
901} \ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs
index 0030dee..7171974 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs
@@ -107,6 +107,62 @@ namespace OpenMetaverse
107 /// </summary> 107 /// </summary>
108 public float AverageReceiveTicksForLastSamplePeriod { get; private set; } 108 public float AverageReceiveTicksForLastSamplePeriod { get; private set; }
109 109
110 #region PacketDropDebugging
111 /// <summary>
112 /// For debugging purposes only... random number generator for dropping
113 /// outbound packets.
114 /// </summary>
115 private Random m_dropRandomGenerator = new Random();
116
117 /// <summary>
118 /// For debugging purposes only... parameters for a simplified
119 /// model of packet loss with bursts, overall drop rate should
120 /// be roughly 1 - m_dropLengthProbability / (m_dropProbabiliy + m_dropLengthProbability)
121 /// which is about 1% for parameters 0.0015 and 0.15
122 /// </summary>
123 private double m_dropProbability = 0.0030;
124 private double m_dropLengthProbability = 0.15;
125 private bool m_dropState = false;
126
127 /// <summary>
128 /// For debugging purposes only... parameters to control the time
129 /// duration over which packet loss bursts can occur, if no packets
130 /// have been sent for m_dropResetTicks milliseconds, then reset the
131 /// state of the packet dropper to its default.
132 /// </summary>
133 private int m_dropLastTick = 0;
134 private int m_dropResetTicks = 500;
135
136 /// <summary>
137 /// Debugging code used to simulate dropped packets with bursts
138 /// </summary>
139 private bool DropOutgoingPacket()
140 {
141 double rnum = m_dropRandomGenerator.NextDouble();
142
143 // if the connection has been idle for awhile (more than m_dropResetTicks) then
144 // reset the state to the default state, don't continue a burst
145 int curtick = Util.EnvironmentTickCount();
146 if (Util.EnvironmentTickCountSubtract(curtick, m_dropLastTick) > m_dropResetTicks)
147 m_dropState = false;
148
149 m_dropLastTick = curtick;
150
151 // if we are dropping packets, then the probability of dropping
152 // this packet is the probability that we stay in the burst
153 if (m_dropState)
154 {
155 m_dropState = (rnum < (1.0 - m_dropLengthProbability)) ? true : false;
156 }
157 else
158 {
159 m_dropState = (rnum < m_dropProbability) ? true : false;
160 }
161
162 return m_dropState;
163 }
164 #endregion PacketDropDebugging
165
110 /// <summary> 166 /// <summary>
111 /// Default constructor 167 /// Default constructor
112 /// </summary> 168 /// </summary>
@@ -117,6 +173,10 @@ namespace OpenMetaverse
117 { 173 {
118 m_localBindAddress = bindAddress; 174 m_localBindAddress = bindAddress;
119 m_udpPort = port; 175 m_udpPort = port;
176
177 // for debugging purposes only, initializes the random number generator
178 // used for simulating packet loss
179 // m_dropRandomGenerator = new Random();
120 } 180 }
121 181
122 /// <summary> 182 /// <summary>
@@ -135,7 +195,7 @@ namespace OpenMetaverse
135 /// manner (not throwing an exception when the remote side resets the 195 /// manner (not throwing an exception when the remote side resets the
136 /// connection). This call is ignored on Mono where the flag is not 196 /// connection). This call is ignored on Mono where the flag is not
137 /// necessary</remarks> 197 /// necessary</remarks>
138 public void StartInbound(int recvBufferSize, bool asyncPacketHandling) 198 public virtual void StartInbound(int recvBufferSize, bool asyncPacketHandling)
139 { 199 {
140 m_asyncPacketHandling = asyncPacketHandling; 200 m_asyncPacketHandling = asyncPacketHandling;
141 201
@@ -158,6 +218,17 @@ namespace OpenMetaverse
158 218
159 try 219 try
160 { 220 {
221 if (m_udpSocket.Ttl < 128)
222 {
223 m_udpSocket.Ttl = 128;
224 }
225 }
226 catch (SocketException)
227 {
228 m_log.Debug("[UDPBASE]: Failed to increase default TTL");
229 }
230 try
231 {
161 // This udp socket flag is not supported under mono, 232 // This udp socket flag is not supported under mono,
162 // so we'll catch the exception and continue 233 // so we'll catch the exception and continue
163 m_udpSocket.IOControl(SIO_UDP_CONNRESET, new byte[] { 0 }, null); 234 m_udpSocket.IOControl(SIO_UDP_CONNRESET, new byte[] { 0 }, null);
@@ -168,6 +239,12 @@ namespace OpenMetaverse
168 m_log.Debug("[UDPBASE]: SIO_UDP_CONNRESET flag not supported on this platform, ignoring"); 239 m_log.Debug("[UDPBASE]: SIO_UDP_CONNRESET flag not supported on this platform, ignoring");
169 } 240 }
170 241
242 // On at least Mono 3.2.8, multiple UDP sockets can bind to the same port by default. At the moment
243 // we never want two regions to listen on the same port as they cannot demultiplex each other's messages,
244 // leading to a confusing bug.
245 // By default, Windows does not allow two sockets to bind to the same port.
246 m_udpSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, false);
247
171 if (recvBufferSize != 0) 248 if (recvBufferSize != 0)
172 m_udpSocket.ReceiveBufferSize = recvBufferSize; 249 m_udpSocket.ReceiveBufferSize = recvBufferSize;
173 250
@@ -185,14 +262,14 @@ namespace OpenMetaverse
185 /// <summary> 262 /// <summary>
186 /// Start outbound UDP packet handling. 263 /// Start outbound UDP packet handling.
187 /// </summary> 264 /// </summary>
188 public void StartOutbound() 265 public virtual void StartOutbound()
189 { 266 {
190 m_log.DebugFormat("[UDPBASE]: Starting outbound UDP loop"); 267 m_log.DebugFormat("[UDPBASE]: Starting outbound UDP loop");
191 268
192 IsRunningOutbound = true; 269 IsRunningOutbound = true;
193 } 270 }
194 271
195 public void StopInbound() 272 public virtual void StopInbound()
196 { 273 {
197 if (IsRunningInbound) 274 if (IsRunningInbound)
198 { 275 {
@@ -203,14 +280,14 @@ namespace OpenMetaverse
203 } 280 }
204 } 281 }
205 282
206 public void StopOutbound() 283 public virtual void StopOutbound()
207 { 284 {
208 m_log.DebugFormat("[UDPBASE]: Stopping outbound UDP loop"); 285 m_log.DebugFormat("[UDPBASE]: Stopping outbound UDP loop");
209 286
210 IsRunningOutbound = false; 287 IsRunningOutbound = false;
211 } 288 }
212 289
213 protected virtual bool EnablePools() 290 public virtual bool EnablePools()
214 { 291 {
215 if (!UsePools) 292 if (!UsePools)
216 { 293 {
@@ -224,7 +301,7 @@ namespace OpenMetaverse
224 return false; 301 return false;
225 } 302 }
226 303
227 protected virtual bool DisablePools() 304 public virtual bool DisablePools()
228 { 305 {
229 if (UsePools) 306 if (UsePools)
230 { 307 {
@@ -389,6 +466,12 @@ namespace OpenMetaverse
389 { 466 {
390// if (IsRunningOutbound) 467// if (IsRunningOutbound)
391// { 468// {
469
470 // This is strictly for debugging purposes to simulate dropped
471 // packets when testing throttles & retransmission code
472 // if (DropOutgoingPacket())
473 // return;
474
392 try 475 try
393 { 476 {
394 m_udpSocket.BeginSendTo( 477 m_udpSocket.BeginSendTo(
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs b/OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs
index f8d0c02..8795c0c 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.8.0.*")] 32[assembly: AssemblyVersion("0.8.2.*")]
33 33
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs
index 9700224..a935dd2 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs
@@ -36,7 +36,6 @@ using OpenSim.Framework;
36using OpenSim.Framework.Monitoring; 36using OpenSim.Framework.Monitoring;
37using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Tests.Common; 38using OpenSim.Tests.Common;
39using OpenSim.Tests.Common.Mock;
40 39
41namespace OpenSim.Region.ClientStack.LindenUDP.Tests 40namespace OpenSim.Region.ClientStack.LindenUDP.Tests
42{ 41{
@@ -47,7 +46,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
47 public class BasicCircuitTests : OpenSimTestCase 46 public class BasicCircuitTests : OpenSimTestCase
48 { 47 {
49 private Scene m_scene; 48 private Scene m_scene;
50 private TestLLUDPServer m_udpServer;
51 49
52 [TestFixtureSetUp] 50 [TestFixtureSetUp]
53 public void FixtureInit() 51 public void FixtureInit()
@@ -73,72 +71,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
73 StatsManager.SimExtraStats = new SimExtraStatsCollector(); 71 StatsManager.SimExtraStats = new SimExtraStatsCollector();
74 } 72 }
75 73
76 /// <summary> 74// /// <summary>
77 /// Build an object name packet for test purposes 75// /// Build an object name packet for test purposes
78 /// </summary> 76// /// </summary>
79 /// <param name="objectLocalId"></param> 77// /// <param name="objectLocalId"></param>
80 /// <param name="objectName"></param> 78// /// <param name="objectName"></param>
81 private ObjectNamePacket BuildTestObjectNamePacket(uint objectLocalId, string objectName) 79// private ObjectNamePacket BuildTestObjectNamePacket(uint objectLocalId, string objectName)
82 { 80// {
83 ObjectNamePacket onp = new ObjectNamePacket(); 81// ObjectNamePacket onp = new ObjectNamePacket();
84 ObjectNamePacket.ObjectDataBlock odb = new ObjectNamePacket.ObjectDataBlock(); 82// ObjectNamePacket.ObjectDataBlock odb = new ObjectNamePacket.ObjectDataBlock();
85 odb.LocalID = objectLocalId; 83// odb.LocalID = objectLocalId;
86 odb.Name = Utils.StringToBytes(objectName); 84// odb.Name = Utils.StringToBytes(objectName);
87 onp.ObjectData = new ObjectNamePacket.ObjectDataBlock[] { odb }; 85// onp.ObjectData = new ObjectNamePacket.ObjectDataBlock[] { odb };
88 onp.Header.Zerocoded = false; 86// onp.Header.Zerocoded = false;
89 87//
90 return onp; 88// return onp;
91 } 89// }
92 90//
93 private void AddUdpServer()
94 {
95 AddUdpServer(new IniConfigSource());
96 }
97
98 private void AddUdpServer(IniConfigSource configSource)
99 {
100 uint port = 0;
101 AgentCircuitManager acm = m_scene.AuthenticateHandler;
102
103 m_udpServer = new TestLLUDPServer(IPAddress.Any, ref port, 0, false, configSource, acm);
104 m_udpServer.AddScene(m_scene);
105 }
106
107 /// <summary>
108 /// Used by tests that aren't testing this stage.
109 /// </summary>
110 private ScenePresence AddClient()
111 {
112 UUID myAgentUuid = TestHelpers.ParseTail(0x1);
113 UUID mySessionUuid = TestHelpers.ParseTail(0x2);
114 uint myCircuitCode = 123456;
115 IPEndPoint testEp = new IPEndPoint(IPAddress.Loopback, 999);
116
117 UseCircuitCodePacket uccp = new UseCircuitCodePacket();
118
119 UseCircuitCodePacket.CircuitCodeBlock uccpCcBlock
120 = new UseCircuitCodePacket.CircuitCodeBlock();
121 uccpCcBlock.Code = myCircuitCode;
122 uccpCcBlock.ID = myAgentUuid;
123 uccpCcBlock.SessionID = mySessionUuid;
124 uccp.CircuitCode = uccpCcBlock;
125
126 byte[] uccpBytes = uccp.ToBytes();
127 UDPPacketBuffer upb = new UDPPacketBuffer(testEp, uccpBytes.Length);
128 upb.DataLength = uccpBytes.Length; // God knows why this isn't set by the constructor.
129 Buffer.BlockCopy(uccpBytes, 0, upb.Data, 0, uccpBytes.Length);
130
131 AgentCircuitData acd = new AgentCircuitData();
132 acd.AgentID = myAgentUuid;
133 acd.SessionID = mySessionUuid;
134
135 m_scene.AuthenticateHandler.AddNewCircuit(myCircuitCode, acd);
136
137 m_udpServer.PacketReceived(upb);
138
139 return m_scene.GetScenePresence(myAgentUuid);
140 }
141
142 /// <summary> 91 /// <summary>
143 /// Test adding a client to the stack 92 /// Test adding a client to the stack
144 /// </summary> 93 /// </summary>
@@ -148,7 +97,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
148 TestHelpers.InMethod(); 97 TestHelpers.InMethod();
149// TestHelpers.EnableLogging(); 98// TestHelpers.EnableLogging();
150 99
151 AddUdpServer(); 100 TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(m_scene);
152 101
153 UUID myAgentUuid = TestHelpers.ParseTail(0x1); 102 UUID myAgentUuid = TestHelpers.ParseTail(0x1);
154 UUID mySessionUuid = TestHelpers.ParseTail(0x2); 103 UUID mySessionUuid = TestHelpers.ParseTail(0x2);
@@ -169,7 +118,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
169 upb.DataLength = uccpBytes.Length; // God knows why this isn't set by the constructor. 118 upb.DataLength = uccpBytes.Length; // God knows why this isn't set by the constructor.
170 Buffer.BlockCopy(uccpBytes, 0, upb.Data, 0, uccpBytes.Length); 119 Buffer.BlockCopy(uccpBytes, 0, upb.Data, 0, uccpBytes.Length);
171 120
172 m_udpServer.PacketReceived(upb); 121 udpServer.PacketReceived(upb);
173 122
174 // Presence shouldn't exist since the circuit manager doesn't know about this circuit for authentication yet 123 // Presence shouldn't exist since the circuit manager doesn't know about this circuit for authentication yet
175 Assert.That(m_scene.GetScenePresence(myAgentUuid), Is.Null); 124 Assert.That(m_scene.GetScenePresence(myAgentUuid), Is.Null);
@@ -180,15 +129,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
180 129
181 m_scene.AuthenticateHandler.AddNewCircuit(myCircuitCode, acd); 130 m_scene.AuthenticateHandler.AddNewCircuit(myCircuitCode, acd);
182 131
183 m_udpServer.PacketReceived(upb); 132 udpServer.PacketReceived(upb);
184 133
185 // Should succeed now 134 // Should succeed now
186 ScenePresence sp = m_scene.GetScenePresence(myAgentUuid); 135 ScenePresence sp = m_scene.GetScenePresence(myAgentUuid);
187 Assert.That(sp.UUID, Is.EqualTo(myAgentUuid)); 136 Assert.That(sp.UUID, Is.EqualTo(myAgentUuid));
188 137
189 Assert.That(m_udpServer.PacketsSent.Count, Is.EqualTo(1)); 138 Assert.That(udpServer.PacketsSent.Count, Is.EqualTo(1));
190 139
191 Packet packet = m_udpServer.PacketsSent[0]; 140 Packet packet = udpServer.PacketsSent[0];
192 Assert.That(packet, Is.InstanceOf(typeof(PacketAckPacket))); 141 Assert.That(packet, Is.InstanceOf(typeof(PacketAckPacket)));
193 142
194 PacketAckPacket ackPacket = packet as PacketAckPacket; 143 PacketAckPacket ackPacket = packet as PacketAckPacket;
@@ -200,15 +149,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
200 public void TestLogoutClientDueToAck() 149 public void TestLogoutClientDueToAck()
201 { 150 {
202 TestHelpers.InMethod(); 151 TestHelpers.InMethod();
203 TestHelpers.EnableLogging(); 152// TestHelpers.EnableLogging();
204 153
205 IniConfigSource ics = new IniConfigSource(); 154 IniConfigSource ics = new IniConfigSource();
206 IConfig config = ics.AddConfig("ClientStack.LindenUDP"); 155 IConfig config = ics.AddConfig("ClientStack.LindenUDP");
207 config.Set("AckTimeout", -1); 156 config.Set("AckTimeout", -1);
208 AddUdpServer(ics); 157 TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(m_scene, ics);
158
159 ScenePresence sp
160 = ClientStackHelpers.AddChildClient(
161 m_scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456);
209 162
210 ScenePresence sp = AddClient(); 163 udpServer.ClientOutgoingPacketHandler(sp.ControllingClient, true, false, false);
211 m_udpServer.ClientOutgoingPacketHandler(sp.ControllingClient, true, false, false);
212 164
213 ScenePresence spAfterAckTimeout = m_scene.GetScenePresence(sp.UUID); 165 ScenePresence spAfterAckTimeout = m_scene.GetScenePresence(sp.UUID);
214 Assert.That(spAfterAckTimeout, Is.Null); 166 Assert.That(spAfterAckTimeout, Is.Null);
@@ -233,7 +185,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
233// testLLUDPServer.RemoveClientCircuit(myCircuitCode); 185// testLLUDPServer.RemoveClientCircuit(myCircuitCode);
234// Assert.IsFalse(testLLUDPServer.HasCircuit(myCircuitCode)); 186// Assert.IsFalse(testLLUDPServer.HasCircuit(myCircuitCode));
235// 187//
236// // Check that removing a non-existant circuit doesn't have any bad effects 188// // Check that removing a non-existent circuit doesn't have any bad effects
237// testLLUDPServer.RemoveClientCircuit(101); 189// testLLUDPServer.RemoveClientCircuit(101);
238// Assert.IsFalse(testLLUDPServer.HasCircuit(101)); 190// Assert.IsFalse(testLLUDPServer.HasCircuit(101));
239// } 191// }
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs
index 575e54c..6c57e6d 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs
@@ -39,7 +39,6 @@ using OpenSim.Framework;
39using OpenSim.Region.CoreModules.Agent.TextureSender; 39using OpenSim.Region.CoreModules.Agent.TextureSender;
40using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Tests.Common; 41using OpenSim.Tests.Common;
42using OpenSim.Tests.Common.Mock;
43 42
44namespace OpenSim.Region.ClientStack.LindenUDP.Tests 43namespace OpenSim.Region.ClientStack.LindenUDP.Tests
45{ 44{
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/PacketHandlerTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/PacketHandlerTests.cs
index 5f73a94..92f1fc3 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/PacketHandlerTests.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/PacketHandlerTests.cs
@@ -30,7 +30,6 @@ using NUnit.Framework;
30using OpenMetaverse; 30using OpenMetaverse;
31using OpenMetaverse.Packets; 31using OpenMetaverse.Packets;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Tests.Common.Mock;
34using OpenSim.Tests.Common; 33using OpenSim.Tests.Common;
35 34
36namespace OpenSim.Region.ClientStack.LindenUDP.Tests 35namespace OpenSim.Region.ClientStack.LindenUDP.Tests
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs
deleted file mode 100644
index 27b9e5b..0000000
--- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/TestLLUDPServer.cs
+++ /dev/null
@@ -1,170 +0,0 @@
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
28using System;
29using System.Collections.Generic;
30using System.Net;
31using System.Net.Sockets;
32using Nini.Config;
33using OpenMetaverse.Packets;
34using OpenSim.Framework;
35
36namespace OpenSim.Region.ClientStack.LindenUDP.Tests
37{
38 /// <summary>
39 /// This class enables regression testing of the LLUDPServer by allowing us to intercept outgoing data.
40 /// </summary>
41 public class TestLLUDPServer : LLUDPServer
42 {
43 public List<Packet> PacketsSent { get; private set; }
44
45 public TestLLUDPServer(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager)
46 : base(listenIP, ref port, proxyPortOffsetParm, allow_alternate_port, configSource, circuitManager)
47 {
48 PacketsSent = new List<Packet>();
49 }
50
51 public override void SendAckImmediate(IPEndPoint remoteEndpoint, PacketAckPacket ack)
52 {
53 PacketsSent.Add(ack);
54 }
55
56 public override void SendPacket(
57 LLUDPClient udpClient, Packet packet, ThrottleOutPacketType category, bool allowSplitting, UnackedPacketMethod method)
58 {
59 PacketsSent.Add(packet);
60 }
61
62 public void ClientOutgoingPacketHandler(IClientAPI client, bool resendUnacked, bool sendAcks, bool sendPing)
63 {
64 m_resendUnacked = resendUnacked;
65 m_sendAcks = sendAcks;
66 m_sendPing = sendPing;
67
68 ClientOutgoingPacketHandler(client);
69 }
70
71//// /// <summary>
72//// /// The chunks of data to pass to the LLUDPServer when it calls EndReceive
73//// /// </summary>
74//// protected Queue<ChunkSenderTuple> m_chunksToLoad = new Queue<ChunkSenderTuple>();
75//
76//// protected override void BeginReceive()
77//// {
78//// if (m_chunksToLoad.Count > 0 && m_chunksToLoad.Peek().BeginReceiveException)
79//// {
80//// ChunkSenderTuple tuple = m_chunksToLoad.Dequeue();
81//// reusedEpSender = tuple.Sender;
82//// throw new SocketException();
83//// }
84//// }
85//
86//// protected override bool EndReceive(out int numBytes, IAsyncResult result, ref EndPoint epSender)
87//// {
88//// numBytes = 0;
89////
90//// //m_log.Debug("Queue size " + m_chunksToLoad.Count);
91////
92//// if (m_chunksToLoad.Count <= 0)
93//// return false;
94////
95//// ChunkSenderTuple tuple = m_chunksToLoad.Dequeue();
96//// RecvBuffer = tuple.Data;
97//// numBytes = tuple.Data.Length;
98//// epSender = tuple.Sender;
99////
100//// return true;
101//// }
102//
103//// public override void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode)
104//// {
105//// // Don't do anything just yet
106//// }
107//
108// /// <summary>
109// /// Signal that this chunk should throw an exception on Socket.BeginReceive()
110// /// </summary>
111// /// <param name="epSender"></param>
112// public void LoadReceiveWithBeginException(EndPoint epSender)
113// {
114// ChunkSenderTuple tuple = new ChunkSenderTuple(epSender);
115// tuple.BeginReceiveException = true;
116// m_chunksToLoad.Enqueue(tuple);
117// }
118//
119// /// <summary>
120// /// Load some data to be received by the LLUDPServer on the next receive call
121// /// </summary>
122// /// <param name="data"></param>
123// /// <param name="epSender"></param>
124// public void LoadReceive(byte[] data, EndPoint epSender)
125// {
126// m_chunksToLoad.Enqueue(new ChunkSenderTuple(data, epSender));
127// }
128//
129// /// <summary>
130// /// Load a packet to be received by the LLUDPServer on the next receive call
131// /// </summary>
132// /// <param name="packet"></param>
133// public void LoadReceive(Packet packet, EndPoint epSender)
134// {
135// LoadReceive(packet.ToBytes(), epSender);
136// }
137//
138// /// <summary>
139// /// Calls the protected asynchronous result method. This fires out all data chunks currently queued for send
140// /// </summary>
141// /// <param name="result"></param>
142// public void ReceiveData(IAsyncResult result)
143// {
144// // Doesn't work the same way anymore
145//// while (m_chunksToLoad.Count > 0)
146//// OnReceivedData(result);
147// }
148 }
149
150 /// <summary>
151 /// Record the data and sender tuple
152 /// </summary>
153 public class ChunkSenderTuple
154 {
155 public byte[] Data;
156 public EndPoint Sender;
157 public bool BeginReceiveException;
158
159 public ChunkSenderTuple(byte[] data, EndPoint sender)
160 {
161 Data = data;
162 Sender = sender;
163 }
164
165 public ChunkSenderTuple(EndPoint sender)
166 {
167 Sender = sender;
168 }
169 }
170}
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs
new file mode 100644
index 0000000..3c82a78
--- /dev/null
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/ThrottleTests.cs
@@ -0,0 +1,427 @@
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
28using System;
29using Nini.Config;
30using NUnit.Framework;
31using OpenMetaverse.Packets;
32using OpenSim.Framework;
33using OpenSim.Region.Framework.Scenes;
34using OpenSim.Tests.Common;
35
36namespace OpenSim.Region.ClientStack.LindenUDP.Tests
37{
38 [TestFixture]
39 public class ThrottleTests : OpenSimTestCase
40 {
41 [TestFixtureSetUp]
42 public void FixtureInit()
43 {
44 // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread.
45 Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest;
46 }
47
48 [TestFixtureTearDown]
49 public void TearDown()
50 {
51 // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple
52 // threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression
53 // tests really shouldn't).
54 Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
55 }
56
57 [Test]
58 public void TestSetRequestDripRate()
59 {
60 TestHelpers.InMethod();
61
62 TokenBucket tb = new TokenBucket("tb", null, 5000, 0);
63 AssertRates(tb, 5000, 0, 5000, 0);
64
65 tb.RequestedDripRate = 4000;
66 AssertRates(tb, 4000, 0, 4000, 0);
67
68 tb.RequestedDripRate = 6000;
69 AssertRates(tb, 6000, 0, 6000, 0);
70 }
71
72 [Test]
73 public void TestSetRequestDripRateWithMax()
74 {
75 TestHelpers.InMethod();
76
77 TokenBucket tb = new TokenBucket("tb", null, 5000, 10000);
78 AssertRates(tb, 5000, 0, 5000, 10000);
79
80 tb.RequestedDripRate = 4000;
81 AssertRates(tb, 4000, 0, 4000, 10000);
82
83 tb.RequestedDripRate = 6000;
84 AssertRates(tb, 6000, 0, 6000, 10000);
85
86 tb.RequestedDripRate = 12000;
87 AssertRates(tb, 10000, 0, 10000, 10000);
88 }
89
90 [Test]
91 public void TestSetRequestDripRateWithChildren()
92 {
93 TestHelpers.InMethod();
94
95 TokenBucket tbParent = new TokenBucket("tbParent", null, 0, 0);
96 TokenBucket tbChild1 = new TokenBucket("tbChild1", tbParent, 3000, 0);
97 TokenBucket tbChild2 = new TokenBucket("tbChild2", tbParent, 5000, 0);
98
99 AssertRates(tbParent, 8000, 8000, 8000, 0);
100 AssertRates(tbChild1, 3000, 0, 3000, 0);
101 AssertRates(tbChild2, 5000, 0, 5000, 0);
102
103 // Test: Setting a parent request greater than total children requests.
104 tbParent.RequestedDripRate = 10000;
105
106 AssertRates(tbParent, 10000, 8000, 8000, 0);
107 AssertRates(tbChild1, 3000, 0, 3000, 0);
108 AssertRates(tbChild2, 5000, 0, 5000, 0);
109
110 // Test: Setting a parent request lower than total children requests.
111 tbParent.RequestedDripRate = 6000;
112
113 AssertRates(tbParent, 6000, 8000, 6000, 0);
114 AssertRates(tbChild1, 3000, 0, 6000 / 8 * 3, 0);
115 AssertRates(tbChild2, 5000, 0, 6000 / 8 * 5, 0);
116 }
117
118 private void AssertRates(
119 TokenBucket tb, double requestedDripRate, double totalDripRequest, double dripRate, double maxDripRate)
120 {
121 Assert.AreEqual((int)requestedDripRate, tb.RequestedDripRate, "Requested drip rate");
122 Assert.AreEqual((int)totalDripRequest, tb.TotalDripRequest, "Total drip request");
123 Assert.AreEqual((int)dripRate, tb.DripRate, "Drip rate");
124 Assert.AreEqual((int)maxDripRate, tb.MaxDripRate, "Max drip rate");
125 }
126
127 [Test]
128 public void TestClientThrottleSetNoLimit()
129 {
130 TestHelpers.InMethod();
131// TestHelpers.EnableLogging();
132
133 Scene scene = new SceneHelpers().SetupScene();
134 TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(scene);
135
136 ScenePresence sp
137 = ClientStackHelpers.AddChildClient(
138 scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456);
139
140 LLUDPClient udpClient = ((LLClientView)sp.ControllingClient).UDPClient;
141
142 udpServer.Throttle.DebugLevel = 1;
143 udpClient.ThrottleDebugLevel = 1;
144
145 int resendBytes = 1000;
146 int landBytes = 2000;
147 int windBytes = 3000;
148 int cloudBytes = 4000;
149 int taskBytes = 5000;
150 int textureBytes = 6000;
151 int assetBytes = 7000;
152
153 SetThrottles(
154 udpClient, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes);
155
156 // We expect this to be lower because of the minimum bound set by MTU
157 int totalBytes = LLUDPServer.MTU + landBytes + windBytes + cloudBytes + taskBytes + textureBytes + assetBytes;
158
159 AssertThrottles(
160 udpClient,
161 LLUDPServer.MTU, landBytes, windBytes, cloudBytes, taskBytes,
162 textureBytes, assetBytes, totalBytes, 0, 0);
163 }
164
165 [Test]
166 public void TestClientThrottleAdaptiveNoLimit()
167 {
168 TestHelpers.InMethod();
169// TestHelpers.EnableLogging();
170
171 Scene scene = new SceneHelpers().SetupScene();
172
173 IniConfigSource ics = new IniConfigSource();
174 IConfig config = ics.AddConfig("ClientStack.LindenUDP");
175 config.Set("enable_adaptive_throttles", true);
176 config.Set("adaptive_throttle_min_bps", 32000);
177
178 TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(scene, ics);
179
180 ScenePresence sp
181 = ClientStackHelpers.AddChildClient(
182 scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456);
183
184 LLUDPClient udpClient = ((LLClientView)sp.ControllingClient).UDPClient;
185
186 udpServer.Throttle.DebugLevel = 1;
187 udpClient.ThrottleDebugLevel = 1;
188
189 // Total is 275000
190 int resendBytes = 5000; // this is set low to test the minimum throttle override
191 int landBytes = 20000;
192 int windBytes = 30000;
193 int cloudBytes = 40000;
194 int taskBytes = 50000;
195 int textureBytes = 60000;
196 int assetBytes = 70000;
197 int totalBytes = resendBytes + landBytes + windBytes + cloudBytes + taskBytes + textureBytes + assetBytes;
198
199 SetThrottles(
200 udpClient, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes);
201
202 // Ratio of current adaptive drip rate to requested bytes, minimum rate is 32000
203 double commitRatio = 32000.0 / totalBytes;
204
205 AssertThrottles(
206 udpClient,
207 LLUDPServer.MTU, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio,
208 textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0);
209
210 // Test an increase in target throttle, ack of 20 packets adds 20 * LLUDPServer.MTU bytes
211 // to the throttle, recompute commitratio from those numbers
212 udpClient.FlowThrottle.AcknowledgePackets(20);
213 commitRatio = (32000.0 + 20.0 * LLUDPServer.MTU) / totalBytes;
214
215 AssertThrottles(
216 udpClient,
217 LLUDPServer.MTU, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio,
218 textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0);
219
220 // Test a decrease in target throttle, adaptive throttle should cut the rate by 50% with a floor
221 // set by the minimum adaptive rate
222 udpClient.FlowThrottle.ExpirePackets(1);
223 commitRatio = (32000.0 + (20.0 * LLUDPServer.MTU)/Math.Pow(2,1)) / totalBytes;
224
225 AssertThrottles(
226 udpClient,
227 LLUDPServer.MTU, landBytes * commitRatio, windBytes * commitRatio, cloudBytes * commitRatio, taskBytes * commitRatio,
228 textureBytes * commitRatio, assetBytes * commitRatio, udpClient.FlowThrottle.AdjustedDripRate, totalBytes, 0);
229 }
230
231 /// <summary>
232 /// Test throttle setttings where max client throttle has been limited server side.
233 /// </summary>
234 [Test]
235 public void TestSingleClientThrottleRegionLimited()
236 {
237 TestHelpers.InMethod();
238 // TestHelpers.EnableLogging();
239
240 int resendBytes = 6000;
241 int landBytes = 8000;
242 int windBytes = 10000;
243 int cloudBytes = 12000;
244 int taskBytes = 14000;
245 int textureBytes = 16000;
246 int assetBytes = 18000;
247 int totalBytes
248 = (int)((resendBytes + landBytes + windBytes + cloudBytes + taskBytes + textureBytes + assetBytes) / 2);
249
250 Scene scene = new SceneHelpers().SetupScene();
251 TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(scene);
252 udpServer.Throttle.RequestedDripRate = totalBytes;
253
254 ScenePresence sp1
255 = ClientStackHelpers.AddChildClient(
256 scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456);
257
258 LLUDPClient udpClient1 = ((LLClientView)sp1.ControllingClient).UDPClient;
259
260 SetThrottles(
261 udpClient1, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes);
262
263 AssertThrottles(
264 udpClient1,
265 resendBytes / 2, landBytes / 2, windBytes / 2, cloudBytes / 2, taskBytes / 2,
266 textureBytes / 2, assetBytes / 2, totalBytes, 0, 0);
267
268 // Test: Now add another client
269 ScenePresence sp2
270 = ClientStackHelpers.AddChildClient(
271 scene, udpServer, TestHelpers.ParseTail(0x10), TestHelpers.ParseTail(0x20), 123457);
272
273 LLUDPClient udpClient2 = ((LLClientView)sp2.ControllingClient).UDPClient;
274 // udpClient.ThrottleDebugLevel = 1;
275
276 SetThrottles(
277 udpClient2, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes);
278
279 AssertThrottles(
280 udpClient1,
281 resendBytes / 4, landBytes / 4, windBytes / 4, cloudBytes / 4, taskBytes / 4,
282 textureBytes / 4, assetBytes / 4, totalBytes / 2, 0, 0);
283
284 AssertThrottles(
285 udpClient2,
286 resendBytes / 4, landBytes / 4, windBytes / 4, cloudBytes / 4, taskBytes / 4,
287 textureBytes / 4, assetBytes / 4, totalBytes / 2, 0, 0);
288 }
289
290 /// <summary>
291 /// Test throttle setttings where max client throttle has been limited server side.
292 /// </summary>
293 [Test]
294 public void TestClientThrottlePerClientLimited()
295 {
296 TestHelpers.InMethod();
297 // TestHelpers.EnableLogging();
298
299 int resendBytes = 4000;
300 int landBytes = 6000;
301 int windBytes = 8000;
302 int cloudBytes = 10000;
303 int taskBytes = 12000;
304 int textureBytes = 14000;
305 int assetBytes = 16000;
306 int totalBytes
307 = (int)((resendBytes + landBytes + windBytes + cloudBytes + taskBytes + textureBytes + assetBytes) / 2);
308
309 Scene scene = new SceneHelpers().SetupScene();
310 TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(scene);
311 udpServer.ThrottleRates.Total = totalBytes;
312
313 ScenePresence sp
314 = ClientStackHelpers.AddChildClient(
315 scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456);
316
317 LLUDPClient udpClient = ((LLClientView)sp.ControllingClient).UDPClient;
318 // udpClient.ThrottleDebugLevel = 1;
319
320 SetThrottles(
321 udpClient, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes);
322
323 AssertThrottles(
324 udpClient,
325 resendBytes / 2, landBytes / 2, windBytes / 2, cloudBytes / 2, taskBytes / 2,
326 textureBytes / 2, assetBytes / 2, totalBytes, 0, totalBytes);
327 }
328
329 [Test]
330 public void TestClientThrottlePerClientAndRegionLimited()
331 {
332 TestHelpers.InMethod();
333 //TestHelpers.EnableLogging();
334
335 int resendBytes = 4000;
336 int landBytes = 6000;
337 int windBytes = 8000;
338 int cloudBytes = 10000;
339 int taskBytes = 12000;
340 int textureBytes = 14000;
341 int assetBytes = 16000;
342
343 // current total 70000
344 int totalBytes = resendBytes + landBytes + windBytes + cloudBytes + taskBytes + textureBytes + assetBytes;
345
346 Scene scene = new SceneHelpers().SetupScene();
347 TestLLUDPServer udpServer = ClientStackHelpers.AddUdpServer(scene);
348 udpServer.ThrottleRates.Total = (int)(totalBytes * 1.1);
349 udpServer.Throttle.RequestedDripRate = (int)(totalBytes * 1.5);
350
351 ScenePresence sp1
352 = ClientStackHelpers.AddChildClient(
353 scene, udpServer, TestHelpers.ParseTail(0x1), TestHelpers.ParseTail(0x2), 123456);
354
355 LLUDPClient udpClient1 = ((LLClientView)sp1.ControllingClient).UDPClient;
356 udpClient1.ThrottleDebugLevel = 1;
357
358 SetThrottles(
359 udpClient1, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes);
360
361 AssertThrottles(
362 udpClient1,
363 resendBytes, landBytes, windBytes, cloudBytes, taskBytes,
364 textureBytes, assetBytes, totalBytes, 0, totalBytes * 1.1);
365
366 // Now add another client
367 ScenePresence sp2
368 = ClientStackHelpers.AddChildClient(
369 scene, udpServer, TestHelpers.ParseTail(0x10), TestHelpers.ParseTail(0x20), 123457);
370
371 LLUDPClient udpClient2 = ((LLClientView)sp2.ControllingClient).UDPClient;
372 udpClient2.ThrottleDebugLevel = 1;
373
374 SetThrottles(
375 udpClient2, resendBytes, landBytes, windBytes, cloudBytes, taskBytes, textureBytes, assetBytes);
376
377 AssertThrottles(
378 udpClient1,
379 resendBytes * 0.75, landBytes * 0.75, windBytes * 0.75, cloudBytes * 0.75, taskBytes * 0.75,
380 textureBytes * 0.75, assetBytes * 0.75, totalBytes * 0.75, 0, totalBytes * 1.1);
381
382 AssertThrottles(
383 udpClient2,
384 resendBytes * 0.75, landBytes * 0.75, windBytes * 0.75, cloudBytes * 0.75, taskBytes * 0.75,
385 textureBytes * 0.75, assetBytes * 0.75, totalBytes * 0.75, 0, totalBytes * 1.1);
386 }
387
388 private void AssertThrottles(
389 LLUDPClient udpClient,
390 double resendBytes, double landBytes, double windBytes, double cloudBytes, double taskBytes, double textureBytes, double assetBytes,
391 double totalBytes, double targetBytes, double maxBytes)
392 {
393 ClientInfo ci = udpClient.GetClientInfo();
394
395// Console.WriteLine(
396// "Resend={0}, Land={1}, Wind={2}, Cloud={3}, Task={4}, Texture={5}, Asset={6}, TOTAL = {7}",
397// ci.resendThrottle, ci.landThrottle, ci.windThrottle, ci.cloudThrottle, ci.taskThrottle, ci.textureThrottle, ci.assetThrottle, ci.totalThrottle);
398
399 Assert.AreEqual((int)resendBytes, ci.resendThrottle, "Resend");
400 Assert.AreEqual((int)landBytes, ci.landThrottle, "Land");
401 Assert.AreEqual((int)windBytes, ci.windThrottle, "Wind");
402 Assert.AreEqual((int)cloudBytes, ci.cloudThrottle, "Cloud");
403 Assert.AreEqual((int)taskBytes, ci.taskThrottle, "Task");
404 Assert.AreEqual((int)textureBytes, ci.textureThrottle, "Texture");
405 Assert.AreEqual((int)assetBytes, ci.assetThrottle, "Asset");
406 Assert.AreEqual((int)totalBytes, ci.totalThrottle, "Total");
407 Assert.AreEqual((int)targetBytes, ci.targetThrottle, "Target");
408 Assert.AreEqual((int)maxBytes, ci.maxThrottle, "Max");
409 }
410
411 private void SetThrottles(
412 LLUDPClient udpClient, int resendBytes, int landBytes, int windBytes, int cloudBytes, int taskBytes, int textureBytes, int assetBytes)
413 {
414 byte[] throttles = new byte[28];
415
416 Array.Copy(BitConverter.GetBytes((float)resendBytes * 8), 0, throttles, 0, 4);
417 Array.Copy(BitConverter.GetBytes((float)landBytes * 8), 0, throttles, 4, 4);
418 Array.Copy(BitConverter.GetBytes((float)windBytes * 8), 0, throttles, 8, 4);
419 Array.Copy(BitConverter.GetBytes((float)cloudBytes * 8), 0, throttles, 12, 4);
420 Array.Copy(BitConverter.GetBytes((float)taskBytes * 8), 0, throttles, 16, 4);
421 Array.Copy(BitConverter.GetBytes((float)textureBytes * 8), 0, throttles, 20, 4);
422 Array.Copy(BitConverter.GetBytes((float)assetBytes * 8), 0, throttles, 24, 4);
423
424 udpClient.SetThrottles(throttles);
425 }
426 }
427} \ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs b/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs
index 451dee5..076551f 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs
@@ -58,7 +58,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
58 58
59 /// <summary>Flag used to enable adaptive throttles</summary> 59 /// <summary>Flag used to enable adaptive throttles</summary>
60 public bool AdaptiveThrottlesEnabled; 60 public bool AdaptiveThrottlesEnabled;
61 61
62 /// <summary>
63 /// Set the minimum rate that the adaptive throttles can set. The viewer
64 /// can still throttle lower than this, but the adaptive throttles will
65 /// never decrease rates below this no matter how many packets are dropped
66 /// </summary>
67 public Int64 MinimumAdaptiveThrottleRate;
68
62 /// <summary>Amount of the texture throttle to steal for the task throttle</summary> 69 /// <summary>Amount of the texture throttle to steal for the task throttle</summary>
63 public double CannibalizeTextureRate; 70 public double CannibalizeTextureRate;
64 71
@@ -75,6 +82,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
75 { 82 {
76 IConfig throttleConfig = config.Configs["ClientStack.LindenUDP"]; 83 IConfig throttleConfig = config.Configs["ClientStack.LindenUDP"];
77 84
85 // Current default total is 66750
78 Resend = throttleConfig.GetInt("resend_default", 6625); 86 Resend = throttleConfig.GetInt("resend_default", 6625);
79 Land = throttleConfig.GetInt("land_default", 9125); 87 Land = throttleConfig.GetInt("land_default", 9125);
80 Wind = throttleConfig.GetInt("wind_default", 1750); 88 Wind = throttleConfig.GetInt("wind_default", 1750);
@@ -93,7 +101,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
93 BrustTime *= 1e-3f; 101 BrustTime *= 1e-3f;
94 102
95 AdaptiveThrottlesEnabled = throttleConfig.GetBoolean("enable_adaptive_throttles", false); 103 AdaptiveThrottlesEnabled = throttleConfig.GetBoolean("enable_adaptive_throttles", false);
96 104 MinimumAdaptiveThrottleRate = throttleConfig.GetInt("adaptive_throttle_min_bps", 32000);
105
97 CannibalizeTextureRate = (double)throttleConfig.GetFloat("CannibalizeTextureRate", 0.0f); 106 CannibalizeTextureRate = (double)throttleConfig.GetFloat("CannibalizeTextureRate", 0.0f);
98 CannibalizeTextureRate = Util.Clamp<double>(CannibalizeTextureRate,0.0, 0.9); 107 CannibalizeTextureRate = Util.Clamp<double>(CannibalizeTextureRate,0.0, 0.9);
99 } 108 }
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs
index 1877cf0..7a42d82 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -42,11 +42,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP
42 public class TokenBucket 42 public class TokenBucket
43 { 43 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45<<<<<<< HEAD
46
47 public string Identifier { get; private set; }
48
49 public int DebugLevel { get; set; }
50
51 /// <summary>
52 /// Number of ticks (ms) per quantum, drip rate and max burst
53 /// are defined over this interval.
54 /// </summary>
55 protected const Int32 m_ticksPerQuantum = 1000;
56=======
45 private static Int32 m_counter = 0; 57 private static Int32 m_counter = 0;
46 58
47// private Int32 m_identifier; 59// private Int32 m_identifier;
48 60
49 protected const float m_timeScale = 1e-3f; 61 protected const float m_timeScale = 1e-3f;
62>>>>>>> avn/ubitvar
50 63
51 /// <summary> 64 /// <summary>
52 /// This is the number of m_minimumDripRate bytes 65 /// This is the number of m_minimumDripRate bytes
@@ -59,7 +72,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
59 72
60 /// <summary> 73 /// <summary>
61 /// </summary> 74 /// </summary>
75<<<<<<< HEAD
76 protected const Int32 m_minimumDripRate = LLUDPServer.MTU;
77=======
62 protected const float m_minimumDripRate = 1400; 78 protected const float m_minimumDripRate = 1400;
79>>>>>>> avn/ubitvar
63 80
64 /// <summary>Time of the last drip, in system ticks</summary> 81 /// <summary>Time of the last drip, in system ticks</summary>
65 protected Int32 m_lastDrip; 82 protected Int32 m_lastDrip;
@@ -73,21 +90,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
73 /// <summary> 90 /// <summary>
74 /// Map of children buckets and their requested maximum burst rate 91 /// Map of children buckets and their requested maximum burst rate
75 /// </summary> 92 /// </summary>
93<<<<<<< HEAD
94 protected Dictionary<TokenBucket,Int64> m_children = new Dictionary<TokenBucket,Int64>();
95=======
76 protected Dictionary<TokenBucket, float> m_children = new Dictionary<TokenBucket, float>(); 96 protected Dictionary<TokenBucket, float> m_children = new Dictionary<TokenBucket, float>();
77 97
78#region Properties 98#region Properties
99>>>>>>> avn/ubitvar
79 100
80 /// <summary> 101 /// <summary>
81 /// The parent bucket of this bucket, or null if this bucket has no 102 /// The parent bucket of this bucket, or null if this bucket has no
82 /// parent. The parent bucket will limit the aggregate bandwidth of all 103 /// parent. The parent bucket will limit the aggregate bandwidth of all
83 /// of its children buckets 104 /// of its children buckets
84 /// </summary> 105 /// </summary>
85 protected TokenBucket m_parent; 106 public TokenBucket Parent { get; protected set; }
86 public TokenBucket Parent
87 {
88 get { return m_parent; }
89 set { m_parent = value; }
90 }
91 107
92 /// <summary> 108 /// <summary>
93 /// This is the maximum number 109 /// This is the maximum number
@@ -120,11 +136,68 @@ namespace OpenSim.Region.ClientStack.LindenUDP
120 } 136 }
121 137
122 /// <summary> 138 /// <summary>
123 /// The speed limit of this bucket in bytes per second. This is the 139 /// The requested drip rate for this particular bucket.
124 /// number of tokens that are added to the bucket per quantum
125 /// </summary> 140 /// </summary>
126 /// <remarks>Tokens are added to the bucket any time 141 /// <remarks>
142 /// 0 then TotalDripRequest is used instead.
143 /// Can never be above MaxDripRate.
144 /// Tokens are added to the bucket at any time
127 /// <seealso cref="RemoveTokens"/> is called, at the granularity of 145 /// <seealso cref="RemoveTokens"/> is called, at the granularity of
146<<<<<<< HEAD
147 /// the system tick interval (typically around 15-22ms)
148 /// FIXME: It is extremely confusing to be able to set a RequestedDripRate of 0 and then receive a positive
149 /// number on get if TotalDripRequest is set. This also stops us being able to retrieve the fact that
150 /// RequestedDripRate is set to 0. Really, this should always return m_dripRate and then we can get
151 /// (m_dripRate == 0 ? TotalDripRequest : m_dripRate) on some other properties.
152 /// </remarks>
153 public virtual Int64 RequestedDripRate
154 {
155 get { return (m_dripRate == 0 ? TotalDripRequest : m_dripRate); }
156 set
157 {
158 if (value <= 0)
159 m_dripRate = 0;
160 else if (MaxDripRate > 0 && value > MaxDripRate)
161 m_dripRate = MaxDripRate;
162 else
163 m_dripRate = value;
164
165 m_burstRate = (Int64)((double)m_dripRate * m_quantumsPerBurst);
166
167 if (Parent != null)
168 Parent.RegisterRequest(this, m_dripRate);
169 }
170 }
171
172 /// <summary>
173 /// Gets the drip rate.
174 /// </summary>
175 /// <value>
176 /// DripRate can never be above max drip rate or below min drip rate.
177 /// If we are a child bucket then the drip rate return is modifed by the total load on the capacity of the
178 /// parent bucket.
179 /// </value>
180 public virtual Int64 DripRate
181 {
182 get
183 {
184 double rate;
185
186 // FIXME: This doesn't properly work if we have a parent and children and a requested drip rate set
187 // on ourselves which is not equal to the child drip rates.
188 if (Parent == null)
189 {
190 if (TotalDripRequest > 0)
191 rate = Math.Min(RequestedDripRate, TotalDripRequest);
192 else
193 rate = RequestedDripRate;
194 }
195 else
196 {
197 rate = (double)RequestedDripRate * Parent.DripRateModifier();
198 }
199
200=======
128 /// the system tick interval (typically around 15-22ms)</remarks> 201 /// the system tick interval (typically around 15-22ms)</remarks>
129 protected float m_dripRate; 202 protected float m_dripRate;
130 public virtual float RequestedDripRate 203 public virtual float RequestedDripRate
@@ -147,17 +220,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
147 return rate; 220 return rate;
148 221
149 rate *= m_parent.DripRateModifier(); 222 rate *= m_parent.DripRateModifier();
223>>>>>>> avn/ubitvar
150 if (rate < m_minimumDripRate) 224 if (rate < m_minimumDripRate)
151 rate = m_minimumDripRate; 225 rate = m_minimumDripRate;
226 else if (MaxDripRate > 0 && rate > MaxDripRate)
227 rate = MaxDripRate;
152 228
153 return (float)rate; 229 return (float)rate;
154 } 230 }
155 } 231 }
232 protected Int64 m_dripRate;
233
234 // <summary>
235 // The maximum rate for flow control. Drip rate can never be greater than this.
236 // </summary>
237 public Int64 MaxDripRate { get; set; }
156 238
157 /// <summary> 239 /// <summary>
158 /// The current total of the requested maximum burst rates of 240 /// The current total of the requested maximum burst rates of children buckets.
159 /// this bucket's children buckets.
160 /// </summary> 241 /// </summary>
242<<<<<<< HEAD
243 public Int64 TotalDripRequest { get; protected set; }
244=======
161 protected float m_totalDripRequest; 245 protected float m_totalDripRequest;
162 public float TotalDripRequest 246 public float TotalDripRequest
163 { 247 {
@@ -168,31 +252,44 @@ namespace OpenSim.Region.ClientStack.LindenUDP
168#endregion Properties 252#endregion Properties
169 253
170#region Constructor 254#region Constructor
255>>>>>>> avn/ubitvar
171 256
172 /// <summary> 257 /// <summary>
173 /// Default constructor 258 /// Default constructor
174 /// </summary> 259 /// </summary>
260 /// <param name="identifier">Identifier for this token bucket</param>
175 /// <param name="parent">Parent bucket if this is a child bucket, or 261 /// <param name="parent">Parent bucket if this is a child bucket, or
176 /// null if this is a root bucket</param> 262 /// null if this is a root bucket</param>
263<<<<<<< HEAD
264 /// <param name="requestedDripRate">
265 /// Requested rate that the bucket fills, in bytes per
266 /// second. If zero, the bucket always remains full.
267 /// </param>
268 public TokenBucket(string identifier, TokenBucket parent, Int64 requestedDripRate, Int64 maxDripRate)
269=======
177 /// <param name="maxBurst">Maximum size of the bucket in bytes, or 270 /// <param name="maxBurst">Maximum size of the bucket in bytes, or
178 /// zero if this bucket has no maximum capacity</param> 271 /// zero if this bucket has no maximum capacity</param>
179 /// <param name="dripRate">Rate that the bucket fills, in bytes per 272 /// <param name="dripRate">Rate that the bucket fills, in bytes per
180 /// second. If zero, the bucket always remains full</param> 273 /// second. If zero, the bucket always remains full</param>
181 public TokenBucket(TokenBucket parent, float dripRate, float MaxBurst) 274 public TokenBucket(TokenBucket parent, float dripRate, float MaxBurst)
275>>>>>>> avn/ubitvar
182 { 276 {
183// m_identifier = m_counter++; 277 Identifier = identifier;
184 m_counter++;
185 278
186 Parent = parent; 279 Parent = parent;
280<<<<<<< HEAD
281 RequestedDripRate = requestedDripRate;
282 MaxDripRate = maxDripRate;
283 m_lastDrip = Util.EnvironmentTickCount();
284=======
187 RequestedDripRate = dripRate; 285 RequestedDripRate = dripRate;
188 RequestedBurst = MaxBurst; 286 RequestedBurst = MaxBurst;
189 // TotalDripRequest = dripRate; // this will be overwritten when a child node registers 287 // TotalDripRequest = dripRate; // this will be overwritten when a child node registers
190 // MaxBurst = (Int64)((double)dripRate * m_quantumsPerBurst); 288 // MaxBurst = (Int64)((double)dripRate * m_quantumsPerBurst);
191 m_lastDrip = Util.EnvironmentTickCount() + 100000; 289 m_lastDrip = Util.EnvironmentTickCount() + 100000;
290>>>>>>> avn/ubitvar
192 } 291 }
193 292
194#endregion Constructor
195
196 /// <summary> 293 /// <summary>
197 /// Compute a modifier for the MaxBurst rate. This is 1.0, meaning 294 /// Compute a modifier for the MaxBurst rate. This is 1.0, meaning
198 /// no modification if the requested bandwidth is less than the 295 /// no modification if the requested bandwidth is less than the
@@ -202,8 +299,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
202 /// </summary> 299 /// </summary>
203 protected float DripRateModifier() 300 protected float DripRateModifier()
204 { 301 {
302<<<<<<< HEAD
303 Int64 driprate = DripRate;
304 double modifier = driprate >= TotalDripRequest ? 1.0 : (double)driprate / (double)TotalDripRequest;
305
306// if (DebugLevel > 0)
307// m_log.DebugFormat(
308// "[TOKEN BUCKET]: Returning drip modifier {0}/{1} = {2} from {3}",
309// driprate, TotalDripRequest, modifier, Identifier);
310
311 return modifier;
312=======
205 float driprate = DripRate; 313 float driprate = DripRate;
206 return driprate >= TotalDripRequest ? 1.0f : driprate / TotalDripRequest; 314 return driprate >= TotalDripRequest ? 1.0f : driprate / TotalDripRequest;
315>>>>>>> avn/ubitvar
207 } 316 }
208 317
209 /// <summary> 318 /// <summary>
@@ -225,16 +334,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP
225 lock (m_children) 334 lock (m_children)
226 { 335 {
227 m_children[child] = request; 336 m_children[child] = request;
228 // m_totalDripRequest = m_children.Values.Sum();
229 337
338<<<<<<< HEAD
339 TotalDripRequest = 0;
340 foreach (KeyValuePair<TokenBucket, Int64> cref in m_children)
341 TotalDripRequest += cref.Value;
342=======
230 m_totalDripRequest = 0; 343 m_totalDripRequest = 0;
231 foreach (KeyValuePair<TokenBucket, float> cref in m_children) 344 foreach (KeyValuePair<TokenBucket, float> cref in m_children)
232 m_totalDripRequest += cref.Value; 345 m_totalDripRequest += cref.Value;
346>>>>>>> avn/ubitvar
233 } 347 }
234 348
235 // Pass the new values up to the parent 349 // Pass the new values up to the parent
236 if (m_parent != null) 350 if (Parent != null)
237 m_parent.RegisterRequest(this,Math.Min(RequestedDripRate, TotalDripRequest)); 351 {
352 Int64 effectiveDripRate;
353
354 if (RequestedDripRate > 0)
355 effectiveDripRate = Math.Min(RequestedDripRate, TotalDripRequest);
356 else
357 effectiveDripRate = TotalDripRequest;
358
359 Parent.RegisterRequest(this, effectiveDripRate);
360 }
238 } 361 }
239 362
240 /// <summary> 363 /// <summary>
@@ -246,17 +369,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
246 lock (m_children) 369 lock (m_children)
247 { 370 {
248 m_children.Remove(child); 371 m_children.Remove(child);
249 // m_totalDripRequest = m_children.Values.Sum();
250 372
373<<<<<<< HEAD
374 TotalDripRequest = 0;
375 foreach (KeyValuePair<TokenBucket, Int64> cref in m_children)
376 TotalDripRequest += cref.Value;
377=======
251 m_totalDripRequest = 0; 378 m_totalDripRequest = 0;
252 foreach (KeyValuePair<TokenBucket, float> cref in m_children) 379 foreach (KeyValuePair<TokenBucket, float> cref in m_children)
253 m_totalDripRequest += cref.Value; 380 m_totalDripRequest += cref.Value;
381>>>>>>> avn/ubitvar
254 } 382 }
255
256 383
257 // Pass the new values up to the parent 384 // Pass the new values up to the parent
258 if (m_parent != null) 385 if (Parent != null)
259 m_parent.RegisterRequest(this,Math.Min(RequestedDripRate, TotalDripRequest)); 386 Parent.RegisterRequest(this,Math.Min(RequestedDripRate, TotalDripRequest));
260 } 387 }
261 388
262 /// <summary> 389 /// <summary>
@@ -300,7 +427,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
300 // with no drip rate... 427 // with no drip rate...
301 if (DripRate == 0) 428 if (DripRate == 0)
302 { 429 {
303 m_log.WarnFormat("[TOKENBUCKET] something odd is happening and drip rate is 0"); 430 m_log.WarnFormat("[TOKENBUCKET] something odd is happening and drip rate is 0 for {0}", Identifier);
304 return; 431 return;
305 } 432 }
306 433
@@ -321,9 +448,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
321 448
322 public class AdaptiveTokenBucket : TokenBucket 449 public class AdaptiveTokenBucket : TokenBucket
323 { 450 {
324// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 451 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
452
453 public bool AdaptiveEnabled { get; set; }
325 454
326 /// <summary> 455 /// <summary>
456<<<<<<< HEAD
457 /// Target drip rate for this bucket.
458 /// </summary>
459 /// <remarks>Usually set by the client. If adaptive is enabled then throttles will increase until we reach this.</remarks>
460 public Int64 TargetDripRate
461 {
462 get { return m_targetDripRate; }
463 set
464 {
465 m_targetDripRate = Math.Max(value, m_minimumFlow);
466=======
327 /// The minimum rate for flow control. Minimum drip rate is one 467 /// The minimum rate for flow control. Minimum drip rate is one
328 /// packet per second. 468 /// packet per second.
329 /// </summary> 469 /// </summary>
@@ -342,25 +482,62 @@ namespace OpenSim.Region.ClientStack.LindenUDP
342 set 482 set
343 { 483 {
344 m_maxDripRate = (value == 0 ? m_totalDripRequest : Math.Max(value, m_minimumFlow)); 484 m_maxDripRate = (value == 0 ? m_totalDripRequest : Math.Max(value, m_minimumFlow));
485>>>>>>> avn/ubitvar
345 } 486 }
346 } 487 }
347 488 protected Int64 m_targetDripRate;
348 private bool m_enabled = false; 489
349
350 // <summary> 490 // <summary>
351 // 491 // Adjust drip rate in response to network conditions.
352 // </summary> 492 // </summary>
353 public virtual float AdjustedDripRate 493 public virtual float AdjustedDripRate
354 { 494 {
355 get { return m_dripRate; } 495 get { return m_dripRate; }
496<<<<<<< HEAD
497 set
498 {
499 m_dripRate = OpenSim.Framework.Util.Clamp<Int64>(value, m_minimumFlow, TargetDripRate);
500 m_burstRate = (Int64)((double)m_dripRate * m_quantumsPerBurst);
501
502 if (Parent != null)
503 Parent.RegisterRequest(this, m_dripRate);
504=======
356 set { 505 set {
357 m_dripRate = OpenSim.Framework.Util.Clamp<float>(value,m_minimumFlow,MaxDripRate); 506 m_dripRate = OpenSim.Framework.Util.Clamp<float>(value,m_minimumFlow,MaxDripRate);
358 507
359 if (m_parent != null) 508 if (m_parent != null)
360 m_parent.RegisterRequest(this,m_dripRate); 509 m_parent.RegisterRequest(this,m_dripRate);
510>>>>>>> avn/ubitvar
361 } 511 }
362 } 512 }
513
514 /// <summary>
515 /// The minimum rate for adaptive flow control.
516 /// </summary>
517 protected Int64 m_minimumFlow = 32000;
363 518
519<<<<<<< HEAD
520 /// <summary>
521 /// Constructor for the AdaptiveTokenBucket class
522 /// <param name="identifier">Unique identifier for the client</param>
523 /// <param name="parent">Parent bucket in the hierarchy</param>
524 /// <param name="requestedDripRate"></param>
525 /// <param name="maxDripRate">The ceiling rate for adaptation</param>
526 /// <param name="minDripRate">The floor rate for adaptation</param>
527 /// </summary>
528 public AdaptiveTokenBucket(string identifier, TokenBucket parent, Int64 requestedDripRate, Int64 maxDripRate, Int64 minDripRate, bool enabled)
529 : base(identifier, parent, requestedDripRate, maxDripRate)
530 {
531 AdaptiveEnabled = enabled;
532
533 if (AdaptiveEnabled)
534 {
535// m_log.DebugFormat("[TOKENBUCKET]: Adaptive throttle enabled");
536 m_minimumFlow = minDripRate;
537 TargetDripRate = m_minimumFlow;
538 AdjustedDripRate = m_minimumFlow;
539 }
540=======
364 // <summary> 541 // <summary>
365 // 542 //
366 // </summary> 543 // </summary>
@@ -375,25 +552,50 @@ namespace OpenSim.Region.ClientStack.LindenUDP
375 AdjustedDripRate = m_maxDripRate * .5f; 552 AdjustedDripRate = m_maxDripRate * .5f;
376 else 553 else
377 AdjustedDripRate = m_maxDripRate; 554 AdjustedDripRate = m_maxDripRate;
555>>>>>>> avn/ubitvar
378 } 556 }
379 557
380 // <summary> 558 /// <summary>
381 // 559 /// Reliable packets sent to the client for which we never received an ack adjust the drip rate down.
382 // </summary> 560 /// <param name="packets">Number of packets that expired without successful delivery</param>
383 public void ExpirePackets(Int32 count) 561 /// </summary>
562 public void ExpirePackets(Int32 packets)
384 { 563 {
385 // m_log.WarnFormat("[ADAPTIVEBUCKET] drop {0} by {1} expired packets",AdjustedDripRate,count); 564 if (AdaptiveEnabled)
386 if (m_enabled) 565 {
387 AdjustedDripRate = (Int64) (AdjustedDripRate / Math.Pow(2,count)); 566 if (DebugLevel > 0)
567 m_log.WarnFormat(
568 "[ADAPTIVEBUCKET] drop {0} by {1} expired packets for {2}",
569 AdjustedDripRate, packets, Identifier);
570
571 // AdjustedDripRate = (Int64) (AdjustedDripRate / Math.Pow(2,packets));
572
573 // Compute the fallback solely on the rate allocated beyond the minimum, this
574 // should smooth out the fallback to the minimum rate
575 AdjustedDripRate = m_minimumFlow + (Int64) ((AdjustedDripRate - m_minimumFlow) / Math.Pow(2, packets));
576 }
388 } 577 }
389 578
390 // <summary> 579 /// <summary>
391 // 580 /// Reliable packets acked by the client adjust the drip rate up.
392 // </summary> 581 /// <param name="packets">Number of packets successfully acknowledged</param>
393 public void AcknowledgePackets(Int32 count) 582 /// </summary>
583 public void AcknowledgePackets(Int32 packets)
584 {
585 if (AdaptiveEnabled)
586 AdjustedDripRate = AdjustedDripRate + packets * LLUDPServer.MTU;
587 }
588
589 /// <summary>
590 /// Adjust the minimum flow level for the adaptive throttle, this will drop adjusted
591 /// throttles back to the minimum levels
592 /// <param>minDripRate--the new minimum flow</param>
593 /// </summary>
594 public void ResetMinimumAdaptiveFlow(Int64 minDripRate)
394 { 595 {
395 if (m_enabled) 596 m_minimumFlow = minDripRate;
396 AdjustedDripRate = AdjustedDripRate + count; 597 TargetDripRate = m_minimumFlow;
598 AdjustedDripRate = m_minimumFlow;
397 } 599 }
398 } 600 }
399} 601}
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs
index 9d6c09e..b546a99 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/UnackedPacketCollection.cs
@@ -31,6 +31,9 @@ using System.Net;
31using System.Threading; 31using System.Threading;
32using OpenMetaverse; 32using OpenMetaverse;
33 33
34//using System.Reflection;
35//using log4net;
36
34namespace OpenSim.Region.ClientStack.LindenUDP 37namespace OpenSim.Region.ClientStack.LindenUDP
35{ 38{
36 /// <summary> 39 /// <summary>
@@ -60,6 +63,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
60 } 63 }
61 } 64 }
62 65
66 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
67
63 /// <summary>Holds the actual unacked packet data, sorted by sequence number</summary> 68 /// <summary>Holds the actual unacked packet data, sorted by sequence number</summary>
64 private Dictionary<uint, OutgoingPacket> m_packets = new Dictionary<uint, OutgoingPacket>(); 69 private Dictionary<uint, OutgoingPacket> m_packets = new Dictionary<uint, OutgoingPacket>();
65 /// <summary>Holds packets that need to be added to the unacknowledged list</summary> 70 /// <summary>Holds packets that need to be added to the unacknowledged list</summary>
@@ -164,8 +169,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
164 } 169 }
165 } 170 }
166 171
167 //if (expiredPackets != null) 172 // if (expiredPackets != null)
168 // m_log.DebugFormat("[UNACKED PACKET COLLECTION]: Found {0} expired packets on timeout of {1}", expiredPackets.Count, timeoutMS); 173 // m_log.DebugFormat("[UNACKED PACKET COLLECTION]: Found {0} expired packets on timeout of {1}", expiredPackets.Count, timeoutMS);
169 174
170 return expiredPackets; 175 return expiredPackets;
171 } 176 }
@@ -192,7 +197,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
192 197
193 // As with other network applications, assume that an acknowledged packet is an 198 // As with other network applications, assume that an acknowledged packet is an
194 // indication that the network can handle a little more load, speed up the transmission 199 // indication that the network can handle a little more load, speed up the transmission
195 ackedPacket.Client.FlowThrottle.AcknowledgePackets(ackedPacket.Buffer.DataLength); 200 ackedPacket.Client.FlowThrottle.AcknowledgePackets(1);
196 201
197 // Update stats 202 // Update stats
198 Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength); 203 Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength);
@@ -207,9 +212,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
207 } 212 }
208 else 213 else
209 { 214 {
210 //m_log.WarnFormat("[UNACKED PACKET COLLECTION]: Could not find packet with sequence number {0} to ack", pendingAcknowledgement.SequenceNumber); 215 // m_log.WarnFormat("[UNACKED PACKET COLLECTION]: found null packet for sequence number {0} to ack",
216 // pendingAcknowledgement.SequenceNumber);
211 } 217 }
212 } 218 }
219 else
220 {
221 // m_log.WarnFormat("[UNACKED PACKET COLLECTION]: Could not find packet with sequence number {0} to ack",
222 // pendingAcknowledgement.SequenceNumber);
223 }
213 } 224 }
214 225
215 uint pendingRemove; 226 uint pendingRemove;
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
index 982646e..d58ab94 100644
--- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs
+++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
@@ -39,6 +39,7 @@ using OpenSim.Region.Framework;
39using OpenSim.Region.Framework.Interfaces; 39using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Region.Physics.Manager; 41using OpenSim.Region.Physics.Manager;
42using OpenSim.Services.Interfaces;
42 43
43namespace OpenSim.Region.ClientStack 44namespace OpenSim.Region.ClientStack
44{ 45{
@@ -140,7 +141,11 @@ namespace OpenSim.Region.ClientStack
140 PhysicsPluginManager physicsPluginManager; 141 PhysicsPluginManager physicsPluginManager;
141 physicsPluginManager = new PhysicsPluginManager(); 142 physicsPluginManager = new PhysicsPluginManager();
142 physicsPluginManager.LoadPluginsFromAssemblies("Physics"); 143 physicsPluginManager.LoadPluginsFromAssemblies("Physics");
144<<<<<<< HEAD
145
146=======
143 147
148>>>>>>> avn/ubitvar
144 return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier, regionExtent); 149 return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier, regionExtent);
145 } 150 }
146 } 151 }
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
index fe60c90..345b53d 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
@@ -32,6 +32,7 @@ using System.Collections.Generic;
32using log4net; 32using log4net;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Region.Framework.Interfaces;
35using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
36using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
37using PermissionMask = OpenSim.Framework.PermissionMask; 38using PermissionMask = OpenSim.Framework.PermissionMask;
@@ -400,6 +401,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
400 } 401 }
401 402
402 m_transactions.RemoveXferUploader(m_transactionID); 403 m_transactions.RemoveXferUploader(m_transactionID);
404
405 m_Scene.EventManager.TriggerOnNewInventoryItemUploadComplete(ourClient.AgentId, (AssetType)type, m_asset.FullID, m_asset.Name, 0);
403 } 406 }
404 407
405 /// <summary> 408 /// <summary>
@@ -452,6 +455,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
452 m_transactions.RemoveXferUploader(m_transactionID); 455 m_transactions.RemoveXferUploader(m_transactionID);
453 } 456 }
454 457
458<<<<<<< HEAD
459=======
455 private void ValidateAssets() 460 private void ValidateAssets()
456 { 461 {
457 if (m_asset.Type == (sbyte)CustomAssetType.AnimationSet) 462 if (m_asset.Type == (sbyte)CustomAssetType.AnimationSet)
@@ -594,5 +599,6 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
594 599
595 return result; 600 return result;
596 } 601 }
602>>>>>>> avn/ubitvar
597 } 603 }
598} 604}
diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
index d9b0eff..47dcbcd 100644
--- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Drawing;
30using System.IO; 31using System.IO;
31using System.Reflection; 32using System.Reflection;
32using System.Text; 33using System.Text;
@@ -166,7 +167,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
166 167
167 // Do Decode! 168 // Do Decode!
168 if (decode) 169 if (decode)
169 Util.FireAndForget(delegate { Decode(assetID, j2kData); }); 170 Util.FireAndForget(delegate { Decode(assetID, j2kData); }, null, "J2KDecoderModule.BeginDecode");
170 } 171 }
171 } 172 }
172 173
@@ -182,6 +183,25 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
182 return DoJ2KDecode(assetID, j2kData, out layers, out components); 183 return DoJ2KDecode(assetID, j2kData, out layers, out components);
183 } 184 }
184 185
186 public Image DecodeToImage(byte[] j2kData)
187 {
188 if (m_useCSJ2K)
189 return J2kImage.FromBytes(j2kData);
190 else
191 {
192 ManagedImage mimage;
193 Image image;
194 if (OpenJPEG.DecodeToImage(j2kData, out mimage, out image))
195 {
196 mimage = null;
197 return image;
198 }
199 else
200 return null;
201 }
202 }
203
204
185 #endregion IJ2KDecoder 205 #endregion IJ2KDecoder
186 206
187 /// <summary> 207 /// <summary>
@@ -211,7 +231,11 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
211 { 231 {
212 try 232 try
213 { 233 {
214 List<int> layerStarts = CSJ2K.J2kImage.GetLayerBoundaries(new MemoryStream(j2kData)); 234 List<int> layerStarts;
235 using (MemoryStream ms = new MemoryStream(j2kData))
236 {
237 layerStarts = CSJ2K.J2kImage.GetLayerBoundaries(ms);
238 }
215 239
216 if (layerStarts != null && layerStarts.Count > 0) 240 if (layerStarts != null && layerStarts.Count > 0)
217 { 241 {
diff --git a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
index 9b0e1f4..ebec9d2 100644
--- a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
@@ -316,9 +316,12 @@ namespace OpenSim.Region.CoreModules.Asset
316 /// </summary> 316 /// </summary>
317 public void Close() 317 public void Close()
318 { 318 {
319 m_enabled = false; 319 if (m_enabled)
320 m_cache.Clear(); 320 {
321 m_cache = null; 321 m_enabled = false;
322 m_cache.Clear();
323 m_cache = null;
324 }
322 } 325 }
323 326
324 /// <summary> 327 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index 5468cdc..c4abc99 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -43,13 +43,14 @@ using Mono.Addins;
43using OpenMetaverse; 43using OpenMetaverse;
44using OpenSim.Framework; 44using OpenSim.Framework;
45using OpenSim.Framework.Console; 45using OpenSim.Framework.Console;
46using OpenSim.Framework.Monitoring;
46using OpenSim.Region.Framework.Interfaces; 47using OpenSim.Region.Framework.Interfaces;
47using OpenSim.Region.Framework.Scenes; 48using OpenSim.Region.Framework.Scenes;
48using OpenSim.Services.Interfaces; 49using OpenSim.Services.Interfaces;
49 50
50 51
51//[assembly: Addin("FlotsamAssetCache", "1.1")] 52//[assembly: Addin("FlotsamAssetCache", "1.1")]
52//[assembly: AddinDependency("OpenSim", "0.5")] 53//[assembly: AddinDependency("OpenSim", "0.8.1")]
53 54
54namespace OpenSim.Region.CoreModules.Asset 55namespace OpenSim.Region.CoreModules.Asset
55{ 56{
@@ -255,20 +256,7 @@ namespace OpenSim.Region.CoreModules.Asset
255 // If the file is already cached, don't cache it, just touch it so access time is updated 256 // If the file is already cached, don't cache it, just touch it so access time is updated
256 if (File.Exists(filename)) 257 if (File.Exists(filename))
257 { 258 {
258 // We don't really want to know about sharing 259 UpdateFileLastAccessTime(filename);
259 // violations here. If the file is locked, then
260 // the other thread has updated the time for us.
261 try
262 {
263 lock (m_CurrentlyWriting)
264 {
265 if (!m_CurrentlyWriting.Contains(filename))
266 File.SetLastAccessTime(filename, DateTime.Now);
267 }
268 }
269 catch
270 {
271 }
272 } 260 }
273 else 261 else
274 { 262 {
@@ -301,7 +289,7 @@ namespace OpenSim.Region.CoreModules.Asset
301 } 289 }
302 290
303 Util.FireAndForget( 291 Util.FireAndForget(
304 delegate { WriteFileCache(filename, asset); }); 292 delegate { WriteFileCache(filename, asset); }, null, "FlotsamAssetCache.UpdateFileCache");
305 } 293 }
306 } 294 }
307 catch (Exception e) 295 catch (Exception e)
@@ -328,6 +316,24 @@ namespace OpenSim.Region.CoreModules.Asset
328 } 316 }
329 317
330 /// <summary> 318 /// <summary>
319 /// Updates the cached file with the current time.
320 /// </summary>
321 /// <param name="filename">Filename.</param>
322 /// <returns><c>true</c>, if the update was successful, false otherwise.</returns>
323 private bool UpdateFileLastAccessTime(string filename)
324 {
325 try
326 {
327 File.SetLastAccessTime(filename, DateTime.Now);
328 return true;
329 }
330 catch
331 {
332 return false;
333 }
334 }
335
336 /// <summary>
331 /// Try to get an asset from the in-memory cache. 337 /// Try to get an asset from the in-memory cache.
332 /// </summary> 338 /// </summary>
333 /// <param name="id"></param> 339 /// <param name="id"></param>
@@ -775,43 +781,49 @@ namespace OpenSim.Region.CoreModules.Asset
775 { 781 {
776 UuidGatherer gatherer = new UuidGatherer(m_AssetService); 782 UuidGatherer gatherer = new UuidGatherer(m_AssetService);
777 783
778 HashSet<UUID> uniqueUuids = new HashSet<UUID>(); 784 Dictionary<UUID, bool> assetsFound = new Dictionary<UUID, bool>();
779 Dictionary<UUID, sbyte> assets = new Dictionary<UUID, sbyte>();
780 785
781 foreach (Scene s in m_Scenes) 786 foreach (Scene s in m_Scenes)
782 { 787 {
783 StampRegionStatusFile(s.RegionInfo.RegionID); 788 StampRegionStatusFile(s.RegionInfo.RegionID);
784 789
785 s.ForEachSOG(delegate(SceneObjectGroup e) 790 s.ForEachSOG(delegate(SceneObjectGroup e)
786 { 791 {
787 gatherer.GatherAssetUuids(e, assets); 792 gatherer.AddForInspection(e);
793 gatherer.GatherAll();
788 794
789 foreach (UUID assetID in assets.Keys) 795 foreach (UUID assetID in gatherer.GatheredUuids.Keys)
790 { 796 {
791 uniqueUuids.Add(assetID); 797 if (!assetsFound.ContainsKey(assetID))
792
793 string filename = GetFileName(assetID.ToString());
794
795 if (File.Exists(filename))
796 { 798 {
797 File.SetLastAccessTime(filename, DateTime.Now); 799 string filename = GetFileName(assetID.ToString());
800
801 if (File.Exists(filename))
802 {
803 UpdateFileLastAccessTime(filename);
804 }
805 else if (storeUncached)
806 {
807 AssetBase cachedAsset = m_AssetService.Get(assetID.ToString());
808 if (cachedAsset == null && gatherer.GatheredUuids[assetID] != (sbyte)AssetType.Unknown)
809 assetsFound[assetID] = false;
810 else
811 assetsFound[assetID] = true;
812 }
798 } 813 }
799 else if (storeUncached) 814 else if (!assetsFound[assetID])
800 { 815 {
801 AssetBase cachedAsset = m_AssetService.Get(assetID.ToString()); 816 m_log.DebugFormat(
802 if (cachedAsset == null && assets[assetID] != (sbyte)AssetType.Unknown)
803 m_log.DebugFormat(
804 "[FLOTSAM ASSET CACHE]: Could not find asset {0}, type {1} referenced by object {2} at {3} in scene {4} when pre-caching all scene assets", 817 "[FLOTSAM ASSET CACHE]: Could not find asset {0}, type {1} referenced by object {2} at {3} in scene {4} when pre-caching all scene assets",
805 assetID, assets[assetID], e.Name, e.AbsolutePosition, s.Name); 818 assetID, gatherer.GatheredUuids[assetID], e.Name, e.AbsolutePosition, s.Name);
806 } 819 }
807 } 820 }
808 821
809 assets.Clear(); 822 gatherer.GatheredUuids.Clear();
810 }); 823 });
811 } 824 }
812 825
813 826 return assetsFound.Count;
814 return uniqueUuids.Count;
815 } 827 }
816 828
817 /// <summary> 829 /// <summary>
@@ -968,10 +980,11 @@ namespace OpenSim.Region.CoreModules.Asset
968 case "assets": 980 case "assets":
969 con.Output("Ensuring assets are cached for all scenes."); 981 con.Output("Ensuring assets are cached for all scenes.");
970 982
971 Util.FireAndForget(delegate { 983 WorkManager.RunInThread(delegate
984 {
972 int assetReferenceTotal = TouchAllSceneAssets(true); 985 int assetReferenceTotal = TouchAllSceneAssets(true);
973 con.OutputFormat("Completed check with {0} assets.", assetReferenceTotal); 986 con.OutputFormat("Completed check with {0} assets.", assetReferenceTotal);
974 }); 987 }, null, "TouchAllSceneAssets");
975 988
976 break; 989 break;
977 990
@@ -1043,6 +1056,18 @@ namespace OpenSim.Region.CoreModules.Asset
1043 return true; 1056 return true;
1044 } 1057 }
1045 1058
1059 public bool[] AssetsExist(string[] ids)
1060 {
1061 bool[] exist = new bool[ids.Length];
1062
1063 for (int i = 0; i < ids.Length; i++)
1064 {
1065 exist[i] = Check(ids[i]);
1066 }
1067
1068 return exist;
1069 }
1070
1046 public string Store(AssetBase asset) 1071 public string Store(AssetBase asset)
1047 { 1072 {
1048 if (asset.FullID == UUID.Zero) 1073 if (asset.FullID == UUID.Zero)
diff --git a/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs b/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs
index fd02b08..73e4431 100644
--- a/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs
+++ b/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs
@@ -39,7 +39,6 @@ using OpenSim.Framework;
39using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
40using OpenSim.Region.Framework.Scenes.Serialization; 40using OpenSim.Region.Framework.Scenes.Serialization;
41using OpenSim.Tests.Common; 41using OpenSim.Tests.Common;
42using OpenSim.Tests.Common.Mock;
43 42
44namespace OpenSim.Region.CoreModules.Asset.Tests 43namespace OpenSim.Region.CoreModules.Asset.Tests
45{ 44{
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 3ae0dea..b24dc0c 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -146,7 +146,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
146 { 146 {
147 DebugLevel = debugLevel; 147 DebugLevel = debugLevel;
148 MainConsole.Instance.OutputFormat( 148 MainConsole.Instance.OutputFormat(
149 "Set event queue debug level to {0} in {1}", DebugLevel, m_scene.Name); 149 "Set attachments debug level to {0} in {1}", DebugLevel, m_scene.Name);
150 } 150 }
151 } 151 }
152 152
@@ -246,8 +246,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
246 string state = sog.GetStateSnapshot(); 246 string state = sog.GetStateSnapshot();
247 ad.AttachmentObjectStates.Add(state); 247 ad.AttachmentObjectStates.Add(state);
248 sp.InTransitScriptStates.Add(state); 248 sp.InTransitScriptStates.Add(state);
249 // Let's remove the scripts of the original object here 249
250 sog.RemoveScriptInstances(true); 250 // Scripts of the originals will be removed when the Agent is successfully removed.
251 // sog.RemoveScriptInstances(true);
251 } 252 }
252 } 253 }
253 } 254 }
@@ -255,6 +256,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
255 256
256 public void CopyAttachments(AgentData ad, IScenePresence sp) 257 public void CopyAttachments(AgentData ad, IScenePresence sp)
257 { 258 {
259// m_log.DebugFormat("[ATTACHMENTS MODULE]: Copying attachment data into {0} in {1}", sp.Name, m_scene.Name);
260
258 if (ad.AttachmentObjects != null && ad.AttachmentObjects.Count > 0) 261 if (ad.AttachmentObjects != null && ad.AttachmentObjects.Count > 0)
259 { 262 {
260 lock (sp.AttachmentsSyncLock) 263 lock (sp.AttachmentsSyncLock)
@@ -265,6 +268,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
265 { 268 {
266 ((SceneObjectGroup)so).LocalId = 0; 269 ((SceneObjectGroup)so).LocalId = 0;
267 ((SceneObjectGroup)so).RootPart.ClearUpdateSchedule(); 270 ((SceneObjectGroup)so).RootPart.ClearUpdateSchedule();
271
272// m_log.DebugFormat(
273// "[ATTACHMENTS MODULE]: Copying script state with {0} bytes for object {1} for {2} in {3}",
274// ad.AttachmentObjectStates[i].Length, so.Name, sp.Name, m_scene.Name);
275
268 so.SetState(ad.AttachmentObjectStates[i++], m_scene); 276 so.SetState(ad.AttachmentObjectStates[i++], m_scene);
269 m_scene.IncomingCreateObject(Vector3.Zero, so); 277 m_scene.IncomingCreateObject(Vector3.Zero, so);
270 } 278 }
@@ -331,6 +339,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
331 339
332 340
333 List<AvatarAttachment> attachments = sp.Appearance.GetAttachments(); 341 List<AvatarAttachment> attachments = sp.Appearance.GetAttachments();
342
343 // Let's get all items at once, so they get cached
344 UUID[] items = new UUID[attachments.Count];
345 int i = 0;
346 foreach (AvatarAttachment attach in attachments)
347 items[i++] = attach.ItemID;
348 m_scene.InventoryService.GetMultipleItems(sp.UUID, items);
349
334 foreach (AvatarAttachment attach in attachments) 350 foreach (AvatarAttachment attach in attachments)
335 { 351 {
336 uint attachmentPt = (uint)attach.AttachPoint; 352 uint attachmentPt = (uint)attach.AttachPoint;
@@ -378,17 +394,37 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
378 if (!Enabled) 394 if (!Enabled)
379 return; 395 return;
380 396
381 if (DebugLevel > 0)
382 m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name);
383
384 List<SceneObjectGroup> attachments = sp.GetAttachments(); 397 List<SceneObjectGroup> attachments = sp.GetAttachments();
385 398
399 if (DebugLevel > 0)
400 m_log.DebugFormat(
401 "[ATTACHMENTS MODULE]: Saving for {0} attachments for {1} in {2}",
402 attachments.Count, sp.Name, m_scene.Name);
403
386 if (attachments.Count <= 0) 404 if (attachments.Count <= 0)
387 return; 405 return;
388 406
389 Dictionary<SceneObjectGroup, string> scriptStates = new Dictionary<SceneObjectGroup, string>(); 407 Dictionary<SceneObjectGroup, string> scriptStates = new Dictionary<SceneObjectGroup, string>();
390 408
409<<<<<<< HEAD
410 foreach (SceneObjectGroup so in attachments)
411 {
412 // Scripts MUST be snapshotted before the object is
413 // removed from the scene because doing otherwise will
414 // clobber the run flag
415 // This must be done outside the sp.AttachmentSyncLock so that there is no risk of a deadlock from
416 // scripts performing attachment operations at the same time. Getting object states stops the scripts.
417 scriptStates[so] = PrepareScriptInstanceForSave(so, false);
418
419// m_log.DebugFormat(
420// "[ATTACHMENTS MODULE]: For object {0} for {1} in {2} got saved state {3}",
421// so.Name, sp.Name, m_scene.Name, scriptStates[so]);
422 }
423
424 lock (sp.AttachmentsSyncLock)
425=======
391 if (sp.PresenceType != PresenceType.Npc) 426 if (sp.PresenceType != PresenceType.Npc)
427>>>>>>> avn/ubitvar
392 { 428 {
393 foreach (SceneObjectGroup so in attachments) 429 foreach (SceneObjectGroup so in attachments)
394 { 430 {
@@ -441,7 +477,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
441 if (!Enabled) 477 if (!Enabled)
442 return false; 478 return false;
443 479
480<<<<<<< HEAD
481 group.DetachFromBackup();
482
483 bool success = AttachObjectInternal(sp, group, attachmentPt, silent, addToInventory, false, append);
484
485 if (!success)
486 group.AttachToBackup();
487
488 return success;
489=======
444 return AttachObjectInternal(sp, group, attachmentPt, silent, useAttachData, addToInventory, false, append); 490 return AttachObjectInternal(sp, group, attachmentPt, silent, useAttachData, addToInventory, false, append);
491>>>>>>> avn/ubitvar
445 } 492 }
446 493
447 /// <summary> 494 /// <summary>
@@ -864,15 +911,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
864 (sbyte)AssetType.Object, 911 (sbyte)AssetType.Object,
865 Utils.StringToBytes(sceneObjectXml), 912 Utils.StringToBytes(sceneObjectXml),
866 sp.UUID); 913 sp.UUID);
867 m_scene.AssetService.Store(asset);
868 914
869 item.AssetID = asset.FullID; 915 if (m_invAccessModule != null)
870 item.Description = asset.Description; 916 m_invAccessModule.UpdateInventoryItemAsset(sp.UUID, item, asset);
871 item.Name = asset.Name;
872 item.AssetType = asset.Type;
873 item.InvType = (int)InventoryType.Object;
874
875 m_scene.InventoryService.UpdateItem(item);
876 917
877 // If the name of the object has been changed whilst attached then we want to update the inventory 918 // If the name of the object has been changed whilst attached then we want to update the inventory
878 // item in the viewer. 919 // item in the viewer.
@@ -907,10 +948,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
907 { 948 {
908 if (DebugLevel > 0) 949 if (DebugLevel > 0)
909 m_log.DebugFormat( 950 m_log.DebugFormat(
910 "[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}", 951 "[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} at pt {2} pos {3} {4} in {5}",
911 so.Name, sp.Name, attachmentpoint, attachOffset, so.RootPart.AttachedPos); 952 so.Name, sp.Name, attachmentpoint, attachOffset, so.RootPart.AttachedPos, m_scene.Name);
912
913 so.DetachFromBackup();
914 953
915 // Remove from database and parcel prim count 954 // Remove from database and parcel prim count
916 m_scene.DeleteFromStorage(so.UUID); 955 m_scene.DeleteFromStorage(so.UUID);
@@ -986,7 +1025,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
986 InventoryItemBase newItem 1025 InventoryItemBase newItem
987 = m_invAccessModule.CopyToInventory( 1026 = m_invAccessModule.CopyToInventory(
988 DeRezAction.TakeCopy, 1027 DeRezAction.TakeCopy,
989 m_scene.InventoryService.GetFolderForType(sp.UUID, AssetType.Object).ID, 1028 m_scene.InventoryService.GetFolderForType(sp.UUID, FolderType.Object).ID,
990 new List<SceneObjectGroup> { grp }, 1029 new List<SceneObjectGroup> { grp },
991 sp.ControllingClient, true)[0]; 1030 sp.ControllingClient, true)[0];
992 1031
@@ -1015,8 +1054,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
1015 private string PrepareScriptInstanceForSave(SceneObjectGroup grp, bool fireDetachEvent) 1054 private string PrepareScriptInstanceForSave(SceneObjectGroup grp, bool fireDetachEvent)
1016 { 1055 {
1017 if (fireDetachEvent) 1056 if (fireDetachEvent)
1057 {
1018 m_scene.EventManager.TriggerOnAttach(grp.LocalId, grp.FromItemID, UUID.Zero); 1058 m_scene.EventManager.TriggerOnAttach(grp.LocalId, grp.FromItemID, UUID.Zero);
1019 1059
1060 // Allow detach event time to do some work before stopping the script
1061 Thread.Sleep(2);
1062 }
1063
1020 using (StringWriter sw = new StringWriter()) 1064 using (StringWriter sw = new StringWriter())
1021 { 1065 {
1022 using (XmlTextWriter writer = new XmlTextWriter(sw)) 1066 using (XmlTextWriter writer = new XmlTextWriter(sw))
@@ -1090,6 +1134,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
1090 1134
1091 return null; 1135 return null;
1092 } 1136 }
1137 else if (itemID == UUID.Zero)
1138 {
1139 // We need to have a FromItemID for multiple attachments on a single attach point to appear. This is
1140 // true on Singularity 1.8.5 and quite possibly other viewers as well. As NPCs don't have an inventory
1141 // we will satisfy this requirement by inserting a random UUID.
1142 objatt.FromItemID = UUID.Random();
1143 }
1093 1144
1094 if (DebugLevel > 0) 1145 if (DebugLevel > 0)
1095 m_log.DebugFormat( 1146 m_log.DebugFormat(
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index f023e77..b632774 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -53,7 +53,6 @@ using OpenSim.Region.ScriptEngine.Interfaces;
53using OpenSim.Region.ScriptEngine.XEngine; 53using OpenSim.Region.ScriptEngine.XEngine;
54using OpenSim.Services.Interfaces; 54using OpenSim.Services.Interfaces;
55using OpenSim.Tests.Common; 55using OpenSim.Tests.Common;
56using OpenSim.Tests.Common.Mock;
57 56
58namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests 57namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
59{ 58{
@@ -199,6 +198,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
199 string attName = "att"; 198 string attName = "att";
200 199
201 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID); 200 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID);
201 Assert.That(so.Backup, Is.True);
202 202
203 m_numberOfAttachEventsFired = 0; 203 m_numberOfAttachEventsFired = 0;
204 scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, true, false, false); 204 scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, true, false, false);
@@ -213,6 +213,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
213 Assert.That(attSo.IsAttachment); 213 Assert.That(attSo.IsAttachment);
214 Assert.That(attSo.UsesPhysics, Is.False); 214 Assert.That(attSo.UsesPhysics, Is.False);
215 Assert.That(attSo.IsTemporary, Is.False); 215 Assert.That(attSo.IsTemporary, Is.False);
216 Assert.That(attSo.Backup, Is.False);
216 217
217 // Check item status 218 // Check item status
218 Assert.That( 219 Assert.That(
@@ -223,7 +224,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
223 Assert.That(attachmentItem, Is.Not.Null); 224 Assert.That(attachmentItem, Is.Not.Null);
224 Assert.That(attachmentItem.Name, Is.EqualTo(attName)); 225 Assert.That(attachmentItem.Name, Is.EqualTo(attName));
225 226
226 InventoryFolderBase targetFolder = scene.InventoryService.GetFolderForType(sp.UUID, AssetType.Object); 227 InventoryFolderBase targetFolder = scene.InventoryService.GetFolderForType(sp.UUID, FolderType.Object);
227 Assert.That(attachmentItem.Folder, Is.EqualTo(targetFolder.ID)); 228 Assert.That(attachmentItem.Folder, Is.EqualTo(targetFolder.ID));
228 229
229 Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1)); 230 Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1));
@@ -270,7 +271,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
270 Assert.That(attachmentItem, Is.Not.Null); 271 Assert.That(attachmentItem, Is.Not.Null);
271 Assert.That(attachmentItem.Name, Is.EqualTo(so.Name)); 272 Assert.That(attachmentItem.Name, Is.EqualTo(so.Name));
272 273
273 InventoryFolderBase targetFolder = scene.InventoryService.GetFolderForType(sp.UUID, AssetType.Object); 274 InventoryFolderBase targetFolder = scene.InventoryService.GetFolderForType(sp.UUID, FolderType.Object);
274 Assert.That(attachmentItem.Folder, Is.EqualTo(targetFolder.ID)); 275 Assert.That(attachmentItem.Folder, Is.EqualTo(targetFolder.ID));
275 276
276 Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(2)); 277 Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(2));
@@ -303,7 +304,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
303 Assert.That(attachmentItem, Is.Not.Null); 304 Assert.That(attachmentItem, Is.Not.Null);
304 Assert.That(attachmentItem.Name, Is.EqualTo(so2.Name)); 305 Assert.That(attachmentItem.Name, Is.EqualTo(so2.Name));
305 306
306 InventoryFolderBase targetFolder = scene.InventoryService.GetFolderForType(sp.UUID, AssetType.Object); 307 InventoryFolderBase targetFolder = scene.InventoryService.GetFolderForType(sp.UUID, FolderType.Object);
307 Assert.That(attachmentItem.Folder, Is.EqualTo(targetFolder.ID)); 308 Assert.That(attachmentItem.Folder, Is.EqualTo(targetFolder.ID));
308 309
309 Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1)); 310 Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1));
@@ -336,7 +337,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
336 Assert.That(attachmentItem, Is.Not.Null); 337 Assert.That(attachmentItem, Is.Not.Null);
337 Assert.That(attachmentItem.Name, Is.EqualTo(so2.Name)); 338 Assert.That(attachmentItem.Name, Is.EqualTo(so2.Name));
338 339
339 InventoryFolderBase targetFolder = scene.InventoryService.GetFolderForType(sp.UUID, AssetType.Object); 340 InventoryFolderBase targetFolder = scene.InventoryService.GetFolderForType(sp.UUID, FolderType.Object);
340 Assert.That(attachmentItem.Folder, Is.EqualTo(targetFolder.ID)); 341 Assert.That(attachmentItem.Folder, Is.EqualTo(targetFolder.ID));
341 342
342 Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1)); 343 Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1));
@@ -385,7 +386,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
385 public void TestRezAttachmentFromInventory() 386 public void TestRezAttachmentFromInventory()
386 { 387 {
387 TestHelpers.InMethod(); 388 TestHelpers.InMethod();
388// log4net.Config.XmlConfigurator.Configure(); 389// TestHelpers.EnableLogging();
389 390
390 Scene scene = CreateTestScene(); 391 Scene scene = CreateTestScene();
391 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); 392 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
@@ -407,6 +408,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
407 Assert.That(attSo.IsAttachment); 408 Assert.That(attSo.IsAttachment);
408 Assert.That(attSo.UsesPhysics, Is.False); 409 Assert.That(attSo.UsesPhysics, Is.False);
409 Assert.That(attSo.IsTemporary, Is.False); 410 Assert.That(attSo.IsTemporary, Is.False);
411 Assert.IsFalse(attSo.Backup);
410 412
411 // Check appearance status 413 // Check appearance status
412 Assert.That(sp.Appearance.GetAttachments().Count, Is.EqualTo(1)); 414 Assert.That(sp.Appearance.GetAttachments().Count, Is.EqualTo(1));
@@ -544,7 +546,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
544 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10); 546 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10);
545 TaskInventoryItem scriptItem 547 TaskInventoryItem scriptItem
546 = TaskInventoryHelpers.AddScript( 548 = TaskInventoryHelpers.AddScript(
547 scene, 549 scene.AssetService,
548 so.RootPart, 550 so.RootPart,
549 "scriptItem", 551 "scriptItem",
550 "default { attach(key id) { if (id != NULL_KEY) { llSay(0, \"Hello World\"); } } }"); 552 "default { attach(key id) { if (id != NULL_KEY) { llSay(0, \"Hello World\"); } } }");
@@ -601,7 +603,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
601 Assert.That(scene.InventoryService.GetItem(new InventoryItemBase(attItem.ID)), Is.Null); 603 Assert.That(scene.InventoryService.GetItem(new InventoryItemBase(attItem.ID)), Is.Null);
602 604
603 // Check object in scene 605 // Check object in scene
604 Assert.That(scene.GetSceneObjectGroup("att"), Is.Not.Null); 606 SceneObjectGroup soInScene = scene.GetSceneObjectGroup("att");
607 Assert.That(soInScene, Is.Not.Null);
608 Assert.IsTrue(soInScene.Backup);
605 609
606 // Check events 610 // Check events
607 Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(1)); 611 Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(1));
@@ -655,7 +659,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
655 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10); 659 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10);
656 TaskInventoryItem scriptTaskItem 660 TaskInventoryItem scriptTaskItem
657 = TaskInventoryHelpers.AddScript( 661 = TaskInventoryHelpers.AddScript(
658 scene, 662 scene.AssetService,
659 so.RootPart, 663 so.RootPart,
660 "scriptItem", 664 "scriptItem",
661 "default { attach(key id) { if (id != NULL_KEY) { llSay(0, \"Hello World\"); } } }"); 665 "default { attach(key id) { if (id != NULL_KEY) { llSay(0, \"Hello World\"); } } }");
@@ -755,6 +759,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
755 Assert.That(attSo.IsAttachment); 759 Assert.That(attSo.IsAttachment);
756 Assert.That(attSo.UsesPhysics, Is.False); 760 Assert.That(attSo.UsesPhysics, Is.False);
757 Assert.That(attSo.IsTemporary, Is.False); 761 Assert.That(attSo.IsTemporary, Is.False);
762 Assert.IsFalse(attSo.Backup);
758 763
759 // Check appearance status 764 // Check appearance status
760 List<AvatarAttachment> retreivedAttachments = presence.Appearance.GetAttachments(); 765 List<AvatarAttachment> retreivedAttachments = presence.Appearance.GetAttachments();
@@ -884,6 +889,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
884 SceneObjectGroup actualSceneBAtt = actualSceneBAttachments[0]; 889 SceneObjectGroup actualSceneBAtt = actualSceneBAttachments[0];
885 Assert.That(actualSceneBAtt.Name, Is.EqualTo(attItem.Name)); 890 Assert.That(actualSceneBAtt.Name, Is.EqualTo(attItem.Name));
886 Assert.That(actualSceneBAtt.AttachmentPoint, Is.EqualTo((uint)AttachmentPoint.Chest)); 891 Assert.That(actualSceneBAtt.AttachmentPoint, Is.EqualTo((uint)AttachmentPoint.Chest));
892 Assert.IsFalse(actualSceneBAtt.Backup);
887 893
888 Assert.That(sceneB.GetSceneObjectGroups().Count, Is.EqualTo(1)); 894 Assert.That(sceneB.GetSceneObjectGroups().Count, Is.EqualTo(1));
889 895
@@ -994,6 +1000,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
994 SceneObjectGroup actualSceneBAtt = actualSceneBAttachments[0]; 1000 SceneObjectGroup actualSceneBAtt = actualSceneBAttachments[0];
995 Assert.That(actualSceneBAtt.Name, Is.EqualTo(attItem.Name)); 1001 Assert.That(actualSceneBAtt.Name, Is.EqualTo(attItem.Name));
996 Assert.That(actualSceneBAtt.AttachmentPoint, Is.EqualTo((uint)AttachmentPoint.Chest)); 1002 Assert.That(actualSceneBAtt.AttachmentPoint, Is.EqualTo((uint)AttachmentPoint.Chest));
1003 Assert.IsFalse(actualSceneBAtt.Backup);
997 1004
998 Assert.That(sceneB.GetSceneObjectGroups().Count, Is.EqualTo(1)); 1005 Assert.That(sceneB.GetSceneObjectGroups().Count, Is.EqualTo(1));
999 1006
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index 22f0366..1e9cfba 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -229,7 +229,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
229 private void SendAppearance(ScenePresence sp) 229 private void SendAppearance(ScenePresence sp)
230 { 230 {
231 // Send the appearance to everyone in the scene 231 // Send the appearance to everyone in the scene
232 sp.SendAppearanceToAllOtherAgents(); 232 sp.SendAppearanceToAllOtherClients();
233 233
234 // Send animations back to the avatar as well 234 // Send animations back to the avatar as well
235 sp.Animator.SendAnimPack(); 235 sp.Animator.SendAnimPack();
@@ -529,6 +529,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
529 ); 529 );
530 } 530 }
531 } 531 }
532<<<<<<< HEAD
533
534// m_log.DebugFormat(
535// "[AVFACTORY]: Looking for texture {0}, id {1} for {2} {3}",
536// face.TextureID, idx, client.Name, client.AgentId);
537=======
532*/ 538*/
533 bool wearableCacheValid = false; 539 bool wearableCacheValid = false;
534 if (wearableCache == null) 540 if (wearableCache == null)
@@ -571,9 +577,15 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
571 if (wearableCacheValid) 577 if (wearableCacheValid)
572 m_log.Debug("[ValidateBakedCache] have valid local cache"); 578 m_log.Debug("[ValidateBakedCache] have valid local cache");
573 } 579 }
580>>>>>>> avn/ubitvar
574 581
575 bool checkExternal = false; 582 bool checkExternal = false;
576 583
584<<<<<<< HEAD
585 if (m_scene.AssetService.Get(face.TextureID.ToString()) == null)
586 return false;
587 }
588=======
577 if (!wearableCacheValid) 589 if (!wearableCacheValid)
578 { 590 {
579 // only use external bake module on login condition check 591 // only use external bake module on login condition check
@@ -646,6 +658,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
646 } 658 }
647 } 659 }
648 } 660 }
661>>>>>>> avn/ubitvar
649 662
650 sp.Appearance.WearableCacheItems = wearableCache; 663 sp.Appearance.WearableCacheItems = wearableCache;
651 664
@@ -672,7 +685,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
672 return 0; 685 return 0;
673 686
674 int texturesRebaked = 0; 687 int texturesRebaked = 0;
675 IImprovedAssetCache cache = m_scene.RequestModuleInterface<IImprovedAssetCache>(); 688// IImprovedAssetCache cache = m_scene.RequestModuleInterface<IImprovedAssetCache>();
676 689
677 for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) 690 for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++)
678 { 691 {
@@ -688,36 +701,21 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
688 701
689 if (missingTexturesOnly) 702 if (missingTexturesOnly)
690 { 703 {
691 if (cache != null) 704 if (m_scene.AssetService.Get(face.TextureID.ToString()) != null)
692 { 705 {
693 if (cache.Check(face.TextureID.ToString())) 706 continue;
694 continue;
695 else
696 {
697 m_log.DebugFormat(
698 "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.",
699 face.TextureID, idx, sp.Name);
700 }
701 } 707 }
702 else 708 else
703 { 709 {
704 if (m_scene.AssetService.Get(face.TextureID.ToString()) != null) 710 // On inter-simulator teleports, this occurs if baked textures are not being stored by the
705 { 711 // grid asset service (which means that they are not available to the new region and so have
706 continue; 712 // to be re-requested from the client).
707 } 713 //
708 714 // The only available core OpenSimulator behaviour right now
709 else 715 // is not to store these textures, temporarily or otherwise.
710 { 716 m_log.DebugFormat(
711 // On inter-simulator teleports, this occurs if baked textures are not being stored by the 717 "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.",
712 // grid asset service (which means that they are not available to the new region and so have 718 face.TextureID, idx, sp.Name);
713 // to be re-requested from the client).
714 //
715 // The only available core OpenSimulator behaviour right now
716 // is not to store these textures, temporarily or otherwise.
717 m_log.DebugFormat(
718 "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.",
719 face.TextureID, idx, sp.Name);
720 }
721 } 719 }
722 } 720 }
723 else 721 else
@@ -786,7 +784,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
786 784
787 if (sendTime < now) 785 if (sendTime < now)
788 { 786 {
789 Util.FireAndForget(o => SendAppearance(avatarID)); 787 Util.FireAndForget(o => SendAppearance(avatarID), null, "AvatarFactoryModule.SendAppearance");
790 m_sendqueue.Remove(avatarID); 788 m_sendqueue.Remove(avatarID);
791 } 789 }
792 } 790 }
@@ -804,7 +802,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
804 802
805 if (sendTime < now) 803 if (sendTime < now)
806 { 804 {
807 Util.FireAndForget(o => SaveAppearance(avatarID)); 805 Util.FireAndForget(o => SaveAppearance(avatarID), null, "AvatarFactoryModule.SaveAppearance");
808 m_savequeue.Remove(avatarID); 806 m_savequeue.Remove(avatarID);
809 } 807 }
810 } 808 }
@@ -856,187 +854,238 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
856 m_scene.EventManager.TriggerAvatarAppearanceChanged(sp); 854 m_scene.EventManager.TriggerAvatarAppearanceChanged(sp);
857 } 855 }
858 856
857 /// <summary>
858 /// For a given set of appearance items, check whether the items are valid and add their asset IDs to
859 /// appearance data.
860 /// </summary>
861 /// <param name='userID'></param>
862 /// <param name='appearance'></param>
859 private void SetAppearanceAssets(UUID userID, AvatarAppearance appearance) 863 private void SetAppearanceAssets(UUID userID, AvatarAppearance appearance)
860 { 864 {
861 IInventoryService invService = m_scene.InventoryService; 865 IInventoryService invService = m_scene.InventoryService;
862 bool resetwearable = false; 866
863 if (invService.GetRootFolder(userID) != null) 867 if (invService.GetRootFolder(userID) != null)
864 { 868 {
865 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) 869 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
866 { 870 {
867 for (int j = 0; j < appearance.Wearables[i].Count; j++) 871 for (int j = 0; j < appearance.Wearables[i].Count; j++)
868 { 872 {
869 // Check if the default wearables are not set
870 if (appearance.Wearables[i][j].ItemID == UUID.Zero) 873 if (appearance.Wearables[i][j].ItemID == UUID.Zero)
871 { 874 {
872 switch ((WearableType) i) 875 m_log.WarnFormat(
873 { 876 "[AVFACTORY]: Wearable item {0}:{1} for user {2} unexpectedly UUID.Zero. Ignoring.",
874 case WearableType.Eyes: 877 i, j, userID);
875 case WearableType.Hair:
876 case WearableType.Shape:
877 case WearableType.Skin:
878 //case WearableType.Underpants:
879 TryAndRepairBrokenWearable((WearableType)i, invService, userID, appearance);
880 resetwearable = true;
881 m_log.Warn("[AVFACTORY]: UUID.Zero Wearables, passing fake values.");
882 resetwearable = true;
883 break;
884 878
885 }
886 continue; 879 continue;
887 } 880 }
888 881
889 // Ignore ruth's assets except for the body parts! missing body parts fail avatar appearance on V1 882 // Ignore ruth's assets
890 if (appearance.Wearables[i][j].ItemID == AvatarWearable.DefaultWearables[i][0].ItemID) 883 if (appearance.Wearables[i][j].ItemID == AvatarWearable.DefaultWearables[i][0].ItemID)
891 {
892 switch ((WearableType)i)
893 {
894 case WearableType.Eyes:
895 case WearableType.Hair:
896 case WearableType.Shape:
897 case WearableType.Skin:
898 //case WearableType.Underpants:
899 TryAndRepairBrokenWearable((WearableType)i, invService, userID, appearance);
900
901 m_log.WarnFormat("[AVFACTORY]: {0} Default Wearables, passing existing values.", (WearableType)i);
902 resetwearable = true;
903 break;
904
905 }
906 continue; 884 continue;
907 } 885
908
909 InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i][j].ItemID, userID); 886 InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i][j].ItemID, userID);
910 baseItem = invService.GetItem(baseItem); 887 baseItem = invService.GetItem(baseItem);
911 888
912 if (baseItem != null) 889 if (baseItem != null)
913 { 890 {
914 appearance.Wearables[i].Add(appearance.Wearables[i][j].ItemID, baseItem.AssetID); 891 appearance.Wearables[i].Add(appearance.Wearables[i][j].ItemID, baseItem.AssetID);
915 int unmodifiedWearableIndexForClosure = i;
916 m_scene.AssetService.Get(baseItem.AssetID.ToString(), this,
917 delegate(string x, object y, AssetBase z)
918 {
919 if (z == null)
920 {
921 TryAndRepairBrokenWearable(
922 (WearableType)unmodifiedWearableIndexForClosure, invService,
923 userID, appearance);
924 }
925 });
926 } 892 }
927 else 893 else
928 { 894 {
929 m_log.ErrorFormat( 895 m_log.WarnFormat(
930 "[AVFACTORY]: Can't find inventory item {0} for {1}, setting to default", 896 "[AVFACTORY]: Can't find inventory item {0} for {1}, setting to default",
931 appearance.Wearables[i][j].ItemID, (WearableType)i); 897 appearance.Wearables[i][j].ItemID, (WearableType)i);
932 898
933 TryAndRepairBrokenWearable((WearableType)i, invService, userID, appearance); 899 appearance.Wearables[i].RemoveItem(appearance.Wearables[i][j].ItemID);
934 resetwearable = true;
935
936 } 900 }
937 } 901 }
938 } 902 }
939
940 // I don't know why we have to test for this again... but the above switches do not capture these scenarios for some reason....
941 if (appearance.Wearables[(int) WearableType.Eyes] == null)
942 {
943 m_log.WarnFormat("[AVFACTORY]: {0} Eyes are Null, passing existing values.", (WearableType.Eyes));
944
945 TryAndRepairBrokenWearable(WearableType.Eyes, invService, userID, appearance);
946 resetwearable = true;
947 }
948 else
949 {
950 if (appearance.Wearables[(int) WearableType.Eyes][0].ItemID == UUID.Zero)
951 {
952 m_log.WarnFormat("[AVFACTORY]: Eyes are UUID.Zero are broken, {0} {1}",
953 appearance.Wearables[(int) WearableType.Eyes][0].ItemID,
954 appearance.Wearables[(int) WearableType.Eyes][0].AssetID);
955 TryAndRepairBrokenWearable(WearableType.Eyes, invService, userID, appearance);
956 resetwearable = true;
957
958 }
959
960 }
961 // I don't know why we have to test for this again... but the above switches do not capture these scenarios for some reason....
962 if (appearance.Wearables[(int)WearableType.Shape] == null)
963 {
964 m_log.WarnFormat("[AVFACTORY]: {0} shape is Null, passing existing values.", (WearableType.Shape));
965
966 TryAndRepairBrokenWearable(WearableType.Shape, invService, userID, appearance);
967 resetwearable = true;
968 }
969 else
970 {
971 if (appearance.Wearables[(int)WearableType.Shape][0].ItemID == UUID.Zero)
972 {
973 m_log.WarnFormat("[AVFACTORY]: Shape is UUID.Zero and broken, {0} {1}",
974 appearance.Wearables[(int)WearableType.Shape][0].ItemID,
975 appearance.Wearables[(int)WearableType.Shape][0].AssetID);
976 TryAndRepairBrokenWearable(WearableType.Shape, invService, userID, appearance);
977 resetwearable = true;
978
979 }
980
981 }
982 // I don't know why we have to test for this again... but the above switches do not capture these scenarios for some reason....
983 if (appearance.Wearables[(int)WearableType.Hair] == null)
984 {
985 m_log.WarnFormat("[AVFACTORY]: {0} Hair is Null, passing existing values.", (WearableType.Hair));
986
987 TryAndRepairBrokenWearable(WearableType.Hair, invService, userID, appearance);
988 resetwearable = true;
989 }
990 else
991 {
992 if (appearance.Wearables[(int)WearableType.Hair][0].ItemID == UUID.Zero)
993 {
994 m_log.WarnFormat("[AVFACTORY]: Hair is UUID.Zero and broken, {0} {1}",
995 appearance.Wearables[(int)WearableType.Hair][0].ItemID,
996 appearance.Wearables[(int)WearableType.Hair][0].AssetID);
997 TryAndRepairBrokenWearable(WearableType.Hair, invService, userID, appearance);
998 resetwearable = true;
999
1000 }
1001
1002 }
1003 // I don't know why we have to test for this again... but the above switches do not capture these scenarios for some reason....
1004 if (appearance.Wearables[(int)WearableType.Skin] == null)
1005 {
1006 m_log.WarnFormat("[AVFACTORY]: {0} Skin is Null, passing existing values.", (WearableType.Skin));
1007
1008 TryAndRepairBrokenWearable(WearableType.Skin, invService, userID, appearance);
1009 resetwearable = true;
1010 }
1011 else
1012 {
1013 if (appearance.Wearables[(int)WearableType.Skin][0].ItemID == UUID.Zero)
1014 {
1015 m_log.WarnFormat("[AVFACTORY]: Skin is UUID.Zero and broken, {0} {1}",
1016 appearance.Wearables[(int)WearableType.Skin][0].ItemID,
1017 appearance.Wearables[(int)WearableType.Skin][0].AssetID);
1018 TryAndRepairBrokenWearable(WearableType.Skin, invService, userID, appearance);
1019 resetwearable = true;
1020
1021 }
1022
1023 }
1024 if (resetwearable)
1025 {
1026 ScenePresence presence = null;
1027 if (m_scene.TryGetScenePresence(userID, out presence))
1028 {
1029 presence.ControllingClient.SendWearables(presence.Appearance.Wearables,
1030 presence.Appearance.Serial++);
1031 }
1032 }
1033
1034 } 903 }
1035 else 904 else
1036 { 905 {
1037 m_log.WarnFormat("[AVFACTORY]: user {0} has no inventory, appearance isn't going to work", userID); 906 m_log.WarnFormat("[AVFACTORY]: user {0} has no inventory, appearance isn't going to work", userID);
1038 } 907 }
908
909// IInventoryService invService = m_scene.InventoryService;
910// bool resetwearable = false;
911// if (invService.GetRootFolder(userID) != null)
912// {
913// for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
914// {
915// for (int j = 0; j < appearance.Wearables[i].Count; j++)
916// {
917// // Check if the default wearables are not set
918// if (appearance.Wearables[i][j].ItemID == UUID.Zero)
919// {
920// switch ((WearableType) i)
921// {
922// case WearableType.Eyes:
923// case WearableType.Hair:
924// case WearableType.Shape:
925// case WearableType.Skin:
926// //case WearableType.Underpants:
927// TryAndRepairBrokenWearable((WearableType)i, invService, userID, appearance);
928// resetwearable = true;
929// m_log.Warn("[AVFACTORY]: UUID.Zero Wearables, passing fake values.");
930// resetwearable = true;
931// break;
932//
933// }
934// continue;
935// }
936//
937// // Ignore ruth's assets except for the body parts! missing body parts fail avatar appearance on V1
938// if (appearance.Wearables[i][j].ItemID == AvatarWearable.DefaultWearables[i][0].ItemID)
939// {
940// switch ((WearableType)i)
941// {
942// case WearableType.Eyes:
943// case WearableType.Hair:
944// case WearableType.Shape:
945// case WearableType.Skin:
946// //case WearableType.Underpants:
947// TryAndRepairBrokenWearable((WearableType)i, invService, userID, appearance);
948//
949// m_log.WarnFormat("[AVFACTORY]: {0} Default Wearables, passing existing values.", (WearableType)i);
950// resetwearable = true;
951// break;
952//
953// }
954// continue;
955// }
956//
957// InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i][j].ItemID, userID);
958// baseItem = invService.GetItem(baseItem);
959//
960// if (baseItem != null)
961// {
962// appearance.Wearables[i].Add(appearance.Wearables[i][j].ItemID, baseItem.AssetID);
963// int unmodifiedWearableIndexForClosure = i;
964// m_scene.AssetService.Get(baseItem.AssetID.ToString(), this,
965// delegate(string x, object y, AssetBase z)
966// {
967// if (z == null)
968// {
969// TryAndRepairBrokenWearable(
970// (WearableType)unmodifiedWearableIndexForClosure, invService,
971// userID, appearance);
972// }
973// });
974// }
975// else
976// {
977// m_log.ErrorFormat(
978// "[AVFACTORY]: Can't find inventory item {0} for {1}, setting to default",
979// appearance.Wearables[i][j].ItemID, (WearableType)i);
980//
981// TryAndRepairBrokenWearable((WearableType)i, invService, userID, appearance);
982// resetwearable = true;
983//
984// }
985// }
986// }
987//
988// // I don't know why we have to test for this again... but the above switches do not capture these scenarios for some reason....
989// if (appearance.Wearables[(int) WearableType.Eyes] == null)
990// {
991// m_log.WarnFormat("[AVFACTORY]: {0} Eyes are Null, passing existing values.", (WearableType.Eyes));
992//
993// TryAndRepairBrokenWearable(WearableType.Eyes, invService, userID, appearance);
994// resetwearable = true;
995// }
996// else
997// {
998// if (appearance.Wearables[(int) WearableType.Eyes][0].ItemID == UUID.Zero)
999// {
1000// m_log.WarnFormat("[AVFACTORY]: Eyes are UUID.Zero are broken, {0} {1}",
1001// appearance.Wearables[(int) WearableType.Eyes][0].ItemID,
1002// appearance.Wearables[(int) WearableType.Eyes][0].AssetID);
1003// TryAndRepairBrokenWearable(WearableType.Eyes, invService, userID, appearance);
1004// resetwearable = true;
1005//
1006// }
1007//
1008// }
1009// // I don't know why we have to test for this again... but the above switches do not capture these scenarios for some reason....
1010// if (appearance.Wearables[(int)WearableType.Shape] == null)
1011// {
1012// m_log.WarnFormat("[AVFACTORY]: {0} shape is Null, passing existing values.", (WearableType.Shape));
1013//
1014// TryAndRepairBrokenWearable(WearableType.Shape, invService, userID, appearance);
1015// resetwearable = true;
1016// }
1017// else
1018// {
1019// if (appearance.Wearables[(int)WearableType.Shape][0].ItemID == UUID.Zero)
1020// {
1021// m_log.WarnFormat("[AVFACTORY]: Shape is UUID.Zero and broken, {0} {1}",
1022// appearance.Wearables[(int)WearableType.Shape][0].ItemID,
1023// appearance.Wearables[(int)WearableType.Shape][0].AssetID);
1024// TryAndRepairBrokenWearable(WearableType.Shape, invService, userID, appearance);
1025// resetwearable = true;
1026//
1027// }
1028//
1029// }
1030// // I don't know why we have to test for this again... but the above switches do not capture these scenarios for some reason....
1031// if (appearance.Wearables[(int)WearableType.Hair] == null)
1032// {
1033// m_log.WarnFormat("[AVFACTORY]: {0} Hair is Null, passing existing values.", (WearableType.Hair));
1034//
1035// TryAndRepairBrokenWearable(WearableType.Hair, invService, userID, appearance);
1036// resetwearable = true;
1037// }
1038// else
1039// {
1040// if (appearance.Wearables[(int)WearableType.Hair][0].ItemID == UUID.Zero)
1041// {
1042// m_log.WarnFormat("[AVFACTORY]: Hair is UUID.Zero and broken, {0} {1}",
1043// appearance.Wearables[(int)WearableType.Hair][0].ItemID,
1044// appearance.Wearables[(int)WearableType.Hair][0].AssetID);
1045// TryAndRepairBrokenWearable(WearableType.Hair, invService, userID, appearance);
1046// resetwearable = true;
1047//
1048// }
1049//
1050// }
1051// // I don't know why we have to test for this again... but the above switches do not capture these scenarios for some reason....
1052// if (appearance.Wearables[(int)WearableType.Skin] == null)
1053// {
1054// m_log.WarnFormat("[AVFACTORY]: {0} Skin is Null, passing existing values.", (WearableType.Skin));
1055//
1056// TryAndRepairBrokenWearable(WearableType.Skin, invService, userID, appearance);
1057// resetwearable = true;
1058// }
1059// else
1060// {
1061// if (appearance.Wearables[(int)WearableType.Skin][0].ItemID == UUID.Zero)
1062// {
1063// m_log.WarnFormat("[AVFACTORY]: Skin is UUID.Zero and broken, {0} {1}",
1064// appearance.Wearables[(int)WearableType.Skin][0].ItemID,
1065// appearance.Wearables[(int)WearableType.Skin][0].AssetID);
1066// TryAndRepairBrokenWearable(WearableType.Skin, invService, userID, appearance);
1067// resetwearable = true;
1068//
1069// }
1070//
1071// }
1072// if (resetwearable)
1073// {
1074// ScenePresence presence = null;
1075// if (m_scene.TryGetScenePresence(userID, out presence))
1076// {
1077// presence.ControllingClient.SendWearables(presence.Appearance.Wearables,
1078// presence.Appearance.Serial++);
1079// }
1080// }
1081//
1082// }
1083// else
1084// {
1085// m_log.WarnFormat("[AVFACTORY]: user {0} has no inventory, appearance isn't going to work", userID);
1086// }
1039 } 1087 }
1088
1040 private void TryAndRepairBrokenWearable(WearableType type, IInventoryService invService, UUID userID,AvatarAppearance appearance) 1089 private void TryAndRepairBrokenWearable(WearableType type, IInventoryService invService, UUID userID,AvatarAppearance appearance)
1041 { 1090 {
1042 UUID defaultwearable = GetDefaultItem(type); 1091 UUID defaultwearable = GetDefaultItem(type);
@@ -1050,8 +1099,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
1050 AssetType 1099 AssetType
1051 = 1100 =
1052 (int) 1101 (int)
1053 AssetType 1102 FolderType
1054 .Bodypart, 1103 .BodyPart,
1055 CreatorId 1104 CreatorId
1056 = 1105 =
1057 userID 1106 userID
@@ -1066,8 +1115,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
1066 invService 1115 invService
1067 .GetFolderForType 1116 .GetFolderForType
1068 (userID, 1117 (userID,
1069 AssetType 1118 FolderType
1070 .Bodypart) 1119 .BodyPart)
1071 .ID, 1120 .ID,
1072 Flags = (uint) type, 1121 Flags = (uint) type,
1073 Name = Enum.GetName(typeof (WearableType), type), 1122 Name = Enum.GetName(typeof (WearableType), type),
@@ -1102,8 +1151,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
1102 invService 1151 invService
1103 .GetFolderForType 1152 .GetFolderForType
1104 (userID, 1153 (userID,
1105 AssetType 1154 FolderType
1106 .CurrentOutfitFolder) 1155 .CurrentOutfit)
1107 .ID, 1156 .ID,
1108 Flags = (uint) type, 1157 Flags = (uint) type,
1109 Name = Enum.GetName(typeof (WearableType), type), 1158 Name = Enum.GetName(typeof (WearableType), type),
@@ -1120,12 +1169,13 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
1120 { 1169 {
1121 m_scene.SendInventoryUpdate(presence.ControllingClient, 1170 m_scene.SendInventoryUpdate(presence.ControllingClient,
1122 invService.GetFolderForType(userID, 1171 invService.GetFolderForType(userID,
1123 AssetType 1172 FolderType
1124 .CurrentOutfitFolder), 1173 .CurrentOutfit),
1125 false, true); 1174 false, true);
1126 } 1175 }
1127 } 1176 }
1128 } 1177 }
1178
1129 private UUID GetDefaultItem(WearableType wearable) 1179 private UUID GetDefaultItem(WearableType wearable)
1130 { 1180 {
1131 // These are ruth 1181 // These are ruth
@@ -1179,7 +1229,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
1179 client.SendWearables(sp.Appearance.Wearables, sp.Appearance.Serial++); 1229 client.SendWearables(sp.Appearance.Wearables, sp.Appearance.Serial++);
1180 else 1230 else
1181 m_log.WarnFormat("[AVFACTORY]: Client_OnRequestWearables unable to find presence for {0}", client.AgentId); 1231 m_log.WarnFormat("[AVFACTORY]: Client_OnRequestWearables unable to find presence for {0}", client.AgentId);
1182 }); 1232 }, null, "AvatarFactoryModule.OnClientRequestWearables");
1183 } 1233 }
1184 1234
1185 /// <summary> 1235 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs
index f090e15..b7ff4e0 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs
@@ -34,7 +34,6 @@ using OpenSim.Framework;
34using OpenSim.Region.CoreModules.Asset; 34using OpenSim.Region.CoreModules.Asset;
35using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
36using OpenSim.Tests.Common; 36using OpenSim.Tests.Common;
37using OpenSim.Tests.Common.Mock;
38 37
39namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory 38namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
40{ 39{
@@ -48,23 +47,110 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
48 public void TestSetAppearance() 47 public void TestSetAppearance()
49 { 48 {
50 TestHelpers.InMethod(); 49 TestHelpers.InMethod();
51// log4net.Config.XmlConfigurator.Configure(); 50// TestHelpers.EnableLogging();
51
52 UUID userId = TestHelpers.ParseTail(0x1);
53 UUID bakedTextureID = TestHelpers.ParseTail(0x2);
54
55 // We need an asset cache because otherwise the LocalAssetServiceConnector will short-circuit directly
56 // to the AssetService, which will then store temporary and local assets permanently
57 CoreAssetCache assetCache = new CoreAssetCache();
58
59 AvatarFactoryModule afm = new AvatarFactoryModule();
60 TestScene scene = new SceneHelpers(assetCache).SetupScene();
61 SceneHelpers.SetupSceneModules(scene, afm);
62 ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId);
63
64 // TODO: Use the actual BunchOfCaps functionality once we slot in the CapabilitiesModules
65 AssetBase bakedTextureAsset;
66 bakedTextureAsset
67 = new AssetBase(
68 bakedTextureID, "Test Baked Texture", (sbyte)AssetType.Texture, userId.ToString());
69 bakedTextureAsset.Data = new byte[] { 2 }; // Not necessary to have a genuine JPEG2000 asset here yet
70 bakedTextureAsset.Temporary = true;
71 bakedTextureAsset.Local = true;
72 scene.AssetService.Store(bakedTextureAsset);
73
74 byte[] visualParams = new byte[AvatarAppearance.VISUALPARAM_COUNT];
75 for (byte i = 0; i < visualParams.Length; i++)
76 visualParams[i] = i;
77
78 Primitive.TextureEntry bakedTextureEntry = new Primitive.TextureEntry(TestHelpers.ParseTail(0x10));
79 uint eyesFaceIndex = (uint)AppearanceManager.BakeTypeToAgentTextureIndex(BakeType.Eyes);
80 Primitive.TextureEntryFace eyesFace = bakedTextureEntry.CreateFace(eyesFaceIndex);
81
82 int rebakeRequestsReceived = 0;
83 ((TestClient)sp.ControllingClient).OnReceivedSendRebakeAvatarTextures += id => rebakeRequestsReceived++;
84
85 // This is the alpha texture
86 eyesFace.TextureID = bakedTextureID;
87 afm.SetAppearance(sp, bakedTextureEntry, visualParams, null);
88
89 Assert.That(rebakeRequestsReceived, Is.EqualTo(0));
90
91 AssetBase eyesBake = scene.AssetService.Get(bakedTextureID.ToString());
92 Assert.That(eyesBake, Is.Not.Null);
93 Assert.That(eyesBake.Temporary, Is.True);
94 Assert.That(eyesBake.Local, Is.True);
95 }
96
97 /// <summary>
98 /// Test appearance setting where the baked texture UUID are library alpha textures.
99 /// </summary>
100 /// <remarks>
101 /// For a mesh avatar, it appears these 'baked textures' are used. So these should not trigger a request to
102 /// rebake.
103 /// </remarks>
104 [Test]
105 public void TestSetAppearanceAlphaBakedTextures()
106 {
107 TestHelpers.InMethod();
108// TestHelpers.EnableLogging();
52 109
53 UUID userId = TestHelpers.ParseTail(0x1); 110 UUID userId = TestHelpers.ParseTail(0x1);
111 UUID alphaTextureID = new UUID("3a367d1c-bef1-6d43-7595-e88c1e3aadb3");
54 112
113 // We need an asset cache because otherwise the LocalAssetServiceConnector will short-circuit directly
114 // to the AssetService, which will then store temporary and local assets permanently
115 CoreAssetCache assetCache = new CoreAssetCache();
116
55 AvatarFactoryModule afm = new AvatarFactoryModule(); 117 AvatarFactoryModule afm = new AvatarFactoryModule();
56 TestScene scene = new SceneHelpers().SetupScene(); 118 TestScene scene = new SceneHelpers(assetCache).SetupScene();
57 SceneHelpers.SetupSceneModules(scene, afm); 119 SceneHelpers.SetupSceneModules(scene, afm);
58 ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId); 120 ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId);
59 121
122 AssetBase libraryAsset;
123 libraryAsset
124 = new AssetBase(
125 alphaTextureID, "Default Alpha Layer Texture", (sbyte)AssetType.Texture, userId.ToString());
126 libraryAsset.Data = new byte[] { 2 }; // Not necessary to have a genuine JPEG2000 asset here yet
127 libraryAsset.Temporary = false;
128 libraryAsset.Local = false;
129 scene.AssetService.Store(libraryAsset);
130
60 byte[] visualParams = new byte[AvatarAppearance.VISUALPARAM_COUNT]; 131 byte[] visualParams = new byte[AvatarAppearance.VISUALPARAM_COUNT];
61 for (byte i = 0; i < visualParams.Length; i++) 132 for (byte i = 0; i < visualParams.Length; i++)
62 visualParams[i] = i; 133 visualParams[i] = i;
63 134
135<<<<<<< HEAD
136 Primitive.TextureEntry bakedTextureEntry = new Primitive.TextureEntry(TestHelpers.ParseTail(0x10));
137 uint eyesFaceIndex = (uint)AppearanceManager.BakeTypeToAgentTextureIndex(BakeType.Eyes);
138 Primitive.TextureEntryFace eyesFace = bakedTextureEntry.CreateFace(eyesFaceIndex);
139
140 int rebakeRequestsReceived = 0;
141 ((TestClient)sp.ControllingClient).OnReceivedSendRebakeAvatarTextures += id => rebakeRequestsReceived++;
142
143 // This is the alpha texture
144 eyesFace.TextureID = alphaTextureID;
145 afm.SetAppearance(sp, bakedTextureEntry, visualParams, null);
146
147 Assert.That(rebakeRequestsReceived, Is.EqualTo(0));
148=======
64 afm.SetAppearance(sp, new Primitive.TextureEntry(TestHelpers.ParseTail(0x10)), visualParams, new WearableCacheItem[0]); 149 afm.SetAppearance(sp, new Primitive.TextureEntry(TestHelpers.ParseTail(0x10)), visualParams, new WearableCacheItem[0]);
65 150
66 // TODO: Check baked texture 151 // TODO: Check baked texture
67 Assert.AreEqual(visualParams, sp.Appearance.VisualParams); 152 Assert.AreEqual(visualParams, sp.Appearance.VisualParams);
153>>>>>>> avn/ubitvar
68 } 154 }
69 155
70 [Test] 156 [Test]
@@ -102,7 +188,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
102 Primitive.TextureEntryFace eyesFace = bakedTextureEntry.CreateFace(eyesFaceIndex); 188 Primitive.TextureEntryFace eyesFace = bakedTextureEntry.CreateFace(eyesFaceIndex);
103 eyesFace.TextureID = eyesTextureId; 189 eyesFace.TextureID = eyesTextureId;
104 190
191<<<<<<< HEAD
192 afm.SetAppearance(sp, bakedTextureEntry, visualParams, null);
193=======
105 afm.SetAppearance(sp, bakedTextureEntry, visualParams, new WearableCacheItem[0]); 194 afm.SetAppearance(sp, bakedTextureEntry, visualParams, new WearableCacheItem[0]);
195>>>>>>> avn/ubitvar
106 afm.SaveBakedTextures(userId); 196 afm.SaveBakedTextures(userId);
107// Dictionary<BakeType, Primitive.TextureEntryFace> bakedTextures = afm.GetBakedTextureFaces(userId); 197// Dictionary<BakeType, Primitive.TextureEntryFace> bakedTextures = afm.GetBakedTextureFaces(userId);
108 198
diff --git a/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs b/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs
new file mode 100644
index 0000000..7d2cad6
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs
@@ -0,0 +1,201 @@
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
28using OpenMetaverse;
29using Nini.Config;
30using System;
31using System.IO;
32using System.Text;
33using System.Xml;
34using System.Xml.Serialization;
35using System.Collections;
36using System.Collections.Generic;
37using System.Reflection;
38using log4net;
39using OpenSim.Framework;
40using OpenSim.Framework.ServiceAuth;
41using OpenSim.Framework.Communications;
42using OpenSim.Region.Framework.Interfaces;
43using OpenSim.Region.Framework.Scenes;
44using OpenSim.Services.Interfaces;
45using Mono.Addins;
46
47namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
48{
49 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "XBakes.Module")]
50 public class XBakesModule : INonSharedRegionModule, IBakedTextureModule
51 {
52 protected Scene m_Scene;
53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54 private UTF8Encoding enc = new UTF8Encoding();
55 private string m_URL = String.Empty;
56 private static XmlSerializer m_serializer = new XmlSerializer(typeof(AssetBase));
57
58 private static IServiceAuth m_Auth;
59
60 public void Initialise(IConfigSource configSource)
61 {
62 IConfig config = configSource.Configs["XBakes"];
63 if (config == null)
64 return;
65
66 m_URL = config.GetString("URL", String.Empty);
67 m_Auth = ServiceAuth.Create(configSource, "XBakes");
68 }
69
70 public void AddRegion(Scene scene)
71 {
72 // m_log.InfoFormat("[XBakes]: Enabled for region {0}", scene.RegionInfo.RegionName);
73 m_Scene = scene;
74
75 scene.RegisterModuleInterface<IBakedTextureModule>(this);
76 }
77
78 public void RegionLoaded(Scene scene)
79 {
80 }
81
82 public void RemoveRegion(Scene scene)
83 {
84 }
85
86 public void Close()
87 {
88 }
89
90 public string Name
91 {
92 get { return "XBakes.Module"; }
93 }
94
95 public Type ReplaceableInterface
96 {
97 get { return null; }
98 }
99
100 public WearableCacheItem[] Get(UUID id)
101 {
102 if (m_URL == String.Empty)
103 return null;
104
105 int size = 0;
106
107 using (RestClient rc = new RestClient(m_URL))
108 {
109 List<WearableCacheItem> ret = new List<WearableCacheItem>();
110 rc.AddResourcePath("bakes");
111 rc.AddResourcePath(id.ToString());
112
113 rc.RequestMethod = "GET";
114
115 try
116 {
117 Stream s = rc.Request(m_Auth);
118
119 using (XmlTextReader sr = new XmlTextReader(s))
120 {
121 sr.ReadStartElement("BakedAppearance");
122 while (sr.LocalName == "BakedTexture")
123 {
124 string sTextureIndex = sr.GetAttribute("TextureIndex");
125 int lTextureIndex = Convert.ToInt32(sTextureIndex);
126 string sCacheId = sr.GetAttribute("CacheId");
127 UUID lCacheId = UUID.Zero;
128 if (!(UUID.TryParse(sCacheId, out lCacheId)))
129 {
130 // ?? Nothing here
131 }
132
133 ++size;
134
135 sr.ReadStartElement("BakedTexture");
136 AssetBase a = (AssetBase)m_serializer.Deserialize(sr);
137 ret.Add(new WearableCacheItem() { CacheId = lCacheId, TextureIndex = (uint)lTextureIndex, TextureAsset = a, TextureID = a.FullID });
138
139 sr.ReadEndElement();
140 }
141
142 m_log.DebugFormat("[XBakes]: read {0} textures for user {1}", ret.Count, id);
143 }
144
145 return ret.ToArray();
146 }
147 catch (XmlException)
148 {
149 return null;
150 }
151 }
152 }
153
154 public void Store(UUID agentId, WearableCacheItem[] data)
155 {
156 if (m_URL == String.Empty)
157 return;
158
159 MemoryStream reqStream;
160
161 using (MemoryStream bakeStream = new MemoryStream())
162 using (XmlTextWriter bakeWriter = new XmlTextWriter(bakeStream, null))
163 {
164 bakeWriter.WriteStartElement(String.Empty, "BakedAppearance", String.Empty);
165
166 for (int i = 0; i < data.Length; i++)
167 {
168 if (data[i] != null)
169 {
170 bakeWriter.WriteStartElement(String.Empty, "BakedTexture", String.Empty);
171 bakeWriter.WriteAttributeString(String.Empty, "TextureIndex", String.Empty, data[i].TextureIndex.ToString());
172 bakeWriter.WriteAttributeString(String.Empty, "CacheId", String.Empty, data[i].CacheId.ToString());
173 if (data[i].TextureAsset != null)
174 m_serializer.Serialize(bakeWriter, data[i].TextureAsset);
175
176 bakeWriter.WriteEndElement();
177 }
178 }
179
180 bakeWriter.WriteEndElement();
181 bakeWriter.Flush();
182
183 reqStream = new MemoryStream(bakeStream.ToArray());
184 }
185
186 RestClient rc = new RestClient(m_URL);
187 rc.AddResourcePath("bakes");
188 rc.AddResourcePath(agentId.ToString());
189
190 rc.RequestMethod = "POST";
191
192 Util.FireAndForget(
193 delegate
194 {
195 rc.Request(reqStream, m_Auth);
196 m_log.DebugFormat("[XBakes]: stored {0} textures for user {1}", data.Length, agentId);
197 }, null, "XBakesModule.Store"
198 );
199 }
200 }
201} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
index 9d70063..2801ef0 100644
--- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
@@ -214,10 +214,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
214 UUID destination = c.Destination; 214 UUID destination = c.Destination;
215 Vector3 fromPos = c.Position; 215 Vector3 fromPos = c.Position;
216 Vector3 regionPos = new Vector3(scene.RegionInfo.WorldLocX, scene.RegionInfo.WorldLocY, 0); 216 Vector3 regionPos = new Vector3(scene.RegionInfo.WorldLocX, scene.RegionInfo.WorldLocY, 0);
217<<<<<<< HEAD
218=======
217 219
218 bool checkParcelHide = false; 220 bool checkParcelHide = false;
219 UUID sourceParcelID = UUID.Zero; 221 UUID sourceParcelID = UUID.Zero;
220 Vector3 hidePos = fromPos; 222 Vector3 hidePos = fromPos;
223>>>>>>> avn/ubitvar
221 224
222 if (c.Channel == DEBUG_CHANNEL) c.Type = ChatTypeEnum.DebugChannel; 225 if (c.Channel == DEBUG_CHANNEL) c.Type = ChatTypeEnum.DebugChannel;
223 226
@@ -355,22 +358,46 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
355 string fromName = c.From; 358 string fromName = c.From;
356 359
357 UUID fromID = UUID.Zero; 360 UUID fromID = UUID.Zero;
361 UUID ownerID = UUID.Zero;
358 ChatSourceType sourceType = ChatSourceType.Object; 362 ChatSourceType sourceType = ChatSourceType.Object;
359 if (null != c.Sender) 363 if (null != c.Sender)
360 { 364 {
361 ScenePresence avatar = (c.Scene as Scene).GetScenePresence(c.Sender.AgentId); 365 ScenePresence avatar = (c.Scene as Scene).GetScenePresence(c.Sender.AgentId);
362 fromID = c.Sender.AgentId; 366 fromID = c.Sender.AgentId;
363 fromName = avatar.Name; 367 fromName = avatar.Name;
368 ownerID = c.Sender.AgentId;
364 sourceType = ChatSourceType.Agent; 369 sourceType = ChatSourceType.Agent;
365 } 370 }
366 else if (c.SenderUUID != UUID.Zero) 371 else if (c.SenderUUID != UUID.Zero)
367 { 372 {
368 fromID = c.SenderUUID; 373 fromID = c.SenderUUID;
374 ownerID = ((SceneObjectPart)c.SenderObject).OwnerID;
369 } 375 }
370 376
371 // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType); 377 // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType);
372 HashSet<UUID> receiverIDs = new HashSet<UUID>(); 378 HashSet<UUID> receiverIDs = new HashSet<UUID>();
373 379
380<<<<<<< HEAD
381 ((Scene)c.Scene).ForEachRootClient(
382 delegate(IClientAPI client)
383 {
384 // don't forward SayOwner chat from objects to
385 // non-owner agents
386 if ((c.Type == ChatTypeEnum.Owner) &&
387 (null != c.SenderObject) &&
388 (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId))
389 return;
390
391 client.SendChatMessage(
392 c.Message, (byte)cType, CenterOfRegion, fromName, fromID, ownerID,
393 (byte)sourceType, (byte)ChatAudibleLevel.Fully);
394
395 receiverIDs.Add(client.AgentId);
396 });
397
398 (c.Scene as Scene).EventManager.TriggerOnChatToClients(
399 fromID, receiverIDs, c.Message, cType, CenterOfRegion, fromName, sourceType, ChatAudibleLevel.Fully);
400=======
374 if (c.Scene != null) 401 if (c.Scene != null)
375 { 402 {
376 ((Scene)c.Scene).ForEachRootClient 403 ((Scene)c.Scene).ForEachRootClient
@@ -392,6 +419,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
392 (c.Scene as Scene).EventManager.TriggerOnChatToClients( 419 (c.Scene as Scene).EventManager.TriggerOnChatToClients(
393 fromID, receiverIDs, c.Message, cType, CenterOfRegion, fromName, sourceType, ChatAudibleLevel.Fully); 420 fromID, receiverIDs, c.Message, cType, CenterOfRegion, fromName, sourceType, ChatAudibleLevel.Fully);
394 } 421 }
422>>>>>>> avn/ubitvar
395 } 423 }
396 424
397 /// <summary> 425 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/Tests/ChatModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Chat/Tests/ChatModuleTests.cs
new file mode 100644
index 0000000..3018d94
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Avatar/Chat/Tests/ChatModuleTests.cs
@@ -0,0 +1,285 @@
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
28using System;
29using System.Collections.Generic;
30using log4net.Config;
31using Nini.Config;
32using NUnit.Framework;
33using OpenMetaverse;
34using OpenSim.Framework;
35using OpenSim.Framework.Servers;
36using OpenSim.Framework.Servers.HttpServer;
37using OpenSim.Region.CoreModules.Avatar.Chat;
38using OpenSim.Region.CoreModules.Framework;
39using OpenSim.Region.CoreModules.Framework.EntityTransfer;
40using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
41using OpenSim.Region.Framework.Scenes;
42using OpenSim.Services.Interfaces;
43using OpenSim.Tests.Common;
44
45namespace OpenSim.Region.CoreModules.Avatar.Chat.Tests
46{
47 [TestFixture]
48 public class ChatModuleTests : OpenSimTestCase
49 {
50 [TestFixtureSetUp]
51 public void FixtureInit()
52 {
53 // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread.
54 // We must do this here so that child agent positions are updated in a predictable manner.
55 Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest;
56 }
57
58 [TestFixtureTearDown]
59 public void TearDown()
60 {
61 // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple
62 // threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression
63 // tests really shouldn't).
64 Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
65 }
66
67 private void SetupNeighbourRegions(TestScene sceneA, TestScene sceneB)
68 {
69 // XXX: HTTP server is not (and should not be) necessary for this test, though it's absence makes the
70 // CapabilitiesModule complain when it can't set up HTTP endpoints.
71 // BaseHttpServer httpServer = new BaseHttpServer(99999);
72 // MainServer.AddHttpServer(httpServer);
73 // MainServer.Instance = httpServer;
74
75 // We need entity transfer modules so that when sp2 logs into the east region, the region calls
76 // EntityTransferModuleto set up a child agent on the west region.
77 // XXX: However, this is not an entity transfer so is misleading.
78 EntityTransferModule etmA = new EntityTransferModule();
79 EntityTransferModule etmB = new EntityTransferModule();
80 LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
81
82 IConfigSource config = new IniConfigSource();
83 config.AddConfig("Chat");
84 IConfig modulesConfig = config.AddConfig("Modules");
85 modulesConfig.Set("EntityTransferModule", etmA.Name);
86 modulesConfig.Set("SimulationServices", lscm.Name);
87
88 SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
89 SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA, new ChatModule());
90 SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB, new ChatModule());
91 }
92
93 /// <summary>
94 /// Tests chat between neighbour regions on the east-west axis
95 /// </summary>
96 /// <remarks>
97 /// Really, this is a combination of a child agent position update test and a chat range test. These need
98 /// to be separated later on.
99 /// </remarks>
100 [Test]
101 public void TestInterRegionChatDistanceEastWest()
102 {
103 TestHelpers.InMethod();
104// TestHelpers.EnableLogging();
105
106 UUID sp1Uuid = TestHelpers.ParseTail(0x11);
107 UUID sp2Uuid = TestHelpers.ParseTail(0x12);
108
109 Vector3 sp1Position = new Vector3(6, 128, 20);
110 Vector3 sp2Position = new Vector3(250, 128, 20);
111
112 SceneHelpers sh = new SceneHelpers();
113 TestScene sceneWest = sh.SetupScene("sceneWest", TestHelpers.ParseTail(0x1), 1000, 1000);
114 TestScene sceneEast = sh.SetupScene("sceneEast", TestHelpers.ParseTail(0x2), 1001, 1000);
115
116 SetupNeighbourRegions(sceneWest, sceneEast);
117
118 ScenePresence sp1 = SceneHelpers.AddScenePresence(sceneEast, sp1Uuid);
119 TestClient sp1Client = (TestClient)sp1.ControllingClient;
120
121 // If we don't set agents to flying, test will go wrong as they instantly fall to z = 0.
122 // TODO: May need to create special complete no-op test physics module rather than basic physics, since
123 // physics is irrelevant to this test.
124 sp1.Flying = true;
125
126 // When sp1 logs in to sceneEast, it sets up a child agent in sceneWest and informs the sp2 client to
127 // make the connection. For this test, will simplify this chain by making the connection directly.
128 ScenePresence sp1Child = SceneHelpers.AddChildScenePresence(sceneWest, sp1Uuid);
129 TestClient sp1ChildClient = (TestClient)sp1Child.ControllingClient;
130
131 sp1.AbsolutePosition = sp1Position;
132
133 ScenePresence sp2 = SceneHelpers.AddScenePresence(sceneWest, sp2Uuid);
134 TestClient sp2Client = (TestClient)sp2.ControllingClient;
135 sp2.Flying = true;
136
137 ScenePresence sp2Child = SceneHelpers.AddChildScenePresence(sceneEast, sp2Uuid);
138 TestClient sp2ChildClient = (TestClient)sp2Child.ControllingClient;
139
140 sp2.AbsolutePosition = sp2Position;
141
142 // We must update the scenes in order to make the root new root agents trigger position updates in their
143 // children.
144 sceneWest.Update(1);
145 sceneEast.Update(1);
146
147 // Check child positions are correct.
148 Assert.AreEqual(
149 new Vector3(sp1Position.X + sceneEast.RegionInfo.RegionSizeX, sp1Position.Y, sp1Position.Z),
150 sp1ChildClient.SceneAgent.AbsolutePosition);
151
152 Assert.AreEqual(
153 new Vector3(sp2Position.X - sceneWest.RegionInfo.RegionSizeX, sp2Position.Y, sp2Position.Z),
154 sp2ChildClient.SceneAgent.AbsolutePosition);
155
156 string receivedSp1ChatMessage = "";
157 string receivedSp2ChatMessage = "";
158
159 sp1ChildClient.OnReceivedChatMessage
160 += (message, type, fromPos, fromName, fromAgentID, ownerID, source, audible) => receivedSp1ChatMessage = message;
161 sp2ChildClient.OnReceivedChatMessage
162 += (message, type, fromPos, fromName, fromAgentID, ownerID, source, audible) => receivedSp2ChatMessage = message;
163
164 TestUserInRange(sp1Client, "ello darling", ref receivedSp2ChatMessage);
165 TestUserInRange(sp2Client, "fantastic cats", ref receivedSp1ChatMessage);
166
167 sp1Position = new Vector3(30, 128, 20);
168 sp1.AbsolutePosition = sp1Position;
169 sceneEast.Update(1);
170
171 // Check child position is correct.
172 Assert.AreEqual(
173 new Vector3(sp1Position.X + sceneEast.RegionInfo.RegionSizeX, sp1Position.Y, sp1Position.Z),
174 sp1ChildClient.SceneAgent.AbsolutePosition);
175
176 TestUserOutOfRange(sp1Client, "beef", ref receivedSp2ChatMessage);
177 TestUserOutOfRange(sp2Client, "lentils", ref receivedSp1ChatMessage);
178 }
179
180 /// <summary>
181 /// Tests chat between neighbour regions on the north-south axis
182 /// </summary>
183 /// <remarks>
184 /// Really, this is a combination of a child agent position update test and a chat range test. These need
185 /// to be separated later on.
186 /// </remarks>
187 [Test]
188 public void TestInterRegionChatDistanceNorthSouth()
189 {
190 TestHelpers.InMethod();
191 // TestHelpers.EnableLogging();
192
193 UUID sp1Uuid = TestHelpers.ParseTail(0x11);
194 UUID sp2Uuid = TestHelpers.ParseTail(0x12);
195
196 Vector3 sp1Position = new Vector3(128, 250, 20);
197 Vector3 sp2Position = new Vector3(128, 6, 20);
198
199 SceneHelpers sh = new SceneHelpers();
200 TestScene sceneNorth = sh.SetupScene("sceneNorth", TestHelpers.ParseTail(0x1), 1000, 1000);
201 TestScene sceneSouth = sh.SetupScene("sceneSouth", TestHelpers.ParseTail(0x2), 1000, 1001);
202
203 SetupNeighbourRegions(sceneNorth, sceneSouth);
204
205 ScenePresence sp1 = SceneHelpers.AddScenePresence(sceneNorth, sp1Uuid);
206 TestClient sp1Client = (TestClient)sp1.ControllingClient;
207
208 // If we don't set agents to flying, test will go wrong as they instantly fall to z = 0.
209 // TODO: May need to create special complete no-op test physics module rather than basic physics, since
210 // physics is irrelevant to this test.
211 sp1.Flying = true;
212
213 // When sp1 logs in to sceneEast, it sets up a child agent in sceneNorth and informs the sp2 client to
214 // make the connection. For this test, will simplify this chain by making the connection directly.
215 ScenePresence sp1Child = SceneHelpers.AddChildScenePresence(sceneSouth, sp1Uuid);
216 TestClient sp1ChildClient = (TestClient)sp1Child.ControllingClient;
217
218 sp1.AbsolutePosition = sp1Position;
219
220 ScenePresence sp2 = SceneHelpers.AddScenePresence(sceneSouth, sp2Uuid);
221 TestClient sp2Client = (TestClient)sp2.ControllingClient;
222 sp2.Flying = true;
223
224 ScenePresence sp2Child = SceneHelpers.AddChildScenePresence(sceneNorth, sp2Uuid);
225 TestClient sp2ChildClient = (TestClient)sp2Child.ControllingClient;
226
227 sp2.AbsolutePosition = sp2Position;
228
229 // We must update the scenes in order to make the root new root agents trigger position updates in their
230 // children.
231 sceneNorth.Update(1);
232 sceneSouth.Update(1);
233
234 // Check child positions are correct.
235 Assert.AreEqual(
236 new Vector3(sp1Position.X, sp1Position.Y - sceneNorth.RegionInfo.RegionSizeY, sp1Position.Z),
237 sp1ChildClient.SceneAgent.AbsolutePosition);
238
239 Assert.AreEqual(
240 new Vector3(sp2Position.X, sp2Position.Y + sceneSouth.RegionInfo.RegionSizeY, sp2Position.Z),
241 sp2ChildClient.SceneAgent.AbsolutePosition);
242
243 string receivedSp1ChatMessage = "";
244 string receivedSp2ChatMessage = "";
245
246 sp1ChildClient.OnReceivedChatMessage
247 += (message, type, fromPos, fromName, fromAgentID, ownerID, source, audible) => receivedSp1ChatMessage = message;
248 sp2ChildClient.OnReceivedChatMessage
249 += (message, type, fromPos, fromName, fromAgentID, ownerID, source, audible) => receivedSp2ChatMessage = message;
250
251 TestUserInRange(sp1Client, "ello darling", ref receivedSp2ChatMessage);
252 TestUserInRange(sp2Client, "fantastic cats", ref receivedSp1ChatMessage);
253
254 sp1Position = new Vector3(30, 128, 20);
255 sp1.AbsolutePosition = sp1Position;
256 sceneNorth.Update(1);
257
258 // Check child position is correct.
259 Assert.AreEqual(
260 new Vector3(sp1Position.X, sp1Position.Y - sceneNorth.RegionInfo.RegionSizeY, sp1Position.Z),
261 sp1ChildClient.SceneAgent.AbsolutePosition);
262
263 TestUserOutOfRange(sp1Client, "beef", ref receivedSp2ChatMessage);
264 TestUserOutOfRange(sp2Client, "lentils", ref receivedSp1ChatMessage);
265 }
266
267 private void TestUserInRange(TestClient speakClient, string testMessage, ref string receivedMessage)
268 {
269 receivedMessage = "";
270
271 speakClient.Chat(0, ChatTypeEnum.Say, testMessage);
272
273 Assert.AreEqual(testMessage, receivedMessage);
274 }
275
276 private void TestUserOutOfRange(TestClient speakClient, string testMessage, ref string receivedMessage)
277 {
278 receivedMessage = "";
279
280 speakClient.Chat(0, ChatTypeEnum.Say, testMessage);
281
282 Assert.AreNotEqual(testMessage, receivedMessage);
283 }
284 }
285} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
index c52d586..b0b7054 100644
--- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
@@ -31,6 +31,7 @@ using Nini.Config;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Region.Framework.Interfaces; 32using OpenSim.Region.Framework.Interfaces;
33using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
34using OpenSim.Services.Interfaces;
34using OpenMetaverse; 35using OpenMetaverse;
35 36
36using Mono.Addins; 37using Mono.Addins;
@@ -182,8 +183,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
182 try 183 try
183 { 184 {
184 ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); 185 ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
186<<<<<<< HEAD
187
188 if (obj == null)
189 return;
190
191=======
185 if (obj == null) 192 if (obj == null)
186 return; 193 return;
194>>>>>>> avn/ubitvar
187 if ((obj.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0 195 if ((obj.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0
188 || avatar.Scene.RegionInfo.RegionSettings.AllowDamage) 196 || avatar.Scene.RegionInfo.RegionSettings.AllowDamage)
189 { 197 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
index 4fdcd01..56819fa 100644
--- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
@@ -133,13 +133,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
133 UUID objectID, UUID ownerID, string message, UUID textureID, 133 UUID objectID, UUID ownerID, string message, UUID textureID,
134 int ch, string[] buttonlabels) 134 int ch, string[] buttonlabels)
135 { 135 {
136 UserAccount account = m_scene.UserAccountService.GetUserAccount( 136 string username = m_scene.UserManagementModule.GetUserName(ownerID);
137 m_scene.RegionInfo.ScopeID, ownerID); 137 string ownerFirstName, ownerLastName = String.Empty;
138 string ownerFirstName, ownerLastName; 138 if (!String.IsNullOrEmpty(username))
139 if (account != null)
140 { 139 {
141 ownerFirstName = account.FirstName; 140 string[] parts = username.Split(' ');
142 ownerLastName = account.LastName; 141 ownerFirstName = parts[0];
142 if (parts.Length > 1)
143 ownerLastName = username.Split(' ')[1];
143 } 144 }
144 else 145 else
145 { 146 {
@@ -170,17 +171,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
170 } 171 }
171 172
172 public void SendTextBoxToUser(UUID avatarid, string message, 173 public void SendTextBoxToUser(UUID avatarid, string message,
173 int chatChannel, string name, UUID objectid, UUID ownerid) 174 int chatChannel, string name, UUID objectid, UUID ownerID)
174 { 175 {
175 UserAccount account = m_scene.UserAccountService.GetUserAccount( 176 string username = m_scene.UserManagementModule.GetUserName(ownerID);
176 m_scene.RegionInfo.ScopeID, ownerid); 177 string ownerFirstName, ownerLastName = String.Empty;
177 string ownerFirstName, ownerLastName; 178 if (!String.IsNullOrEmpty(username))
178 UUID ownerID = UUID.Zero;
179 if (account != null)
180 { 179 {
181 ownerFirstName = account.FirstName; 180 string[] parts = username.Split(' ');
182 ownerLastName = account.LastName; 181 ownerFirstName = parts[0];
183 ownerID = account.PrincipalID; 182 if (parts.Length > 1)
183 ownerLastName = username.Split(' ')[1];
184 } 184 }
185 else 185 else
186 { 186 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs
index b44a5c9..eb23e83 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs
@@ -181,7 +181,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
181 if (folderID == UUID.Zero) 181 if (folderID == UUID.Zero)
182 { 182 {
183 InventoryFolderBase folder = inv.GetFolderForType(userID, 183 InventoryFolderBase folder = inv.GetFolderForType(userID,
184 AssetType.CallingCard); 184 FolderType.CallingCard);
185 185
186 if (folder == null) // Nowhere to put it 186 if (folder == null) // Nowhere to put it
187 return UUID.Zero; 187 return UUID.Zero;
@@ -237,7 +237,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
237 IInventoryService invService = m_Scenes[0].InventoryService; 237 IInventoryService invService = m_Scenes[0].InventoryService;
238 238
239 InventoryFolderBase trashFolder = 239 InventoryFolderBase trashFolder =
240 invService.GetFolderForType(client.AgentId, AssetType.TrashFolder); 240 invService.GetFolderForType(client.AgentId, FolderType.Trash);
241 241
242 InventoryItemBase item = new InventoryItemBase(transactionID, client.AgentId); 242 InventoryItemBase item = new InventoryItemBase(transactionID, client.AgentId);
243 item = invService.GetItem(item); 243 item = invService.GetItem(item);
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index b693f2d..7ab568e 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -94,6 +94,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
94 protected Dictionary<UUID, UserFriendData> m_Friends = new Dictionary<UUID, UserFriendData>(); 94 protected Dictionary<UUID, UserFriendData> m_Friends = new Dictionary<UUID, UserFriendData>();
95 95
96 /// <summary> 96 /// <summary>
97 /// Maintain a record of clients that need to notify about their online status. This only
98 /// needs to be done on login. Subsequent online/offline friend changes are sent by a different mechanism.
99 /// </summary>
100 protected HashSet<UUID> m_NeedsToNotifyStatus = new HashSet<UUID>();
101
102 /// <summary>
97 /// Maintain a record of viewers that need to be sent notifications for friends that are online. This only 103 /// Maintain a record of viewers that need to be sent notifications for friends that are online. This only
98 /// needs to be done on login. Subsequent online/offline friend changes are sent by a different mechanism. 104 /// needs to be done on login. Subsequent online/offline friend changes are sent by a different mechanism.
99 /// </summary> 105 /// </summary>
@@ -324,6 +330,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
324 private void OnMakeRootAgent(ScenePresence sp) 330 private void OnMakeRootAgent(ScenePresence sp)
325 { 331 {
326 RecacheFriends(sp.ControllingClient); 332 RecacheFriends(sp.ControllingClient);
333
334 lock (m_NeedsToNotifyStatus)
335 {
336 if (m_NeedsToNotifyStatus.Remove(sp.UUID))
337 {
338 // Inform the friends that this user is online. This can only be done once the client is a Root Agent.
339 StatusChange(sp.UUID, true);
340 }
341 }
327 } 342 }
328 343
329 private void OnClientLogin(IClientAPI client) 344 private void OnClientLogin(IClientAPI client)
@@ -331,8 +346,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
331 UUID agentID = client.AgentId; 346 UUID agentID = client.AgentId;
332 347
333 //m_log.DebugFormat("[XXX]: OnClientLogin!"); 348 //m_log.DebugFormat("[XXX]: OnClientLogin!");
334 // Inform the friends that this user is online 349
335 StatusChange(agentID, true); 350 // Register that we need to send this user's status to friends. This can only be done
351 // once the client becomes a Root Agent, because as part of sending out the presence
352 // we also get back the presence of the HG friends, and we need to send that to the
353 // client, but that can only be done when the client is a Root Agent.
354 lock (m_NeedsToNotifyStatus)
355 m_NeedsToNotifyStatus.Add(agentID);
336 356
337 // Register that we need to send the list of online friends to this user 357 // Register that we need to send the list of online friends to this user
338 lock (m_NeedsListOfOnlineFriends) 358 lock (m_NeedsListOfOnlineFriends)
@@ -491,7 +511,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
491 511
492 // Notify about this user status 512 // Notify about this user status
493 StatusNotify(friendList, agentID, online); 513 StatusNotify(friendList, agentID, online);
494 } 514 }, null, "FriendsModule.StatusChange"
495 ); 515 );
496 } 516 }
497 } 517 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs
index ff87ece..13512a2 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -289,18 +289,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
289 289
290 rootElement.AppendChild(result); 290 rootElement.AppendChild(result);
291 291
292 return DocToBytes(doc); 292 return Util.DocToBytes(doc);
293 }
294
295 private byte[] DocToBytes(XmlDocument doc)
296 {
297 MemoryStream ms = new MemoryStream();
298 XmlTextWriter xw = new XmlTextWriter(ms, null);
299 xw.Formatting = Formatting.Indented;
300 doc.WriteTo(xw);
301 xw.Flush();
302
303 return ms.ToArray();
304 } 293 }
305 294
306 #endregion 295 #endregion
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
index d00945e..27b7376 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
@@ -239,6 +239,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
239 fList.Add(s.Substring(0, 36)); 239 fList.Add(s.Substring(0, 36));
240 } 240 }
241 241
242 // FIXME: also query the presence status of friends in other grids (like in HGStatusNotifier.Notify())
243
242 PresenceInfo[] presence = PresenceService.GetAgents(fList.ToArray()); 244 PresenceInfo[] presence = PresenceService.GetAgents(fList.ToArray());
243 foreach (PresenceInfo pi in presence) 245 foreach (PresenceInfo pi in presence)
244 { 246 {
@@ -658,7 +660,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
658 FriendsService.Delete(friendUUI, agentID.ToString()); 660 FriendsService.Delete(friendUUI, agentID.ToString());
659 661
660 // notify the exfriend's service 662 // notify the exfriend's service
661 Util.FireAndForget(delegate { Delete(exfriendID, agentID, friendUUI); }); 663 Util.FireAndForget(
664 delegate { Delete(exfriendID, agentID, friendUUI); }, null, "HGFriendsModule.DeleteFriendshipForeignFriend");
662 665
663 m_log.DebugFormat("[HGFRIENDS MODULE]: {0} terminated {1}", agentID, friendUUI); 666 m_log.DebugFormat("[HGFRIENDS MODULE]: {0} terminated {1}", agentID, friendUUI);
664 return true; 667 return true;
@@ -676,7 +679,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
676 FriendsService.Delete(agentUUI, exfriendID.ToString()); 679 FriendsService.Delete(agentUUI, exfriendID.ToString());
677 680
678 // notify the agent's service? 681 // notify the agent's service?
679 Util.FireAndForget(delegate { Delete(agentID, exfriendID, agentUUI); }); 682 Util.FireAndForget(
683 delegate { Delete(agentID, exfriendID, agentUUI); }, null, "HGFriendsModule.DeleteFriendshipLocalFriend");
680 684
681 m_log.DebugFormat("[HGFRIENDS MODULE]: {0} terminated {1}", agentUUI, exfriendID); 685 m_log.DebugFormat("[HGFRIENDS MODULE]: {0} terminated {1}", agentUUI, exfriendID);
682 return true; 686 return true;
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs
index 961117e..e6fd54e 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs
@@ -35,7 +35,6 @@ using OpenSim.Framework;
35using OpenSim.Region.CoreModules.Avatar.Friends; 35using OpenSim.Region.CoreModules.Avatar.Friends;
36using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
37using OpenSim.Tests.Common; 37using OpenSim.Tests.Common;
38using OpenSim.Tests.Common.Mock;
39 38
40namespace OpenSim.Region.CoreModules.Avatar.Friends.Tests 39namespace OpenSim.Region.CoreModules.Avatar.Friends.Tests
41{ 40{
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs
index 7bf19c2..a1b918a 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs
@@ -210,10 +210,10 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
210 success = m_IMService.OutgoingInstantMessage(im, url, foreigner); 210 success = m_IMService.OutgoingInstantMessage(im, url, foreigner);
211 211
212 if (!success && !foreigner) 212 if (!success && !foreigner)
213 HandleUndeliveredMessage(im, result); 213 HandleUndeliverableMessage(im, result);
214 else 214 else
215 result(success); 215 result(success);
216 }); 216 }, null, "HGMessageTransferModule.SendInstantMessage");
217 217
218 return; 218 return;
219 } 219 }
@@ -246,7 +246,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
246 return successful; 246 return successful;
247 } 247 }
248 248
249 protected void HandleUndeliveredMessage(GridInstantMessage im, MessageResultNotification result) 249 public void HandleUndeliverableMessage(GridInstantMessage im, MessageResultNotification result)
250 { 250 {
251 UndeliveredMessage handlerUndeliveredMessage = OnUndeliveredMessage; 251 UndeliveredMessage handlerUndeliveredMessage = OnUndeliveredMessage;
252 252
@@ -282,7 +282,17 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
282 string uasURL = circuit.ServiceURLs["HomeURI"].ToString(); 282 string uasURL = circuit.ServiceURLs["HomeURI"].ToString();
283 m_log.DebugFormat("[HG MESSAGE TRANSFER]: getting UUI of user {0} from {1}", toAgent, uasURL); 283 m_log.DebugFormat("[HG MESSAGE TRANSFER]: getting UUI of user {0} from {1}", toAgent, uasURL);
284 UserAgentServiceConnector uasConn = new UserAgentServiceConnector(uasURL); 284 UserAgentServiceConnector uasConn = new UserAgentServiceConnector(uasURL);
285 return uasConn.GetUUI(fromAgent, toAgent); 285
286 string agentUUI = string.Empty;
287 try
288 {
289 agentUUI = uasConn.GetUUI(fromAgent, toAgent);
290 }
291 catch (Exception e) {
292 m_log.Debug("[HG MESSAGE TRANSFER]: GetUUI call failed ", e);
293 }
294
295 return agentUUI;
286 } 296 }
287 } 297 }
288 } 298 }
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
index b321adb..5573c94 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
@@ -188,7 +188,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
188 SendGridInstantMessageViaXMLRPC(im, result); 188 SendGridInstantMessageViaXMLRPC(im, result);
189 } 189 }
190 190
191 private void HandleUndeliveredMessage(GridInstantMessage im, MessageResultNotification result) 191 public void HandleUndeliverableMessage(GridInstantMessage im, MessageResultNotification result)
192 { 192 {
193 UndeliveredMessage handlerUndeliveredMessage = OnUndeliveredMessage; 193 UndeliveredMessage handlerUndeliveredMessage = OnUndeliveredMessage;
194 194
@@ -445,7 +445,14 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
445 return resp; 445 return resp;
446 } 446 }
447 447
448<<<<<<< HEAD
449 /// <summary>
450 /// delegate for sending a grid instant message asynchronously
451 /// </summary>
452 public delegate void GridInstantMessageDelegate(GridInstantMessage im, MessageResultNotification result);
453=======
448 private delegate void GridInstantMessageDelegate(GridInstantMessage im, MessageResultNotification result); 454 private delegate void GridInstantMessageDelegate(GridInstantMessage im, MessageResultNotification result);
455>>>>>>> avn/ubitvar
449 456
450 private class GIM { 457 private class GIM {
451 public GridInstantMessage im; 458 public GridInstantMessage im;
@@ -472,25 +479,31 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
472 } 479 }
473 } 480 }
474 481
482<<<<<<< HEAD
483 d.BeginInvoke(im, result, GridInstantMessageCompleted, d);
484=======
475 private void GridInstantMessageCompleted(IAsyncResult iar) 485 private void GridInstantMessageCompleted(IAsyncResult iar)
476 { 486 {
477 GridInstantMessageDelegate d = (GridInstantMessageDelegate)iar.AsyncState; 487 GridInstantMessageDelegate d = (GridInstantMessageDelegate)iar.AsyncState;
478 d.EndInvoke(iar); 488 d.EndInvoke(iar);
489>>>>>>> avn/ubitvar
479 } 490 }
480 491
481 /// <summary> 492 /// <summary>
482 /// Recursive SendGridInstantMessage over XMLRPC method. 493 /// Internal SendGridInstantMessage over XMLRPC method.
483 /// This is called from within a dedicated thread.
484 /// The first time this is called, prevRegionHandle will be 0 Subsequent times this is called from
485 /// itself, prevRegionHandle will be the last region handle that we tried to send.
486 /// If the handles are the same, we look up the user's location using the grid.
487 /// If the handles are still the same, we end. The send failed.
488 /// </summary> 494 /// </summary>
495<<<<<<< HEAD
496 /// <remarks>
497 /// This is called from within a dedicated thread.
498 /// </remarks>
499 private void SendGridInstantMessageViaXMLRPCAsync(GridInstantMessage im, MessageResultNotification result)
500=======
489 /// <param name="prevRegionHandle"> 501 /// <param name="prevRegionHandle">
490 /// Pass in 0 the first time this method is called. It will be called recursively with the last 502 /// Pass in 0 the first time this method is called. It will be called recursively with the last
491 /// regionhandle tried 503 /// regionhandle tried
492 /// </param> 504 /// </param>
493 private void SendGridInstantMessageViaXMLRPCAsyncMain(GridInstantMessage im, MessageResultNotification result) 505 private void SendGridInstantMessageViaXMLRPCAsyncMain(GridInstantMessage im, MessageResultNotification result)
506>>>>>>> avn/ubitvar
494 { 507 {
495 GIM gim; 508 GIM gim;
496 do { 509 do {
@@ -516,120 +529,83 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
516 { 529 {
517 530
518 UUID toAgentID = new UUID(im.toAgentID); 531 UUID toAgentID = new UUID(im.toAgentID);
519 532 UUID regionID;
520 PresenceInfo upd = null; 533 bool needToLookupAgent;
521
522 bool lookupAgent = false;
523 534
524 lock (m_UserRegionMap) 535 lock (m_UserRegionMap)
536 needToLookupAgent = !m_UserRegionMap.TryGetValue(toAgentID, out regionID);
537
538 while (true)
525 { 539 {
526 if (m_UserRegionMap.ContainsKey(toAgentID)) 540 if (needToLookupAgent)
527 { 541 {
528 upd = new PresenceInfo(); 542 PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() });
529 upd.RegionID = m_UserRegionMap[toAgentID];
530 543
531 // We need to compare the current regionhandle with the previous region handle 544 UUID foundRegionID = UUID.Zero;
532 // or the recursive loop will never end because it will never try to lookup the agent again
533 if (prevRegionID == upd.RegionID)
534 {
535 lookupAgent = true;
536 }
537 }
538 else
539 {
540 lookupAgent = true;
541 }
542 }
543
544 545
545 // Are we needing to look-up an agent? 546 if (presences != null)
546 if (lookupAgent)
547 {
548 // Non-cached user agent lookup.
549 PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() });
550 if (presences != null && presences.Length > 0)
551 {
552 foreach (PresenceInfo p in presences)
553 { 547 {
554 if (p.RegionID != UUID.Zero) 548 foreach (PresenceInfo p in presences)
555 { 549 {
556 upd = p; 550 if (p.RegionID != UUID.Zero)
557 break; 551 {
552 foundRegionID = p.RegionID;
553 break;
554 }
558 } 555 }
559 } 556 }
557
558 // If not found or the found region is the same as the last lookup, then message is undeliverable
559 if (foundRegionID == UUID.Zero || foundRegionID == regionID)
560 break;
561 else
562 regionID = foundRegionID;
560 } 563 }
561 564
562 if (upd != null) 565 GridRegion reginfo = m_Scenes[0].GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, regionID);
566 if (reginfo == null)
563 { 567 {
564 // check if we've tried this before.. 568 m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find region {0}", regionID);
565 // This is one way to end the recursive loop 569 break;
566 //
567 if (upd.RegionID == prevRegionID)
568 {
569 // m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message");
570 HandleUndeliveredMessage(im, result);
571 return;
572 }
573 } 570 }
574 else
575 {
576 // m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message");
577 HandleUndeliveredMessage(im, result);
578 return;
579 }
580 }
581 571
572<<<<<<< HEAD
573 // Try to send the message to the agent via the retrieved region.
574 Hashtable msgdata = ConvertGridInstantMessageToXMLRPC(im);
575 msgdata["region_handle"] = 0;
576 bool imresult = doIMSending(reginfo, msgdata);
577
578 // If the message delivery was successful, then cache the entry.
579 if (imresult)
580=======
582 if (upd != null) 581 if (upd != null)
583 { 582 {
584 GridRegion reginfo = m_Scenes[0].GridService.GetRegionByUUID(UUID.Zero, 583 GridRegion reginfo = m_Scenes[0].GridService.GetRegionByUUID(UUID.Zero,
585 upd.RegionID); 584 upd.RegionID);
586 if (reginfo != null) 585 if (reginfo != null)
586>>>>>>> avn/ubitvar
587 { 587 {
588 Hashtable msgdata = ConvertGridInstantMessageToXMLRPC(im); 588 lock (m_UserRegionMap)
589 // Not actually used anymore, left in for compatibility
590 // Remove at next interface change
591 //
592 msgdata["region_handle"] = 0;
593 bool imresult = doIMSending(reginfo, msgdata);
594 if (imresult)
595 {
596 // IM delivery successful, so store the Agent's location in our local cache.
597 lock (m_UserRegionMap)
598 {
599 if (m_UserRegionMap.ContainsKey(toAgentID))
600 {
601 m_UserRegionMap[toAgentID] = upd.RegionID;
602 }
603 else
604 {
605 m_UserRegionMap.Add(toAgentID, upd.RegionID);
606 }
607 }
608 result(true);
609 }
610 else
611 { 589 {
612 // try again, but lookup user this time. 590 m_UserRegionMap[toAgentID] = regionID;
613 // Warning, this must call the Async version
614 // of this method or we'll be making thousands of threads
615 // The version within the spawned thread is SendGridInstantMessageViaXMLRPCAsync
616 // The version that spawns the thread is SendGridInstantMessageViaXMLRPC
617
618 // This is recursive!!!!!
619 SendGridInstantMessageViaXMLRPCAsync(im, result,
620 upd.RegionID);
621 } 591 }
592 result(true);
593 return;
622 } 594 }
623 else 595
624 { 596 // If we reach this point in the first iteration of the while, then we may have unsuccessfully tried
625 m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find region {0}", upd.RegionID); 597 // to use a locally cached region ID. All subsequent attempts need to lookup agent details from
626 HandleUndeliveredMessage(im, result); 598 // the presence service.
627 } 599 needToLookupAgent = true;
628 }
629 else
630 {
631 HandleUndeliveredMessage(im, result);
632 } 600 }
601
602 // If we reached this point then the message was not deliverable. Remove the bad cache entry and
603 // signal the delivery failure.
604 lock (m_UserRegionMap)
605 m_UserRegionMap.Remove(toAgentID);
606
607 // m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message");
608 HandleUndeliverableMessage(im, result);
633 } 609 }
634 610
635 /// <summary> 611 /// <summary>
@@ -640,7 +616,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
640 /// <returns>Bool if the message was successfully delivered at the other side.</returns> 616 /// <returns>Bool if the message was successfully delivered at the other side.</returns>
641 protected virtual bool doIMSending(GridRegion reginfo, Hashtable xmlrpcdata) 617 protected virtual bool doIMSending(GridRegion reginfo, Hashtable xmlrpcdata)
642 { 618 {
643
644 ArrayList SendParams = new ArrayList(); 619 ArrayList SendParams = new ArrayList();
645 SendParams.Add(xmlrpcdata); 620 SendParams.Add(xmlrpcdata);
646 XmlRpcRequest GridReq = new XmlRpcRequest("grid_instant_message", SendParams); 621 XmlRpcRequest GridReq = new XmlRpcRequest("grid_instant_message", SendParams);
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
index 41958b3..76023bd 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
@@ -238,6 +238,17 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
238 return; 238 return;
239 } 239 }
240 240
241<<<<<<< HEAD
242 if (!m_ForwardOfflineGroupMessages)
243 {
244 if (im.dialog == (byte)InstantMessageDialog.GroupNotice ||
245 im.dialog == (byte)InstantMessageDialog.GroupInvitation)
246 return;
247 }
248
249 bool success = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, bool>(
250 "POST", m_RestURL+"/SaveMessage/", im, 10000);
251=======
241 Scene scene = FindScene(new UUID(im.fromAgentID)); 252 Scene scene = FindScene(new UUID(im.fromAgentID));
242 if (scene == null) 253 if (scene == null)
243 scene = m_SceneList[0]; 254 scene = m_SceneList[0];
@@ -245,6 +256,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
245 SendReply reply = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, SendReply>( 256 SendReply reply = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, SendReply>(
246 "POST", m_RestURL+"/SaveMessage/?scope=" + 257 "POST", m_RestURL+"/SaveMessage/?scope=" +
247 scene.RegionInfo.ScopeID.ToString(), im); 258 scene.RegionInfo.ScopeID.ToString(), im);
259>>>>>>> avn/ubitvar
248 260
249 if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) 261 if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent)
250 { 262 {
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs
index 4c678c2..c2440d8 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs
@@ -49,8 +49,10 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
49 private static readonly ILog m_log = LogManager.GetLogger( 49 private static readonly ILog m_log = LogManager.GetLogger(
50 MethodBase.GetCurrentMethod().DeclaringType); 50 MethodBase.GetCurrentMethod().DeclaringType);
51 51
52#pragma warning disable 0067
52 public event PresenceChange OnPresenceChange; 53 public event PresenceChange OnPresenceChange;
53 public event BulkPresenceData OnBulkPresenceData; 54 public event BulkPresenceData OnBulkPresenceData;
55#pragma warning restore 0067
54 56
55 protected List<Scene> m_Scenes = new List<Scene>(); 57 protected List<Scene> m_Scenes = new List<Scene>();
56 58
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 5a8544e..4a06fd1 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -61,6 +61,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
61 61
62 private UserAccount m_userInfo; 62 private UserAccount m_userInfo;
63 private string m_invPath; 63 private string m_invPath;
64
65 /// <value>
66 /// ID of this request
67 /// </value>
68 protected UUID m_id;
64 69
65 /// <summary> 70 /// <summary>
66 /// Do we want to merge this load with existing inventory? 71 /// Do we want to merge this load with existing inventory?
@@ -71,6 +76,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
71 protected IAssetService m_AssetService; 76 protected IAssetService m_AssetService;
72 protected IUserAccountService m_UserAccountService; 77 protected IUserAccountService m_UserAccountService;
73 78
79 private InventoryArchiverModule m_module;
80
74 /// <value> 81 /// <value>
75 /// The stream from which the inventory archive will be loaded. 82 /// The stream from which the inventory archive will be loaded.
76 /// </value> 83 /// </value>
@@ -114,11 +121,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
114 /// Record the creator id that should be associated with an asset. This is used to adjust asset creator ids 121 /// Record the creator id that should be associated with an asset. This is used to adjust asset creator ids
115 /// after OSP resolution (since OSP creators are only stored in the item 122 /// after OSP resolution (since OSP creators are only stored in the item
116 /// </summary> 123 /// </summary>
117 protected Dictionary<UUID, UUID> m_creatorIdForAssetId = new Dictionary<UUID, UUID>(); 124 protected Dictionary<UUID, UUID> m_creatorIdForAssetId = new Dictionary<UUID, UUID>();
118 125
119 public InventoryArchiveReadRequest( 126 public InventoryArchiveReadRequest(
120 IInventoryService inv, IAssetService assets, IUserAccountService uacc, UserAccount userInfo, string invPath, string loadPath, bool merge) 127 IInventoryService inv, IAssetService assets, IUserAccountService uacc, UserAccount userInfo, string invPath, string loadPath, bool merge)
128 : this(UUID.Zero, null,
129 inv,
130 assets,
131 uacc,
132 userInfo,
133 invPath,
134 loadPath,
135 merge)
136 {
137 }
138
139 public InventoryArchiveReadRequest(
140 UUID id, InventoryArchiverModule module, IInventoryService inv, IAssetService assets, IUserAccountService uacc, UserAccount userInfo, string invPath, string loadPath, bool merge)
121 : this( 141 : this(
142 id,
143 module,
122 inv, 144 inv,
123 assets, 145 assets,
124 uacc, 146 uacc,
@@ -130,8 +152,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
130 } 152 }
131 153
132 public InventoryArchiveReadRequest( 154 public InventoryArchiveReadRequest(
133 IInventoryService inv, IAssetService assets, IUserAccountService uacc, UserAccount userInfo, string invPath, Stream loadStream, bool merge) 155 UUID id, InventoryArchiverModule module, IInventoryService inv, IAssetService assets, IUserAccountService uacc, UserAccount userInfo, string invPath, Stream loadStream, bool merge)
134 { 156 {
157 m_id = id;
135 m_InventoryService = inv; 158 m_InventoryService = inv;
136 m_AssetService = assets; 159 m_AssetService = assets;
137 m_UserAccountService = uacc; 160 m_UserAccountService = uacc;
@@ -139,6 +162,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
139 m_userInfo = userInfo; 162 m_userInfo = userInfo;
140 m_invPath = invPath; 163 m_invPath = invPath;
141 m_loadStream = loadStream; 164 m_loadStream = loadStream;
165 m_module = module;
142 166
143 // FIXME: Do not perform this check since older versions of OpenSim do save the control file after other things 167 // FIXME: Do not perform this check since older versions of OpenSim do save the control file after other things
144 // (I thought they weren't). We will need to bump the version number and perform this check on all 168 // (I thought they weren't). We will need to bump the version number and perform this check on all
@@ -161,6 +185,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
161 { 185 {
162 try 186 try
163 { 187 {
188 Exception reportedException = null;
189
164 string filePath = "ERROR"; 190 string filePath = "ERROR";
165 191
166 List<InventoryFolderBase> folderCandidates 192 List<InventoryFolderBase> folderCandidates
@@ -197,14 +223,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
197 } 223 }
198 224
199 archive.Close(); 225 archive.Close();
200 226
201 m_log.DebugFormat( 227 m_log.DebugFormat(
202 "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures", 228 "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures",
203 m_successfulAssetRestores, m_failedAssetRestores); 229 m_successfulAssetRestores, m_failedAssetRestores);
204 m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", m_successfulItemRestores); 230
231 //Alicia: When this is called by LibraryModule or Tests, m_module will be null as event is not required
232 if(m_module != null)
233 m_module.TriggerInventoryArchiveLoaded(m_id, true, m_userInfo, m_invPath, m_loadStream, reportedException, m_successfulItemRestores);
205 234
206 return m_loadedNodes; 235 return m_loadedNodes;
207 } 236 }
237 catch(Exception Ex)
238 {
239 // Trigger saved event with failed result and exception data
240 if (m_module != null)
241 m_module.TriggerInventoryArchiveLoaded(m_id, false, m_userInfo, m_invPath, m_loadStream, Ex, 0);
242
243 return m_loadedNodes;
244 }
208 finally 245 finally
209 { 246 {
210 m_loadStream.Close(); 247 m_loadStream.Close();
@@ -375,14 +412,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
375 newFolderName = InventoryArchiveUtils.UnescapeArchivePath(newFolderName); 412 newFolderName = InventoryArchiveUtils.UnescapeArchivePath(newFolderName);
376 UUID newFolderId = UUID.Random(); 413 UUID newFolderId = UUID.Random();
377 414
378 // Asset type has to be Unknown here rather than Folder, otherwise the created folder can't be
379 // deleted once the client has relogged.
380 // The root folder appears to be labelled AssetType.Folder (shows up as "Category" in the client)
381 // even though there is a AssetType.RootCategory
382 destFolder 415 destFolder
383 = new InventoryFolderBase( 416 = new InventoryFolderBase(
384 newFolderId, newFolderName, m_userInfo.PrincipalID, 417 newFolderId, newFolderName, m_userInfo.PrincipalID,
385 (short)AssetType.Unknown, destFolder.ID, 1); 418 (short)FolderType.None, destFolder.ID, 1);
386 m_InventoryService.AddFolder(destFolder); 419 m_InventoryService.AddFolder(destFolder);
387 420
388 // Record that we have now created this folder 421 // Record that we have now created this folder
@@ -483,52 +516,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
483 { 516 {
484 if (m_creatorIdForAssetId.ContainsKey(assetId)) 517 if (m_creatorIdForAssetId.ContainsKey(assetId))
485 { 518 {
486 string xmlData = Utils.BytesToString(data); 519 data = SceneObjectSerializer.ModifySerializedObject(assetId, data,
487 List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>(); 520 sog => {
521 bool modified = false;
522
523 foreach (SceneObjectPart sop in sog.Parts)
524 {
525 if (string.IsNullOrEmpty(sop.CreatorData))
526 {
527 sop.CreatorID = m_creatorIdForAssetId[assetId];
528 modified = true;
529 }
530 }
531
532 return modified;
533 });
488 534
489 CoalescedSceneObjects coa = null; 535 if (data == null)
490 if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa)) 536 return false;
491 {
492// m_log.DebugFormat(
493// "[INVENTORY ARCHIVER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count);
494
495 if (coa.Objects.Count == 0)
496 {
497 m_log.WarnFormat(
498 "[INVENTORY ARCHIVE READ REQUEST]: Aborting load of coalesced object from asset {0} as it has zero loaded components",
499 assetId);
500 return false;
501 }
502
503 sceneObjects.AddRange(coa.Objects);
504 }
505 else
506 {
507 SceneObjectGroup deserializedObject = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
508
509 if (deserializedObject != null)
510 {
511 sceneObjects.Add(deserializedObject);
512 }
513 else
514 {
515 m_log.WarnFormat(
516 "[INVENTORY ARCHIVE READ REQUEST]: Aborting load of object from asset {0} as deserialization failed",
517 assetId);
518
519 return false;
520 }
521 }
522
523 foreach (SceneObjectGroup sog in sceneObjects)
524 foreach (SceneObjectPart sop in sog.Parts)
525 if (string.IsNullOrEmpty(sop.CreatorData))
526 sop.CreatorID = m_creatorIdForAssetId[assetId];
527
528 if (coa != null)
529 data = Utils.StringToBytes(CoalescedSceneObjectsSerializer.ToXml(coa));
530 else
531 data = Utils.StringToBytes(SceneObjectSerializer.ToOriginalXmlFormat(sceneObjects[0]));
532 } 537 }
533 } 538 }
534 539
@@ -550,7 +555,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
550 return false; 555 return false;
551 } 556 }
552 } 557 }
553 558
554 /// <summary> 559 /// <summary>
555 /// Load control file 560 /// Load control file
556 /// </summary> 561 /// </summary>
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index 4292719..f002ad7 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -34,6 +34,7 @@ using System.Xml;
34using log4net; 34using log4net;
35using OpenMetaverse; 35using OpenMetaverse;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Framework.Monitoring;
37using OpenSim.Framework.Serialization; 38using OpenSim.Framework.Serialization;
38using OpenSim.Framework.Serialization.External; 39using OpenSim.Framework.Serialization.External;
39using OpenSim.Region.CoreModules.World.Archiver; 40using OpenSim.Region.CoreModules.World.Archiver;
@@ -42,6 +43,8 @@ using OpenSim.Services.Interfaces;
42using Ionic.Zlib; 43using Ionic.Zlib;
43using GZipStream = Ionic.Zlib.GZipStream; 44using GZipStream = Ionic.Zlib.GZipStream;
44using CompressionMode = Ionic.Zlib.CompressionMode; 45using CompressionMode = Ionic.Zlib.CompressionMode;
46using CompressionLevel = Ionic.Zlib.CompressionLevel;
47using PermissionMask = OpenSim.Framework.PermissionMask;
45 48
46namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver 49namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
47{ 50{
@@ -54,6 +57,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
54 /// </summary> 57 /// </summary>
55 public bool SaveAssets { get; set; } 58 public bool SaveAssets { get; set; }
56 59
60 /// <summary>
61 /// Determines which items will be included in the archive, according to their permissions.
62 /// Default is null, meaning no permission checks.
63 /// </summary>
64 public string FilterContent { get; set; }
65
66 /// <summary>
67 /// Counter for inventory items saved to archive for passing to compltion event
68 /// </summary>
69 public int CountItems { get; set; }
70
71 /// <summary>
72 /// Counter for inventory items skipped due to permission filter option for passing to compltion event
73 /// </summary>
74 public int CountFiltered { get; set; }
75
57 /// <value> 76 /// <value>
58 /// Used to select all inventory nodes in a folder but not the folder itself 77 /// Used to select all inventory nodes in a folder but not the folder itself
59 /// </value> 78 /// </value>
@@ -73,12 +92,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
73 /// <value> 92 /// <value>
74 /// ID of this request 93 /// ID of this request
75 /// </value> 94 /// </value>
76 protected Guid m_id; 95 protected UUID m_id;
77
78 /// <value>
79 /// Used to collect the uuids of the assets that we need to save into the archive
80 /// </value>
81 protected Dictionary<UUID, sbyte> m_assetUuids = new Dictionary<UUID, sbyte>();
82 96
83 /// <value> 97 /// <value>
84 /// Used to collect the uuids of the users that we need to save into the archive 98 /// Used to collect the uuids of the users that we need to save into the archive
@@ -94,7 +108,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
94 /// Constructor 108 /// Constructor
95 /// </summary> 109 /// </summary>
96 public InventoryArchiveWriteRequest( 110 public InventoryArchiveWriteRequest(
97 Guid id, InventoryArchiverModule module, Scene scene, 111 UUID id, InventoryArchiverModule module, Scene scene,
98 UserAccount userInfo, string invPath, string savePath) 112 UserAccount userInfo, string invPath, string savePath)
99 : this( 113 : this(
100 id, 114 id,
@@ -110,7 +124,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
110 /// Constructor 124 /// Constructor
111 /// </summary> 125 /// </summary>
112 public InventoryArchiveWriteRequest( 126 public InventoryArchiveWriteRequest(
113 Guid id, InventoryArchiverModule module, Scene scene, 127 UUID id, InventoryArchiverModule module, Scene scene,
114 UserAccount userInfo, string invPath, Stream saveStream) 128 UserAccount userInfo, string invPath, Stream saveStream)
115 { 129 {
116 m_id = id; 130 m_id = id;
@@ -122,6 +136,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
122 m_assetGatherer = new UuidGatherer(m_scene.AssetService); 136 m_assetGatherer = new UuidGatherer(m_scene.AssetService);
123 137
124 SaveAssets = true; 138 SaveAssets = true;
139 FilterContent = null;
125 } 140 }
126 141
127 protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids, bool timedOut) 142 protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids, bool timedOut)
@@ -150,7 +165,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
150 } 165 }
151 166
152 m_module.TriggerInventoryArchiveSaved( 167 m_module.TriggerInventoryArchiveSaved(
153 m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException); 168 m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException, CountItems, CountFiltered);
154 } 169 }
155 170
156 protected void SaveInvItem(InventoryItemBase inventoryItem, string path, Dictionary<string, object> options, IUserAccountService userAccountService) 171 protected void SaveInvItem(InventoryItemBase inventoryItem, string path, Dictionary<string, object> options, IUserAccountService userAccountService)
@@ -166,10 +181,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
166 "[INVENTORY ARCHIVER]: Skipping inventory item {0} {1} at {2}", 181 "[INVENTORY ARCHIVER]: Skipping inventory item {0} {1} at {2}",
167 inventoryItem.Name, inventoryItem.ID, path); 182 inventoryItem.Name, inventoryItem.ID, path);
168 } 183 }
184
185 CountFiltered++;
186
169 return; 187 return;
170 } 188 }
171 } 189 }
172 190
191 // Check For Permissions Filter Flags
192 if (!CanUserArchiveObject(m_userInfo.PrincipalID, inventoryItem))
193 {
194 m_log.InfoFormat(
195 "[INVENTORY ARCHIVER]: Insufficient permissions, skipping inventory item {0} {1} at {2}",
196 inventoryItem.Name, inventoryItem.ID, path);
197
198 // Count Items Excluded
199 CountFiltered++;
200
201 return;
202 }
203
173 if (options.ContainsKey("verbose")) 204 if (options.ContainsKey("verbose"))
174 m_log.InfoFormat( 205 m_log.InfoFormat(
175 "[INVENTORY ARCHIVER]: Saving item {0} {1} (asset UUID {2})", 206 "[INVENTORY ARCHIVER]: Saving item {0} {1} (asset UUID {2})",
@@ -185,9 +216,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
185 216
186 AssetType itemAssetType = (AssetType)inventoryItem.AssetType; 217 AssetType itemAssetType = (AssetType)inventoryItem.AssetType;
187 218
219 // Count inventory items (different to asset count)
220 CountItems++;
221
188 // Don't chase down link asset items as they actually point to their target item IDs rather than an asset 222 // Don't chase down link asset items as they actually point to their target item IDs rather than an asset
189 if (SaveAssets && itemAssetType != AssetType.Link && itemAssetType != AssetType.LinkFolder) 223 if (SaveAssets && itemAssetType != AssetType.Link && itemAssetType != AssetType.LinkFolder)
190 m_assetGatherer.GatherAssetUuids(inventoryItem.AssetID, (sbyte)inventoryItem.AssetType, m_assetUuids); 224 m_assetGatherer.AddForInspection(inventoryItem.AssetID);
191 } 225 }
192 226
193 /// <summary> 227 /// <summary>
@@ -243,6 +277,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
243 } 277 }
244 278
245 /// <summary> 279 /// <summary>
280 /// Checks whether the user has permission to export an inventory item to an IAR.
281 /// </summary>
282 /// <param name="UserID">The user</param>
283 /// <param name="InvItem">The inventory item</param>
284 /// <returns>Whether the user is allowed to export the object to an IAR</returns>
285 private bool CanUserArchiveObject(UUID UserID, InventoryItemBase InvItem)
286 {
287 if (FilterContent == null)
288 return true;// Default To Allow Export
289
290 bool permitted = true;
291
292 bool canCopy = (InvItem.CurrentPermissions & (uint)PermissionMask.Copy) != 0;
293 bool canTransfer = (InvItem.CurrentPermissions & (uint)PermissionMask.Transfer) != 0;
294 bool canMod = (InvItem.CurrentPermissions & (uint)PermissionMask.Modify) != 0;
295
296 if (FilterContent.Contains("C") && !canCopy)
297 permitted = false;
298
299 if (FilterContent.Contains("T") && !canTransfer)
300 permitted = false;
301
302 if (FilterContent.Contains("M") && !canMod)
303 permitted = false;
304
305 return permitted;
306 }
307
308 /// <summary>
246 /// Execute the inventory write request 309 /// Execute the inventory write request
247 /// </summary> 310 /// </summary>
248 public void Execute(Dictionary<string, object> options, IUserAccountService userAccountService) 311 public void Execute(Dictionary<string, object> options, IUserAccountService userAccountService)
@@ -250,6 +313,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
250 if (options.ContainsKey("noassets") && (bool)options["noassets"]) 313 if (options.ContainsKey("noassets") && (bool)options["noassets"])
251 SaveAssets = false; 314 SaveAssets = false;
252 315
316 // Set Permission filter if flag is set
317 if (options.ContainsKey("checkPermissions"))
318 {
319 Object temp;
320 if (options.TryGetValue("checkPermissions", out temp))
321 FilterContent = temp.ToString().ToUpper();
322 }
323
253 try 324 try
254 { 325 {
255 InventoryFolderBase inventoryFolder = null; 326 InventoryFolderBase inventoryFolder = null;
@@ -309,7 +380,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
309 // We couldn't find the path indicated 380 // We couldn't find the path indicated
310 string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath); 381 string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath);
311 Exception e = new InventoryArchiverException(errorMessage); 382 Exception e = new InventoryArchiverException(errorMessage);
312 m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e); 383 m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e, 0, 0);
313 throw e; 384 throw e;
314 } 385 }
315 386
@@ -347,16 +418,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
347 418
348 if (SaveAssets) 419 if (SaveAssets)
349 { 420 {
350 m_log.DebugFormat("[INVENTORY ARCHIVER]: Saving {0} assets for items", m_assetUuids.Count); 421 m_assetGatherer.GatherAll();
422
423 m_log.DebugFormat(
424 "[INVENTORY ARCHIVER]: Saving {0} assets for items", m_assetGatherer.GatheredUuids.Count);
351 425
352 AssetsRequest ar 426 AssetsRequest ar
353 = new AssetsRequest( 427 = new AssetsRequest(
354 new AssetsArchiver(m_archiveWriter), 428 new AssetsArchiver(m_archiveWriter),
355 m_assetUuids, m_scene.AssetService, 429 m_assetGatherer.GatheredUuids, m_scene.AssetService,
356 m_scene.UserAccountService, m_scene.RegionInfo.ScopeID, 430 m_scene.UserAccountService, m_scene.RegionInfo.ScopeID,
357 options, ReceivedAllAssets); 431 options, ReceivedAllAssets);
358 432
359 Util.FireAndForget(o => ar.Execute()); 433 WorkManager.RunInThread(o => ar.Execute(), null, string.Format("AssetsRequest ({0})", m_scene.Name));
360 } 434 }
361 else 435 else
362 { 436 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index ea660bd..5295ba3 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -57,6 +57,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
57// public bool DisablePresenceChecks { get; set; } 57// public bool DisablePresenceChecks { get; set; }
58 58
59 public event InventoryArchiveSaved OnInventoryArchiveSaved; 59 public event InventoryArchiveSaved OnInventoryArchiveSaved;
60 public event InventoryArchiveLoaded OnInventoryArchiveLoaded;
60 61
61 /// <summary> 62 /// <summary>
62 /// The file to load and save inventory if no filename has been specified 63 /// The file to load and save inventory if no filename has been specified
@@ -64,9 +65,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
64 protected const string DEFAULT_INV_BACKUP_FILENAME = "user-inventory.iar"; 65 protected const string DEFAULT_INV_BACKUP_FILENAME = "user-inventory.iar";
65 66
66 /// <value> 67 /// <value>
67 /// Pending save completions initiated from the console 68 /// Pending save and load completions initiated from the console
68 /// </value> 69 /// </value>
69 protected List<Guid> m_pendingConsoleSaves = new List<Guid>(); 70 protected List<UUID> m_pendingConsoleTasks = new List<UUID>();
70 71
71 /// <value> 72 /// <value>
72 /// All scenes that this module knows about 73 /// All scenes that this module knows about
@@ -111,6 +112,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
111 { 112 {
112 scene.RegisterModuleInterface<IInventoryArchiverModule>(this); 113 scene.RegisterModuleInterface<IInventoryArchiverModule>(this);
113 OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted; 114 OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted;
115 OnInventoryArchiveLoaded += LoadInvConsoleCommandCompleted;
114 116
115 scene.AddCommand( 117 scene.AddCommand(
116 "Archiving", this, "load iar", 118 "Archiving", this, "load iar",
@@ -139,7 +141,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
139 + "-e|--exclude=<name/uuid> don't save the inventory item in archive" + Environment.NewLine 141 + "-e|--exclude=<name/uuid> don't save the inventory item in archive" + Environment.NewLine
140 + "-f|--excludefolder=<folder/uuid> don't save contents of the folder in archive" + Environment.NewLine 142 + "-f|--excludefolder=<folder/uuid> don't save contents of the folder in archive" + Environment.NewLine
141 + "-v|--verbose extra debug messages.\n" 143 + "-v|--verbose extra debug messages.\n"
142 + "--noassets stops assets being saved to the IAR.", 144 + "--noassets stops assets being saved to the IAR."
145 + "--perm=<permissions> stops items with insufficient permissions from being saved to the IAR.\n"
146 + " <permissions> can contain one or more of these characters: \"C\" = Copy, \"T\" = Transfer, \"M\" = Modify.\n",
143 HandleSaveInvConsoleCommand); 147 HandleSaveInvConsoleCommand);
144 148
145 m_aScene = scene; 149 m_aScene = scene;
@@ -175,22 +179,34 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
175 /// Trigger the inventory archive saved event. 179 /// Trigger the inventory archive saved event.
176 /// </summary> 180 /// </summary>
177 protected internal void TriggerInventoryArchiveSaved( 181 protected internal void TriggerInventoryArchiveSaved(
178 Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, 182 UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream,
179 Exception reportedException) 183 Exception reportedException, int SaveCount, int FilterCount)
180 { 184 {
181 InventoryArchiveSaved handlerInventoryArchiveSaved = OnInventoryArchiveSaved; 185 InventoryArchiveSaved handlerInventoryArchiveSaved = OnInventoryArchiveSaved;
182 if (handlerInventoryArchiveSaved != null) 186 if (handlerInventoryArchiveSaved != null)
183 handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException); 187 handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException, SaveCount , FilterCount);
188 }
189
190 /// <summary>
191 /// Trigger the inventory archive loaded event.
192 /// </summary>
193 protected internal void TriggerInventoryArchiveLoaded(
194 UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream loadStream,
195 Exception reportedException, int LoadCount)
196 {
197 InventoryArchiveLoaded handlerInventoryArchiveLoaded = OnInventoryArchiveLoaded;
198 if (handlerInventoryArchiveLoaded != null)
199 handlerInventoryArchiveLoaded(id, succeeded, userInfo, invPath, loadStream, reportedException, LoadCount);
184 } 200 }
185 201
186 public bool ArchiveInventory( 202 public bool ArchiveInventory(
187 Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream) 203 UUID id, string firstName, string lastName, string invPath, string pass, Stream saveStream)
188 { 204 {
189 return ArchiveInventory(id, firstName, lastName, invPath, pass, saveStream, new Dictionary<string, object>()); 205 return ArchiveInventory(id, firstName, lastName, invPath, pass, saveStream, new Dictionary<string, object>());
190 } 206 }
191 207
192 public bool ArchiveInventory( 208 public bool ArchiveInventory(
193 Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream, 209 UUID id, string firstName, string lastName, string invPath, string pass, Stream saveStream,
194 Dictionary<string, object> options) 210 Dictionary<string, object> options)
195 { 211 {
196 if (m_scenes.Count > 0) 212 if (m_scenes.Count > 0)
@@ -230,7 +246,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
230 } 246 }
231 247
232 public bool ArchiveInventory( 248 public bool ArchiveInventory(
233 Guid id, string firstName, string lastName, string invPath, string pass, string savePath, 249 UUID id, string firstName, string lastName, string invPath, string pass, string savePath,
234 Dictionary<string, object> options) 250 Dictionary<string, object> options)
235 { 251 {
236// if (!ConsoleUtil.CheckFileDoesNotExist(MainConsole.Instance, savePath)) 252// if (!ConsoleUtil.CheckFileDoesNotExist(MainConsole.Instance, savePath))
@@ -272,13 +288,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
272 return false; 288 return false;
273 } 289 }
274 290
275 public bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream) 291 public bool DearchiveInventory(UUID id, string firstName, string lastName, string invPath, string pass, Stream loadStream)
276 { 292 {
277 return DearchiveInventory(firstName, lastName, invPath, pass, loadStream, new Dictionary<string, object>()); 293 return DearchiveInventory(id, firstName, lastName, invPath, pass, loadStream, new Dictionary<string, object>());
278 } 294 }
279 295
280 public bool DearchiveInventory( 296 public bool DearchiveInventory(
281 string firstName, string lastName, string invPath, string pass, Stream loadStream, 297 UUID id, string firstName, string lastName, string invPath, string pass, Stream loadStream,
282 Dictionary<string, object> options) 298 Dictionary<string, object> options)
283 { 299 {
284 if (m_scenes.Count > 0) 300 if (m_scenes.Count > 0)
@@ -294,7 +310,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
294 310
295 try 311 try
296 { 312 {
297 request = new InventoryArchiveReadRequest(m_aScene.InventoryService, m_aScene.AssetService, m_aScene.UserAccountService, userInfo, invPath, loadStream, merge); 313 request = new InventoryArchiveReadRequest(id, this, m_aScene.InventoryService, m_aScene.AssetService, m_aScene.UserAccountService, userInfo, invPath, loadStream, merge);
298 } 314 }
299 catch (EntryPointNotFoundException e) 315 catch (EntryPointNotFoundException e)
300 { 316 {
@@ -326,7 +342,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
326 } 342 }
327 343
328 public bool DearchiveInventory( 344 public bool DearchiveInventory(
329 string firstName, string lastName, string invPath, string pass, string loadPath, 345 UUID id, string firstName, string lastName, string invPath, string pass, string loadPath,
330 Dictionary<string, object> options) 346 Dictionary<string, object> options)
331 { 347 {
332 if (m_scenes.Count > 0) 348 if (m_scenes.Count > 0)
@@ -342,7 +358,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
342 358
343 try 359 try
344 { 360 {
345 request = new InventoryArchiveReadRequest(m_aScene.InventoryService, m_aScene.AssetService, m_aScene.UserAccountService, userInfo, invPath, loadPath, merge); 361 request = new InventoryArchiveReadRequest(id, this, m_aScene.InventoryService, m_aScene.AssetService, m_aScene.UserAccountService, userInfo, invPath, loadPath, merge);
346 } 362 }
347 catch (EntryPointNotFoundException e) 363 catch (EntryPointNotFoundException e)
348 { 364 {
@@ -378,6 +394,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
378 { 394 {
379 try 395 try
380 { 396 {
397 UUID id = UUID.Random();
398
381 Dictionary<string, object> options = new Dictionary<string, object>(); 399 Dictionary<string, object> options = new Dictionary<string, object>();
382 OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; }); 400 OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; });
383 401
@@ -400,10 +418,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
400 "[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}", 418 "[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}",
401 loadPath, invPath, firstName, lastName); 419 loadPath, invPath, firstName, lastName);
402 420
403 if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options)) 421 lock (m_pendingConsoleTasks)
404 m_log.InfoFormat( 422 m_pendingConsoleTasks.Add(id);
405 "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}", 423
406 loadPath, firstName, lastName); 424 DearchiveInventory(id, firstName, lastName, invPath, pass, loadPath, options);
407 } 425 }
408 catch (InventoryArchiverException e) 426 catch (InventoryArchiverException e)
409 { 427 {
@@ -417,7 +435,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
417 /// <param name="cmdparams"></param> 435 /// <param name="cmdparams"></param>
418 protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams) 436 protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams)
419 { 437 {
420 Guid id = Guid.NewGuid(); 438 UUID id = UUID.Random();
421 439
422 Dictionary<string, object> options = new Dictionary<string, object>(); 440 Dictionary<string, object> options = new Dictionary<string, object>();
423 441
@@ -439,6 +457,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
439 options["excludefolders"] = new List<String>(); 457 options["excludefolders"] = new List<String>();
440 ((List<String>)options["excludefolders"]).Add(v); 458 ((List<String>)options["excludefolders"]).Add(v);
441 }); 459 });
460 ops.Add("perm=", delegate(string v) { options["checkPermissions"] = v; });
442 461
443 List<string> mainParams = ops.Parse(cmdparams); 462 List<string> mainParams = ops.Parse(cmdparams);
444 463
@@ -464,8 +483,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
464 "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}", 483 "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}",
465 savePath, invPath, firstName, lastName); 484 savePath, invPath, firstName, lastName);
466 485
467 lock (m_pendingConsoleSaves) 486 lock (m_pendingConsoleTasks)
468 m_pendingConsoleSaves.Add(id); 487 m_pendingConsoleTasks.Add(id);
469 488
470 ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, options); 489 ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, options);
471 } 490 }
@@ -476,20 +495,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
476 } 495 }
477 496
478 private void SaveInvConsoleCommandCompleted( 497 private void SaveInvConsoleCommandCompleted(
479 Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, 498 UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream,
480 Exception reportedException) 499 Exception reportedException, int SaveCount, int FilterCount)
481 { 500 {
482 lock (m_pendingConsoleSaves) 501 lock (m_pendingConsoleTasks)
483 { 502 {
484 if (m_pendingConsoleSaves.Contains(id)) 503 if (m_pendingConsoleTasks.Contains(id))
485 m_pendingConsoleSaves.Remove(id); 504 m_pendingConsoleTasks.Remove(id);
486 else 505 else
487 return; 506 return;
488 } 507 }
489 508
490 if (succeeded) 509 if (succeeded)
491 { 510 {
492 m_log.InfoFormat("[INVENTORY ARCHIVER]: Saved archive for {0} {1}", userInfo.FirstName, userInfo.LastName); 511 // Report success and include item count and filter count (Skipped items due to --perm or --exclude switches)
512 if(FilterCount == 0)
513 m_log.InfoFormat("[INVENTORY ARCHIVER]: Saved archive with {0} items for {1} {2}", SaveCount, userInfo.FirstName, userInfo.LastName);
514 else
515 m_log.InfoFormat("[INVENTORY ARCHIVER]: Saved archive with {0} items for {1} {2}. Skipped {3} items due to exclude and/or perm switches", SaveCount, userInfo.FirstName, userInfo.LastName, FilterCount);
493 } 516 }
494 else 517 else
495 { 518 {
@@ -499,6 +522,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
499 } 522 }
500 } 523 }
501 524
525 private void LoadInvConsoleCommandCompleted(
526 UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream loadStream,
527 Exception reportedException, int LoadCount)
528 {
529 lock (m_pendingConsoleTasks)
530 {
531 if (m_pendingConsoleTasks.Contains(id))
532 m_pendingConsoleTasks.Remove(id);
533 else
534 return;
535 }
536
537 if (succeeded)
538 {
539 m_log.InfoFormat("[INVENTORY ARCHIVER]: Loaded {0} items from archive {1} for {2} {3}", LoadCount, invPath, userInfo.FirstName, userInfo.LastName);
540 }
541 else
542 {
543 m_log.ErrorFormat(
544 "[INVENTORY ARCHIVER]: Archive load for {0} {1} failed - {2}",
545 userInfo.FirstName, userInfo.LastName, reportedException.Message);
546 }
547 }
548
502 /// <summary> 549 /// <summary>
503 /// Get user information for the given name. 550 /// Get user information for the given name.
504 /// </summary> 551 /// </summary>
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs
index 08f199a..84f9f3f 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs
@@ -43,7 +43,6 @@ using OpenSim.Region.Framework.Scenes;
43using OpenSim.Region.Framework.Scenes.Serialization; 43using OpenSim.Region.Framework.Scenes.Serialization;
44using OpenSim.Services.Interfaces; 44using OpenSim.Services.Interfaces;
45using OpenSim.Tests.Common; 45using OpenSim.Tests.Common;
46using OpenSim.Tests.Common.Mock;
47 46
48namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests 47namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
49{ 48{
@@ -69,8 +68,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
69 68
70 UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "meowfood"); 69 UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "meowfood");
71 UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire"); 70 UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire");
72 71
73 archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream); 72 archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream);
74 InventoryItemBase foundItem1 73 InventoryItemBase foundItem1
75 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, m_item1Name); 74 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, m_item1Name);
76 75
@@ -79,7 +78,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
79 // Now try loading to a root child folder 78 // Now try loading to a root child folder
80 UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xA", false); 79 UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xA", false);
81 MemoryStream archiveReadStream = new MemoryStream(m_iarStream.ToArray()); 80 MemoryStream archiveReadStream = new MemoryStream(m_iarStream.ToArray());
82 archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "xA", "meowfood", archiveReadStream); 81 archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName, "xA", "meowfood", archiveReadStream);
83 82
84 InventoryItemBase foundItem2 83 InventoryItemBase foundItem2
85 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, "xA/" + m_item1Name); 84 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, "xA/" + m_item1Name);
@@ -88,7 +87,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
88 // Now try loading to a more deeply nested folder 87 // Now try loading to a more deeply nested folder
89 UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xB/xC", false); 88 UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xB/xC", false);
90 archiveReadStream = new MemoryStream(archiveReadStream.ToArray()); 89 archiveReadStream = new MemoryStream(archiveReadStream.ToArray());
91 archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "xB/xC", "meowfood", archiveReadStream); 90 archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName, "xB/xC", "meowfood", archiveReadStream);
92 91
93 InventoryItemBase foundItem3 92 InventoryItemBase foundItem3
94 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, "xB/xC/" + m_item1Name); 93 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, "xB/xC/" + m_item1Name);
@@ -110,7 +109,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
110 SceneHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); 109 SceneHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
111 110
112 UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "password"); 111 UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "password");
113 archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/Objects", "password", m_iarStream); 112 archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName, "/Objects", "password", m_iarStream);
114 113
115 InventoryItemBase foundItem1 114 InventoryItemBase foundItem1
116 = InventoryArchiveUtils.FindItemByPath( 115 = InventoryArchiveUtils.FindItemByPath(
@@ -180,13 +179,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
180 179
181 mre.Reset(); 180 mre.Reset();
182 archiverModule.ArchiveInventory( 181 archiverModule.ArchiveInventory(
183 Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream); 182 UUID.Random(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream);
184 mre.WaitOne(60000, false); 183 mre.WaitOne(60000, false);
185 184
186 // LOAD ITEM 185 // LOAD ITEM
187 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); 186 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
188 187
189 archiverModule.DearchiveInventory(userFirstName, userLastName, "Scripts", userPassword, archiveReadStream); 188 archiverModule.DearchiveInventory(UUID.Random(), userFirstName, userLastName, "Scripts", userPassword, archiveReadStream);
190 189
191 InventoryItemBase foundItem1 190 InventoryItemBase foundItem1
192 = InventoryArchiveUtils.FindItemByPath( 191 = InventoryArchiveUtils.FindItemByPath(
@@ -229,7 +228,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
229 228
230 { 229 {
231 // Test replication of path1 230 // Test replication of path1
232 new InventoryArchiveReadRequest(scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false) 231 new InventoryArchiveReadRequest(UUID.Random(), null, scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false)
233 .ReplicateArchivePathToUserInventory( 232 .ReplicateArchivePathToUserInventory(
234 iarPath1, scene.InventoryService.GetRootFolder(ua1.PrincipalID), 233 iarPath1, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
235 foldersCreated, nodesLoaded); 234 foldersCreated, nodesLoaded);
@@ -246,7 +245,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
246 245
247 { 246 {
248 // Test replication of path2 247 // Test replication of path2
249 new InventoryArchiveReadRequest(scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false) 248 new InventoryArchiveReadRequest(UUID.Random(), null, scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false)
250 .ReplicateArchivePathToUserInventory( 249 .ReplicateArchivePathToUserInventory(
251 iarPath2, scene.InventoryService.GetRootFolder(ua1.PrincipalID), 250 iarPath2, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
252 foldersCreated, nodesLoaded); 251 foldersCreated, nodesLoaded);
@@ -292,7 +291,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
292 291
293 string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName }); 292 string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName });
294 293
295 new InventoryArchiveReadRequest(scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false) 294 new InventoryArchiveReadRequest(UUID.Random(), null, scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false)
296 .ReplicateArchivePathToUserInventory( 295 .ReplicateArchivePathToUserInventory(
297 itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID), 296 itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
298 new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>()); 297 new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>());
@@ -343,7 +342,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
343 342
344 string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName }); 343 string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName });
345 344
346 new InventoryArchiveReadRequest(scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, folder1ExistingName, (Stream)null, true) 345 new InventoryArchiveReadRequest(UUID.Random(), null, scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, folder1ExistingName, (Stream)null, true)
347 .ReplicateArchivePathToUserInventory( 346 .ReplicateArchivePathToUserInventory(
348 itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID), 347 itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
349 new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>()); 348 new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>());
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs
index 1b521fc..d5f3a22 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs
@@ -43,7 +43,6 @@ using OpenSim.Region.Framework.Scenes;
43using OpenSim.Region.Framework.Scenes.Serialization; 43using OpenSim.Region.Framework.Scenes.Serialization;
44using OpenSim.Services.Interfaces; 44using OpenSim.Services.Interfaces;
45using OpenSim.Tests.Common; 45using OpenSim.Tests.Common;
46using OpenSim.Tests.Common.Mock;
47 46
48namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests 47namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
49{ 48{
@@ -72,7 +71,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
72// TestHelpers.EnableLogging(); 71// TestHelpers.EnableLogging();
73 72
74 UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "password"); 73 UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "password");
75 m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream); 74 m_archiverModule.DearchiveInventory(UUID.Random(), m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream);
76 75
77 InventoryItemBase coaItem 76 InventoryItemBase coaItem
78 = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_coaItemName); 77 = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_coaItemName);
@@ -106,8 +105,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
106// log4net.Config.XmlConfigurator.Configure(); 105// log4net.Config.XmlConfigurator.Configure();
107 106
108 UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "meowfood"); 107 UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "meowfood");
109 108
110 m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "meowfood", m_iarStream); 109 m_archiverModule.DearchiveInventory(UUID.Random(), m_uaLL1.FirstName, m_uaLL1.LastName, "/", "meowfood", m_iarStream);
111 InventoryItemBase foundItem1 110 InventoryItemBase foundItem1
112 = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_item1Name); 111 = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_item1Name);
113 112
@@ -171,7 +170,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
171// log4net.Config.XmlConfigurator.Configure(); 170// log4net.Config.XmlConfigurator.Configure();
172 171
173 UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "password"); 172 UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "password");
174 m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "password", m_iarStream); 173 m_archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName, "/", "password", m_iarStream);
175 174
176 InventoryItemBase foundItem1 175 InventoryItemBase foundItem1
177 = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaMT.PrincipalID, m_item1Name); 176 = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaMT.PrincipalID, m_item1Name);
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs
index b85739e..b614c18 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs
@@ -43,7 +43,6 @@ using OpenSim.Region.Framework.Scenes;
43using OpenSim.Region.Framework.Scenes.Serialization; 43using OpenSim.Region.Framework.Scenes.Serialization;
44using OpenSim.Services.Interfaces; 44using OpenSim.Services.Interfaces;
45using OpenSim.Tests.Common; 45using OpenSim.Tests.Common;
46using OpenSim.Tests.Common.Mock;
47 46
48namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests 47namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
49{ 48{
@@ -85,8 +84,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
85 byte[] data = tar.ReadEntry(out filePath, out tarEntryType); 84 byte[] data = tar.ReadEntry(out filePath, out tarEntryType);
86 Assert.That(filePath, Is.EqualTo(ArchiveConstants.CONTROL_FILE_PATH)); 85 Assert.That(filePath, Is.EqualTo(ArchiveConstants.CONTROL_FILE_PATH));
87 86
88 InventoryArchiveReadRequest iarr 87 InventoryArchiveReadRequest iarr
89 = new InventoryArchiveReadRequest(null, null, null, null, null, (Stream)null, false); 88 = new InventoryArchiveReadRequest(UUID.Random(), null, null, null, null, null, null, (Stream)null, false);
90 iarr.LoadControlFile(filePath, data); 89 iarr.LoadControlFile(filePath, data);
91 90
92 Assert.That(iarr.ControlFileLoaded, Is.True); 91 Assert.That(iarr.ControlFileLoaded, Is.True);
@@ -110,7 +109,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
110 109
111 mre.Reset(); 110 mre.Reset();
112 m_archiverModule.ArchiveInventory( 111 m_archiverModule.ArchiveInventory(
113 Guid.NewGuid(), userFirstName, userLastName, "/", userPassword, archiveWriteStream); 112 UUID.Random(), userFirstName, userLastName, "/", userPassword, archiveWriteStream);
114 mre.WaitOne(60000, false); 113 mre.WaitOne(60000, false);
115 114
116 // Test created iar 115 // Test created iar
@@ -179,7 +178,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
179 178
180 mre.Reset(); 179 mre.Reset();
181 m_archiverModule.ArchiveInventory( 180 m_archiverModule.ArchiveInventory(
182 Guid.NewGuid(), userFirstName, userLastName, "f1", userPassword, archiveWriteStream); 181 UUID.Random(), userFirstName, userLastName, "f1", userPassword, archiveWriteStream);
183 mre.WaitOne(60000, false); 182 mre.WaitOne(60000, false);
184 183
185 // Test created iar 184 // Test created iar
@@ -267,7 +266,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
267 266
268 mre.Reset(); 267 mre.Reset();
269 m_archiverModule.ArchiveInventory( 268 m_archiverModule.ArchiveInventory(
270 Guid.NewGuid(), userFirstName, userLastName, "Objects/" + item1Name, userPassword, archiveWriteStream); 269 UUID.Random(), userFirstName, userLastName, "Objects/" + item1Name, userPassword, archiveWriteStream);
271 mre.WaitOne(60000, false); 270 mre.WaitOne(60000, false);
272 271
273 byte[] archive = archiveWriteStream.ToArray(); 272 byte[] archive = archiveWriteStream.ToArray();
@@ -364,7 +363,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
364 363
365 // When we're not saving assets, archiving is being done synchronously. 364 // When we're not saving assets, archiving is being done synchronously.
366 m_archiverModule.ArchiveInventory( 365 m_archiverModule.ArchiveInventory(
367 Guid.NewGuid(), userFirstName, userLastName, "Objects/" + item1Name, userPassword, archiveWriteStream, options); 366 UUID.Random(), userFirstName, userLastName, "Objects/" + item1Name, userPassword, archiveWriteStream, options);
368 367
369 byte[] archive = archiveWriteStream.ToArray(); 368 byte[] archive = archiveWriteStream.ToArray();
370 MemoryStream archiveReadStream = new MemoryStream(archive); 369 MemoryStream archiveReadStream = new MemoryStream(archive);
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs
index db78da9..4b015d7 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs
@@ -43,7 +43,6 @@ using OpenSim.Region.Framework.Scenes;
43using OpenSim.Region.Framework.Scenes.Serialization; 43using OpenSim.Region.Framework.Scenes.Serialization;
44using OpenSim.Services.Interfaces; 44using OpenSim.Services.Interfaces;
45using OpenSim.Tests.Common; 45using OpenSim.Tests.Common;
46using OpenSim.Tests.Common.Mock;
47 46
48namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests 47namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
49{ 48{
@@ -163,14 +162,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
163 scene.AddInventoryItem(coaItem); 162 scene.AddInventoryItem(coaItem);
164 163
165 archiverModule.ArchiveInventory( 164 archiverModule.ArchiveInventory(
166 Guid.NewGuid(), m_uaLL1.FirstName, m_uaLL1.LastName, "/*", "hampshire", archiveWriteStream); 165 UUID.Random(), m_uaLL1.FirstName, m_uaLL1.LastName, "/*", "hampshire", archiveWriteStream);
167 166
168 m_iarStreamBytes = archiveWriteStream.ToArray(); 167 m_iarStreamBytes = archiveWriteStream.ToArray();
169 } 168 }
170 169
171 protected void SaveCompleted( 170 protected void SaveCompleted(
172 Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, 171 UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream,
173 Exception reportedException) 172 Exception reportedException, int SaveCount, int FilterCount)
174 { 173 {
175 mre.Set(); 174 mre.Set();
176 } 175 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
index 3815c71..18e18a9 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
@@ -180,8 +180,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
180 "[INVENTORY TRANSFER]: Inserting original folder {0} into agent {1}'s inventory", 180 "[INVENTORY TRANSFER]: Inserting original folder {0} into agent {1}'s inventory",
181 folderID, new UUID(im.toAgentID)); 181 folderID, new UUID(im.toAgentID));
182 182
183<<<<<<< HEAD
184 InventoryFolderBase folderCopy
185 = scene.GiveInventoryFolder(client, receipientID, client.AgentId, folderID, UUID.Zero);
186=======
183 InventoryFolderBase folderCopy 187 InventoryFolderBase folderCopy
184 = scene.GiveInventoryFolder(recipientID, client.AgentId, folderID, UUID.Zero); 188 = scene.GiveInventoryFolder(recipientID, client.AgentId, folderID, UUID.Zero);
189>>>>>>> avn/ubitvar
185 190
186 if (folderCopy == null) 191 if (folderCopy == null)
187 { 192 {
@@ -217,13 +222,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
217 "into agent {1}'s inventory", 222 "into agent {1}'s inventory",
218 itemID, new UUID(im.toAgentID)); 223 itemID, new UUID(im.toAgentID));
219 224
220 InventoryItemBase itemCopy = scene.GiveInventoryItem( 225 string message;
221 new UUID(im.toAgentID), 226 InventoryItemBase itemCopy = scene.GiveInventoryItem(new UUID(im.toAgentID), client.AgentId, itemID, out message);
222 client.AgentId, itemID);
223 227
224 if (itemCopy == null) 228 if (itemCopy == null)
225 { 229 {
226 client.SendAgentAlertMessage("Can't find item to give. Nothing given.", false); 230 client.SendAgentAlertMessage(message, false);
227 return; 231 return;
228 } 232 }
229 233
@@ -389,7 +393,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
389 IInventoryService invService = scene.InventoryService; 393 IInventoryService invService = scene.InventoryService;
390 394
391 InventoryFolderBase trashFolder = 395 InventoryFolderBase trashFolder =
392 invService.GetFolderForType(client.AgentId, AssetType.TrashFolder); 396 invService.GetFolderForType(client.AgentId, FolderType.Trash);
393 397
394 UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip 398 UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip
395 399
@@ -471,6 +475,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
471 /// <param name="im"></param> 475 /// <param name="im"></param>
472 private void OnGridInstantMessage(GridInstantMessage im) 476 private void OnGridInstantMessage(GridInstantMessage im)
473 { 477 {
478<<<<<<< HEAD
479 // Check if it's a type of message that we should handle
480 if (!((im.dialog == (byte) InstantMessageDialog.InventoryOffered)
481 || (im.dialog == (byte) InstantMessageDialog.TaskInventoryOffered)
482 || (im.dialog == (byte) InstantMessageDialog.InventoryAccepted)
483 || (im.dialog == (byte) InstantMessageDialog.InventoryDeclined)
484 || (im.dialog == (byte) InstantMessageDialog.TaskInventoryDeclined)))
485 return;
486
487 m_log.DebugFormat(
488 "[INVENTORY TRANSFER]: {0} IM type received from grid. From={1} ({2}), To={3}",
489 (InstantMessageDialog)im.dialog, im.fromAgentID, im.fromAgentName, im.toAgentID);
490
491=======
492>>>>>>> avn/ubitvar
474 // Check if this is ours to handle 493 // Check if this is ours to handle
475 // 494 //
476 Scene scene = FindClientScene(new UUID(im.toAgentID)); 495 Scene scene = FindClientScene(new UUID(im.toAgentID));
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/Tests/InventoryTransferModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/Tests/InventoryTransferModuleTests.cs
index 162a0c3..7ddc396 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/Tests/InventoryTransferModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/Tests/InventoryTransferModuleTests.cs
@@ -39,7 +39,6 @@ using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
40using OpenSim.Services.Interfaces; 40using OpenSim.Services.Interfaces;
41using OpenSim.Tests.Common; 41using OpenSim.Tests.Common;
42using OpenSim.Tests.Common.Mock;
43 42
44namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests 43namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests
45{ 44{
@@ -237,8 +236,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests
237 InventoryItemBase receivedItem 236 InventoryItemBase receivedItem
238 = UserInventoryHelpers.GetInventoryItem(m_scene.InventoryService, receiverSp.UUID, "Trash/givenObj"); 237 = UserInventoryHelpers.GetInventoryItem(m_scene.InventoryService, receiverSp.UUID, "Trash/givenObj");
239 238
240 InventoryFolderBase trashFolder 239 InventoryFolderBase trashFolder
241 = m_scene.InventoryService.GetFolderForType(receiverSp.UUID, AssetType.TrashFolder); 240 = m_scene.InventoryService.GetFolderForType(receiverSp.UUID, FolderType.Trash);
242 241
243 Assert.That(receivedItem, Is.Not.Null); 242 Assert.That(receivedItem, Is.Not.Null);
244 Assert.That(receivedItem.ID, Is.Not.EqualTo(originalItem.ID)); 243 Assert.That(receivedItem.ID, Is.Not.EqualTo(originalItem.ID));
@@ -430,8 +429,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests
430 InventoryFolderBase receivedFolder 429 InventoryFolderBase receivedFolder
431 = UserInventoryHelpers.GetInventoryFolder(m_scene.InventoryService, receiverSp.UUID, "Trash/f1"); 430 = UserInventoryHelpers.GetInventoryFolder(m_scene.InventoryService, receiverSp.UUID, "Trash/f1");
432 431
433 InventoryFolderBase trashFolder 432 InventoryFolderBase trashFolder
434 = m_scene.InventoryService.GetFolderForType(receiverSp.UUID, AssetType.TrashFolder); 433 = m_scene.InventoryService.GetFolderForType(receiverSp.UUID, FolderType.Trash);
435 434
436 Assert.That(receivedFolder, Is.Not.Null); 435 Assert.That(receivedFolder, Is.Not.Null);
437 Assert.That(receivedFolder.ID, Is.Not.EqualTo(originalFolder.ID)); 436 Assert.That(receivedFolder.ID, Is.Not.EqualTo(originalFolder.ID));
diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs
index a34f2d2..24286a4 100644
--- a/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs
@@ -239,16 +239,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
239 GatekeeperServiceConnector gConn = new GatekeeperServiceConnector(); 239 GatekeeperServiceConnector gConn = new GatekeeperServiceConnector();
240 GridRegion gatekeeper = new GridRegion(); 240 GridRegion gatekeeper = new GridRegion();
241 gatekeeper.ServerURI = url; 241 gatekeeper.ServerURI = url;
242 GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, new UUID(im.RegionID)); 242 string homeURI = scene.GetAgentHomeURI(client.AgentId);
243
244 string message;
245 GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, new UUID(im.RegionID), client.AgentId, homeURI, out message);
243 if (finalDestination != null) 246 if (finalDestination != null)
244 { 247 {
245 ScenePresence sp = scene.GetScenePresence(client.AgentId); 248 ScenePresence sp = scene.GetScenePresence(client.AgentId);
246 IEntityTransferModule transferMod = scene.RequestModuleInterface<IEntityTransferModule>(); 249 IEntityTransferModule transferMod = scene.RequestModuleInterface<IEntityTransferModule>();
247 250
248 if (transferMod != null && sp != null) 251 if (transferMod != null && sp != null)
252 {
253 if (message != null)
254 sp.ControllingClient.SendAgentAlertMessage(message, true);
255
249 transferMod.DoTeleport( 256 transferMod.DoTeleport(
250 sp, gatekeeper, finalDestination, im.Position + new Vector3(0.5f, 0.5f, 0f), 257 sp, gatekeeper, finalDestination, im.Position + new Vector3(0.5f, 0.5f, 0f),
251 Vector3.UnitX, teleportflags); 258 Vector3.UnitX, teleportflags);
259 }
260 }
261 else
262 {
263 m_log.InfoFormat("[HG LURE MODULE]: Lure failed: {0}", message);
264 client.SendAgentAlertMessage(message, true);
252 } 265 }
253 } 266 }
254 } 267 }
diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
index 7177d9b..bea2834 100644
--- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
@@ -46,8 +46,12 @@ using OpenSim.Region.Framework.Scenes;
46using OpenSim.Services.Interfaces; 46using OpenSim.Services.Interfaces;
47using Mono.Addins; 47using Mono.Addins;
48using OpenSim.Services.Connectors.Hypergrid; 48using OpenSim.Services.Connectors.Hypergrid;
49using OpenSim.Framework.Servers.HttpServer;
50using OpenSim.Services.UserProfilesService;
51using GridRegion = OpenSim.Services.Interfaces.GridRegion;
52using Microsoft.CSharp;
49 53
50namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles 54namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
51{ 55{
52 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "UserProfilesModule")] 56 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "UserProfilesModule")]
53 public class UserProfileModule : IProfileModule, INonSharedRegionModule 57 public class UserProfileModule : IProfileModule, INonSharedRegionModule
@@ -63,6 +67,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
63 Dictionary<UUID, UUID> m_classifiedCache = new Dictionary<UUID, UUID>(); 67 Dictionary<UUID, UUID> m_classifiedCache = new Dictionary<UUID, UUID>();
64 Dictionary<UUID, int> m_classifiedInterest = new Dictionary<UUID, int>(); 68 Dictionary<UUID, int> m_classifiedInterest = new Dictionary<UUID, int>();
65 69
70 private JsonRpcRequestManager rpc = new JsonRpcRequestManager();
71
66 public Scene Scene 72 public Scene Scene
67 { 73 {
68 get; private set; 74 get; private set;
@@ -74,7 +80,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
74 /// <value> 80 /// <value>
75 /// The configuration 81 /// The configuration
76 /// </value> 82 /// </value>
77 public IConfigSource Config { 83 public IConfigSource Config
84 {
78 get; 85 get;
79 set; 86 set;
80 } 87 }
@@ -85,7 +92,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
85 /// <value> 92 /// <value>
86 /// The profile server URI. 93 /// The profile server URI.
87 /// </value> 94 /// </value>
88 public string ProfileServerUri { 95 public string ProfileServerUri
96 {
89 get; 97 get;
90 set; 98 set;
91 } 99 }
@@ -107,11 +115,18 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
107 /// <value> 115 /// <value>
108 /// <c>true</c> if enabled; otherwise, <c>false</c>. 116 /// <c>true</c> if enabled; otherwise, <c>false</c>.
109 /// </value> 117 /// </value>
110 public bool Enabled { 118 public bool Enabled
119 {
111 get; 120 get;
112 set; 121 set;
113 } 122 }
114 123
124 public string MyGatekeeper
125 {
126 get; private set;
127 }
128
129
115 #region IRegionModuleBase implementation 130 #region IRegionModuleBase implementation
116 /// <summary> 131 /// <summary>
117 /// This is called to initialize the region module. For shared modules, this is called exactly once, after 132 /// This is called to initialize the region module. For shared modules, this is called exactly once, after
@@ -147,6 +162,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
147 m_log.Debug("[PROFILES]: Full Profiles Enabled"); 162 m_log.Debug("[PROFILES]: Full Profiles Enabled");
148 ReplaceableInterface = null; 163 ReplaceableInterface = null;
149 Enabled = true; 164 Enabled = true;
165
166 MyGatekeeper = Util.GetConfigVarFromSections<string>(source, "GatekeeperURI",
167 new string[] { "Startup", "Hypergrid", "UserProfiles" }, String.Empty);
150 } 168 }
151 169
152 /// <summary> 170 /// <summary>
@@ -176,7 +194,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
176 Util.FireAndForget(delegate 194 Util.FireAndForget(delegate
177 { 195 {
178 GetImageAssets(((IScenePresence)obj).UUID); 196 GetImageAssets(((IScenePresence)obj).UUID);
179 }); 197 }, null, "UserProfileModule.GetImageAssets");
180 } 198 }
181 199
182 /// <summary> 200 /// <summary>
@@ -315,7 +333,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
315 UUID.TryParse(args[0], out creatorId); 333 UUID.TryParse(args[0], out creatorId);
316 parameters.Add("creatorId", OSD.FromUUID(creatorId)); 334 parameters.Add("creatorId", OSD.FromUUID(creatorId));
317 OSD Params = (OSD)parameters; 335 OSD Params = (OSD)parameters;
318 if(!JsonRpcRequest(ref Params, "avatarclassifiedsrequest", serverURI, UUID.Random().ToString())) 336 if(!rpc.JsonRpcRequest(ref Params, "avatarclassifiedsrequest", serverURI, UUID.Random().ToString()))
319 { 337 {
320 remoteClient.SendAvatarClassifiedReply(new UUID(args[0]), classifieds); 338 remoteClient.SendAvatarClassifiedReply(new UUID(args[0]), classifieds);
321 return; 339 return;
@@ -375,7 +393,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
375 GetUserProfileServerURI(target, out serverURI); 393 GetUserProfileServerURI(target, out serverURI);
376 394
377 object Ad = (object)ad; 395 object Ad = (object)ad;
378 if(!JsonRpcRequest(ref Ad, "classifieds_info_query", serverURI, UUID.Random().ToString())) 396 if(!rpc.JsonRpcRequest(ref Ad, "classifieds_info_query", serverURI, UUID.Random().ToString()))
379 { 397 {
380 remoteClient.SendAgentAlertMessage( 398 remoteClient.SendAgentAlertMessage(
381 "Error getting classified info", false); 399 "Error getting classified info", false);
@@ -435,9 +453,21 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
435 uint queryParentEstate, UUID querySnapshotID, Vector3 queryGlobalPos, byte queryclassifiedFlags, 453 uint queryParentEstate, UUID querySnapshotID, Vector3 queryGlobalPos, byte queryclassifiedFlags,
436 int queryclassifiedPrice, IClientAPI remoteClient) 454 int queryclassifiedPrice, IClientAPI remoteClient)
437 { 455 {
456 Scene s = (Scene)remoteClient.Scene;
457 IMoneyModule money = s.RequestModuleInterface<IMoneyModule>();
458
459 if (money != null)
460 {
461 if (!money.AmountCovered(remoteClient.AgentId, queryclassifiedPrice))
462 {
463 remoteClient.SendAgentAlertMessage("You do not have enough money to create requested classified.", false);
464 return;
465 }
466 money.ApplyCharge(remoteClient.AgentId, queryclassifiedPrice, MoneyTransactionType.ClassifiedCharge);
467 }
468
438 UserClassifiedAdd ad = new UserClassifiedAdd(); 469 UserClassifiedAdd ad = new UserClassifiedAdd();
439 470
440 Scene s = (Scene) remoteClient.Scene;
441 Vector3 pos = remoteClient.SceneAgent.AbsolutePosition; 471 Vector3 pos = remoteClient.SceneAgent.AbsolutePosition;
442 ILandObject land = s.LandChannel.GetLandObject(pos.X, pos.Y); 472 ILandObject land = s.LandChannel.GetLandObject(pos.X, pos.Y);
443 ScenePresence p = FindPresence(remoteClient.AgentId); 473 ScenePresence p = FindPresence(remoteClient.AgentId);
@@ -471,10 +501,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
471 501
472 OSD.SerializeMembers(Ad); 502 OSD.SerializeMembers(Ad);
473 503
474 if(!JsonRpcRequest(ref Ad, "classified_update", serverURI, UUID.Random().ToString())) 504 if(!rpc.JsonRpcRequest(ref Ad, "classified_update", serverURI, UUID.Random().ToString()))
475 { 505 {
476 remoteClient.SendAgentAlertMessage( 506 remoteClient.SendAgentAlertMessage(
477 "Error updating classified", false); 507 "Error updating classified", false);
508 return;
478 } 509 }
479 } 510 }
480 511
@@ -497,10 +528,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
497 UUID.TryParse(queryClassifiedID.ToString(), out classifiedId); 528 UUID.TryParse(queryClassifiedID.ToString(), out classifiedId);
498 parameters.Add("classifiedId", OSD.FromUUID(classifiedId)); 529 parameters.Add("classifiedId", OSD.FromUUID(classifiedId));
499 OSD Params = (OSD)parameters; 530 OSD Params = (OSD)parameters;
500 if(!JsonRpcRequest(ref Params, "classified_delete", serverURI, UUID.Random().ToString())) 531 if(!rpc.JsonRpcRequest(ref Params, "classified_delete", serverURI, UUID.Random().ToString()))
501 { 532 {
502 remoteClient.SendAgentAlertMessage( 533 remoteClient.SendAgentAlertMessage(
503 "Error classified delete", false); 534 "Error classified delete", false);
535 return;
504 } 536 }
505 537
506 parameters = (OSDMap)Params; 538 parameters = (OSDMap)Params;
@@ -547,7 +579,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
547 OSDMap parameters= new OSDMap(); 579 OSDMap parameters= new OSDMap();
548 parameters.Add("creatorId", OSD.FromUUID(targetId)); 580 parameters.Add("creatorId", OSD.FromUUID(targetId));
549 OSD Params = (OSD)parameters; 581 OSD Params = (OSD)parameters;
550 if(!JsonRpcRequest(ref Params, "avatarpicksrequest", serverURI, UUID.Random().ToString())) 582 if(!rpc.JsonRpcRequest(ref Params, "avatarpicksrequest", serverURI, UUID.Random().ToString()))
551 { 583 {
552 remoteClient.SendAvatarPicksReply(new UUID(args[0]), picks); 584 remoteClient.SendAvatarPicksReply(new UUID(args[0]), picks);
553 return; 585 return;
@@ -588,37 +620,66 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
588 return; 620 return;
589 621
590 UUID targetID; 622 UUID targetID;
591 UUID.TryParse(args[0], out targetID); 623 UUID.TryParse (args [0], out targetID);
592 string serverURI = string.Empty; 624 string serverURI = string.Empty;
593 GetUserProfileServerURI(targetID, out serverURI); 625 GetUserProfileServerURI (targetID, out serverURI);
626
627 string theirGatekeeperURI;
628 GetUserGatekeeperURI (targetID, out theirGatekeeperURI);
629
594 IClientAPI remoteClient = (IClientAPI)sender; 630 IClientAPI remoteClient = (IClientAPI)sender;
595 631
596 UserProfilePick pick = new UserProfilePick(); 632 UserProfilePick pick = new UserProfilePick ();
597 UUID.TryParse(args[0], out pick.CreatorId); 633 UUID.TryParse (args [0], out pick.CreatorId);
598 UUID.TryParse(args[1], out pick.PickId); 634 UUID.TryParse (args [1], out pick.PickId);
599 635
600 636
601 object Pick = (object)pick; 637 object Pick = (object)pick;
602 if(!JsonRpcRequest(ref Pick, "pickinforequest", serverURI, UUID.Random().ToString())) 638 if (!rpc.JsonRpcRequest (ref Pick, "pickinforequest", serverURI, UUID.Random ().ToString ())) {
603 { 639 remoteClient.SendAgentAlertMessage (
604 remoteClient.SendAgentAlertMessage(
605 "Error selecting pick", false); 640 "Error selecting pick", false);
641 return;
606 } 642 }
607 pick = (UserProfilePick) Pick; 643 pick = (UserProfilePick)Pick;
608 if(pick.SnapshotId == UUID.Zero) 644
645 Vector3 globalPos = new Vector3(Vector3.Zero);
646
647 // Smoke and mirrors
648 if (pick.Gatekeeper == MyGatekeeper)
609 { 649 {
610 // In case of a new UserPick, the data may not be ready and we would send wrong data, skip it... 650 Vector3.TryParse(pick.GlobalPos,out globalPos);
611 m_log.DebugFormat("[PROFILES]: PickInfoRequest: SnapshotID is {0}", UUID.Zero.ToString()); 651 }
612 return; 652 else
653 {
654 // Setup the illusion
655 string region = string.Format("{0} {1}",pick.Gatekeeper,pick.SimName);
656 GridRegion target = Scene.GridService.GetRegionByName(Scene.RegionInfo.ScopeID, region);
657
658 if(target == null)
659 {
660 // This is a dead or unreachable region
661 }
662 else
663 {
664 // Work our slight of hand
665 int x = target.RegionLocX;
666 int y = target.RegionLocY;
667
668 dynamic synthX = globalPos.X - (globalPos.X/Constants.RegionSize) * Constants.RegionSize;
669 synthX += x;
670 globalPos.X = synthX;
671
672 dynamic synthY = globalPos.Y - (globalPos.Y/Constants.RegionSize) * Constants.RegionSize;
673 synthY += y;
674 globalPos.Y = synthY;
675 }
613 } 676 }
614
615 Vector3 globalPos;
616 Vector3.TryParse(pick.GlobalPos,out globalPos);
617 677
618 m_log.DebugFormat("[PROFILES]: PickInfoRequest: {0} : {1}", pick.Name.ToString(), pick.SnapshotId.ToString()); 678 m_log.DebugFormat("[PROFILES]: PickInfoRequest: {0} : {1}", pick.Name.ToString(), pick.SnapshotId.ToString());
619 679
680 // Pull the rabbit out of the hat
620 remoteClient.SendPickInfoReply(pick.PickId,pick.CreatorId,pick.TopPick,pick.ParcelId,pick.Name, 681 remoteClient.SendPickInfoReply(pick.PickId,pick.CreatorId,pick.TopPick,pick.ParcelId,pick.Name,
621 pick.Desc,pick.SnapshotId,pick.User,pick.OriginalName,pick.SimName, 682 pick.Desc,pick.SnapshotId,pick.ParcelName,pick.OriginalName,pick.SimName,
622 globalPos,pick.SortOrder,pick.Enabled); 683 globalPos,pick.SortOrder,pick.Enabled);
623 } 684 }
624 685
@@ -653,9 +714,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
653 /// Enabled. 714 /// Enabled.
654 /// </param> 715 /// </param>
655 public void PickInfoUpdate(IClientAPI remoteClient, UUID pickID, UUID creatorID, bool topPick, string name, string desc, UUID snapshotID, int sortOrder, bool enabled) 716 public void PickInfoUpdate(IClientAPI remoteClient, UUID pickID, UUID creatorID, bool topPick, string name, string desc, UUID snapshotID, int sortOrder, bool enabled)
656 { 717 {
657 718 //TODO: See how this works with NPC, May need to test
658 m_log.DebugFormat("[PROFILES]: Start PickInfoUpdate Name: {0} PickId: {1} SnapshotId: {2}", name, pickID.ToString(), snapshotID.ToString()); 719 m_log.DebugFormat("[PROFILES]: Start PickInfoUpdate Name: {0} PickId: {1} SnapshotId: {2}", name, pickID.ToString(), snapshotID.ToString());
720
659 UserProfilePick pick = new UserProfilePick(); 721 UserProfilePick pick = new UserProfilePick();
660 string serverURI = string.Empty; 722 string serverURI = string.Empty;
661 GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 723 GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
@@ -667,40 +729,45 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
667 remoteClient.Scene.RegionInfo.WorldLocY + avaPos.Y, 729 remoteClient.Scene.RegionInfo.WorldLocY + avaPos.Y,
668 avaPos.Z); 730 avaPos.Z);
669 731
670 string landOwnerName = string.Empty; 732 string landParcelName = "My Parcel";
671 ILandObject land = p.Scene.LandChannel.GetLandObject(avaPos.X, avaPos.Y); 733 UUID landParcelID = p.currentParcelUUID;
672 if(land.LandData.IsGroupOwned) 734
735 ILandObject land = p.Scene.LandChannel.GetLandObject(avaPos.X, avaPos.Y);
736
737 if (land != null)
673 { 738 {
674 IGroupsModule groupMod = p.Scene.RequestModuleInterface<IGroupsModule>(); 739 // If land found, use parcel uuid from here because the value from SP will be blank if the avatar hasnt moved
675 UUID groupId = land.LandData.GroupID; 740 landParcelName = land.LandData.Name;
676 GroupRecord groupRecord = groupMod.GetGroupRecord(groupId); 741 landParcelID = land.LandData.GlobalID;
677 landOwnerName = groupRecord.GroupName;
678 } 742 }
679 else 743 else
680 { 744 {
681 IUserAccountService accounts = p.Scene.RequestModuleInterface<IUserAccountService>(); 745 m_log.WarnFormat(
682 UserAccount user = accounts.GetUserAccount(p.Scene.RegionInfo.ScopeID, land.LandData.OwnerID); 746 "[PROFILES]: PickInfoUpdate found no parcel info at {0},{1} in {2}",
683 landOwnerName = user.Name; 747 avaPos.X, avaPos.Y, p.Scene.Name);
684 } 748 }
685 749
750
686 pick.PickId = pickID; 751 pick.PickId = pickID;
687 pick.CreatorId = creatorID; 752 pick.CreatorId = creatorID;
688 pick.TopPick = topPick; 753 pick.TopPick = topPick;
689 pick.Name = name; 754 pick.Name = name;
690 pick.Desc = desc; 755 pick.Desc = desc;
691 pick.ParcelId = p.currentParcelUUID; 756 pick.ParcelId = landParcelID;
692 pick.SnapshotId = snapshotID; 757 pick.SnapshotId = snapshotID;
693 pick.User = landOwnerName; 758 pick.ParcelName = landParcelName;
694 pick.SimName = remoteClient.Scene.RegionInfo.RegionName; 759 pick.SimName = remoteClient.Scene.RegionInfo.RegionName;
760 pick.Gatekeeper = MyGatekeeper;
695 pick.GlobalPos = posGlobal.ToString(); 761 pick.GlobalPos = posGlobal.ToString();
696 pick.SortOrder = sortOrder; 762 pick.SortOrder = sortOrder;
697 pick.Enabled = enabled; 763 pick.Enabled = enabled;
698 764
699 object Pick = (object)pick; 765 object Pick = (object)pick;
700 if(!JsonRpcRequest(ref Pick, "picks_update", serverURI, UUID.Random().ToString())) 766 if(!rpc.JsonRpcRequest(ref Pick, "picks_update", serverURI, UUID.Random().ToString()))
701 { 767 {
702 remoteClient.SendAgentAlertMessage( 768 remoteClient.SendAgentAlertMessage(
703 "Error updating pick", false); 769 "Error updating pick", false);
770 return;
704 } 771 }
705 772
706 m_log.DebugFormat("[PROFILES]: Finish PickInfoUpdate {0} {1}", pick.Name, pick.PickId.ToString()); 773 m_log.DebugFormat("[PROFILES]: Finish PickInfoUpdate {0} {1}", pick.Name, pick.PickId.ToString());
@@ -723,10 +790,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
723 OSDMap parameters= new OSDMap(); 790 OSDMap parameters= new OSDMap();
724 parameters.Add("pickId", OSD.FromUUID(queryPickID)); 791 parameters.Add("pickId", OSD.FromUUID(queryPickID));
725 OSD Params = (OSD)parameters; 792 OSD Params = (OSD)parameters;
726 if(!JsonRpcRequest(ref Params, "picks_delete", serverURI, UUID.Random().ToString())) 793 if(!rpc.JsonRpcRequest(ref Params, "picks_delete", serverURI, UUID.Random().ToString()))
727 { 794 {
728 remoteClient.SendAgentAlertMessage( 795 remoteClient.SendAgentAlertMessage(
729 "Error picks delete", false); 796 "Error picks delete", false);
797 return;
730 } 798 }
731 } 799 }
732 #endregion Picks 800 #endregion Picks
@@ -758,7 +826,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
758 UUID.TryParse(args[0], out note.TargetId); 826 UUID.TryParse(args[0], out note.TargetId);
759 827
760 object Note = (object)note; 828 object Note = (object)note;
761 if(!JsonRpcRequest(ref Note, "avatarnotesrequest", serverURI, UUID.Random().ToString())) 829 if(!rpc.JsonRpcRequest(ref Note, "avatarnotesrequest", serverURI, UUID.Random().ToString()))
762 { 830 {
763 remoteClient.SendAvatarNotesReply(note.TargetId, note.Notes); 831 remoteClient.SendAvatarNotesReply(note.TargetId, note.Notes);
764 return; 832 return;
@@ -792,13 +860,81 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
792 GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 860 GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
793 861
794 object Note = note; 862 object Note = note;
795 if(!JsonRpcRequest(ref Note, "avatar_notes_update", serverURI, UUID.Random().ToString())) 863 if(!rpc.JsonRpcRequest(ref Note, "avatar_notes_update", serverURI, UUID.Random().ToString()))
796 { 864 {
865 remoteClient.SendAgentAlertMessage(
866 "Error updating note", false);
797 return; 867 return;
798 } 868 }
799 } 869 }
800 #endregion Notes 870 #endregion Notes
801 871
872<<<<<<< HEAD
873 #region User Preferences
874 /// <summary>
875 /// Updates the user preferences.
876 /// </summary>
877 /// <param name='imViaEmail'>
878 /// Im via email.
879 /// </param>
880 /// <param name='visible'>
881 /// Visible.
882 /// </param>
883 /// <param name='remoteClient'>
884 /// Remote client.
885 /// </param>
886 public void UpdateUserPreferences(bool imViaEmail, bool visible, IClientAPI remoteClient)
887 {
888 UserPreferences pref = new UserPreferences();
889
890 pref.UserId = remoteClient.AgentId;
891 pref.IMViaEmail = imViaEmail;
892 pref.Visible = visible;
893
894 string serverURI = string.Empty;
895 bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
896
897 object Pref = pref;
898 if(!rpc.JsonRpcRequest(ref Pref, "user_preferences_update", serverURI, UUID.Random().ToString()))
899 {
900 m_log.InfoFormat("[PROFILES]: UserPreferences update error");
901 remoteClient.SendAgentAlertMessage("Error updating preferences", false);
902 return;
903 }
904 }
905
906 /// <summary>
907 /// Users the preferences request.
908 /// </summary>
909 /// <param name='remoteClient'>
910 /// Remote client.
911 /// </param>
912 public void UserPreferencesRequest(IClientAPI remoteClient)
913 {
914 UserPreferences pref = new UserPreferences();
915
916 pref.UserId = remoteClient.AgentId;
917
918 string serverURI = string.Empty;
919 bool foreign = GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
920
921
922 object Pref = (object)pref;
923 if(!rpc.JsonRpcRequest(ref Pref, "user_preferences_request", serverURI, UUID.Random().ToString()))
924 {
925// m_log.InfoFormat("[PROFILES]: UserPreferences request error");
926// remoteClient.SendAgentAlertMessage("Error requesting preferences", false);
927 return;
928 }
929 pref = (UserPreferences) Pref;
930
931 remoteClient.SendUserInfoReply(pref.IMViaEmail, pref.Visible, pref.EMail);
932
933 }
934 #endregion User Preferences
935
936=======
937>>>>>>> avn/ubitvar
802 #region Avatar Properties 938 #region Avatar Properties
803 /// <summary> 939 /// <summary>
804 /// Update the avatars interests . 940 /// Update the avatars interests .
@@ -836,16 +972,17 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
836 GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 972 GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
837 973
838 object Param = prop; 974 object Param = prop;
839 if(!JsonRpcRequest(ref Param, "avatar_interests_update", serverURI, UUID.Random().ToString())) 975 if(!rpc.JsonRpcRequest(ref Param, "avatar_interests_update", serverURI, UUID.Random().ToString()))
840 { 976 {
841 remoteClient.SendAgentAlertMessage( 977 remoteClient.SendAgentAlertMessage(
842 "Error updating interests", false); 978 "Error updating interests", false);
979 return;
843 } 980 }
844 } 981 }
845 982
846 public void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) 983 public void RequestAvatarProperties(IClientAPI remoteClient, UUID avatarID)
847 { 984 {
848 if ( String.IsNullOrEmpty(avatarID.ToString()) || String.IsNullOrEmpty(remoteClient.AgentId.ToString())) 985 if (String.IsNullOrEmpty(avatarID.ToString()) || String.IsNullOrEmpty(remoteClient.AgentId.ToString()))
849 { 986 {
850 // Looking for a reason that some viewers are sending null Id's 987 // Looking for a reason that some viewers are sending null Id's
851 m_log.DebugFormat("[PROFILES]: This should not happen remoteClient.AgentId {0} - avatarID {1}", remoteClient.AgentId, avatarID); 988 m_log.DebugFormat("[PROFILES]: This should not happen remoteClient.AgentId {0} - avatarID {1}", remoteClient.AgentId, avatarID);
@@ -922,7 +1059,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
922 string result = string.Empty; 1059 string result = string.Empty;
923 1060
924 props.UserId = avatarID; 1061 props.UserId = avatarID;
925 GetProfileData(ref props, out result); 1062
1063 if (!GetProfileData(ref props, foreign, out result))
1064 {
1065// m_log.DebugFormat("Error getting profile for {0}: {1}", avatarID, result);
1066 return;
1067 }
926 1068
927 remoteClient.SendAvatarProperties(props.UserId, props.AboutText, born, charterMember , props.FirstLifeText, flags, 1069 remoteClient.SendAvatarProperties(props.UserId, props.AboutText, born, charterMember , props.FirstLifeText, flags,
928 props.FirstLifeImageId, props.ImageId, props.WebUrl, props.PartnerId); 1070 props.FirstLifeImageId, props.ImageId, props.WebUrl, props.PartnerId);
@@ -959,10 +1101,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
959 1101
960 object Prop = prop; 1102 object Prop = prop;
961 1103
962 if(!JsonRpcRequest(ref Prop, "avatar_properties_update", serverURI, UUID.Random().ToString())) 1104 if(!rpc.JsonRpcRequest(ref Prop, "avatar_properties_update", serverURI, UUID.Random().ToString()))
963 { 1105 {
964 remoteClient.SendAgentAlertMessage( 1106 remoteClient.SendAgentAlertMessage(
965 "Error updating properties", false); 1107 "Error updating properties", false);
1108 return;
966 } 1109 }
967 1110
968 RequestAvatarProperties(remoteClient, newProfile.ID); 1111 RequestAvatarProperties(remoteClient, newProfile.ID);
@@ -975,10 +1118,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
975 /// <returns> 1118 /// <returns>
976 /// The profile data. 1119 /// The profile data.
977 /// </returns> 1120 /// </returns>
978 /// <param name='userID'> 1121 bool GetProfileData(ref UserProfileProperties properties, bool foreign, out string message)
979 /// User I.
980 /// </param>
981 bool GetProfileData(ref UserProfileProperties properties, out string message)
982 { 1122 {
983 // Can't handle NPC yet... 1123 // Can't handle NPC yet...
984 ScenePresence p = FindPresence(properties.UserId); 1124 ScenePresence p = FindPresence(properties.UserId);
@@ -997,14 +1137,49 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
997 1137
998 // This is checking a friend on the home grid 1138 // This is checking a friend on the home grid
999 // Not HG friend 1139 // Not HG friend
1000 if ( String.IsNullOrEmpty(serverURI)) 1140 if (String.IsNullOrEmpty(serverURI))
1001 { 1141 {
1002 message = "No Presence - foreign friend"; 1142 message = "No Presence - foreign friend";
1003 return false; 1143 return false;
1004 } 1144 }
1005 1145
1006 object Prop = (object)properties; 1146 object Prop = (object)properties;
1007 JsonRpcRequest(ref Prop, "avatar_properties_request", serverURI, UUID.Random().ToString()); 1147 if (!rpc.JsonRpcRequest(ref Prop, "avatar_properties_request", serverURI, UUID.Random().ToString()))
1148 {
1149 // If it's a foreign user then try again using OpenProfile, in case that's what the grid is using
1150 bool secondChanceSuccess = false;
1151 if (foreign)
1152 {
1153 try
1154 {
1155 OpenProfileClient client = new OpenProfileClient(serverURI);
1156 if (client.RequestAvatarPropertiesUsingOpenProfile(ref properties))
1157 secondChanceSuccess = true;
1158 }
1159 catch (Exception e)
1160 {
1161 m_log.Debug(
1162 string.Format(
1163 "[PROFILES]: Request using the OpenProfile API for user {0} to {1} failed",
1164 properties.UserId, serverURI),
1165 e);
1166
1167 // Allow the return 'message' to say "JsonRpcRequest" and not "OpenProfile", because
1168 // the most likely reason that OpenProfile failed is that the remote server
1169 // doesn't support OpenProfile, and that's not very interesting.
1170 }
1171 }
1172
1173 if (!secondChanceSuccess)
1174 {
1175 message = string.Format("JsonRpcRequest for user {0} to {1} failed", properties.UserId, serverURI);
1176 m_log.DebugFormat("[PROFILES]: {0}", message);
1177
1178 return false;
1179 }
1180 // else, continue below
1181 }
1182
1008 properties = (UserProfileProperties)Prop; 1183 properties = (UserProfileProperties)Prop;
1009 1184
1010 message = "Success"; 1185 message = "Success";
@@ -1025,25 +1200,36 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
1025 1200
1026 assetServerURI = UserManagementModule.GetUserServerURL(avatarId, "AssetServerURI"); 1201 assetServerURI = UserManagementModule.GetUserServerURL(avatarId, "AssetServerURI");
1027 1202
1203 if(string.IsNullOrEmpty(profileServerURI) || string.IsNullOrEmpty(assetServerURI))
1204 return false;
1205
1028 OSDMap parameters= new OSDMap(); 1206 OSDMap parameters= new OSDMap();
1029 parameters.Add("avatarId", OSD.FromUUID(avatarId)); 1207 parameters.Add("avatarId", OSD.FromUUID(avatarId));
1030 OSD Params = (OSD)parameters; 1208 OSD Params = (OSD)parameters;
1031 if(!JsonRpcRequest(ref Params, "image_assets_request", profileServerURI, UUID.Random().ToString())) 1209 if(!rpc.JsonRpcRequest(ref Params, "image_assets_request", profileServerURI, UUID.Random().ToString()))
1032 { 1210 {
1033 return false; 1211 return false;
1034 } 1212 }
1035 1213
1036 parameters = (OSDMap)Params; 1214 parameters = (OSDMap)Params;
1037 1215
1038 OSDArray list = (OSDArray)parameters["result"]; 1216 if (parameters.ContainsKey("result"))
1039
1040 foreach(OSD asset in list)
1041 { 1217 {
1042 OSDString assetId = (OSDString)asset; 1218 OSDArray list = (OSDArray)parameters["result"];
1219
1220 foreach (OSD asset in list)
1221 {
1222 OSDString assetId = (OSDString)asset;
1043 1223
1044 Scene.AssetService.Get(string.Format("{0}/{1}",assetServerURI, assetId.AsString())); 1224 Scene.AssetService.Get(string.Format("{0}/{1}", assetServerURI, assetId.AsString()));
1225 }
1226 return true;
1227 }
1228 else
1229 {
1230 m_log.ErrorFormat("[PROFILES]: Problematic response for image_assets_request from {0}", profileServerURI);
1231 return false;
1045 } 1232 }
1046 return true;
1047 } 1233 }
1048 1234
1049 /// <summary> 1235 /// <summary>
@@ -1097,7 +1283,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
1097 1283
1098 UserAgentServiceConnector uConn = new UserAgentServiceConnector(home_url); 1284 UserAgentServiceConnector uConn = new UserAgentServiceConnector(home_url);
1099 1285
1100 Dictionary<string, object> account = uConn.GetUserInfo(userID); 1286 Dictionary<string, object> account;
1287 try
1288 {
1289 account = uConn.GetUserInfo(userID);
1290 }
1291 catch (Exception e)
1292 {
1293 m_log.Debug("[PROFILES]: GetUserInfo call failed ", e);
1294 account = new Dictionary<string, object>();
1295 }
1101 1296
1102 if (account.Count > 0) 1297 if (account.Count > 0)
1103 { 1298 {
@@ -1125,6 +1320,37 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
1125 } 1320 }
1126 1321
1127 /// <summary> 1322 /// <summary>
1323 /// Gets the user gatekeeper server URI.
1324 /// </summary>
1325 /// <returns>
1326 /// The user gatekeeper server URI.
1327 /// </returns>
1328 /// <param name='userID'>
1329 /// If set to <c>true</c> user URI.
1330 /// </param>
1331 /// <param name='serverURI'>
1332 /// If set to <c>true</c> server URI.
1333 /// </param>
1334 bool GetUserGatekeeperURI(UUID userID, out string serverURI)
1335 {
1336 bool local;
1337 local = UserManagementModule.IsLocalGridUser(userID);
1338
1339 if (!local)
1340 {
1341 serverURI = UserManagementModule.GetUserServerURL(userID, "GatekeeperURI");
1342 // Is Foreign
1343 return true;
1344 }
1345 else
1346 {
1347 serverURI = MyGatekeeper;
1348 // Is local
1349 return false;
1350 }
1351 }
1352
1353 /// <summary>
1128 /// Gets the user profile server UR. 1354 /// Gets the user profile server UR.
1129 /// </summary> 1355 /// </summary>
1130 /// <returns> 1356 /// <returns>
@@ -1175,6 +1401,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
1175 return null; 1401 return null;
1176 } 1402 }
1177 #endregion Util 1403 #endregion Util
1404<<<<<<< HEAD
1405=======
1178 1406
1179 #region Web Util 1407 #region Web Util
1180 /// <summary> 1408 /// <summary>
@@ -1352,5 +1580,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
1352 return true; 1580 return true;
1353 } 1581 }
1354 #endregion Web Util 1582 #endregion Web Util
1583>>>>>>> avn/ubitvar
1355 } 1584 }
1356} 1585}
diff --git a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs
index f615c6b..44eee89 100644
--- a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs
@@ -160,6 +160,10 @@ namespace OpenSim.Region.CoreModules.Framework
160 } 160 }
161 } 161 }
162 162
163// m_log.DebugFormat(
164// "[CAPS]: Adding capabilities for agent {0} in {1} with path {2}",
165// agentId, m_scene.RegionInfo.RegionName, capsObjectPath);
166
163 caps = new Caps(MainServer.Instance, m_scene.RegionInfo.ExternalHostName, 167 caps = new Caps(MainServer.Instance, m_scene.RegionInfo.ExternalHostName,
164 (MainServer.Instance == null) ? 0: MainServer.Instance.Port, 168 (MainServer.Instance == null) ? 0: MainServer.Instance.Port,
165 capsObjectPath, agentId, m_scene.RegionInfo.RegionName); 169 capsObjectPath, agentId, m_scene.RegionInfo.RegionName);
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index efee080..7937383 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -111,6 +111,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
111 /// </remarks> 111 /// </remarks>
112 private Stat m_interRegionTeleportFailures; 112 private Stat m_interRegionTeleportFailures;
113 113
114 protected string m_ThisHomeURI;
115 protected string m_GatekeeperURI;
116
114 protected bool m_Enabled = false; 117 protected bool m_Enabled = false;
115 118
116 public Scene Scene { get; private set; } 119 public Scene Scene { get; private set; }
@@ -151,6 +154,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
151 // Add this agent in this region as a banned person 154 // Add this agent in this region as a banned person
152 public void Add(ulong pRegionHandle, UUID pAgentID) 155 public void Add(ulong pRegionHandle, UUID pAgentID)
153 { 156 {
157<<<<<<< HEAD
158 if (!m_bannedRegions.TryGetValue(pAgentID, out m_idCache))
159 {
160 m_idCache = new ExpiringCache<ulong, DateTime>();
161 m_bannedRegions.Add(pAgentID, m_idCache, TimeSpan.FromSeconds(45));
162 }
163 m_idCache.Add(pRegionHandle, DateTime.Now + TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(15));
164=======
154 this.Add(pRegionHandle, pAgentID, 45, 15); 165 this.Add(pRegionHandle, pAgentID, 45, 15);
155 } 166 }
156 public void Add(ulong pRegionHandle, UUID pAgentID, double newTime, double extendTime) 167 public void Add(ulong pRegionHandle, UUID pAgentID, double newTime, double extendTime)
@@ -161,6 +172,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
161 m_bannedRegions.Add(pAgentID, m_idCache, TimeSpan.FromSeconds(newTime)); 172 m_bannedRegions.Add(pAgentID, m_idCache, TimeSpan.FromSeconds(newTime));
162 } 173 }
163 m_idCache.Add(pRegionHandle, DateTime.Now + TimeSpan.FromSeconds(extendTime), TimeSpan.FromSeconds(extendTime)); 174 m_idCache.Add(pRegionHandle, DateTime.Now + TimeSpan.FromSeconds(extendTime), TimeSpan.FromSeconds(extendTime));
175>>>>>>> avn/ubitvar
164 } 176 }
165 // Remove the agent from the region's banned list 177 // Remove the agent from the region's banned list
166 public void Remove(ulong pRegionHandle, UUID pAgentID) 178 public void Remove(ulong pRegionHandle, UUID pAgentID)
@@ -210,6 +222,21 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
210 { 222 {
211 string transferVersionName = "SIMULATION"; 223 string transferVersionName = "SIMULATION";
212 float maxTransferVersion = 0.3f; 224 float maxTransferVersion = 0.3f;
225<<<<<<< HEAD
226
227 IConfig hypergridConfig = source.Configs["Hypergrid"];
228 if (hypergridConfig != null)
229 {
230 m_ThisHomeURI = hypergridConfig.GetString("HomeURI", string.Empty);
231 if (m_ThisHomeURI != string.Empty && !m_ThisHomeURI.EndsWith("/"))
232 m_ThisHomeURI += '/';
233
234 m_GatekeeperURI = hypergridConfig.GetString("GatekeeperURI", string.Empty);
235 if (m_GatekeeperURI != string.Empty && !m_GatekeeperURI.EndsWith("/"))
236 m_GatekeeperURI += '/';
237 }
238=======
239>>>>>>> avn/ubitvar
213 240
214 IConfig transferConfig = source.Configs["EntityTransfer"]; 241 IConfig transferConfig = source.Configs["EntityTransfer"];
215 if (transferConfig != null) 242 if (transferConfig != null)
@@ -488,8 +515,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
488 515
489 // TODO: Check other Scene HeightField 516 // TODO: Check other Scene HeightField
490 posZLimit = (float)sp.Scene.Heightmap[(int)position.X, (int)position.Y]; 517 posZLimit = (float)sp.Scene.Heightmap[(int)position.X, (int)position.Y];
518<<<<<<< HEAD
519=======
491 520
492 posZLimit += localHalfAVHeight + 0.1f; 521 posZLimit += localHalfAVHeight + 0.1f;
522>>>>>>> avn/ubitvar
493 523
494 if ((position.Z < posZLimit) && !(Single.IsInfinity(posZLimit) || Single.IsNaN(posZLimit))) 524 if ((position.Z < posZLimit) && !(Single.IsInfinity(posZLimit) || Single.IsNaN(posZLimit)))
495 { 525 {
@@ -537,15 +567,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
537 567
538 if (reg != null) 568 if (reg != null)
539 { 569 {
540 finalDestination = GetFinalDestination(reg); 570 string homeURI = Scene.GetAgentHomeURI(sp.ControllingClient.AgentId);
571
572 string message;
573 finalDestination = GetFinalDestination(reg, sp.ControllingClient.AgentId, homeURI, out message);
541 574
542 if (finalDestination == null) 575 if (finalDestination == null)
543 { 576 {
544 m_log.WarnFormat( 577 m_log.WarnFormat( "{0} Final destination is having problems. Unable to teleport {1} {2}: {3}",
545 "[ENTITY TRANSFER MODULE]: Final destination is having problems. Unable to teleport {0} {1}", 578 LogHeader, sp.Name, sp.UUID, message);
546 sp.Name, sp.UUID);
547 579
548 sp.ControllingClient.SendTeleportFailed("Problem at destination"); 580 sp.ControllingClient.SendTeleportFailed(message);
549 return; 581 return;
550 } 582 }
551 583
@@ -566,6 +598,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
566 return; 598 return;
567 } 599 }
568 600
601 if (message != null)
602 sp.ControllingClient.SendAgentAlertMessage(message, true);
603
569 // 604 //
570 // This is it 605 // This is it
571 // 606 //
@@ -587,9 +622,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
587 Util.RegionHandleToRegionLoc(regionHandle, out regX, out regY); 622 Util.RegionHandleToRegionLoc(regionHandle, out regX, out regY);
588 623
589 MapBlockData block = new MapBlockData(); 624 MapBlockData block = new MapBlockData();
625<<<<<<< HEAD
626 block.X = (ushort)regX;
627 block.Y = (ushort)regY;
628 block.Access = (byte)SimAccess.Down;
629=======
590 block.X = (ushort)(regX); 630 block.X = (ushort)(regX);
591 block.Y = (ushort)(regY); 631 block.Y = (ushort)(regY);
592 block.Access = (byte)SimAccess.Down; // == not there 632 block.Access = (byte)SimAccess.Down; // == not there
633>>>>>>> avn/ubitvar
593 634
594 List<MapBlockData> blocks = new List<MapBlockData>(); 635 List<MapBlockData> blocks = new List<MapBlockData>();
595 blocks.Add(block); 636 blocks.Add(block);
@@ -666,7 +707,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
666 m_log.DebugFormat( 707 m_log.DebugFormat(
667 "[ENTITY TRANSFER MODULE]: Ignoring teleport request of {0} {1} to {2} ({3}) {4}/{5} - agent is already in transit.", 708 "[ENTITY TRANSFER MODULE]: Ignoring teleport request of {0} {1} to {2} ({3}) {4}/{5} - agent is already in transit.",
668 sp.Name, sp.UUID, reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position); 709 sp.Name, sp.UUID, reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position);
669 710 sp.ControllingClient.SendTeleportFailed("Agent is already in transit.");
670 return; 711 return;
671 } 712 }
672 713
@@ -724,6 +765,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
724 return; 765 return;
725 } 766 }
726 767
768<<<<<<< HEAD
769 uint newRegionX, newRegionY, oldRegionX, oldRegionY;
770 Util.RegionHandleToRegionLoc(reg.RegionHandle, out newRegionX, out newRegionY);
771 Util.RegionHandleToRegionLoc(sp.Scene.RegionInfo.RegionHandle, out oldRegionX, out oldRegionY);
772
773=======
774>>>>>>> avn/ubitvar
727 ulong destinationHandle = finalDestination.RegionHandle; 775 ulong destinationHandle = finalDestination.RegionHandle;
728 776
729 // Let's do DNS resolution only once in this process, please! 777 // Let's do DNS resolution only once in this process, please!
@@ -746,12 +794,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
746 string version; 794 string version;
747 string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion); 795 string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion);
748 if (!Scene.SimulationService.QueryAccess( 796 if (!Scene.SimulationService.QueryAccess(
797<<<<<<< HEAD
798 finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, myversion, sp.Scene.GetFormatsOffered(), out version, out reason))
799=======
749 finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, myversion, out version, out reason)) 800 finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, myversion, out version, out reason))
801>>>>>>> avn/ubitvar
750 { 802 {
751 sp.ControllingClient.SendTeleportFailed(reason); 803 sp.ControllingClient.SendTeleportFailed(reason);
752 804
753 m_log.DebugFormat( 805 m_log.DebugFormat(
754 "[ENTITY TRANSFER MODULE]: {0} was stopped from teleporting from {1} to {2} because {3}", 806 "[ENTITY TRANSFER MODULE]: {0} was stopped from teleporting from {1} to {2} because: {3}",
755 sp.Name, sp.Scene.Name, finalDestination.RegionName, reason); 807 sp.Name, sp.Scene.Name, finalDestination.RegionName, reason);
756 808
757 return; 809 return;
@@ -788,8 +840,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
788 // once we reach here... 840 // once we reach here...
789 //avatar.Scene.RemoveCapsHandler(avatar.UUID); 841 //avatar.Scene.RemoveCapsHandler(avatar.UUID);
790 842
791 string capsPath = String.Empty;
792
793 AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); 843 AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
794 AgentCircuitData agentCircuit = sp.ControllingClient.RequestClientInfo(); 844 AgentCircuitData agentCircuit = sp.ControllingClient.RequestClientInfo();
795 agentCircuit.startpos = position; 845 agentCircuit.startpos = position;
@@ -810,6 +860,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
810 agentCircuit.Id0 = currentAgentCircuit.Id0; 860 agentCircuit.Id0 = currentAgentCircuit.Id0;
811 } 861 }
812 862
863<<<<<<< HEAD
864 // if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY))
865 float dist = (float)Math.Max(sp.Scene.DefaultDrawDistance,
866 (float)Math.Max(sp.Scene.RegionInfo.RegionSizeX, sp.Scene.RegionInfo.RegionSizeY));
867 if (NeedsNewAgent(dist, oldRegionX, newRegionX, oldRegionY, newRegionY))
868=======
813 IClientIPEndpoint ipepClient; 869 IClientIPEndpoint ipepClient;
814 870
815 uint newRegionX, newRegionY, oldRegionX, oldRegionY; 871 uint newRegionX, newRegionY, oldRegionX, oldRegionY;
@@ -824,6 +880,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
824 oldSizeX, oldSizeY, newSizeX, newSizeY); 880 oldSizeX, oldSizeY, newSizeX, newSizeY);
825 881
826 if (OutSideViewRange) 882 if (OutSideViewRange)
883>>>>>>> avn/ubitvar
827 { 884 {
828 m_log.DebugFormat( 885 m_log.DebugFormat(
829 "[ENTITY TRANSFER MODULE]: Determined that region {0} at {1},{2} needs new child agent for agent {3} from {4}", 886 "[ENTITY TRANSFER MODULE]: Determined that region {0} at {1},{2} needs new child agent for agent {3} from {4}",
@@ -854,7 +911,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
854 float.TryParse(versionComponents[1], out versionNumber); 911 float.TryParse(versionComponents[1], out versionNumber);
855 912
856 if (versionNumber >= 0.2f && MaxOutgoingTransferVersion >= versionNumber) 913 if (versionNumber >= 0.2f && MaxOutgoingTransferVersion >= versionNumber)
914<<<<<<< HEAD
915 TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason);
916=======
857 TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange , version, out reason); 917 TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange , version, out reason);
918>>>>>>> avn/ubitvar
858 else 919 else
859 TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange, version, out reason); 920 TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange, version, out reason);
860 } 921 }
@@ -878,12 +939,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
878 { 939 {
879 m_interRegionTeleportFailures.Value++; 940 m_interRegionTeleportFailures.Value++;
880 941
881 sp.ControllingClient.SendTeleportFailed(String.Format("Teleport refused: {0}", reason));
882
883 m_log.DebugFormat( 942 m_log.DebugFormat(
884 "[ENTITY TRANSFER MODULE]: Teleport of {0} from {1} to {2} was refused because {3}", 943 "[ENTITY TRANSFER MODULE]: Teleport of {0} from {1} to {2} was refused because {3}",
885 sp.Name, sp.Scene.RegionInfo.RegionName, finalDestination.RegionName, reason); 944 sp.Name, sp.Scene.RegionInfo.RegionName, finalDestination.RegionName, reason);
886 945
946 sp.ControllingClient.SendTeleportFailed(reason);
947
887 return; 948 return;
888 } 949 }
889 950
@@ -912,6 +973,20 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
912 m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring); 973 m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring);
913 974
914 // OK, it got this agent. Let's close some child agents 975 // OK, it got this agent. Let's close some child agents
976<<<<<<< HEAD
977 sp.CloseChildAgents(newRegionX, newRegionY);
978
979 IClientIPEndpoint ipepClient;
980 string capsPath = String.Empty;
981 float dist = (float)Math.Max(sp.Scene.DefaultDrawDistance,
982 (float)Math.Max(sp.Scene.RegionInfo.RegionSizeX, sp.Scene.RegionInfo.RegionSizeY));
983 if (NeedsNewAgent(dist, oldRegionX, newRegionX, oldRegionY, newRegionY))
984 {
985 m_log.DebugFormat(
986 "[ENTITY TRANSFER MODULE]: Determined that region {0} at {1},{2} needs new child agent for incoming agent {3} from {4}",
987 finalDestination.RegionName, newRegionX, newRegionY, sp.Name, Scene.Name);
988=======
989>>>>>>> avn/ubitvar
915 990
916 991
917 if (OutSideViewRange) 992 if (OutSideViewRange)
@@ -1082,7 +1157,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1082 1157
1083 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone 1158 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
1084 1159
1160<<<<<<< HEAD
1161 if (NeedsClosing(sp.Scene.DefaultDrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
1162=======
1085 if (OutSideViewRange) 1163 if (OutSideViewRange)
1164>>>>>>> avn/ubitvar
1086 { 1165 {
1087 if (!sp.Scene.IncomingPreCloseClient(sp)) 1166 if (!sp.Scene.IncomingPreCloseClient(sp))
1088 return; 1167 return;
@@ -1114,12 +1193,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1114 { 1193 {
1115 m_interRegionTeleportFailures.Value++; 1194 m_interRegionTeleportFailures.Value++;
1116 1195
1117 sp.ControllingClient.SendTeleportFailed(String.Format("Teleport refused: {0}", reason));
1118
1119 m_log.DebugFormat( 1196 m_log.DebugFormat(
1120 "[ENTITY TRANSFER MODULE]: Teleport of {0} from {1} to {2} was refused because {3}", 1197 "[ENTITY TRANSFER MODULE]: Teleport of {0} from {1} to {2} was refused because {3}",
1121 sp.Name, sp.Scene.RegionInfo.RegionName, finalDestination.RegionName, reason); 1198 sp.Name, sp.Scene.RegionInfo.RegionName, finalDestination.RegionName, reason);
1122 1199
1200 sp.ControllingClient.SendTeleportFailed(reason);
1201
1123 return; 1202 return;
1124 } 1203 }
1125 1204
@@ -1147,6 +1226,35 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1147 // Past this point we have to attempt clean up if the teleport fails, so update transfer state. 1226 // Past this point we have to attempt clean up if the teleport fails, so update transfer state.
1148 m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring); 1227 m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring);
1149 1228
1229<<<<<<< HEAD
1230 IClientIPEndpoint ipepClient;
1231 string capsPath = String.Empty;
1232 float dist = (float)Math.Max(sp.Scene.DefaultDrawDistance,
1233 (float)Math.Max(sp.Scene.RegionInfo.RegionSizeX, sp.Scene.RegionInfo.RegionSizeY));
1234 if (NeedsNewAgent(dist, oldRegionX, newRegionX, oldRegionY, newRegionY))
1235 {
1236 m_log.DebugFormat(
1237 "[ENTITY TRANSFER MODULE]: Determined that region {0} at {1},{2} needs new child agent for agent {3} from {4}",
1238 finalDestination.RegionName, newRegionX, newRegionY, sp.Name, Scene.Name);
1239
1240 //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent...");
1241 #region IP Translation for NAT
1242 // Uses ipepClient above
1243 if (sp.ClientView.TryGet(out ipepClient))
1244 {
1245 endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address);
1246 }
1247 #endregion
1248 capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
1249 }
1250 else
1251 {
1252 agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle);
1253 capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
1254 }
1255
1256=======
1257>>>>>>> avn/ubitvar
1150 // We need to set this here to avoid an unlikely race condition when teleporting to a neighbour simulator, 1258 // We need to set this here to avoid an unlikely race condition when teleporting to a neighbour simulator,
1151 // where that neighbour simulator could otherwise request a child agent create on the source which then 1259 // where that neighbour simulator could otherwise request a child agent create on the source which then
1152 // closes our existing agent which is still signalled as root. 1260 // closes our existing agent which is still signalled as root.
@@ -1225,7 +1333,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1225 sp.MakeChildAgent(destinationHandle); 1333 sp.MakeChildAgent(destinationHandle);
1226 1334
1227 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone 1335 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
1336<<<<<<< HEAD
1337 if (NeedsClosing(sp.Scene.DefaultDrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
1338=======
1228 if (OutSideViewRange) 1339 if (OutSideViewRange)
1340>>>>>>> avn/ubitvar
1229 { 1341 {
1230 if (!sp.Scene.IncomingPreCloseClient(sp)) 1342 if (!sp.Scene.IncomingPreCloseClient(sp))
1231 return; 1343 return;
@@ -1302,8 +1414,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1302 1414
1303 protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) 1415 protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout)
1304 { 1416 {
1417 GridRegion source = new GridRegion(Scene.RegionInfo);
1418 source.RawServerURI = m_GatekeeperURI;
1419
1305 logout = false; 1420 logout = false;
1306 bool success = Scene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason); 1421 bool success = Scene.SimulationService.CreateAgent(source, finalDestination, agentCircuit, teleportFlags, out reason);
1307 1422
1308 if (success) 1423 if (success)
1309 sp.Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout); 1424 sp.Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout);
@@ -1341,16 +1456,21 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1341 scene.SendKillObject(new List<uint> { localID }); 1456 scene.SendKillObject(new List<uint> { localID });
1342 } 1457 }
1343 1458
1344 protected virtual GridRegion GetFinalDestination(GridRegion region) 1459 protected virtual GridRegion GetFinalDestination(GridRegion region, UUID agentID, string agentHomeURI, out string message)
1345 { 1460 {
1461 message = null;
1346 return region; 1462 return region;
1347 } 1463 }
1348 1464
1349 // This returns 'true' if the new region already has a child agent for our 1465 // This returns 'true' if the new region already has a child agent for our
1350 // incoming agent. The implication is that, if 'false', we have to create the 1466 // incoming agent. The implication is that, if 'false', we have to create the
1351 // child and then teleport into the region. 1467 // child and then teleport into the region.
1468<<<<<<< HEAD
1469 protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY)
1470=======
1352 protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, 1471 protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY,
1353 int oldsizeX, int oldsizeY, int newsizeX, int newsizeY) 1472 int oldsizeX, int oldsizeY, int newsizeX, int newsizeY)
1473>>>>>>> avn/ubitvar
1354 { 1474 {
1355 if (m_regionCombinerModule != null && m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID)) 1475 if (m_regionCombinerModule != null && m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID))
1356 { 1476 {
@@ -1367,6 +1487,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1367 return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY, 1487 return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY,
1368 oldsizeX, oldsizeY, newsizeX, newsizeY); 1488 oldsizeX, oldsizeY, newsizeX, newsizeY);
1369 } 1489 }
1490<<<<<<< HEAD
1491
1492=======
1370/* 1493/*
1371 protected virtual bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, 1494 protected virtual bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY,
1372 uint oldsizeX, uint oldsizeY, uint newsizeX, uint newsizeY, GridRegion reg) 1495 uint oldsizeX, uint oldsizeY, uint newsizeX, uint newsizeY, GridRegion reg)
@@ -1376,6 +1499,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1376 oldsizeX, oldsizeY, newsizeX, newsizeY); 1499 oldsizeX, oldsizeY, newsizeX, newsizeY);
1377 } 1500 }
1378*/ 1501*/
1502>>>>>>> avn/ubitvar
1379 #endregion 1503 #endregion
1380 1504
1381 #region Landmark Teleport 1505 #region Landmark Teleport
@@ -1421,6 +1545,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1421 if (uinfo.HomeRegionID == UUID.Zero) 1545 if (uinfo.HomeRegionID == UUID.Zero)
1422 { 1546 {
1423 // can't find the Home region: Tell viewer and abort 1547 // can't find the Home region: Tell viewer and abort
1548 m_log.ErrorFormat("{0} No grid user info found for {1} {2}. Cannot send home.",
1549 LogHeader, client.Name, client.AgentId);
1424 client.SendTeleportFailed("You don't have a home position set."); 1550 client.SendTeleportFailed("You don't have a home position set.");
1425 return false; 1551 return false;
1426 } 1552 }
@@ -1454,10 +1580,82 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1454 1580
1455 #region Agent Crossings 1581 #region Agent Crossings
1456 1582
1583<<<<<<< HEAD
1584 // Given a position relative to the current region (which has previously been tested to
1585 // see that it is actually outside the current region), find the new region that the
1586 // point is actually in.
1587 // Returns the coordinates and information of the new region or 'null' of it doesn't exist.
1588 public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos,
1589 out string version, out Vector3 newpos, out string failureReason)
1590=======
1457 public bool checkAgentAccessToRegion(ScenePresence agent, GridRegion destiny, Vector3 position, out string version, out string reason) 1591 public bool checkAgentAccessToRegion(ScenePresence agent, GridRegion destiny, Vector3 position, out string version, out string reason)
1592>>>>>>> avn/ubitvar
1458 { 1593 {
1459 reason = String.Empty; 1594 reason = String.Empty;
1460 version = String.Empty; 1595 version = String.Empty;
1596<<<<<<< HEAD
1597 newpos = pos;
1598 failureReason = string.Empty;
1599 string homeURI = scene.GetAgentHomeURI(agentID);
1600
1601// m_log.DebugFormat(
1602// "[ENTITY TRANSFER MODULE]: Crossing agent {0} at pos {1} in {2}", agent.Name, pos, scene.Name);
1603
1604 // Compute world location of the object's position
1605 double presenceWorldX = (double)scene.RegionInfo.WorldLocX + pos.X;
1606 double presenceWorldY = (double)scene.RegionInfo.WorldLocY + pos.Y;
1607
1608 // Call the grid service to lookup the region containing the new position.
1609 GridRegion neighbourRegion = GetRegionContainingWorldLocation(scene.GridService, scene.RegionInfo.ScopeID,
1610 presenceWorldX, presenceWorldY,
1611 Math.Max(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY));
1612
1613 if (neighbourRegion != null)
1614 {
1615 // Compute the entity's position relative to the new region
1616 newpos = new Vector3((float)(presenceWorldX - (double)neighbourRegion.RegionLocX),
1617 (float)(presenceWorldY - (double)neighbourRegion.RegionLocY),
1618 pos.Z);
1619
1620 if (m_bannedRegionCache.IfBanned(neighbourRegion.RegionHandle, agentID))
1621 {
1622 failureReason = "Cannot region cross into banned parcel";
1623 neighbourRegion = null;
1624 }
1625 else
1626 {
1627 // If not banned, make sure this agent is not in the list.
1628 m_bannedRegionCache.Remove(neighbourRegion.RegionHandle, agentID);
1629 }
1630
1631 // Check to see if we have access to the target region.
1632 string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion);
1633 if (neighbourRegion != null
1634 && !scene.SimulationService.QueryAccess(neighbourRegion, agentID, homeURI, false, newpos, myversion, scene.GetFormatsOffered(), out version, out failureReason))
1635 {
1636 // remember banned
1637 m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID);
1638 neighbourRegion = null;
1639 }
1640 }
1641 else
1642 {
1643 // The destination region just doesn't exist
1644 failureReason = "Cannot cross into non-existent region";
1645 }
1646
1647 if (neighbourRegion == null)
1648 m_log.DebugFormat("{0} GetDestination: region not found. Old region name={1} at <{2},{3}> of size <{4},{5}>. Old pos={6}",
1649 LogHeader, scene.RegionInfo.RegionName,
1650 scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY,
1651 scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY,
1652 pos);
1653 else
1654 m_log.DebugFormat("{0} GetDestination: new region={1} at <{2},{3}> of size <{4},{5}>, newpos=<{6},{7}>",
1655 LogHeader, neighbourRegion.RegionName,
1656 neighbourRegion.RegionLocX, neighbourRegion.RegionLocY, neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY,
1657 newpos.X, newpos.Y);
1658=======
1461 1659
1462 UUID agentID = agent.UUID; 1660 UUID agentID = agent.UUID;
1463 ulong destinyHandle = destiny.RegionHandle; 1661 ulong destinyHandle = destiny.RegionHandle;
@@ -1549,6 +1747,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1549 // The destination region just doesn't exist 1747 // The destination region just doesn't exist
1550 failureReason = "Cannot cross into non-existent region"; 1748 failureReason = "Cannot cross into non-existent region";
1551 } 1749 }
1750>>>>>>> avn/ubitvar
1552 1751
1553 if (neighbourRegion == null) 1752 if (neighbourRegion == null)
1554 m_log.DebugFormat("{0} GetDestination: region not found. Old region name={1} at <{2},{3}> of size <{4},{5}>. Old pos={6}", 1753 m_log.DebugFormat("{0} GetDestination: region not found. Old region name={1} at <{2},{3}> of size <{4},{5}>. Old pos={6}",
@@ -1567,6 +1766,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1567 1766
1568 public bool Cross(ScenePresence agent, bool isFlying) 1767 public bool Cross(ScenePresence agent, bool isFlying)
1569 { 1768 {
1769<<<<<<< HEAD
1770=======
1570 agent.IsInTransit = true; 1771 agent.IsInTransit = true;
1571 CrossAsyncDelegate d = CrossAsync; 1772 CrossAsyncDelegate d = CrossAsync;
1572 d.BeginInvoke(agent, isFlying, CrossCompleted, d); 1773 d.BeginInvoke(agent, isFlying, CrossCompleted, d);
@@ -1592,10 +1793,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1592 { 1793 {
1593 uint x; 1794 uint x;
1594 uint y; 1795 uint y;
1796>>>>>>> avn/ubitvar
1595 Vector3 newpos; 1797 Vector3 newpos;
1596 string version; 1798 string version;
1597 string failureReason; 1799 string failureReason;
1598 1800
1801<<<<<<< HEAD
1802 GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, agent.AbsolutePosition,
1803 out version, out newpos, out failureReason);
1804 if (neighbourRegion == null)
1805 {
1806 agent.ControllingClient.SendAlertMessage(failureReason);
1807 return false;
1808=======
1599 Vector3 pos = agent.AbsolutePosition + agent.Velocity; 1809 Vector3 pos = agent.AbsolutePosition + agent.Velocity;
1600 1810
1601 GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, pos, 1811 GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, pos,
@@ -1605,13 +1815,20 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1605 if (failureReason != String.Empty) 1815 if (failureReason != String.Empty)
1606 agent.ControllingClient.SendAlertMessage(failureReason); 1816 agent.ControllingClient.SendAlertMessage(failureReason);
1607 return agent; 1817 return agent;
1818>>>>>>> avn/ubitvar
1608 } 1819 }
1609 1820
1610// agent.IsInTransit = true; 1821// agent.IsInTransit = true;
1611 1822
1823<<<<<<< HEAD
1824 Scene.EventManager.TriggerCrossAgentToNewRegion(agent, isFlying, neighbourRegion);
1825
1826 return true;
1827=======
1612 CrossAgentToNewRegionAsync(agent, newpos, neighbourRegion, isFlying, version); 1828 CrossAgentToNewRegionAsync(agent, newpos, neighbourRegion, isFlying, version);
1613 agent.IsInTransit = false; 1829 agent.IsInTransit = false;
1614 return agent; 1830 return agent;
1831>>>>>>> avn/ubitvar
1615 } 1832 }
1616 1833
1617 1834
@@ -1707,19 +1924,30 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1707 ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, 1924 ScenePresence agent, Vector3 pos, GridRegion neighbourRegion,
1708 bool isFlying, string version) 1925 bool isFlying, string version)
1709 { 1926 {
1710 if (!CrossAgentToNewRegionPrep(agent, neighbourRegion)) 1927 try
1711 { 1928 {
1712 m_entityTransferStateMachine.ResetFromTransit(agent.UUID); 1929 m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: new region={1} at <{2},{3}>. newpos={4}",
1713 return agent; 1930 LogHeader, neighbourRegion.RegionName, neighbourRegion.RegionLocX, neighbourRegion.RegionLocY, pos);
1714 } 1931
1932 if (!CrossAgentToNewRegionPrep(agent, neighbourRegion))
1933 {
1934 m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: prep failed. Resetting transfer state", LogHeader);
1935 m_entityTransferStateMachine.ResetFromTransit(agent.UUID);
1936 }
1937
1938 if (!CrossAgentIntoNewRegionMain(agent, pos, neighbourRegion, isFlying))
1939 {
1940 m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: cross main failed. Resetting transfer state", LogHeader);
1941 m_entityTransferStateMachine.ResetFromTransit(agent.UUID);
1942 }
1715 1943
1716 if (!CrossAgentIntoNewRegionMain(agent, pos, neighbourRegion, isFlying)) 1944 CrossAgentToNewRegionPost(agent, pos, neighbourRegion, isFlying, version);
1945 }
1946 catch (Exception e)
1717 { 1947 {
1718 m_entityTransferStateMachine.ResetFromTransit(agent.UUID); 1948 m_log.Error(string.Format("{0}: CrossAgentToNewRegionAsync: failed with exception ", LogHeader), e);
1719 return agent;
1720 } 1949 }
1721 1950
1722 CrossAgentToNewRegionPost(agent, pos, neighbourRegion, isFlying, version);
1723 return agent; 1951 return agent;
1724 } 1952 }
1725 1953
@@ -1730,6 +1958,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1730 { 1958 {
1731 AgentData cAgent = new AgentData(); 1959 AgentData cAgent = new AgentData();
1732 agent.CopyTo(cAgent); 1960 agent.CopyTo(cAgent);
1961<<<<<<< HEAD
1962 cAgent.Position = pos;
1963
1964=======
1733 1965
1734// agent.Appearance.WearableCacheItems = null; 1966// agent.Appearance.WearableCacheItems = null;
1735 1967
@@ -1737,6 +1969,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1737 1969
1738 cAgent.ChildrenCapSeeds = agent.KnownRegions; 1970 cAgent.ChildrenCapSeeds = agent.KnownRegions;
1739 1971
1972>>>>>>> avn/ubitvar
1740 if (isFlying) 1973 if (isFlying)
1741 cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; 1974 cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
1742 1975
@@ -1815,6 +2048,25 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1815 capsPath); 2048 capsPath);
1816 } 2049 }
1817 2050
2051<<<<<<< HEAD
2052 // SUCCESS!
2053 m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.ReceivedAtDestination);
2054
2055 // Unlike a teleport, here we do not wait for the destination region to confirm the receipt.
2056 m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp);
2057
2058 agent.MakeChildAgent();
2059
2060 // FIXME: Possibly this should occur lower down after other commands to close other agents,
2061 // but not sure yet what the side effects would be.
2062 m_entityTransferStateMachine.ResetFromTransit(agent.UUID);
2063
2064 // now we have a child agent in this region. Request all interesting data about other (root) agents
2065 agent.SendOtherAgentsAvatarDataToClient();
2066 agent.SendOtherAgentsAppearanceToClient();
2067
2068=======
2069>>>>>>> avn/ubitvar
1818 // Backwards compatibility. Best effort 2070 // Backwards compatibility. Best effort
1819 if (version == "Unknown" || version == string.Empty) 2071 if (version == "Unknown" || version == string.Empty)
1820 { 2072 {
@@ -1823,6 +2075,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1823 CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); 2075 CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true);
1824 } 2076 }
1825 2077
2078<<<<<<< HEAD
2079 // Next, let's close the child agent connections that are too far away.
2080 uint neighbourx;
2081 uint neighboury;
2082 Util.RegionHandleToRegionLoc(neighbourRegion.RegionHandle, out neighbourx, out neighboury);
2083=======
1826 // SUCCESS! 2084 // SUCCESS!
1827 m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.ReceivedAtDestination); 2085 m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.ReceivedAtDestination);
1828 2086
@@ -1838,6 +2096,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1838 // FIXME: Possibly this should occur lower down after other commands to close other agents, 2096 // FIXME: Possibly this should occur lower down after other commands to close other agents,
1839 // but not sure yet what the side effects would be. 2097 // but not sure yet what the side effects would be.
1840 m_entityTransferStateMachine.ResetFromTransit(agent.UUID); 2098 m_entityTransferStateMachine.ResetFromTransit(agent.UUID);
2099>>>>>>> avn/ubitvar
1841 2100
1842 agent.CloseChildAgents(neighbourRegion.RegionHandle, neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY); 2101 agent.CloseChildAgents(neighbourRegion.RegionHandle, neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY);
1843 2102
@@ -1918,8 +2177,24 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1918 2177
1919 seeds.Add(regionhandler, agent.CapsPath); 2178 seeds.Add(regionhandler, agent.CapsPath);
1920 2179
2180<<<<<<< HEAD
2181 sp.AddNeighbourRegion(region.RegionHandle, agent.CapsPath);
2182 //foreach (ulong h in agent.ChildrenCapSeeds.Keys)
2183 // m_log.DebugFormat("[XXX] --> {0}", h);
2184 //m_log.DebugFormat("[XXX] Adding {0}", region.RegionHandle);
2185 if (agent.ChildrenCapSeeds.ContainsKey(region.RegionHandle))
2186 {
2187 m_log.WarnFormat(
2188 "[ENTITY TRANSFER]: Overwriting caps seed {0} with {1} for region {2} (handle {3}) for {4} in {5}",
2189 agent.ChildrenCapSeeds[region.RegionHandle], agent.CapsPath,
2190 region.RegionName, region.RegionHandle, sp.Name, Scene.Name);
2191 }
2192
2193 agent.ChildrenCapSeeds[region.RegionHandle] = agent.CapsPath;
2194=======
1921// agent.ChildrenCapSeeds = new Dictionary<ulong, string>(seeds); 2195// agent.ChildrenCapSeeds = new Dictionary<ulong, string>(seeds);
1922 agent.ChildrenCapSeeds = null; 2196 agent.ChildrenCapSeeds = null;
2197>>>>>>> avn/ubitvar
1923 2198
1924 if (sp.Scene.CapsModule != null) 2199 if (sp.Scene.CapsModule != null)
1925 { 2200 {
@@ -2003,7 +2278,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2003 2278
2004 if (m_regionInfo != null) 2279 if (m_regionInfo != null)
2005 { 2280 {
2281<<<<<<< HEAD
2282 neighbours = GetNeighbours(sp, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
2283=======
2006 neighbours = GetNeighbors(sp, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); 2284 neighbours = GetNeighbors(sp, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
2285>>>>>>> avn/ubitvar
2007 } 2286 }
2008 else 2287 else
2009 { 2288 {
@@ -2252,6 +2531,127 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2252 #endregion // NotFoundLocationCache class 2531 #endregion // NotFoundLocationCache class
2253 private NotFoundLocationCache m_notFoundLocationCache = new NotFoundLocationCache(); 2532 private NotFoundLocationCache m_notFoundLocationCache = new NotFoundLocationCache();
2254 2533
2534<<<<<<< HEAD
2535 // Computes the difference between two region bases.
2536 // Returns a vector of world coordinates (meters) from base of first region to the second.
2537 // The first region is the home region of the passed scene presence.
2538 Vector3 CalculateOffset(ScenePresence sp, GridRegion neighbour)
2539 {
2540 /*
2541 int rRegionX = (int)sp.Scene.RegionInfo.LegacyRegionLocX;
2542 int rRegionY = (int)sp.Scene.RegionInfo.LegacyRegionLocY;
2543 int tRegionX = neighbour.RegionLocX / (int)Constants.RegionSize;
2544 int tRegionY = neighbour.RegionLocY / (int)Constants.RegionSize;
2545 int shiftx = (rRegionX - tRegionX) * (int)Constants.RegionSize;
2546 int shifty = (rRegionY - tRegionY) * (int)Constants.RegionSize;
2547 return new Vector3(shiftx, shifty, 0f);
2548 */
2549 return new Vector3( sp.Scene.RegionInfo.WorldLocX - neighbour.RegionLocX,
2550 sp.Scene.RegionInfo.WorldLocY - neighbour.RegionLocY,
2551 0f);
2552 }
2553
2554 public GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID, double px, double py)
2555 {
2556 // Since we don't know how big the regions could be, we have to search a very large area
2557 // to find possible regions.
2558 return GetRegionContainingWorldLocation(pGridService, pScopeID, px, py, Constants.MaximumRegionSize);
2559 }
2560
2561 #region NotFoundLocationCache class
2562 // A collection of not found locations to make future lookups 'not found' lookups quick.
2563 // A simple expiring cache that keeps not found locations for some number of seconds.
2564 // A 'not found' location is presumed to be anywhere in the minimum sized region that
2565 // contains that point. A conservitive estimate.
2566 private class NotFoundLocationCache
2567 {
2568 private struct NotFoundLocation
2569 {
2570 public double minX, maxX, minY, maxY;
2571 public DateTime expireTime;
2572 }
2573 private List<NotFoundLocation> m_notFoundLocations = new List<NotFoundLocation>();
2574 public NotFoundLocationCache()
2575 {
2576 }
2577 // Add an area to the list of 'not found' places. The area is the snapped region
2578 // area around the added point.
2579 public void Add(double pX, double pY)
2580 {
2581 lock (m_notFoundLocations)
2582 {
2583 if (!LockedContains(pX, pY))
2584 {
2585 NotFoundLocation nfl = new NotFoundLocation();
2586 // A not found location is not found for at least a whole region sized area
2587 nfl.minX = pX - (pX % (double)Constants.RegionSize);
2588 nfl.minY = pY - (pY % (double)Constants.RegionSize);
2589 nfl.maxX = nfl.minX + (double)Constants.RegionSize;
2590 nfl.maxY = nfl.minY + (double)Constants.RegionSize;
2591 nfl.expireTime = DateTime.Now + TimeSpan.FromSeconds(30);
2592 m_notFoundLocations.Add(nfl);
2593 }
2594 }
2595
2596 }
2597 // Test to see of this point is in any of the 'not found' areas.
2598 // Return 'true' if the point is found inside the 'not found' areas.
2599 public bool Contains(double pX, double pY)
2600 {
2601 bool ret = false;
2602 lock (m_notFoundLocations)
2603 ret = LockedContains(pX, pY);
2604 return ret;
2605 }
2606 private bool LockedContains(double pX, double pY)
2607 {
2608 bool ret = false;
2609 this.DoExpiration();
2610 foreach (NotFoundLocation nfl in m_notFoundLocations)
2611 {
2612 if (pX >= nfl.minX && pX < nfl.maxX && pY >= nfl.minY && pY < nfl.maxY)
2613 {
2614 ret = true;
2615 break;
2616 }
2617 }
2618 return ret;
2619 }
2620 private void DoExpiration()
2621 {
2622 List<NotFoundLocation> m_toRemove = null;
2623 DateTime now = DateTime.Now;
2624 foreach (NotFoundLocation nfl in m_notFoundLocations)
2625 {
2626 if (nfl.expireTime < now)
2627 {
2628 if (m_toRemove == null)
2629 m_toRemove = new List<NotFoundLocation>();
2630 m_toRemove.Add(nfl);
2631 }
2632 }
2633 if (m_toRemove != null)
2634 {
2635 foreach (NotFoundLocation nfl in m_toRemove)
2636 m_notFoundLocations.Remove(nfl);
2637 m_toRemove.Clear();
2638 }
2639 }
2640 }
2641 #endregion // NotFoundLocationCache class
2642 private NotFoundLocationCache m_notFoundLocationCache = new NotFoundLocationCache();
2643
2644 // Given a world position (fractional meter coordinate), get the GridRegion info for
2645 // the region containing that point.
2646 // Someday this should be a method on GridService.
2647 // 'pSizeHint' is the size of the source region but since the destination point can be anywhere
2648 // the size of the target region is unknown thus the search area might have to be very large.
2649 // Return 'null' if no such region exists.
2650 public GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID,
2651 double px, double py, uint pSizeHint)
2652 {
2653 m_log.DebugFormat("{0} GetRegionContainingWorldLocation: query, loc=<{1},{2}>", LogHeader, px, py);
2654=======
2255// needed for current OSG or old grid code 2655// needed for current OSG or old grid code
2256 2656
2257 public GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID, double px, double py) 2657 public GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID, double px, double py)
@@ -2271,6 +2671,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2271 double px, double py, uint pSizeHint) 2671 double px, double py, uint pSizeHint)
2272 { 2672 {
2273 m_log.DebugFormat("{0} GetRegionContainingWorldLocation: call, XY=<{1},{2}>", LogHeader, px, py); 2673 m_log.DebugFormat("{0} GetRegionContainingWorldLocation: call, XY=<{1},{2}>", LogHeader, px, py);
2674>>>>>>> avn/ubitvar
2274 GridRegion ret = null; 2675 GridRegion ret = null;
2275 const double fudge = 2.0; 2676 const double fudge = 2.0;
2276 2677
@@ -2364,6 +2765,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2364 IPEndPoint endPoint, bool newAgent) 2765 IPEndPoint endPoint, bool newAgent)
2365 { 2766 {
2366 2767
2768<<<<<<< HEAD
2769 Scene scene = sp.Scene;
2770
2771 m_log.DebugFormat(
2772 "[ENTITY TRANSFER MODULE]: Informing {0} {1} about neighbour {2} {3} at ({4},{5})",
2773 sp.Name, sp.UUID, reg.RegionName, endPoint, reg.RegionCoordX, reg.RegionCoordY);
2774=======
2367 if (newAgent) 2775 if (newAgent)
2368 { 2776 {
2369 Scene scene = sp.Scene; 2777 Scene scene = sp.Scene;
@@ -2371,12 +2779,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2371 m_log.DebugFormat( 2779 m_log.DebugFormat(
2372 "[ENTITY TRANSFER MODULE]: Informing {0} {1} about neighbour {2} {3} at ({4},{5})", 2780 "[ENTITY TRANSFER MODULE]: Informing {0} {1} about neighbour {2} {3} at ({4},{5})",
2373 sp.Name, sp.UUID, reg.RegionName, endPoint, reg.RegionCoordX, reg.RegionCoordY); 2781 sp.Name, sp.UUID, reg.RegionName, endPoint, reg.RegionCoordX, reg.RegionCoordY);
2782>>>>>>> avn/ubitvar
2374 2783
2375 string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath); 2784 string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath);
2376 2785
2377 string reason = String.Empty; 2786 string reason = String.Empty;
2378 2787
2788<<<<<<< HEAD
2789 bool regionAccepted = scene.SimulationService.CreateAgent(null, reg, a, (uint)TeleportFlags.Default, out reason);
2790=======
2379 bool regionAccepted = scene.SimulationService.CreateAgent(reg, a, (uint)TeleportFlags.Default, out reason); 2791 bool regionAccepted = scene.SimulationService.CreateAgent(reg, a, (uint)TeleportFlags.Default, out reason);
2792>>>>>>> avn/ubitvar
2380 2793
2381 if (regionAccepted) 2794 if (regionAccepted)
2382 { 2795 {
@@ -2435,7 +2848,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2435 extent.Y = (float)Util.WorldToRegionLoc((uint)megaRegionSize.Y); 2848 extent.Y = (float)Util.WorldToRegionLoc((uint)megaRegionSize.Y);
2436 } 2849 }
2437 2850
2851<<<<<<< HEAD
2852=======
2438 2853
2854>>>>>>> avn/ubitvar
2439 swCorner.X = Scene.RegionInfo.RegionLocX - 1; 2855 swCorner.X = Scene.RegionInfo.RegionLocX - 1;
2440 swCorner.Y = Scene.RegionInfo.RegionLocY - 1; 2856 swCorner.Y = Scene.RegionInfo.RegionLocY - 1;
2441 neCorner.X = Scene.RegionInfo.RegionLocX + extent.X; 2857 neCorner.X = Scene.RegionInfo.RegionLocX + extent.X;
@@ -2443,13 +2859,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2443 } 2859 }
2444 2860
2445 /// <summary> 2861 /// <summary>
2446 /// Return the list of regions that are considered to be neighbours to the given scene. 2862 /// Return the list of online regions that are considered to be neighbours to the given scene.
2447 /// </summary> 2863 /// </summary>
2448 /// <param name="pScene"></param> 2864 /// <param name="avatar"></param>
2449 /// <param name="pRegionLocX"></param> 2865 /// <param name="pRegionLocX"></param>
2450 /// <param name="pRegionLocY"></param> 2866 /// <param name="pRegionLocY"></param>
2451 /// <returns></returns> 2867 /// <returns></returns>
2868<<<<<<< HEAD
2869 protected List<GridRegion> GetNeighbours(ScenePresence avatar, uint pRegionLocX, uint pRegionLocY)
2870=======
2452 protected List<GridRegion> GetNeighbors(ScenePresence avatar, uint pRegionLocX, uint pRegionLocY) 2871 protected List<GridRegion> GetNeighbors(ScenePresence avatar, uint pRegionLocX, uint pRegionLocY)
2872>>>>>>> avn/ubitvar
2453 { 2873 {
2454 Scene pScene = avatar.Scene; 2874 Scene pScene = avatar.Scene;
2455 RegionInfo m_regionInfo = pScene.RegionInfo; 2875 RegionInfo m_regionInfo = pScene.RegionInfo;
@@ -2460,6 +2880,22 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2460 // view to include everything in the megaregion 2880 // view to include everything in the megaregion
2461 if (m_regionCombinerModule == null || !m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID)) 2881 if (m_regionCombinerModule == null || !m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID))
2462 { 2882 {
2883<<<<<<< HEAD
2884 // The area to check is as big as the current region.
2885 // We presume all adjacent regions are the same size as this region.
2886 uint dd = Math.Max((uint)avatar.Scene.DefaultDrawDistance,
2887 Math.Max(Scene.RegionInfo.RegionSizeX, Scene.RegionInfo.RegionSizeY));
2888
2889 uint startX = Util.RegionToWorldLoc(pRegionLocX) - dd + Constants.RegionSize/2;
2890 uint startY = Util.RegionToWorldLoc(pRegionLocY) - dd + Constants.RegionSize/2;
2891
2892 uint endX = Util.RegionToWorldLoc(pRegionLocX) + dd + Constants.RegionSize/2;
2893 uint endY = Util.RegionToWorldLoc(pRegionLocY) + dd + Constants.RegionSize/2;
2894
2895 neighbours
2896 = avatar.Scene.GridService.GetRegionRange(
2897 m_regionInfo.ScopeID, (int)startX, (int)endX, (int)startY, (int)endY);
2898=======
2463 uint dd = (uint)avatar.DrawDistance; 2899 uint dd = (uint)avatar.DrawDistance;
2464 2900
2465 // until avatar movement updates client connections, we need to seend at least this current region imediate Neighbors 2901 // until avatar movement updates client connections, we need to seend at least this current region imediate Neighbors
@@ -2484,6 +2920,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2484 = avatar.Scene.GridService.GetRegionRange( 2920 = avatar.Scene.GridService.GetRegionRange(
2485 m_regionInfo.ScopeID, (int)startX, (int)endX, (int)startY, (int)endY); 2921 m_regionInfo.ScopeID, (int)startX, (int)endX, (int)startY, (int)endY);
2486 2922
2923>>>>>>> avn/ubitvar
2487 } 2924 }
2488 else 2925 else
2489 { 2926 {
@@ -2497,9 +2934,24 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2497 (int)Util.RegionToWorldLoc((uint)swCorner.Y), (int)Util.RegionToWorldLoc((uint)neCorner.Y)); 2934 (int)Util.RegionToWorldLoc((uint)swCorner.Y), (int)Util.RegionToWorldLoc((uint)neCorner.Y));
2498 } 2935 }
2499 2936
2937<<<<<<< HEAD
2938// neighbours.ForEach(
2939// n =>
2940// m_log.DebugFormat(
2941// "[ENTITY TRANSFER MODULE]: Region flags for {0} as seen by {1} are {2}",
2942// n.RegionName, Scene.Name, n.RegionFlags != null ? n.RegionFlags.ToString() : "not present"));
2943
2944 // The r.RegionFlags == null check only needs to be made for simulators before 2015-01-14 (pre 0.8.1).
2945 neighbours.RemoveAll(
2946 r =>
2947 r.RegionID == m_regionInfo.RegionID
2948 || (r.RegionFlags != null && (r.RegionFlags & OpenSim.Framework.RegionFlags.RegionOnline) == 0));
2949
2950=======
2500 // The r.RegionFlags == null check only needs to be made for simulators before 2015-01-14 (pre 0.8.1). 2951 // The r.RegionFlags == null check only needs to be made for simulators before 2015-01-14 (pre 0.8.1).
2501 neighbours.RemoveAll( r => r.RegionID == m_regionInfo.RegionID ); 2952 neighbours.RemoveAll( r => r.RegionID == m_regionInfo.RegionID );
2502 2953
2954>>>>>>> avn/ubitvar
2503 return neighbours; 2955 return neighbours;
2504 } 2956 }
2505 #endregion 2957 #endregion
@@ -2566,7 +3018,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2566 /// Move the given scene object into a new region depending on which region its absolute position has moved 3018 /// Move the given scene object into a new region depending on which region its absolute position has moved
2567 /// into. 3019 /// into.
2568 /// 3020 ///
2569 /// This method locates the new region handle and offsets the prim position for the new region 3021 /// Using the objects new world location, ask the grid service for a the new region and adjust the prim
3022 /// position to be relative to the new region.
2570 /// </summary> 3023 /// </summary>
2571 /// <param name="grp">the scene object that we're crossing</param> 3024 /// <param name="grp">the scene object that we're crossing</param>
2572 /// <param name="attemptedPosition">the attempted out of region position of the scene object. This position is 3025 /// <param name="attemptedPosition">the attempted out of region position of the scene object. This position is
@@ -2583,6 +3036,23 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2583 if (scene == null) 3036 if (scene == null)
2584 return; 3037 return;
2585 3038
3039<<<<<<< HEAD
3040 if (grp.RootPart.DIE_AT_EDGE)
3041 {
3042 // We remove the object here
3043 try
3044 {
3045 scene.DeleteSceneObject(grp, false);
3046 }
3047 catch (Exception)
3048 {
3049 m_log.Warn("[DATABASE]: exception when trying to remove the prim that crossed the border.");
3050 }
3051 return;
3052 }
3053
3054=======
3055>>>>>>> avn/ubitvar
2586 // Remember the old group position in case the region lookup fails so position can be restored. 3056 // Remember the old group position in case the region lookup fails so position can be restored.
2587 Vector3 oldGroupPosition = grp.RootPart.GroupPosition; 3057 Vector3 oldGroupPosition = grp.RootPart.GroupPosition;
2588 3058
@@ -2759,5 +3229,69 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2759 } 3229 }
2760 #endregion 3230 #endregion
2761 3231
3232 public virtual bool HandleIncomingSceneObject(SceneObjectGroup so, Vector3 newPosition)
3233 {
3234 // If the user is banned, we won't let any of their objects
3235 // enter. Period.
3236 //
3237 if (Scene.RegionInfo.EstateSettings.IsBanned(so.OwnerID))
3238 {
3239 m_log.DebugFormat(
3240 "[ENTITY TRANSFER MODULE]: Denied prim crossing of {0} {1} into {2} for banned avatar {3}",
3241 so.Name, so.UUID, Scene.Name, so.OwnerID);
3242
3243 return false;
3244 }
3245
3246 if (newPosition != Vector3.Zero)
3247 so.RootPart.GroupPosition = newPosition;
3248
3249 if (!Scene.AddSceneObject(so))
3250 {
3251 m_log.DebugFormat(
3252 "[ENTITY TRANSFER MODULE]: Problem adding scene object {0} {1} into {2} ",
3253 so.Name, so.UUID, Scene.Name);
3254
3255 return false;
3256 }
3257
3258 if (!so.IsAttachment)
3259 {
3260 // FIXME: It would be better to never add the scene object at all rather than add it and then delete
3261 // it
3262 if (!Scene.Permissions.CanObjectEntry(so.UUID, true, so.AbsolutePosition))
3263 {
3264 // Deny non attachments based on parcel settings
3265 //
3266 m_log.Info("[ENTITY TRANSFER MODULE]: Denied prim crossing because of parcel settings");
3267
3268 Scene.DeleteSceneObject(so, false);
3269
3270 return false;
3271 }
3272
3273 // For attachments, we need to wait until the agent is root
3274 // before we restart the scripts, or else some functions won't work.
3275 so.RootPart.ParentGroup.CreateScriptInstances(
3276 0, false, Scene.DefaultScriptEngine, GetStateSource(so));
3277
3278 so.ResumeScripts();
3279
3280 if (so.RootPart.KeyframeMotion != null)
3281 so.RootPart.KeyframeMotion.UpdateSceneObject(so);
3282 }
3283
3284 return true;
3285 }
3286
3287 private int GetStateSource(SceneObjectGroup sog)
3288 {
3289 ScenePresence sp = Scene.GetScenePresence(sog.OwnerID);
3290
3291 if (sp != null)
3292 return sp.GetStateSource();
3293
3294 return 2; // StateSource.PrimCrossing
3295 }
2762 } 3296 }
2763} 3297}
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferStateMachine.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferStateMachine.cs
index e903383..54ec751 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferStateMachine.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferStateMachine.cs
@@ -77,6 +77,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
77 public class EntityTransferStateMachine 77 public class EntityTransferStateMachine
78 { 78 {
79 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 79 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
80 private static readonly string LogHeader = "[ENTITY TRANSFER STATE MACHINE]";
80 81
81 /// <summary> 82 /// <summary>
82 /// If true then on a teleport, the source region waits for a callback from the destination region. If 83 /// If true then on a teleport, the source region waits for a callback from the destination region. If
@@ -100,6 +101,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
100 /// <returns>true if the agent was not already in transit, false if it was</returns> 101 /// <returns>true if the agent was not already in transit, false if it was</returns>
101 internal bool SetInTransit(UUID id) 102 internal bool SetInTransit(UUID id)
102 { 103 {
104 m_log.DebugFormat("{0} SetInTransit. agent={1}, newState=Preparing", LogHeader, id);
103 lock (m_agentsInTransit) 105 lock (m_agentsInTransit)
104 { 106 {
105 if (!m_agentsInTransit.ContainsKey(id)) 107 if (!m_agentsInTransit.ContainsKey(id))
@@ -121,6 +123,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
121 /// <exception cref='Exception'>Illegal transitions will throw an Exception</exception> 123 /// <exception cref='Exception'>Illegal transitions will throw an Exception</exception>
122 internal bool UpdateInTransit(UUID id, AgentTransferState newState) 124 internal bool UpdateInTransit(UUID id, AgentTransferState newState)
123 { 125 {
126 m_log.DebugFormat("{0} UpdateInTransit. agent={1}, newState={2}", LogHeader, id, newState);
127
124 bool transitionOkay = false; 128 bool transitionOkay = false;
125 129
126 // We don't want to throw an exception on cancel since this can come it at any time. 130 // We don't want to throw an exception on cancel since this can come it at any time.
@@ -193,6 +197,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
193 } 197 }
194 else if (failIfNotOkay) 198 else if (failIfNotOkay)
195 { 199 {
200 m_log.DebugFormat("{0} UpdateInTransit. Throwing transition failure = {1}", LogHeader, failureMessage);
196 throw new Exception(failureMessage); 201 throw new Exception(failureMessage);
197 } 202 }
198// else 203// else
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 4ef2fa9..233b251 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -31,6 +31,7 @@ using System.Reflection;
31 31
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Framework.Client; 33using OpenSim.Framework.Client;
34using OpenSim.Framework.Monitoring;
34using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
35using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
36using OpenSim.Services.Connectors.Hypergrid; 37using OpenSim.Services.Connectors.Hypergrid;
@@ -53,7 +54,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54 55
55 private int m_levelHGTeleport = 0; 56 private int m_levelHGTeleport = 0;
56 private string m_ThisHomeURI;
57 57
58 private GatekeeperServiceConnector m_GatekeeperConnector; 58 private GatekeeperServiceConnector m_GatekeeperConnector;
59 private IUserAgentService m_UAS; 59 private IUserAgentService m_UAS;
@@ -111,6 +111,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
111 } 111 }
112 } 112 }
113 113
114 /// <summary>
115 /// Used for processing analysis of incoming attachments in a controlled fashion.
116 /// </summary>
117 private JobEngine m_incomingSceneObjectEngine;
118
114 #region ISharedRegionModule 119 #region ISharedRegionModule
115 120
116 public override string Name 121 public override string Name
@@ -145,14 +150,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
145 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); 150 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name);
146 } 151 }
147 } 152 }
148
149 moduleConfig = source.Configs["Hypergrid"];
150 if (moduleConfig != null)
151 {
152 m_ThisHomeURI = moduleConfig.GetString("HomeURI", string.Empty);
153 if (m_ThisHomeURI != string.Empty && !m_ThisHomeURI.EndsWith("/"))
154 m_ThisHomeURI += '/';
155 }
156 } 153 }
157 154
158 public override void AddRegion(Scene scene) 155 public override void AddRegion(Scene scene)
@@ -162,33 +159,27 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
162 if (m_Enabled) 159 if (m_Enabled)
163 { 160 {
164 scene.RegisterModuleInterface<IUserAgentVerificationModule>(this); 161 scene.RegisterModuleInterface<IUserAgentVerificationModule>(this);
165 scene.EventManager.OnIncomingSceneObject += OnIncomingSceneObject; 162 //scene.EventManager.OnIncomingSceneObject += OnIncomingSceneObject;
166 } 163
167 } 164 m_incomingSceneObjectEngine
168 165 = new JobEngine(
169 void OnIncomingSceneObject(SceneObjectGroup so) 166 string.Format("HG Incoming Scene Object Engine ({0})", scene.Name),
170 { 167 "HG INCOMING SCENE OBJECT ENGINE");
171 if (!so.IsAttachment) 168
172 return; 169 StatsManager.RegisterStat(
173 170 new Stat(
174 if (so.AttachedAvatar == UUID.Zero || Scene.UserManagementModule.IsLocalGridUser(so.AttachedAvatar)) 171 "HGIncomingAttachmentsWaiting",
175 return; 172 "Number of incoming attachments waiting for processing.",
176 173 "",
177 // foreign user 174 "",
178 AgentCircuitData aCircuit = Scene.AuthenticateHandler.GetAgentCircuitData(so.AttachedAvatar); 175 "entitytransfer",
179 if (aCircuit != null && (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0) 176 Name,
180 { 177 StatType.Pull,
181 if (aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI")) 178 MeasuresOfInterest.None,
182 { 179 stat => stat.Value = m_incomingSceneObjectEngine.JobsWaiting,
183 string url = aCircuit.ServiceURLs["AssetServerURI"].ToString(); 180 StatVerbosity.Debug));
184 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Incoming attachment {0} for HG user {1} with asset server {2}", so.Name, so.AttachedAvatar, url); 181
185 Dictionary<UUID, sbyte> ids = new Dictionary<UUID, sbyte>(); 182 m_incomingSceneObjectEngine.Start();
186 HGUuidGatherer uuidGatherer = new HGUuidGatherer(Scene.AssetService, url);
187 uuidGatherer.GatherAssetUuids(so, ids);
188
189 foreach (KeyValuePair<UUID, sbyte> kvp in ids)
190 uuidGatherer.FetchAsset(kvp.Key);
191 }
192 } 183 }
193 } 184 }
194 185
@@ -218,26 +209,30 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
218 base.RemoveRegion(scene); 209 base.RemoveRegion(scene);
219 210
220 if (m_Enabled) 211 if (m_Enabled)
212 {
221 scene.UnregisterModuleInterface<IUserAgentVerificationModule>(this); 213 scene.UnregisterModuleInterface<IUserAgentVerificationModule>(this);
214 m_incomingSceneObjectEngine.Stop();
215 }
222 } 216 }
223 217
224 #endregion 218 #endregion
225 219
226 #region HG overrides of IEntiryTransferModule 220 #region HG overrides of IEntityTransferModule
227 221
228 protected override GridRegion GetFinalDestination(GridRegion region) 222 protected override GridRegion GetFinalDestination(GridRegion region, UUID agentID, string agentHomeURI, out string message)
229 { 223 {
230 int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, region.RegionID); 224 int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, region.RegionID);
231 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: region {0} flags: {1}", region.RegionName, flags); 225 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: region {0} flags: {1}", region.RegionName, flags);
226 message = null;
232 227
233 if ((flags & (int)OpenSim.Framework.RegionFlags.Hyperlink) != 0) 228 if ((flags & (int)OpenSim.Framework.RegionFlags.Hyperlink) != 0)
234 { 229 {
235 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region is hyperlink"); 230 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region is hyperlink");
236 GridRegion real_destination = m_GatekeeperConnector.GetHyperlinkRegion(region, region.RegionID); 231 GridRegion real_destination = m_GatekeeperConnector.GetHyperlinkRegion(region, region.RegionID, agentID, agentHomeURI, out message);
237 if (real_destination != null) 232 if (real_destination != null)
238 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: GetFinalDestination serveruri -> {0}", real_destination.ServerURI); 233 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: GetFinalDestination: ServerURI={0}", real_destination.ServerURI);
239 else 234 else
240 m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: GetHyperlinkRegion to Gatekeeper {0} failed", region.ServerURI); 235 m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: GetHyperlinkRegion of region {0} from Gatekeeper {1} failed: {2}", region.RegionID, region.ServerURI, message);
241 return real_destination; 236 return real_destination;
242 } 237 }
243 238
@@ -295,11 +290,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
295 else 290 else
296 connector = new UserAgentServiceConnector(userAgentDriver); 291 connector = new UserAgentServiceConnector(userAgentDriver);
297 292
298 bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, false, out reason); 293 GridRegion source = new GridRegion(Scene.RegionInfo);
294 source.RawServerURI = m_GatekeeperURI;
295
296 bool success = connector.LoginAgentToGrid(source, agentCircuit, reg, finalDestination, false, out reason);
299 logout = success; // flag for later logout from this grid; this is an HG TP 297 logout = success; // flag for later logout from this grid; this is an HG TP
300 298
301 if (success) 299 if (success)
302 sp.Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout); 300 Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout);
303 301
304 return success; 302 return success;
305 } 303 }
@@ -436,6 +434,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
436 // return base.UpdateAgent(reg, finalDestination, agentData, sp); 434 // return base.UpdateAgent(reg, finalDestination, agentData, sp);
437 //} 435 //}
438 436
437<<<<<<< HEAD
438 public override void TriggerTeleportHome(UUID id, IClientAPI client)
439 {
440 TeleportHome(id, client);
441 }
442
443=======
444>>>>>>> avn/ubitvar
439 public override bool TeleportHome(UUID id, IClientAPI client) 445 public override bool TeleportHome(UUID id, IClientAPI client)
440 { 446 {
441 m_log.DebugFormat( 447 m_log.DebugFormat(
@@ -462,7 +468,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
462 468
463 IUserAgentService userAgentService = new UserAgentServiceConnector(aCircuit.ServiceURLs["HomeURI"].ToString()); 469 IUserAgentService userAgentService = new UserAgentServiceConnector(aCircuit.ServiceURLs["HomeURI"].ToString());
464 Vector3 position = Vector3.UnitY, lookAt = Vector3.UnitY; 470 Vector3 position = Vector3.UnitY, lookAt = Vector3.UnitY;
465 GridRegion finalDestination = userAgentService.GetHomeRegion(aCircuit.AgentID, out position, out lookAt); 471
472 GridRegion finalDestination = null;
473 try
474 {
475 finalDestination = userAgentService.GetHomeRegion(aCircuit.AgentID, out position, out lookAt);
476 }
477 catch (Exception e)
478 {
479 m_log.Debug("[HG ENTITY TRANSFER MODULE]: GetHomeRegion call failed ", e);
480 }
481
466 if (finalDestination == null) 482 if (finalDestination == null)
467 { 483 {
468 client.SendTeleportFailed("Your home region could not be found"); 484 client.SendTeleportFailed("Your home region could not be found");
@@ -509,35 +525,174 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
509 // Local region? 525 // Local region?
510 if (info != null) 526 if (info != null)
511 { 527 {
512 ((Scene)(remoteClient.Scene)).RequestTeleportLocation(remoteClient, info.RegionHandle, lm.Position, 528 Scene.RequestTeleportLocation(
529 remoteClient, info.RegionHandle, lm.Position,
513 Vector3.Zero, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark)); 530 Vector3.Zero, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark));
514
515 return;
516 } 531 }
517 else 532 else
518 { 533 {
519 // Foreign region 534 // Foreign region
520 Scene scene = (Scene)(remoteClient.Scene);
521 GatekeeperServiceConnector gConn = new GatekeeperServiceConnector(); 535 GatekeeperServiceConnector gConn = new GatekeeperServiceConnector();
522 GridRegion gatekeeper = new GridRegion(); 536 GridRegion gatekeeper = new GridRegion();
523 gatekeeper.ServerURI = lm.Gatekeeper; 537 gatekeeper.ServerURI = lm.Gatekeeper;
524 GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, new UUID(lm.RegionID)); 538 string homeURI = Scene.GetAgentHomeURI(remoteClient.AgentId);
539
540 string message;
541 GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, new UUID(lm.RegionID), remoteClient.AgentId, homeURI, out message);
525 542
526 if (finalDestination != null) 543 if (finalDestination != null)
527 { 544 {
528 ScenePresence sp = scene.GetScenePresence(remoteClient.AgentId); 545 ScenePresence sp = Scene.GetScenePresence(remoteClient.AgentId);
529 IEntityTransferModule transferMod = scene.RequestModuleInterface<IEntityTransferModule>(); 546
547 if (sp != null)
548 {
549 if (message != null)
550 sp.ControllingClient.SendAgentAlertMessage(message, true);
551
552 // Validate assorted conditions
553 string reason = string.Empty;
554 if (!ValidateGenericConditions(sp, gatekeeper, finalDestination, 0, out reason))
555 {
556 sp.ControllingClient.SendTeleportFailed(reason);
557 return;
558 }
530 559
531 if (transferMod != null && sp != null) 560 DoTeleport(
532 transferMod.DoTeleport(
533 sp, gatekeeper, finalDestination, lm.Position, Vector3.UnitX, 561 sp, gatekeeper, finalDestination, lm.Position, Vector3.UnitX,
534 (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark)); 562 (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark));
563 }
564 }
565 else
566 {
567 remoteClient.SendTeleportFailed(message);
568 }
569
570 }
571 }
572
573 private void RemoveIncomingSceneObjectJobs(string commonIdToRemove)
574 {
575 List<JobEngine.Job> jobsToReinsert = new List<JobEngine.Job>();
576 int jobsRemoved = 0;
577
578 JobEngine.Job job;
579 while ((job = m_incomingSceneObjectEngine.RemoveNextJob()) != null)
580 {
581 if (job.CommonId != commonIdToRemove)
582 jobsToReinsert.Add(job);
583 else
584 jobsRemoved++;
585 }
586
587 m_log.DebugFormat(
588 "[HG ENTITY TRANSFER]: Removing {0} jobs with common ID {1} and reinserting {2} other jobs",
589 jobsRemoved, commonIdToRemove, jobsToReinsert.Count);
590
591 if (jobsToReinsert.Count > 0)
592 {
593 foreach (JobEngine.Job jobToReinsert in jobsToReinsert)
594 m_incomingSceneObjectEngine.QueueJob(jobToReinsert);
595 }
596 }
597
598 public override bool HandleIncomingSceneObject(SceneObjectGroup so, Vector3 newPosition)
599 {
600 // FIXME: We must make it so that we can use SOG.IsAttachment here. At the moment it is always null!
601 if (!so.IsAttachmentCheckFull())
602 return base.HandleIncomingSceneObject(so, newPosition);
603
604 // Equally, we can't use so.AttachedAvatar here.
605 if (so.OwnerID == UUID.Zero || Scene.UserManagementModule.IsLocalGridUser(so.OwnerID))
606 return base.HandleIncomingSceneObject(so, newPosition);
607
608 // foreign user
609 AgentCircuitData aCircuit = Scene.AuthenticateHandler.GetAgentCircuitData(so.OwnerID);
610 if (aCircuit != null)
611 {
612 if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) == 0)
613 {
614 // We have already pulled the necessary attachments from the source grid.
615 base.HandleIncomingSceneObject(so, newPosition);
535 } 616 }
617 else
618 {
619 if (aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI"))
620 {
621 m_incomingSceneObjectEngine.QueueJob(
622 string.Format("HG UUID Gather for attachment {0} for {1}", so.Name, aCircuit.Name),
623 () =>
624 {
625 string url = aCircuit.ServiceURLs["AssetServerURI"].ToString();
626 // m_log.DebugFormat(
627 // "[HG ENTITY TRANSFER MODULE]: Incoming attachment {0} for HG user {1} with asset service {2}",
628 // so.Name, so.AttachedAvatar, url);
629
630 IDictionary<UUID, sbyte> ids = new Dictionary<UUID, sbyte>();
631 HGUuidGatherer uuidGatherer
632 = new HGUuidGatherer(Scene.AssetService, url, ids);
633 uuidGatherer.AddForInspection(so);
536 634
635 while (!uuidGatherer.Complete)
636 {
637 int tickStart = Util.EnvironmentTickCount();
638
639 UUID? nextUuid = uuidGatherer.NextUuidToInspect;
640 uuidGatherer.GatherNext();
641
642 // m_log.DebugFormat(
643 // "[HG ENTITY TRANSFER]: Gathered attachment asset uuid {0} for object {1} for HG user {2} took {3} ms with asset service {4}",
644 // nextUuid, so.Name, so.OwnerID, Util.EnvironmentTickCountSubtract(tickStart), url);
645
646 int ticksElapsed = Util.EnvironmentTickCountSubtract(tickStart);
647
648 if (ticksElapsed > 30000)
649 {
650 m_log.WarnFormat(
651 "[HG ENTITY TRANSFER]: Removing incoming scene object jobs for HG user {0} as gather of {1} from {2} took {3} ms to respond (> {4} ms)",
652 so.OwnerID, so.Name, url, ticksElapsed, 30000);
653
654 RemoveIncomingSceneObjectJobs(so.OwnerID.ToString());
655
656 return;
657 }
658 }
659
660 // m_log.DebugFormat(
661 // "[HG ENTITY TRANSFER]: Fetching {0} assets for attachment {1} for HG user {2} with asset service {3}",
662 // ids.Count, so.Name, so.OwnerID, url);
663
664 foreach (KeyValuePair<UUID, sbyte> kvp in ids)
665 {
666 int tickStart = Util.EnvironmentTickCount();
667
668 uuidGatherer.FetchAsset(kvp.Key);
669
670 int ticksElapsed = Util.EnvironmentTickCountSubtract(tickStart);
671
672 if (ticksElapsed > 30000)
673 {
674 m_log.WarnFormat(
675 "[HG ENTITY TRANSFER]: Removing incoming scene object jobs for HG user {0} as fetch of {1} from {2} took {3} ms to respond (> {4} ms)",
676 so.OwnerID, kvp.Key, url, ticksElapsed, 30000);
677
678 RemoveIncomingSceneObjectJobs(so.OwnerID.ToString());
679
680 return;
681 }
682 }
683
684 base.HandleIncomingSceneObject(so, newPosition);
685
686 // m_log.DebugFormat(
687 // "[HG ENTITY TRANSFER MODULE]: Completed incoming attachment {0} for HG user {1} with asset server {2}",
688 // so.Name, so.OwnerID, url);
689 },
690 so.OwnerID.ToString());
691 }
692 }
537 } 693 }
538 694
539 // can't find the region: Tell viewer and abort 695 return true;
540 remoteClient.SendTeleportFailed("The teleport destination could not be found.");
541 } 696 }
542 697
543 #endregion 698 #endregion
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
index d4fb1ba..f54298c 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
@@ -35,6 +35,7 @@ using System.Xml;
35using log4net; 35using log4net;
36using OpenMetaverse; 36using OpenMetaverse;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Framework.Serialization.External;
38 39
39using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
40using OpenSim.Region.Framework.Scenes.Serialization; 41using OpenSim.Region.Framework.Scenes.Serialization;
@@ -118,45 +119,44 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
118 if (string.IsNullOrEmpty(url)) 119 if (string.IsNullOrEmpty(url))
119 return false; 120 return false;
120 121
121 if (asset != null) 122 if (!url.EndsWith("/") && !url.EndsWith("="))
122 { 123 url = url + "/";
123 if (!url.EndsWith("/") && !url.EndsWith("="))
124 url = url + "/";
125
126 bool success = true;
127 // See long comment in AssetCache.AddAsset
128 if (!asset.Temporary || asset.Local)
129 {
130 // We need to copy the asset into a new asset, because
131 // we need to set its ID to be URL+UUID, so that the
132 // HGAssetService dispatches it to the remote grid.
133 // It's not pretty, but the best that can be done while
134 // not having a global naming infrastructure
135 AssetBase asset1 = new AssetBase(asset.FullID, asset.Name, asset.Type, asset.Metadata.CreatorID);
136 Copy(asset, asset1);
137 asset1.ID = url + asset.ID;
138
139 AdjustIdentifiers(asset1.Metadata);
140 if (asset1.Metadata.Type == (sbyte)AssetType.Object)
141 asset1.Data = AdjustIdentifiers(asset.Data);
142 else
143 asset1.Data = asset.Data;
144 124
145 string id = m_scene.AssetService.Store(asset1); 125 if (asset == null)
146 if (id == string.Empty) 126 {
147 { 127 m_log.Warn("[HG ASSET MAPPER]: Tried to post asset to remote server, but asset not in local cache.");
148 m_log.DebugFormat("[HG ASSET MAPPER]: Asset server {0} did not accept {1}", url, asset.ID); 128 return false;
149 success = false;
150 }
151 else
152 m_log.DebugFormat("[HG ASSET MAPPER]: Posted copy of asset {0} from local asset server to {1}", asset1.ID, url);
153 }
154 return success;
155 } 129 }
130
131 // See long comment in AssetCache.AddAsset
132 if (asset.Temporary || asset.Local)
133 return true;
134
135 // We need to copy the asset into a new asset, because
136 // we need to set its ID to be URL+UUID, so that the
137 // HGAssetService dispatches it to the remote grid.
138 // It's not pretty, but the best that can be done while
139 // not having a global naming infrastructure
140 AssetBase asset1 = new AssetBase(asset.FullID, asset.Name, asset.Type, asset.Metadata.CreatorID);
141 Copy(asset, asset1);
142 asset1.ID = url + asset.ID;
143
144 AdjustIdentifiers(asset1.Metadata);
145 if (asset1.Metadata.Type == (sbyte)AssetType.Object)
146 asset1.Data = AdjustIdentifiers(asset.Data);
156 else 147 else
157 m_log.Warn("[HG ASSET MAPPER]: Tried to post asset to remote server, but asset not in local cache."); 148 asset1.Data = asset.Data;
158 149
159 return false; 150 string id = m_scene.AssetService.Store(asset1);
151 if (String.IsNullOrEmpty(id))
152 {
153 m_log.DebugFormat("[HG ASSET MAPPER]: Asset server {0} did not accept {1}", url, asset.ID);
154 return false;
155 }
156 else {
157 m_log.DebugFormat("[HG ASSET MAPPER]: Posted copy of asset {0} from local asset server to {1}", asset1.ID, url);
158 return true;
159 }
160 } 160 }
161 161
162 private void Copy(AssetBase from, AssetBase to) 162 private void Copy(AssetBase from, AssetBase to)
@@ -190,49 +190,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
190 return Utils.StringToBytes(RewriteSOP(xml)); 190 return Utils.StringToBytes(RewriteSOP(xml));
191 } 191 }
192 192
193 protected string RewriteSOP(string xml) 193 protected string RewriteSOP(string xmlData)
194 { 194 {
195 XmlDocument doc = new XmlDocument(); 195// Console.WriteLine("Input XML [{0}]", xmlData);
196 doc.LoadXml(xml); 196 return ExternalRepresentationUtils.RewriteSOP(xmlData, m_scene.Name, m_HomeURI, m_scene.UserAccountService, m_scene.RegionInfo.ScopeID);
197 XmlNodeList sops = doc.GetElementsByTagName("SceneObjectPart");
198
199 foreach (XmlNode sop in sops)
200 {
201 UserAccount creator = null;
202 bool hasCreatorData = false;
203 XmlNodeList nodes = sop.ChildNodes;
204 foreach (XmlNode node in nodes)
205 {
206 if (node.Name == "CreatorID")
207 {
208 UUID uuid = UUID.Zero;
209 UUID.TryParse(node.InnerText, out uuid);
210 creator = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, uuid);
211 }
212 if (node.Name == "CreatorData" && node.InnerText != null && node.InnerText != string.Empty)
213 hasCreatorData = true;
214
215 //if (node.Name == "OwnerID")
216 //{
217 // UserAccount owner = GetUser(node.InnerText);
218 // if (owner != null)
219 // node.InnerText = m_ProfileServiceURL + "/" + node.InnerText + "/" + owner.FirstName + " " + owner.LastName;
220 //}
221 }
222
223 if (!hasCreatorData && creator != null)
224 {
225 XmlElement creatorData = doc.CreateElement("CreatorData");
226 creatorData.InnerText = m_HomeURI + ";" + creator.FirstName + " " + creator.LastName;
227 sop.AppendChild(creatorData);
228 }
229 }
230
231 using (StringWriter wr = new StringWriter())
232 {
233 doc.Save(wr);
234 return wr.ToString();
235 }
236 197
237 } 198 }
238 199
@@ -260,12 +221,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
260 221
261 // The act of gathering UUIDs downloads some assets from the remote server 222 // The act of gathering UUIDs downloads some assets from the remote server
262 // but not all... 223 // but not all...
263 Dictionary<UUID, sbyte> ids = new Dictionary<UUID, sbyte>();
264 HGUuidGatherer uuidGatherer = new HGUuidGatherer(m_scene.AssetService, userAssetURL); 224 HGUuidGatherer uuidGatherer = new HGUuidGatherer(m_scene.AssetService, userAssetURL);
265 uuidGatherer.GatherAssetUuids(assetID, meta.Type, ids); 225 uuidGatherer.AddForInspection(assetID);
266 m_log.DebugFormat("[HG ASSET MAPPER]: Preparing to get {0} assets", ids.Count); 226 uuidGatherer.GatherAll();
227
228 m_log.DebugFormat("[HG ASSET MAPPER]: Preparing to get {0} assets", uuidGatherer.GatheredUuids.Count);
267 bool success = true; 229 bool success = true;
268 foreach (UUID uuid in ids.Keys) 230 foreach (UUID uuid in uuidGatherer.GatheredUuids.Keys)
269 if (FetchAsset(userAssetURL, uuid) == null) 231 if (FetchAsset(userAssetURL, uuid) == null)
270 success = false; 232 success = false;
271 233
@@ -276,39 +238,92 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
276 m_log.DebugFormat("[HG ASSET MAPPER]: Successfully got item {0} from asset server {1}", assetID, userAssetURL); 238 m_log.DebugFormat("[HG ASSET MAPPER]: Successfully got item {0} from asset server {1}", assetID, userAssetURL);
277 } 239 }
278 240
279
280 public void Post(UUID assetID, UUID ownerID, string userAssetURL) 241 public void Post(UUID assetID, UUID ownerID, string userAssetURL)
281 { 242 {
282 // Post the item from the local AssetCache onto the remote asset server 243 m_log.DebugFormat("[HG ASSET MAPPER]: Starting to send asset {0} with children to asset server {1}", assetID, userAssetURL);
283 // and place an entry in m_assetMap 244
245 // Find all the embedded assets
284 246
285 m_log.Debug("[HG ASSET MAPPER]: Posting object " + assetID + " to asset server " + userAssetURL);
286 AssetBase asset = m_scene.AssetService.Get(assetID.ToString()); 247 AssetBase asset = m_scene.AssetService.Get(assetID.ToString());
287 if (asset != null) 248 if (asset == null)
249 {
250 m_log.DebugFormat("[HG ASSET MAPPER]: Something wrong with asset {0}, it could not be found", assetID);
251 return;
252 }
253
254 HGUuidGatherer uuidGatherer = new HGUuidGatherer(m_scene.AssetService, string.Empty);
255 uuidGatherer.AddForInspection(asset.FullID);
256 uuidGatherer.GatherAll();
257
258 // Check which assets already exist in the destination server
259
260 string url = userAssetURL;
261 if (!url.EndsWith("/") && !url.EndsWith("="))
262 url = url + "/";
263
264 string[] remoteAssetIDs = new string[uuidGatherer.GatheredUuids.Count];
265 int i = 0;
266 foreach (UUID id in uuidGatherer.GatheredUuids.Keys)
267 remoteAssetIDs[i++] = url + id.ToString();
268
269 bool[] exist = m_scene.AssetService.AssetsExist(remoteAssetIDs);
270
271 var existSet = new HashSet<string>();
272 i = 0;
273 foreach (UUID id in uuidGatherer.GatheredUuids.Keys)
274 {
275 if (exist[i])
276 existSet.Add(id.ToString());
277 ++i;
278 }
279
280 // Send only those assets which don't already exist in the destination server
281
282 bool success = true;
283
284 foreach (UUID uuid in uuidGatherer.GatheredUuids.Keys)
288 { 285 {
289 Dictionary<UUID, sbyte> ids = new Dictionary<UUID, sbyte>(); 286 if (!existSet.Contains(uuid.ToString()))
290 HGUuidGatherer uuidGatherer = new HGUuidGatherer(m_scene.AssetService, string.Empty);
291 uuidGatherer.GatherAssetUuids(asset.FullID, asset.Type, ids);
292 bool success = false;
293 foreach (UUID uuid in ids.Keys)
294 { 287 {
295 asset = m_scene.AssetService.Get(uuid.ToString()); 288 asset = m_scene.AssetService.Get(uuid.ToString());
296 if (asset == null) 289 if (asset == null)
290 {
297 m_log.DebugFormat("[HG ASSET MAPPER]: Could not find asset {0}", uuid); 291 m_log.DebugFormat("[HG ASSET MAPPER]: Could not find asset {0}", uuid);
292 }
298 else 293 else
299 success = PostAsset(userAssetURL, asset); 294 {
295 try
296 {
297 success &= PostAsset(userAssetURL, asset);
298 }
299 catch (Exception e)
300 {
301 m_log.Error(
302 string.Format(
303 "[HG ASSET MAPPER]: Failed to post asset {0} (type {1}, length {2}) referenced from {3} to {4} with exception ",
304 asset.ID, asset.Type, asset.Data.Length, assetID, userAssetURL),
305 e);
306
307 // For debugging purposes for now we will continue to throw the exception up the stack as was already happening. However, after
308 // debugging we may want to simply report the failure if we can tell this is due to a failure
309 // with a particular asset and not a destination network failure where all asset posts will fail (and
310 // generate large amounts of log spam).
311 throw e;
312 }
313 }
300 } 314 }
301
302 // maybe all pieces got there...
303 if (!success)
304 m_log.DebugFormat("[HG ASSET MAPPER]: Problems posting item {0} to asset server {1}", assetID, userAssetURL);
305 else 315 else
306 m_log.DebugFormat("[HG ASSET MAPPER]: Successfully posted item {0} to asset server {1}", assetID, userAssetURL); 316 {
307 317 m_log.DebugFormat(
318 "[HG ASSET MAPPER]: Didn't post asset {0} referenced from {1} because it already exists in asset server {2}",
319 uuid, assetID, userAssetURL);
320 }
308 } 321 }
309 else
310 m_log.DebugFormat("[HG ASSET MAPPER]: Something wrong with asset {0}, it could not be found", assetID);
311 322
323 if (!success)
324 m_log.DebugFormat("[HG ASSET MAPPER]: Problems sending asset {0} with children to asset server {1}", assetID, userAssetURL);
325 else
326 m_log.DebugFormat("[HG ASSET MAPPER]: Successfully sent asset {0} with children to asset server {1}", assetID, userAssetURL);
312 } 327 }
313 328
314 #endregion 329 #endregion
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
index ce7ed26..582b267 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
@@ -64,6 +64,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
64 64
65 private bool m_bypassPermissions = true; 65 private bool m_bypassPermissions = true;
66 66
67 // This simple check makes it possible to support grids in which all the simulators
68 // share all central services of the Robust server EXCEPT assets. In other words,
69 // grids where the simulators' assets are kept in one DB and the users' inventory assets
70 // are kept on another. When users rez items from inventory or take objects from world,
71 // an HG-like asset copy takes place between the 2 servers, the world asset server and
72 // the user's asset server.
73 private bool m_CheckSeparateAssets = false;
74 private string m_LocalAssetsURL = string.Empty;
75
67// private bool m_Initialized = false; 76// private bool m_Initialized = false;
68 77
69 #region INonSharedRegionModule 78 #region INonSharedRegionModule
@@ -99,6 +108,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
99 108
100 m_OutboundPermission = thisModuleConfig.GetBoolean("OutboundPermission", true); 109 m_OutboundPermission = thisModuleConfig.GetBoolean("OutboundPermission", true);
101 m_RestrictInventoryAccessAbroad = thisModuleConfig.GetBoolean("RestrictInventoryAccessAbroad", true); 110 m_RestrictInventoryAccessAbroad = thisModuleConfig.GetBoolean("RestrictInventoryAccessAbroad", true);
111 m_CheckSeparateAssets = thisModuleConfig.GetBoolean("CheckSeparateAssets", false);
112 m_LocalAssetsURL = thisModuleConfig.GetString("RegionHGAssetServerURI", string.Empty);
113 m_LocalAssetsURL = m_LocalAssetsURL.Trim(new char[] { '/' });
114
102 } 115 }
103 else 116 else
104 m_log.Warn("[HG INVENTORY ACCESS MODULE]: HGInventoryAccessModule configs not found. ProfileServerURI not set!"); 117 m_log.Warn("[HG INVENTORY ACCESS MODULE]: HGInventoryAccessModule configs not found. ProfileServerURI not set!");
@@ -117,7 +130,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
117 130
118 base.AddRegion(scene); 131 base.AddRegion(scene);
119 m_assMapper = new HGAssetMapper(scene, m_HomeURI); 132 m_assMapper = new HGAssetMapper(scene, m_HomeURI);
120 scene.EventManager.OnNewInventoryItemUploadComplete += UploadInventoryItem; 133 scene.EventManager.OnNewInventoryItemUploadComplete += PostInventoryAsset;
121 scene.EventManager.OnTeleportStart += TeleportStart; 134 scene.EventManager.OnTeleportStart += TeleportStart;
122 scene.EventManager.OnTeleportFail += TeleportFail; 135 scene.EventManager.OnTeleportFail += TeleportFail;
123 136
@@ -196,7 +209,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
196 } 209 }
197 } 210 }
198 211
199 public void UploadInventoryItem(UUID avatarID, AssetType type, UUID assetID, string name, int userlevel) 212 public void PostInventoryAsset(UUID avatarID, AssetType type, UUID assetID, string name, int userlevel)
200 { 213 {
201 if (type == AssetType.Link) 214 if (type == AssetType.Link)
202 return; 215 return;
@@ -235,18 +248,32 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
235 { 248 {
236 UUID newAssetID = base.CapsUpdateInventoryItemAsset(remoteClient, itemID, data); 249 UUID newAssetID = base.CapsUpdateInventoryItemAsset(remoteClient, itemID, data);
237 250
238 UploadInventoryItem(remoteClient.AgentId, AssetType.Unknown, newAssetID, "", 0); 251 PostInventoryAsset(remoteClient.AgentId, AssetType.Unknown, newAssetID, "", 0);
239 252
240 return newAssetID; 253 return newAssetID;
241 } 254 }
242 255
256 ///
257 /// UpdateInventoryItemAsset
258 ///
259 public override bool UpdateInventoryItemAsset(UUID ownerID, InventoryItemBase item, AssetBase asset)
260 {
261 if (base.UpdateInventoryItemAsset(ownerID, item, asset))
262 {
263 PostInventoryAsset(ownerID, (AssetType)asset.Type, asset.FullID, asset.Name, 0);
264 return true;
265 }
266
267 return false;
268 }
269
243 /// 270 ///
244 /// Used in DeleteToInventory 271 /// Used in DeleteToInventory
245 /// 272 ///
246 protected override void ExportAsset(UUID agentID, UUID assetID) 273 protected override void ExportAsset(UUID agentID, UUID assetID)
247 { 274 {
248 if (!assetID.Equals(UUID.Zero)) 275 if (!assetID.Equals(UUID.Zero))
249 UploadInventoryItem(agentID, AssetType.Unknown, assetID, "", 0); 276 PostInventoryAsset(agentID, AssetType.Unknown, assetID, "", 0);
250 else 277 else
251 m_log.Debug("[HGScene]: Scene.Inventory did not create asset"); 278 m_log.Debug("[HGScene]: Scene.Inventory did not create asset");
252 } 279 }
@@ -284,50 +311,98 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
284 SceneObjectGroup sog = base.RezObject(remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, 311 SceneObjectGroup sog = base.RezObject(remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection,
285 RezSelected, RemoveItem, fromTaskID, attachment); 312 RezSelected, RemoveItem, fromTaskID, attachment);
286 313
287 if (sog == null)
288 remoteClient.SendAgentAlertMessage("Unable to rez: problem accessing inventory or locating assets", false);
289
290 return sog; 314 return sog;
291 315
292 } 316 }
293 317
294 public override void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver) 318 public override void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver)
295 { 319 {
296 string userAssetServer = string.Empty; 320 string senderAssetServer = string.Empty;
297 if (IsForeignUser(sender, out userAssetServer) && userAssetServer != string.Empty) 321 string receiverAssetServer = string.Empty;
298 m_assMapper.Get(item.AssetID, sender, userAssetServer); 322 bool isForeignSender, isForeignReceiver;
323 isForeignSender = IsForeignUser(sender, out senderAssetServer);
324 isForeignReceiver = IsForeignUser(receiver, out receiverAssetServer);
325
326 // They're both local. Nothing to do.
327 if (!isForeignSender && !isForeignReceiver)
328 return;
299 329
300 if (IsForeignUser(receiver, out userAssetServer) && userAssetServer != string.Empty && m_OutboundPermission) 330 // At least one of them is foreign.
301 m_assMapper.Post(item.AssetID, receiver, userAssetServer); 331 // If both users have the same asset server, no need to transfer the asset
332 if (senderAssetServer.Equals(receiverAssetServer))
333 {
334 m_log.DebugFormat("[HGScene]: Asset transfer between foreign users, but they have the same server. No transfer.");
335 return;
336 }
337
338 if (isForeignSender && senderAssetServer != string.Empty)
339 m_assMapper.Get(item.AssetID, sender, senderAssetServer);
340
341 if (isForeignReceiver && receiverAssetServer != string.Empty && m_OutboundPermission)
342 m_assMapper.Post(item.AssetID, receiver, receiverAssetServer);
302 } 343 }
303 344
304 public override bool IsForeignUser(UUID userID, out string assetServerURL) 345 public override bool IsForeignUser(UUID userID, out string assetServerURL)
305 { 346 {
306 assetServerURL = string.Empty; 347 assetServerURL = string.Empty;
307 348
308 if (UserManagementModule != null && !UserManagementModule.IsLocalGridUser(userID)) 349 if (UserManagementModule != null)
309 { // foreign 350 {
310 ScenePresence sp = null; 351 if (!m_CheckSeparateAssets)
311 if (m_Scene.TryGetScenePresence(userID, out sp))
312 { 352 {
313 AgentCircuitData aCircuit = m_Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); 353 if (!UserManagementModule.IsLocalGridUser(userID))
314 if (aCircuit != null && aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI")) 354 { // foreign
315 { 355 ScenePresence sp = null;
316 assetServerURL = aCircuit.ServiceURLs["AssetServerURI"].ToString(); 356 if (m_Scene.TryGetScenePresence(userID, out sp))
317 assetServerURL = assetServerURL.Trim(new char[] { '/' }); 357 {
358 AgentCircuitData aCircuit = m_Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
359 if (aCircuit != null && aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI"))
360 {
361 assetServerURL = aCircuit.ServiceURLs["AssetServerURI"].ToString();
362 assetServerURL = assetServerURL.Trim(new char[] { '/' });
363 }
364 }
365 else
366 {
367 assetServerURL = UserManagementModule.GetUserServerURL(userID, "AssetServerURI");
368 assetServerURL = assetServerURL.Trim(new char[] { '/' });
369 }
370 return true;
318 } 371 }
319 } 372 }
320 else 373 else
321 { 374 {
322 assetServerURL = UserManagementModule.GetUserServerURL(userID, "AssetServerURI"); 375 if (IsLocalInventoryAssetsUser(userID, out assetServerURL))
323 assetServerURL = assetServerURL.Trim(new char[] { '/' }); 376 {
377 m_log.DebugFormat("[HGScene]: user {0} has local assets {1}", userID, assetServerURL);
378 return false;
379 }
380 else
381 {
382 m_log.DebugFormat("[HGScene]: user {0} has foreign assets {1}", userID, assetServerURL);
383 return true;
384 }
324 } 385 }
325 return true;
326 } 386 }
327
328 return false; 387 return false;
329 } 388 }
330 389
390 private bool IsLocalInventoryAssetsUser(UUID uuid, out string assetsURL)
391 {
392 assetsURL = UserManagementModule.GetUserServerURL(uuid, "AssetServerURI");
393 if (assetsURL == string.Empty)
394 {
395 AgentCircuitData agent = m_Scene.AuthenticateHandler.GetAgentCircuitData(uuid);
396 if (agent != null)
397 {
398 assetsURL = agent.ServiceURLs["AssetServerURI"].ToString();
399 assetsURL = assetsURL.Trim(new char[] { '/' });
400 }
401 }
402 return m_LocalAssetsURL.Equals(assetsURL);
403 }
404
405
331 protected override InventoryItemBase GetItem(UUID agentID, UUID itemID) 406 protected override InventoryItemBase GetItem(UUID agentID, UUID itemID)
332 { 407 {
333 InventoryItemBase item = base.GetItem(agentID, itemID); 408 InventoryItemBase item = base.GetItem(agentID, itemID);
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 15718d2..dff9126 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -207,7 +207,17 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
207 { 207 {
208 byte[] data = null; 208 byte[] data = null;
209 209
210<<<<<<< HEAD
211 AssetBase asset = m_Scene.CreateAsset(name, description, assetType, data, remoteClient.AgentId);
212 m_Scene.AssetService.Store(asset);
213 m_Scene.CreateNewInventoryItem(
214 remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID,
215 name, description, 0, callbackID, asset.FullID, asset.Type, invType, nextOwnerMask, creationDate);
216 }
217 else
218=======
210 if (invType == (sbyte)InventoryType.Landmark && presence != null) 219 if (invType == (sbyte)InventoryType.Landmark && presence != null)
220>>>>>>> avn/ubitvar
211 { 221 {
212 string suffix = string.Empty, prefix = string.Empty; 222 string suffix = string.Empty, prefix = string.Empty;
213 string strdata = GenerateLandmark(presence, out prefix, out suffix); 223 string strdata = GenerateLandmark(presence, out prefix, out suffix);
@@ -312,7 +322,34 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
312 322
313 return UUID.Zero; 323 return UUID.Zero;
314 } 324 }
315 325
326 public virtual bool UpdateInventoryItemAsset(UUID ownerID, InventoryItemBase item, AssetBase asset)
327 {
328 if (item != null && item.Owner == ownerID && asset != null)
329 {
330// m_log.DebugFormat(
331// "[INVENTORY ACCESS MODULE]: Updating item {0} {1} with new asset {2}",
332// item.Name, item.ID, asset.ID);
333
334 item.AssetID = asset.FullID;
335 item.Description = asset.Description;
336 item.Name = asset.Name;
337 item.AssetType = asset.Type;
338 item.InvType = (int)InventoryType.Object;
339
340 m_Scene.AssetService.Store(asset);
341 m_Scene.InventoryService.UpdateItem(item);
342
343 return true;
344 }
345 else
346 {
347 m_log.ErrorFormat("[INVENTORY ACCESS MODULE]: Given invalid item for inventory update: {0}",
348 (item == null || asset == null? "null item or asset" : "wrong owner"));
349 return false;
350 }
351 }
352
316 public virtual List<InventoryItemBase> CopyToInventory( 353 public virtual List<InventoryItemBase> CopyToInventory(
317 DeRezAction action, UUID folderID, 354 DeRezAction action, UUID folderID,
318 List<SceneObjectGroup> objectGroups, IClientAPI remoteClient, bool asAttachment) 355 List<SceneObjectGroup> objectGroups, IClientAPI remoteClient, bool asAttachment)
@@ -377,10 +414,32 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
377 // this possible is not needed if keyframes are saved 414 // this possible is not needed if keyframes are saved
378 Dictionary<UUID, KeyframeMotion> originalKeyframes = new Dictionary<UUID, KeyframeMotion>(); 415 Dictionary<UUID, KeyframeMotion> originalKeyframes = new Dictionary<UUID, KeyframeMotion>();
379 416
417 Dictionary<SceneObjectGroup, KeyframeMotion> group2Keyframe = new Dictionary<SceneObjectGroup, KeyframeMotion>();
418
380 foreach (SceneObjectGroup objectGroup in objlist) 419 foreach (SceneObjectGroup objectGroup in objlist)
381 { 420 {
382 if (objectGroup.RootPart.KeyframeMotion != null) 421 if (objectGroup.RootPart.KeyframeMotion != null)
383 { 422 {
423<<<<<<< HEAD
424 objectGroup.RootPart.KeyframeMotion.Pause();
425 group2Keyframe.Add(objectGroup, objectGroup.RootPart.KeyframeMotion);
426 objectGroup.RootPart.KeyframeMotion = null;
427 }
428
429// Vector3 inventoryStoredPosition = new Vector3
430// (((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize)
431// ? 250
432// : objectGroup.AbsolutePosition.X)
433// ,
434// (objectGroup.AbsolutePosition.Y > (int)Constants.RegionSize)
435// ? 250
436// : objectGroup.AbsolutePosition.Y,
437// objectGroup.AbsolutePosition.Z);
438//
439// originalPositions[objectGroup.UUID] = objectGroup.AbsolutePosition;
440//
441// objectGroup.AbsolutePosition = inventoryStoredPosition;
442=======
384 objectGroup.RootPart.KeyframeMotion.Suspend(); 443 objectGroup.RootPart.KeyframeMotion.Suspend();
385 } 444 }
386 objectGroup.RootPart.SetForce(Vector3.Zero); 445 objectGroup.RootPart.SetForce(Vector3.Zero);
@@ -421,6 +480,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
421 480
422 objectGroup.AbsolutePosition = inventoryStoredPosition; 481 objectGroup.AbsolutePosition = inventoryStoredPosition;
423 objectGroup.RootPart.RotationOffset = inventoryStoredRotation; 482 objectGroup.RootPart.RotationOffset = inventoryStoredRotation;
483>>>>>>> avn/ubitvar
424 484
425 // Make sure all bits but the ones we want are clear 485 // Make sure all bits but the ones we want are clear
426 // on take. 486 // on take.
@@ -534,6 +594,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
534 } 594 }
535 } 595 }
536 596
597 // Restore KeyframeMotion
598 foreach (SceneObjectGroup objectGroup in group2Keyframe.Keys)
599 {
600 objectGroup.RootPart.KeyframeMotion = group2Keyframe[objectGroup];
601 objectGroup.RootPart.KeyframeMotion.Start();
602 }
603
537 // This is a hook to do some per-asset post-processing for subclasses that need that 604 // This is a hook to do some per-asset post-processing for subclasses that need that
538 if (remoteClient != null) 605 if (remoteClient != null)
539 ExportAsset(remoteClient.AgentId, asset.FullID); 606 ExportAsset(remoteClient.AgentId, asset.FullID);
@@ -576,6 +643,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
576 643
577 if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) 644 if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions())
578 { 645 {
646 // Changing ownership, so apply the "Next Owner" permissions to all of the
647 // inventory item's permissions.
648
579 uint perms = effectivePerms; 649 uint perms = effectivePerms;
580 PermissionsUtil.ApplyFoldedPermissions(effectivePerms, ref perms); 650 PermissionsUtil.ApplyFoldedPermissions(effectivePerms, ref perms);
581 651
@@ -590,6 +660,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
590 } 660 }
591 else 661 else
592 { 662 {
663 // Not changing ownership.
664 // In this case we apply the permissions in the object's items ONLY to the inventory
665 // item's "Next Owner" permissions, but NOT to its "Current", "Base", etc. permissions.
666 // E.g., if the object contains a No-Transfer item then the item's "Next Owner"
667 // permissions are also No-Transfer.
668 PermissionsUtil.ApplyFoldedPermissions(effectivePerms, ref allObjectsNextOwnerPerms);
669
593 item.BasePermissions = effectivePerms; 670 item.BasePermissions = effectivePerms;
594 item.CurrentPermissions = effectivePerms; 671 item.CurrentPermissions = effectivePerms;
595 item.NextPermissions = so.RootPart.NextOwnerMask & effectivePerms; 672 item.NextPermissions = so.RootPart.NextOwnerMask & effectivePerms;
@@ -621,6 +698,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
621 protected InventoryItemBase CreateItemForObject( 698 protected InventoryItemBase CreateItemForObject(
622 DeRezAction action, IClientAPI remoteClient, SceneObjectGroup so, UUID folderID) 699 DeRezAction action, IClientAPI remoteClient, SceneObjectGroup so, UUID folderID)
623 { 700 {
701// m_log.DebugFormat(
702// "[BASIC INVENTORY ACCESS MODULE]: Creating item for object {0} {1} for folder {2}, action {3}",
703// so.Name, so.UUID, folderID, action);
704//
624 // Get the user info of the item destination 705 // Get the user info of the item destination
625 // 706 //
626 UUID userID = UUID.Zero; 707 UUID userID = UUID.Zero;
@@ -698,18 +779,18 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
698 if (remoteClient == null || 779 if (remoteClient == null ||
699 so.OwnerID != remoteClient.AgentId) 780 so.OwnerID != remoteClient.AgentId)
700 { 781 {
701 folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); 782 folder = m_Scene.InventoryService.GetFolderForType(userID, FolderType.LostAndFound);
702 } 783 }
703 else 784 else
704 { 785 {
705 folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); 786 folder = m_Scene.InventoryService.GetFolderForType(userID, FolderType.Trash);
706 } 787 }
707 } 788 }
708 else if (action == DeRezAction.Return) 789 else if (action == DeRezAction.Return)
709 { 790 {
710 // Dump to lost + found unconditionally 791 // Dump to lost + found unconditionally
711 // 792 //
712 folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); 793 folder = m_Scene.InventoryService.GetFolderForType(userID, FolderType.LostAndFound);
713 } 794 }
714 795
715 if (folderID == UUID.Zero && folder == null) 796 if (folderID == UUID.Zero && folder == null)
@@ -718,7 +799,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
718 { 799 {
719 // Deletes go to trash by default 800 // Deletes go to trash by default
720 // 801 //
721 folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); 802 folder = m_Scene.InventoryService.GetFolderForType(userID, FolderType.Trash);
722 } 803 }
723 else 804 else
724 { 805 {
@@ -726,14 +807,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
726 { 807 {
727 // Taking copy of another person's item. Take to 808 // Taking copy of another person's item. Take to
728 // Objects folder. 809 // Objects folder.
729 folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.Object); 810 folder = m_Scene.InventoryService.GetFolderForType(userID, FolderType.Object);
730 so.FromFolderID = UUID.Zero; 811 so.FromFolderID = UUID.Zero;
731 } 812 }
732 else 813 else
733 { 814 {
734 // Catch all. Use lost & found 815 // Catch all. Use lost & found
735 // 816 //
736 folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); 817 folder = m_Scene.InventoryService.GetFolderForType(userID, FolderType.LostAndFound);
737 } 818 }
738 } 819 }
739 } 820 }
@@ -752,7 +833,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
752 if(folder.Type == 14 || folder.Type == 16) 833 if(folder.Type == 14 || folder.Type == 16)
753 { 834 {
754 // folder.Type = 6; 835 // folder.Type = 6;
755 folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.Object); 836 folder = m_Scene.InventoryService.GetFolderForType(userID, FolderType.Object);
756 } 837 }
757 } 838 }
758 } 839 }
@@ -804,7 +885,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
804 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, 885 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
805 bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) 886 bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment)
806 { 887 {
807 AssetBase rezAsset = m_Scene.AssetService.Get(assetID.ToString()); 888 AssetBase rezAsset = m_Scene.AssetService.Get(assetID.ToString());
808 889
809 if (rezAsset == null) 890 if (rezAsset == null)
810 { 891 {
@@ -813,12 +894,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
813 m_log.WarnFormat( 894 m_log.WarnFormat(
814 "[InventoryAccessModule]: Could not find asset {0} for item {1} {2} for {3} in RezObject()", 895 "[InventoryAccessModule]: Could not find asset {0} for item {1} {2} for {3} in RezObject()",
815 assetID, item.Name, item.ID, remoteClient.Name); 896 assetID, item.Name, item.ID, remoteClient.Name);
897 remoteClient.SendAgentAlertMessage(string.Format("Unable to rez: could not find asset {0} for item {1}.", assetID, item.Name), false);
816 } 898 }
817 else 899 else
818 { 900 {
819 m_log.WarnFormat( 901 m_log.WarnFormat(
820 "[INVENTORY ACCESS MODULE]: Could not find asset {0} for {1} in RezObject()", 902 "[INVENTORY ACCESS MODULE]: Could not find asset {0} for {1} in RezObject()",
821 assetID, remoteClient.Name); 903 assetID, remoteClient.Name);
904 remoteClient.SendAgentAlertMessage(string.Format("Unable to rez: could not find asset {0}.", assetID), false);
822 } 905 }
823 906
824 return null; 907 return null;
@@ -833,7 +916,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
833 byte bRayEndIsIntersection = (byte)(RayEndIsIntersection ? 1 : 0); 916 byte bRayEndIsIntersection = (byte)(RayEndIsIntersection ? 1 : 0);
834 Vector3 pos; 917 Vector3 pos;
835 918
836 bool single = m_Scene.GetObjectsToRez(rezAsset.Data, attachment, out objlist, out veclist, out bbox, out offsetHeight); 919 bool single
920 = m_Scene.GetObjectsToRez(
921 rezAsset.Data, attachment, out objlist, out veclist, out bbox, out offsetHeight);
837 922
838 if (single) 923 if (single)
839 { 924 {
@@ -937,7 +1022,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
937 // one full update during the attachment 1022 // one full update during the attachment
938 // process causes some clients to fail to display the 1023 // process causes some clients to fail to display the
939 // attachment properly. 1024 // attachment properly.
940 m_Scene.AddNewSceneObject(group, true, false); 1025 m_Scene.AddNewSceneObject(group, !attachment, false);
941 1026
942 // if attachment we set it's asset id so object updates 1027 // if attachment we set it's asset id so object updates
943 // can reflect that, if not, we set it's position in world. 1028 // can reflect that, if not, we set it's position in world.
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/HGAssetMapperTests.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/HGAssetMapperTests.cs
new file mode 100644
index 0000000..007ff63
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/HGAssetMapperTests.cs
@@ -0,0 +1,146 @@
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
28using System;
29using System.Threading;
30using System.Xml;
31using Nini.Config;
32using NUnit.Framework;
33using OpenMetaverse;
34using OpenSim.Framework;
35using OpenSim.Region.CoreModules.Framework.InventoryAccess;
36using OpenSim.Region.Framework.Scenes;
37using OpenSim.Region.ScriptEngine.XEngine;
38using OpenSim.Services.Interfaces;
39using OpenSim.Tests.Common;
40
41namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
42{
43 [TestFixture]
44 public class HGAssetMapperTests : OpenSimTestCase
45 {
46 [Test]
47 public void TestPostAssetRewrite()
48 {
49 TestHelpers.InMethod();
50// TestHelpers.EnableLogging();
51
52 XEngine xengine = new OpenSim.Region.ScriptEngine.XEngine.XEngine();
53 xengine.DebugLevel = 1;
54
55 IniConfigSource configSource = new IniConfigSource();
56
57 IConfig startupConfig = configSource.AddConfig("Startup");
58 startupConfig.Set("DefaultScriptEngine", "XEngine");
59
60 IConfig xEngineConfig = configSource.AddConfig("XEngine");
61 xEngineConfig.Set("Enabled", "true");
62 xEngineConfig.Set("StartDelay", "0");
63 xEngineConfig.Set("AppDomainLoading", "false");
64
65 string homeUrl = "http://hg.HomeTestPostAssetRewriteGrid.com";
66 string foreignUrl = "http://hg.ForeignTestPostAssetRewriteGrid.com";
67 int soIdTail = 0x1;
68 UUID assetId = TestHelpers.ParseTail(0x10);
69 UUID userId = TestHelpers.ParseTail(0x100);
70 UUID sceneId = TestHelpers.ParseTail(0x1000);
71 string userFirstName = "TestPostAsset";
72 string userLastName = "Rewrite";
73 int soPartsCount = 3;
74
75 Scene scene = new SceneHelpers().SetupScene("TestPostAssetRewriteScene", sceneId, 1000, 1000, configSource);
76 SceneHelpers.SetupSceneModules(scene, configSource, xengine);
77 scene.StartScripts();
78
79 HGAssetMapper hgam = new HGAssetMapper(scene, homeUrl);
80 UserAccount ua
81 = UserAccountHelpers.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "password");
82
83 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, soPartsCount, ua.PrincipalID, "part", soIdTail);
84 RezScript(
85 scene, so.UUID, "default { state_entry() { llSay(0, \"Hello World\"); } }", "item1", ua.PrincipalID);
86
87 AssetBase asset = AssetHelpers.CreateAsset(assetId, so);
88 asset.CreatorID = foreignUrl;
89 hgam.PostAsset(foreignUrl, asset);
90
91 // Check transformed asset.
92 AssetBase ncAssetGet = scene.AssetService.Get(assetId.ToString());
93 Assert.AreEqual(foreignUrl, ncAssetGet.CreatorID);
94 string xmlData = Utils.BytesToString(ncAssetGet.Data);
95 XmlDocument ncAssetGetXmlDoc = new XmlDocument();
96 ncAssetGetXmlDoc.LoadXml(xmlData);
97
98// Console.WriteLine(ncAssetGetXmlDoc.OuterXml);
99
100 XmlNodeList creatorDataNodes = ncAssetGetXmlDoc.GetElementsByTagName("CreatorData");
101
102 Assert.AreEqual(soPartsCount, creatorDataNodes.Count);
103 //Console.WriteLine("creatorDataNodes {0}", creatorDataNodes.Count);
104
105 foreach (XmlNode creatorDataNode in creatorDataNodes)
106 {
107 Assert.AreEqual(
108 string.Format("{0};{1} {2}", homeUrl, ua.FirstName, ua.LastName), creatorDataNode.InnerText);
109 }
110
111 // Check that saved script nodes have attributes
112 XmlNodeList savedScriptStateNodes = ncAssetGetXmlDoc.GetElementsByTagName("SavedScriptState");
113
114 Assert.AreEqual(1, savedScriptStateNodes.Count);
115 Assert.AreEqual(1, savedScriptStateNodes[0].Attributes.Count);
116 XmlNode uuidAttribute = savedScriptStateNodes[0].Attributes.GetNamedItem("UUID");
117 Assert.NotNull(uuidAttribute);
118 // XXX: To check the actual UUID attribute we would have to do some work to retreive the UUID of the task
119 // item created earlier.
120 }
121
122 private void RezScript(Scene scene, UUID soId, string script, string itemName, UUID userId)
123 {
124 InventoryItemBase itemTemplate = new InventoryItemBase();
125 // itemTemplate.ID = itemId;
126 itemTemplate.Name = itemName;
127 itemTemplate.Folder = soId;
128 itemTemplate.InvType = (int)InventoryType.LSL;
129
130 // XXX: Ultimately it would be better to be able to directly manipulate the script engine to rez a script
131 // immediately for tests rather than chunter through it's threaded mechanisms.
132 AutoResetEvent chatEvent = new AutoResetEvent(false);
133
134 scene.EventManager.OnChatFromWorld += (s, c) =>
135 {
136// Console.WriteLine("Got chat [{0}]", c.Message);
137 chatEvent.Set();
138 };
139
140 scene.RezNewScript(userId, itemTemplate, script);
141
142// Console.WriteLine("HERE");
143 Assert.IsTrue(chatEvent.WaitOne(60000), "Chat event in HGAssetMapperTests.RezScript not received");
144 }
145 }
146} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs
index ad1a0e1..c64ab44 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs
@@ -44,7 +44,6 @@ using OpenSim.Region.Framework.Scenes;
44using OpenSim.Region.Framework.Scenes.Serialization; 44using OpenSim.Region.Framework.Scenes.Serialization;
45using OpenSim.Services.Interfaces; 45using OpenSim.Services.Interfaces;
46using OpenSim.Tests.Common; 46using OpenSim.Tests.Common;
47using OpenSim.Tests.Common.Mock;
48 47
49namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests 48namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
50{ 49{
@@ -111,6 +110,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
111 InventoryFolderBase objsFolder 110 InventoryFolderBase objsFolder
112 = InventoryArchiveUtils.FindFoldersByPath(m_scene.InventoryService, m_userId, "Objects")[0]; 111 = InventoryArchiveUtils.FindFoldersByPath(m_scene.InventoryService, m_userId, "Objects")[0];
113 item1.Folder = objsFolder.ID; 112 item1.Folder = objsFolder.ID;
113 item1.Flags |= (uint)InventoryItemFlags.ObjectHasMultipleItems;
114 m_scene.AddInventoryItem(item1); 114 m_scene.AddInventoryItem(item1);
115 115
116 SceneObjectGroup so 116 SceneObjectGroup so
diff --git a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs
index 69d7e16..d10c9b4 100644
--- a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs
@@ -159,7 +159,7 @@ namespace OpenSim.Region.CoreModules.Framework.Library
159 } 159 }
160 160
161 RegionInfo regInfo = new RegionInfo(); 161 RegionInfo regInfo = new RegionInfo();
162 Scene m_MockScene = new Scene(regInfo); 162 Scene m_MockScene = new Scene(regInfo, null);
163 LocalInventoryService invService = new LocalInventoryService(lib); 163 LocalInventoryService invService = new LocalInventoryService(lib);
164 m_MockScene.RegisterModuleInterface<IInventoryService>(invService); 164 m_MockScene.RegisterModuleInterface<IInventoryService>(invService);
165 m_MockScene.RegisterModuleInterface<IAssetService>(m_Scene.AssetService); 165 m_MockScene.RegisterModuleInterface<IAssetService>(m_Scene.AssetService);
diff --git a/OpenSim/Region/CoreModules/Framework/Library/LocalInventoryService.cs b/OpenSim/Region/CoreModules/Framework/Library/LocalInventoryService.cs
index 49589fd..e1e1838 100644
--- a/OpenSim/Region/CoreModules/Framework/Library/LocalInventoryService.cs
+++ b/OpenSim/Region/CoreModules/Framework/Library/LocalInventoryService.cs
@@ -65,7 +65,7 @@ namespace OpenSim.Region.CoreModules.Framework.Library
65 { 65 {
66 InventoryFolderImpl folder = null; 66 InventoryFolderImpl folder = null;
67 InventoryCollection inv = new InventoryCollection(); 67 InventoryCollection inv = new InventoryCollection();
68 inv.UserID = m_Library.Owner; 68 inv.OwnerID = m_Library.Owner;
69 69
70 if (folderID != m_Library.ID) 70 if (folderID != m_Library.ID)
71 { 71 {
@@ -87,6 +87,34 @@ namespace OpenSim.Region.CoreModules.Framework.Library
87 return inv; 87 return inv;
88 } 88 }
89 89
90 public virtual InventoryCollection[] GetMultipleFoldersContent(UUID principalID, UUID[] folderIDs)
91 {
92 InventoryCollection[] invColl = new InventoryCollection[folderIDs.Length];
93 int i = 0;
94 foreach (UUID fid in folderIDs)
95 {
96 invColl[i++] = GetFolderContent(principalID, fid);
97 }
98
99 return invColl;
100 }
101
102 public virtual InventoryItemBase[] GetMultipleItems(UUID principalID, UUID[] itemIDs)
103 {
104 InventoryItemBase[] itemColl = new InventoryItemBase[itemIDs.Length];
105 int i = 0;
106 InventoryItemBase item = new InventoryItemBase();
107 item.Owner = principalID;
108 foreach (UUID fid in itemIDs)
109 {
110 item.ID = fid;
111 itemColl[i++] = GetItem(item);
112 }
113
114 return itemColl;
115 }
116
117
90 /// <summary> 118 /// <summary>
91 /// Add a new folder to the user's inventory 119 /// Add a new folder to the user's inventory
92 /// </summary> 120 /// </summary>
@@ -142,28 +170,12 @@ namespace OpenSim.Region.CoreModules.Framework.Library
142 public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) { return null; } 170 public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) { return null; }
143 171
144 /// <summary> 172 /// <summary>
145 /// Synchronous inventory fetch.
146 /// </summary>
147 /// <param name="userID"></param>
148 /// <returns></returns>
149 public InventoryCollection GetUserInventory(UUID userID) { return null; }
150
151 /// <summary>
152 /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the
153 /// inventory has been received
154 /// </summary>
155 /// <param name="userID"></param>
156 /// <param name="callback"></param>
157 public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) { }
158
159
160 /// <summary>
161 /// Gets the user folder for the given folder-type 173 /// Gets the user folder for the given folder-type
162 /// </summary> 174 /// </summary>
163 /// <param name="userID"></param> 175 /// <param name="userID"></param>
164 /// <param name="type"></param> 176 /// <param name="type"></param>
165 /// <returns></returns> 177 /// <returns></returns>
166 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) { return null; } 178 public InventoryFolderBase GetFolderForType(UUID userID, FolderType type) { return null; }
167 179
168 180
169 /// <summary> 181 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Framework/Search/BasicSearchModule.cs b/OpenSim/Region/CoreModules/Framework/Search/BasicSearchModule.cs
index 8838612..3849996 100644
--- a/OpenSim/Region/CoreModules/Framework/Search/BasicSearchModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/Search/BasicSearchModule.cs
@@ -150,6 +150,8 @@ namespace OpenSim.Region.CoreModules.Framework.Search
150 150
151 void OnDirFindQuery(IClientAPI remoteClient, UUID queryID, string queryText, uint queryFlags, int queryStart) 151 void OnDirFindQuery(IClientAPI remoteClient, UUID queryID, string queryText, uint queryFlags, int queryStart)
152 { 152 {
153 queryText = queryText.Trim();
154
153 if (((DirFindFlags)queryFlags & DirFindFlags.People) == DirFindFlags.People) 155 if (((DirFindFlags)queryFlags & DirFindFlags.People) == DirFindFlags.People)
154 { 156 {
155 if (string.IsNullOrEmpty(queryText)) 157 if (string.IsNullOrEmpty(queryText))
@@ -194,4 +196,4 @@ namespace OpenSim.Region.CoreModules.Framework.Search
194 196
195 } 197 }
196 198
197} \ No newline at end of file 199}
diff --git a/OpenSim/Region/CoreModules/Framework/ServiceThrottle/ServiceThrottleModule.cs b/OpenSim/Region/CoreModules/Framework/ServiceThrottle/ServiceThrottleModule.cs
index a70261e..3abacbd 100644
--- a/OpenSim/Region/CoreModules/Framework/ServiceThrottle/ServiceThrottleModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/ServiceThrottle/ServiceThrottleModule.cs
@@ -67,7 +67,7 @@ namespace OpenSim.Region.CoreModules.Framework
67 m_timer.Elapsed += ProcessQueue; 67 m_timer.Elapsed += ProcessQueue;
68 m_timer.Start(); 68 m_timer.Start();
69 69
70 //Watchdog.StartThread( 70 //WorkManager.StartThread(
71 // ProcessQueue, 71 // ProcessQueue,
72 // "GridServiceRequestThread", 72 // "GridServiceRequestThread",
73 // ThreadPriority.BelowNormal, 73 // ThreadPriority.BelowNormal,
diff --git a/OpenSim/Region/CoreModules/Framework/Statistics/Logging/LogWriter.cs b/OpenSim/Region/CoreModules/Framework/Statistics/Logging/LogWriter.cs
index 2fe9026..a176958 100755
--- a/OpenSim/Region/CoreModules/Framework/Statistics/Logging/LogWriter.cs
+++ b/OpenSim/Region/CoreModules/Framework/Statistics/Logging/LogWriter.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -151,7 +151,7 @@ namespace OpenSim.Region.CoreModules.Framework.Statistics.Logging
151 string path = (m_logDirectory.Length > 0 ? m_logDirectory 151 string path = (m_logDirectory.Length > 0 ? m_logDirectory
152 + System.IO.Path.DirectorySeparatorChar.ToString() : "") 152 + System.IO.Path.DirectorySeparatorChar.ToString() : "")
153 + String.Format("{0}{1}.log", LogFileHeader, now.ToString("yyyyMMddHHmmss")); 153 + String.Format("{0}{1}.log", LogFileHeader, now.ToString("yyyyMMddHHmmss"));
154 m_logFile = new StreamWriter(File.Open(path, FileMode.Append, FileAccess.Write)); 154 m_logFile = new StreamWriter(File.Open(path, FileMode.Append, FileAccess.Write, FileShare.ReadWrite));
155 } 155 }
156 if (m_logFile != null) 156 if (m_logFile != null)
157 { 157 {
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs
index 245c808..7b89c2c 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs
@@ -130,7 +130,17 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
130 } 130 }
131 131
132 UserAgentServiceConnector uasConn = new UserAgentServiceConnector(uriStr); 132 UserAgentServiceConnector uasConn = new UserAgentServiceConnector(uriStr);
133 UUID userID = uasConn.GetUUID(names[0], names[1]); 133
134 UUID userID = UUID.Zero;
135 try
136 {
137 userID = uasConn.GetUUID(names[0], names[1]);
138 }
139 catch (Exception e)
140 {
141 m_log.Debug("[USER MANAGEMENT MODULE]: GetUUID call failed ", e);
142 }
143
134 if (!userID.Equals(UUID.Zero)) 144 if (!userID.Equals(UUID.Zero))
135 { 145 {
136 UserData ud = new UserData(); 146 UserData ud = new UserData();
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/Tests/HGUserManagementModuleTests.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/Tests/HGUserManagementModuleTests.cs
index 9d36aa5..4e3b7e5 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/Tests/HGUserManagementModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/Tests/HGUserManagementModuleTests.cs
@@ -32,7 +32,6 @@ using OpenMetaverse;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Region.CoreModules.Framework.UserManagement; 33using OpenSim.Region.CoreModules.Framework.UserManagement;
34using OpenSim.Tests.Common; 34using OpenSim.Tests.Common;
35using OpenSim.Tests.Common.Mock;
36 35
37namespace OpenSim.Region.CoreModules.Framework.UserManagement.Tests 36namespace OpenSim.Region.CoreModules.Framework.UserManagement.Tests
38{ 37{
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index e571c62..a536757 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -62,6 +62,8 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
62 // The cache 62 // The cache
63 protected Dictionary<UUID, UserData> m_UserCache = new Dictionary<UUID, UserData>(); 63 protected Dictionary<UUID, UserData> m_UserCache = new Dictionary<UUID, UserData>();
64 64
65 protected bool m_DisplayChangingHomeURI = false;
66
65 #region ISharedRegionModule 67 #region ISharedRegionModule
66 68
67 public void Initialise(IConfigSource config) 69 public void Initialise(IConfigSource config)
@@ -73,6 +75,17 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
73 Init(); 75 Init();
74 m_log.DebugFormat("[USER MANAGEMENT MODULE]: {0} is enabled", Name); 76 m_log.DebugFormat("[USER MANAGEMENT MODULE]: {0} is enabled", Name);
75 } 77 }
78
79 if(!m_Enabled)
80 {
81 return;
82 }
83
84 IConfig userManagementConfig = config.Configs["UserManagement"];
85 if (userManagementConfig == null)
86 return;
87
88 m_DisplayChangingHomeURI = userManagementConfig.GetBoolean("DisplayChangingHomeURI", false);
76 } 89 }
77 90
78 public bool IsSharedModule 91 public bool IsSharedModule
@@ -94,7 +107,10 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
94 { 107 {
95 if (m_Enabled) 108 if (m_Enabled)
96 { 109 {
97 m_Scenes.Add(scene); 110 lock (m_Scenes)
111 {
112 m_Scenes.Add(scene);
113 }
98 114
99 scene.RegisterModuleInterface<IUserManagement>(this); 115 scene.RegisterModuleInterface<IUserManagement>(this);
100 scene.RegisterModuleInterface<IPeople>(this); 116 scene.RegisterModuleInterface<IPeople>(this);
@@ -108,7 +124,10 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
108 if (m_Enabled) 124 if (m_Enabled)
109 { 125 {
110 scene.UnregisterModuleInterface<IUserManagement>(this); 126 scene.UnregisterModuleInterface<IUserManagement>(this);
111 m_Scenes.Remove(scene); 127 lock (m_Scenes)
128 {
129 m_Scenes.Remove(scene);
130 }
112 } 131 }
113 } 132 }
114 133
@@ -124,7 +143,10 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
124 143
125 public void Close() 144 public void Close()
126 { 145 {
127 m_Scenes.Clear(); 146 lock (m_Scenes)
147 {
148 m_Scenes.Clear();
149 }
128 150
129 lock (m_UserCache) 151 lock (m_UserCache)
130 m_UserCache.Clear(); 152 m_UserCache.Clear();
@@ -132,7 +154,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
132 154
133 #endregion ISharedRegionModule 155 #endregion ISharedRegionModule
134 156
135 157
136 #region Event Handlers 158 #region Event Handlers
137 159
138 void EventManager_OnPrimsLoaded(Scene s) 160 void EventManager_OnPrimsLoaded(Scene s)
@@ -158,7 +180,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
158 void HandleUUIDNameRequest(UUID uuid, IClientAPI client) 180 void HandleUUIDNameRequest(UUID uuid, IClientAPI client)
159 { 181 {
160// m_log.DebugFormat( 182// m_log.DebugFormat(
161// "[USER MANAGEMENT MODULE]: Handling request for name binding of UUID {0} from {1}", 183// "[USER MANAGEMENT MODULE]: Handling request for name binding of UUID {0} from {1}",
162// uuid, remote_client.Name); 184// uuid, remote_client.Name);
163 185
164 if (m_Scenes[0].LibraryService != null && (m_Scenes[0].LibraryService.LibraryRootFolder.Owner == uuid)) 186 if (m_Scenes[0].LibraryService != null && (m_Scenes[0].LibraryService.LibraryRootFolder.Owner == uuid))
@@ -167,11 +189,18 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
167 } 189 }
168 else 190 else
169 { 191 {
170 string[] names = new string[2]; 192 UserData user;
171 if (TryGetUserNamesFromCache(uuid, names)) 193 /* bypass that continuation here when entry is already available */
194 lock (m_UserCache)
172 { 195 {
173 client.SendNameReply(uuid, names[0], names[1]); 196 if (m_UserCache.TryGetValue(uuid, out user))
174 return; 197 {
198 if (!user.IsUnknownUser && user.HasGridUserTried)
199 {
200 client.SendNameReply(uuid, user.FirstName, user.LastName);
201 return;
202 }
203 }
175 } 204 }
176 205
177 // Not found in cache, queue continuation 206 // Not found in cache, queue continuation
@@ -183,13 +212,15 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
183 // appear to clear this when the user asks it to clear the cache, but others may not. 212 // appear to clear this when the user asks it to clear the cache, but others may not.
184 // 213 //
185 // So to avoid clients 214 // So to avoid clients
186 // (particularly Hypergrid clients) permanently binding "Unknown User" to a given UUID, we will 215 // (particularly Hypergrid clients) permanently binding "Unknown User" to a given UUID, we will
187 // instead drop the request entirely. 216 // instead drop the request entirely.
188 if (TryGetUserNames(uuid, names)) 217 if (GetUser(uuid, out user))
189 client.SendNameReply(uuid, names[0], names[1]); 218 {
219 client.SendNameReply(uuid, user.FirstName, user.LastName);
220 }
190// else 221// else
191// m_log.DebugFormat( 222// m_log.DebugFormat(
192// "[USER MANAGEMENT MODULE]: No bound name for {0} found, ignoring request from {1}", 223// "[USER MANAGEMENT MODULE]: No bound name for {0} found, ignoring request from {1}",
193// uuid, client.Name); 224// uuid, client.Name);
194 }); 225 });
195 } 226 }
@@ -269,19 +300,19 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
269 ud.FirstName = acc.FirstName; 300 ud.FirstName = acc.FirstName;
270 ud.LastName = acc.LastName; 301 ud.LastName = acc.LastName;
271 ud.Id = acc.PrincipalID; 302 ud.Id = acc.PrincipalID;
303 ud.HasGridUserTried = true;
304 ud.IsUnknownUser = false;
272 users.Add(ud); 305 users.Add(ud);
273 } 306 }
274 } 307 }
275 308
276 // search the local cache 309 // search the local cache
277 lock (m_UserCache) 310 foreach (UserData data in m_UserCache.Values)
278 { 311 {
279 foreach (UserData data in m_UserCache.Values) 312 if (data.Id != UUID.Zero && !data.IsUnknownUser &&
280 { 313 users.Find(delegate(UserData d) { return d.Id == data.Id; }) == null &&
281 if (users.Find(delegate(UserData d) { return d.Id == data.Id; }) == null && 314 (data.FirstName.ToLower().StartsWith(query.ToLower()) || data.LastName.ToLower().StartsWith(query.ToLower())))
282 (data.FirstName.ToLower().StartsWith(query.ToLower()) || data.LastName.ToLower().StartsWith(query.ToLower()))) 315 users.Add(data);
283 users.Add(data);
284 }
285 } 316 }
286 317
287 AddAdditionalUsers(query, users); 318 AddAdditionalUsers(query, users);
@@ -305,6 +336,8 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
305 } 336 }
306 } 337 }
307 338
339<<<<<<< HEAD
340=======
308 /// <summary> 341 /// <summary>
309 /// 342 ///
310 /// </summary> 343 /// </summary>
@@ -400,6 +433,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
400 } 433 }
401 } 434 }
402 435
436>>>>>>> avn/ubitvar
403 #region IUserManagement 437 #region IUserManagement
404 438
405 public UUID GetUserIdByName(string name) 439 public UUID GetUserIdByName(string name)
@@ -433,50 +467,56 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
433 467
434 public string GetUserName(UUID uuid) 468 public string GetUserName(UUID uuid)
435 { 469 {
436 string[] names = new string[2]; 470 UserData user;
437 TryGetUserNames(uuid, names); 471 GetUser(uuid, out user);
438 472 return user.FirstName + " " + user.LastName;
439 return names[0] + " " + names[1];
440
441 } 473 }
442 474
443 public string GetUserHomeURL(UUID userID) 475 public string GetUserHomeURL(UUID userID)
444 { 476 {
445 lock (m_UserCache) 477 UserData user;
478 if(GetUser(userID, out user))
446 { 479 {
447 if (m_UserCache.ContainsKey(userID)) 480 return user.HomeURL;
448 return m_UserCache[userID].HomeURL;
449 } 481 }
450
451 return string.Empty; 482 return string.Empty;
452 } 483 }
453 484
454 public string GetUserServerURL(UUID userID, string serverType) 485 public string GetUserServerURL(UUID userID, string serverType)
455 { 486 {
456 UserData userdata; 487 UserData userdata;
457 lock (m_UserCache) 488 if(!GetUser(userID, out userdata))
458 m_UserCache.TryGetValue(userID, out userdata); 489 {
490 return string.Empty;
491 }
459 492
460 if (userdata != null) 493 if (userdata.ServerURLs != null && userdata.ServerURLs.ContainsKey(serverType) && userdata.ServerURLs[serverType] != null)
494 {
495 return userdata.ServerURLs[serverType].ToString();
496 }
497
498 if (!string.IsNullOrEmpty(userdata.HomeURL))
461 { 499 {
462// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Requested url type {0} for {1}", serverType, userID); 500// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Requested url type {0} for {1}", serverType, userID);
463 501
464 if (userdata.ServerURLs != null && userdata.ServerURLs.ContainsKey(serverType) && userdata.ServerURLs[serverType] != null) 502 UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL);
503 try
465 { 504 {
466 return userdata.ServerURLs[serverType].ToString(); 505 userdata.ServerURLs = uConn.GetServerURLs(userID);
467 } 506 }
468 507 catch(System.Net.WebException e)
469 if (!string.IsNullOrEmpty(userdata.HomeURL))
470 { 508 {
471 //m_log.DebugFormat( 509 m_log.DebugFormat("[USER MANAGEMENT MODULE]: GetServerURLs call failed {0}", e.Message);
472 // "[USER MANAGEMENT MODULE]: Did not find url type {0} so requesting urls from '{1}' for {2}", 510 userdata.ServerURLs = new Dictionary<string, object>();
473 // serverType, userdata.HomeURL, userID); 511 }
474 512 catch (Exception e)
475 UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL); 513 {
476 userdata.ServerURLs = uConn.GetServerURLs(userID); 514 m_log.Debug("[USER MANAGEMENT MODULE]: GetServerURLs call failed ", e);
477 if (userdata.ServerURLs != null && userdata.ServerURLs.ContainsKey(serverType) && userdata.ServerURLs[serverType] != null) 515 userdata.ServerURLs = new Dictionary<string, object>();
478 return userdata.ServerURLs[serverType].ToString();
479 } 516 }
517
518 if (userdata.ServerURLs != null && userdata.ServerURLs.ContainsKey(serverType) && userdata.ServerURLs[serverType] != null)
519 return userdata.ServerURLs[serverType].ToString();
480 } 520 }
481 521
482 return string.Empty; 522 return string.Empty;
@@ -484,19 +524,15 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
484 524
485 public string GetUserUUI(UUID userID) 525 public string GetUserUUI(UUID userID)
486 { 526 {
487 UserData ud; 527 string uui;
488 lock (m_UserCache) 528 GetUserUUI(userID, out uui);
489 m_UserCache.TryGetValue(userID, out ud); 529 return uui;
530 }
490 531
491 if (ud == null) // It's not in the cache 532 public bool GetUserUUI(UUID userID, out string uui)
492 { 533 {
493 string[] names = new string[2]; 534 UserData ud;
494 // This will pull the data from either UserAccounts or GridUser 535 bool result = GetUser(userID, out ud);
495 // and stick it into the cache
496 TryGetUserNamesFromServices(userID, names);
497 lock (m_UserCache)
498 m_UserCache.TryGetValue(userID, out ud);
499 }
500 536
501 if (ud != null) 537 if (ud != null)
502 { 538 {
@@ -510,125 +546,251 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
510 first = parts[0]; 546 first = parts[0];
511 last = parts[1]; 547 last = parts[1];
512 } 548 }
513 return userID + ";" + homeURL + ";" + first + " " + last; 549 uui = userID + ";" + homeURL + ";" + first + " " + last;
514 } 550 }
515 } 551 }
516 552
517 return userID.ToString(); 553 uui = userID.ToString();
554 return result;
518 } 555 }
519 556
520 public void AddUser(UUID uuid, string first, string last) 557 #region Cache Management
558 public bool GetUser(UUID uuid, out UserData userdata)
521 { 559 {
522 lock (m_UserCache) 560 lock (m_UserCache)
523 { 561 {
524 if (m_UserCache.ContainsKey(uuid)) 562 if (m_UserCache.TryGetValue(uuid, out userdata))
525 return; 563 {
564 if (userdata.HasGridUserTried)
565 {
566 return true;
567 }
568 }
569 else
570 {
571 userdata = new UserData();
572 userdata.HasGridUserTried = false;
573 userdata.Id = uuid;
574 userdata.FirstName = "Unknown";
575 userdata.LastName = "UserUMMAU42";
576 userdata.HomeURL = string.Empty;
577 userdata.IsUnknownUser = true;
578 userdata.HasGridUserTried = false;
579 }
526 } 580 }
527 581
528 UserData user = new UserData(); 582 /* BEGIN: do not wrap this code in any lock here
529 user.Id = uuid; 583 * There are HTTP calls in here.
530 user.FirstName = first; 584 */
531 user.LastName = last; 585 if (!userdata.HasGridUserTried)
586 {
587 /* rewrite here */
588 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, uuid);
589 if (account != null)
590 {
591 userdata.FirstName = account.FirstName;
592 userdata.LastName = account.LastName;
593 userdata.HomeURL = string.Empty;
594 userdata.IsUnknownUser = false;
595 userdata.HasGridUserTried = true;
596 }
597 }
532 598
533 AddUserInternal(user); 599 if (!userdata.HasGridUserTried)
600 {
601 GridUserInfo uInfo = null;
602 if (null != m_Scenes[0].GridUserService)
603 {
604 uInfo = m_Scenes[0].GridUserService.GetGridUserInfo(uuid.ToString());
605 }
606 if (uInfo != null)
607 {
608 string url, first, last, tmp;
609 UUID u;
610 if(uInfo.UserID.Length <= 36)
611 {
612 /* not a UUI */
613 }
614 else if (Util.ParseUniversalUserIdentifier(uInfo.UserID, out u, out url, out first, out last, out tmp))
615 {
616 if (url != string.Empty)
617 {
618 userdata.FirstName = first.Replace(" ", ".") + "." + last.Replace(" ", ".");
619 userdata.HomeURL = url;
620 try
621 {
622 userdata.LastName = "@" + new Uri(url).Authority;
623 userdata.IsUnknownUser = false;
624 }
625 catch
626 {
627 userdata.LastName = "@unknown";
628 }
629 userdata.HasGridUserTried = true;
630 }
631 }
632 else
633 m_log.DebugFormat("[USER MANAGEMENT MODULE]: Unable to parse UUI {0}", uInfo.UserID);
634 }
635 }
636 /* END: do not wrap this code in any lock here */
637
638 lock (m_UserCache)
639 {
640 m_UserCache[uuid] = userdata;
641 }
642 return !userdata.IsUnknownUser;
534 } 643 }
535 644
536 public void AddUser(UUID uuid, string first, string last, string homeURL) 645 public void AddUser(UUID uuid, string first, string last)
537 { 646 {
538 //m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, first {1}, last {2}, url {3}", uuid, first, last, homeURL); 647 lock(m_UserCache)
539 if (homeURL == string.Empty) 648 {
540 return; 649 if(!m_UserCache.ContainsKey(uuid))
541 650 {
542 AddUser(uuid, homeURL + ";" + first + " " + last); 651 UserData user = new UserData();
652 user.Id = uuid;
653 user.FirstName = first;
654 user.LastName = last;
655 user.IsUnknownUser = false;
656 user.HasGridUserTried = false;
657 m_UserCache.Add(uuid, user);
658 }
659 }
543 } 660 }
544 661
545 public void AddUser(UUID id, string creatorData) 662 public void AddUser(UUID uuid, string first, string last, string homeURL)
546 { 663 {
547 //m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, creatorData {1}", id, creatorData); 664 //m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, first {1}, last {2}, url {3}", uuid, first, last, homeURL);
548 665
549 UserData oldUser; 666 UserData oldUser;
550 lock (m_UserCache) 667 lock (m_UserCache)
551 m_UserCache.TryGetValue(id, out oldUser);
552
553 if (oldUser != null)
554 { 668 {
555 if (string.IsNullOrEmpty(creatorData)) 669 if (m_UserCache.TryGetValue(uuid, out oldUser))
556 { 670 {
557 //ignore updates without creator data 671 if (!oldUser.IsUnknownUser)
558 return; 672 {
559 } 673 if (homeURL != oldUser.HomeURL && m_DisplayChangingHomeURI)
560 674 {
561 //try update unknown users, but don't update anyone else 675 m_log.DebugFormat("[USER MANAGEMENT MODULE]: Different HomeURI for {0} {1} ({2}): {3} and {4}",
562 if (oldUser.FirstName == "Unknown" && !creatorData.Contains("Unknown")) 676 first, last, uuid.ToString(), homeURL, oldUser.HomeURL);
563 { 677 }
564 lock (m_UserCache) 678 /* no update needed */
565 m_UserCache.Remove(id); 679 return;
566 m_log.DebugFormat("[USER MANAGEMENT MODULE]: Re-adding user with id {0}, creatorData [{1}] and old HomeURL {2}", id, creatorData, oldUser.HomeURL); 680 }
567 } 681 }
568 else 682 else if(!m_UserCache.ContainsKey(uuid))
569 { 683 {
570 //we have already a valid user within the cache 684 oldUser = new UserData();
571 return; 685 oldUser.HasGridUserTried = false;
686 oldUser.IsUnknownUser = false;
687 if (homeURL != string.Empty)
688 {
689 oldUser.FirstName = first.Replace(" ", ".") + "." + last.Replace(" ", ".");
690 try
691 {
692 oldUser.LastName = "@" + new Uri(homeURL).Authority;
693 oldUser.IsUnknownUser = false;
694 }
695 catch
696 {
697 oldUser.LastName = "@unknown";
698 }
699 }
700 else
701 {
702 oldUser.FirstName = first;
703 oldUser.LastName = last;
704 }
705 oldUser.HomeURL = homeURL;
706 oldUser.Id = uuid;
707 m_UserCache.Add(uuid, oldUser);
572 } 708 }
573 } 709 }
710 }
574 711
575 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id); 712 public void AddUser(UUID id, string creatorData)
713 {
714 // m_log.InfoFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, creatorData {1}", id, creatorData);
576 715
577 if (account != null) 716 if(string.IsNullOrEmpty(creatorData))
578 { 717 {
579 AddUser(id, account.FirstName, account.LastName); 718 AddUser(id, string.Empty, string.Empty, string.Empty);
580 } 719 }
581 else 720 else
582 { 721 {
583 UserData user = new UserData(); 722 string homeURL;
584 user.Id = id; 723 string firstname = string.Empty;
724 string lastname = string.Empty;
585 725
586 if (!string.IsNullOrEmpty(creatorData)) 726 //creatorData = <endpoint>;<name>
587 {
588 //creatorData = <endpoint>;<name>
589 727
590 string[] parts = creatorData.Split(';'); 728 string[] parts = creatorData.Split(';');
591 if (parts.Length >= 1) 729 if(parts.Length > 1)
730 {
731 string[] nameparts = parts[1].Split(' ');
732 firstname = nameparts[0];
733 for(int xi = 1; xi < nameparts.Length; ++xi)
592 { 734 {
593 user.HomeURL = parts[0]; 735 if(xi != 1)
594 try
595 { 736 {
596 Uri uri = new Uri(parts[0]); 737 lastname += " ";
597 user.LastName = "@" + uri.Authority;
598 } 738 }
599 catch (UriFormatException) 739 lastname += nameparts[xi];
740 }
741 }
742 else
743 {
744 firstname = "Unknown";
745 lastname = "UserUMMAU5";
746 }
747 if (parts.Length >= 1)
748 {
749 homeURL = parts[0];
750 if(Uri.IsWellFormedUriString(homeURL, UriKind.Absolute))
751 {
752 AddUser(id, firstname, lastname, homeURL);
753 }
754 else
755 {
756 m_log.DebugFormat("[SCENE]: Unable to parse Uri {0} for CreatorID {1}", parts[0], creatorData);
757
758 lock (m_UserCache)
600 { 759 {
601 m_log.DebugFormat("[SCENE]: Unable to parse Uri {0}", parts[0]); 760 if(!m_UserCache.ContainsKey(id))
602 user.LastName = "@unknown"; 761 {
762 UserData newUser = new UserData();
763 newUser.Id = id;
764 newUser.FirstName = firstname + "." + lastname.Replace(' ', '.');
765 newUser.LastName = "@unknown";
766 newUser.HomeURL = string.Empty;
767 newUser.HasGridUserTried = false;
768 newUser.IsUnknownUser = true; /* we mark those users as Unknown user so a re-retrieve may be activated */
769 m_UserCache.Add(id, newUser);
770 }
603 } 771 }
604 } 772 }
605
606 if (parts.Length >= 2)
607 user.FirstName = parts[1].Replace(' ', '.');
608 } 773 }
609 else 774 else
610 { 775 {
611 // Temporarily add unknown user entries of this type into the cache so that we can distinguish 776 lock(m_UserCache)
612 // this source from other recent (hopefully resolved) bugs that fail to retrieve a user name binding 777 {
613 // TODO: Can be removed when GUN* unknown users have definitely dropped significantly or 778 if(!m_UserCache.ContainsKey(id))
614 // disappeared. 779 {
615 user.FirstName = "Unknown"; 780 UserData newUser = new UserData();
616 user.LastName = "UserUMMAU4"; 781 newUser.Id = id;
782 newUser.FirstName = "Unknown";
783 newUser.LastName = "UserUMMAU4";
784 newUser.HomeURL = string.Empty;
785 newUser.IsUnknownUser = true;
786 newUser.HasGridUserTried = false;
787 m_UserCache.Add(id, newUser);
788 }
789 }
617 } 790 }
618
619 AddUserInternal(user);
620 } 791 }
621 } 792 }
622 793 #endregion
623 void AddUserInternal(UserData user)
624 {
625 lock (m_UserCache)
626 m_UserCache[user.Id] = user;
627
628 //m_log.DebugFormat(
629 // "[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}",
630 // user.Id, user.FirstName, user.LastName, user.HomeURL);
631 }
632 794
633 public bool IsLocalGridUser(UUID uuid) 795 public bool IsLocalGridUser(UUID uuid)
634 { 796 {
@@ -662,6 +824,21 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
662 "Show the bindings between user UUIDs and user names", 824 "Show the bindings between user UUIDs and user names",
663 String.Empty, 825 String.Empty,
664 HandleShowUsers); 826 HandleShowUsers);
827
828 MainConsole.Instance.Commands.AddCommand("Users", true,
829 "reset user cache",
830 "reset user cache",
831 "reset user cache to allow changed settings to be applied",
832 String.Empty,
833 HandleResetUserCache);
834 }
835
836 private void HandleResetUserCache(string module, string[] cmd)
837 {
838 lock(m_UserCache)
839 {
840 m_UserCache.Clear();
841 }
665 } 842 }
666 843
667 private void HandleShowUser(string module, string[] cmd) 844 private void HandleShowUser(string module, string[] cmd)
@@ -676,17 +853,12 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
676 if (!ConsoleUtil.TryParseConsoleUuid(MainConsole.Instance, cmd[2], out userId)) 853 if (!ConsoleUtil.TryParseConsoleUuid(MainConsole.Instance, cmd[2], out userId))
677 return; 854 return;
678 855
679 string[] names;
680
681 UserData ud; 856 UserData ud;
682 857
683 lock (m_UserCache) 858 if(!GetUser(userId, out ud))
684 { 859 {
685 if (!m_UserCache.TryGetValue(userId, out ud)) 860 MainConsole.Instance.OutputFormat("No name known for user with id {0}", userId);
686 { 861 return;
687 MainConsole.Instance.OutputFormat("No name known for user with id {0}", userId);
688 return;
689 }
690 } 862 }
691 863
692 ConsoleDisplayTable cdt = new ConsoleDisplayTable(); 864 ConsoleDisplayTable cdt = new ConsoleDisplayTable();
@@ -704,11 +876,17 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
704 cdt.AddColumn("UUID", 36); 876 cdt.AddColumn("UUID", 36);
705 cdt.AddColumn("Name", 30); 877 cdt.AddColumn("Name", 30);
706 cdt.AddColumn("HomeURL", 40); 878 cdt.AddColumn("HomeURL", 40);
879 cdt.AddColumn("Checked", 10);
707 880
708 lock (m_UserCache) 881 Dictionary<UUID, UserData> copyDict;
882 lock(m_UserCache)
883 {
884 copyDict = new Dictionary<UUID, UserData>(m_UserCache);
885 }
886
887 foreach(KeyValuePair<UUID, UserData> kvp in copyDict)
709 { 888 {
710 foreach (KeyValuePair<UUID, UserData> kvp in m_UserCache) 889 cdt.AddRow(kvp.Key, string.Format("{0} {1}", kvp.Value.FirstName, kvp.Value.LastName), kvp.Value.HomeURL, kvp.Value.HasGridUserTried ? "yes" : "no");
711 cdt.AddRow(kvp.Key, string.Format("{0} {1}", kvp.Value.FirstName, kvp.Value.LastName), kvp.Value.HomeURL);
712 } 890 }
713 891
714 MainConsole.Instance.Output(cdt.ToString()); 892 MainConsole.Instance.Output(cdt.ToString());
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs
index 8946b5c..a5c7543 100644
--- a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs
@@ -37,6 +37,7 @@ using OpenSim.Framework;
37using OpenSim.Region.CoreModules.World.WorldMap; 37using OpenSim.Region.CoreModules.World.WorldMap;
38using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
40using OpenSim.Services.Interfaces;
40using GridRegion = OpenSim.Services.Interfaces.GridRegion; 41using GridRegion = OpenSim.Services.Interfaces.GridRegion;
41 42
42namespace OpenSim.Region.CoreModules.Hypergrid 43namespace OpenSim.Region.CoreModules.Hypergrid
@@ -126,7 +127,8 @@ namespace OpenSim.Region.CoreModules.Hypergrid
126 foreach (MapBlockData b in mapBlocks) 127 foreach (MapBlockData b in mapBlocks)
127 { 128 {
128 b.Name = string.Empty; 129 b.Name = string.Empty;
129 b.Access = 254; // means 'simulator is offline'. We need this because the viewer ignores 255's 130 // Set 'simulator is offline'. We need this because the viewer ignores SimAccess.Unknown (255)
131 b.Access = (byte)SimAccess.Down;
130 } 132 }
131 133
132 m_log.DebugFormat("[HG MAP]: Resetting {0} blocks", mapBlocks.Count); 134 m_log.DebugFormat("[HG MAP]: Resetting {0} blocks", mapBlocks.Count);
diff --git a/OpenSim/Region/CoreModules/Properties/AssemblyInfo.cs b/OpenSim/Region/CoreModules/Properties/AssemblyInfo.cs
index 9809c86..64532df 100644
--- a/OpenSim/Region/CoreModules/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/CoreModules/Properties/AssemblyInfo.cs
@@ -30,9 +30,9 @@ using Mono.Addins;
30// Build Number 30// Build Number
31// Revision 31// Revision
32// 32//
33[assembly: AssemblyVersion("0.8.0.*")] 33[assembly: AssemblyVersion("0.8.2.*")]
34 34
35 35
36[assembly: Addin("OpenSim.Region.CoreModules", "0.1")] 36[assembly: Addin("OpenSim.Region.CoreModules", OpenSim.VersionInfo.VersionNumber)]
37[assembly: AddinDependency("OpenSim", "0.5")] 37[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)]
38 38
diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
index 9d77b19..a686a4d 100644
--- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
@@ -514,9 +514,11 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
514 scene.RegionInfo.RegionID.ToString()); 514 scene.RegionInfo.RegionID.ToString());
515 asset.Data = assetData; 515 asset.Data = assetData;
516 asset.Description = String.Format("URL image : {0}", Url); 516 asset.Description = String.Format("URL image : {0}", Url);
517 asset.Local = false; 517 if (asset.Description.Length > 128)
518 asset.Description = asset.Description.Substring(0, 128);
519 asset.Local = true; // dynamic images aren't saved in the assets server
518 asset.Temporary = ((Disp & DISP_TEMP) != 0); 520 asset.Temporary = ((Disp & DISP_TEMP) != 0);
519 scene.AssetService.Store(asset); 521 scene.AssetService.Store(asset); // this will only save the asset in the local asset cache
520 522
521 IJ2KDecoder cacheLayerDecode = scene.RequestModuleInterface<IJ2KDecoder>(); 523 IJ2KDecoder cacheLayerDecode = scene.RequestModuleInterface<IJ2KDecoder>();
522 if (cacheLayerDecode != null) 524 if (cacheLayerDecode != null)
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
index 6880f56..235fbbb 100644
--- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
+++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
@@ -37,6 +37,7 @@ using System.Security.Cryptography.X509Certificates;
37using Nini.Config; 37using Nini.Config;
38using OpenMetaverse; 38using OpenMetaverse;
39using OpenSim.Framework; 39using OpenSim.Framework;
40using OpenSim.Framework.Communications;
40using OpenSim.Framework.Servers; 41using OpenSim.Framework.Servers;
41using OpenSim.Framework.Servers.HttpServer; 42using OpenSim.Framework.Servers.HttpServer;
42using OpenSim.Region.Framework.Interfaces; 43using OpenSim.Region.Framework.Interfaces;
@@ -92,10 +93,13 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
92 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HttpRequestModule")] 93 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HttpRequestModule")]
93 public class HttpRequestModule : ISharedRegionModule, IHttpRequestModule 94 public class HttpRequestModule : ISharedRegionModule, IHttpRequestModule
94 { 95 {
96// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
97
95 private object HttpListLock = new object(); 98 private object HttpListLock = new object();
96 private int httpTimeout = 30000; 99 private int httpTimeout = 30000;
97 private string m_name = "HttpScriptRequests"; 100 private string m_name = "HttpScriptRequests";
98 101
102 private OutboundUrlFilter m_outboundUrlFilter;
99 private string m_proxyurl = ""; 103 private string m_proxyurl = "";
100 private string m_proxyexcepts = ""; 104 private string m_proxyexcepts = "";
101 105
@@ -134,10 +138,12 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
134 return false; 138 return false;
135 139
136 // Check for policy and execute it if defined 140 // Check for policy and execute it if defined
141#pragma warning disable 0618
137 if (ServicePointManager.CertificatePolicy != null) 142 if (ServicePointManager.CertificatePolicy != null)
138 { 143 {
139 return ServicePointManager.CertificatePolicy.CheckValidationResult (sp, certificate, Request, 0); 144 return ServicePointManager.CertificatePolicy.CheckValidationResult (sp, certificate, Request, 0);
140 } 145 }
146#pragma warning restore 0618
141 147
142 return true; 148 return true;
143 } 149 }
@@ -155,7 +161,9 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
155 return UUID.Zero; 161 return UUID.Zero;
156 } 162 }
157 163
158 public UUID StartHttpRequest(uint localID, UUID itemID, string url, List<string> parameters, Dictionary<string, string> headers, string body) 164 public UUID StartHttpRequest(
165 uint localID, UUID itemID, string url, List<string> parameters, Dictionary<string, string> headers, string body,
166 out HttpInitialRequestStatus status)
159 { 167 {
160 UUID reqID = UUID.Random(); 168 UUID reqID = UUID.Random();
161 HttpRequestClass htc = new HttpRequestClass(); 169 HttpRequestClass htc = new HttpRequestClass();
@@ -231,7 +239,8 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
231 } 239 }
232 } 240 }
233 } 241 }
234 242
243 htc.RequestModule = this;
235 htc.LocalID = localID; 244 htc.LocalID = localID;
236 htc.ItemID = itemID; 245 htc.ItemID = itemID;
237 htc.Url = url; 246 htc.Url = url;
@@ -242,14 +251,43 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
242 htc.proxyurl = m_proxyurl; 251 htc.proxyurl = m_proxyurl;
243 htc.proxyexcepts = m_proxyexcepts; 252 htc.proxyexcepts = m_proxyexcepts;
244 253
254 // Same number as default HttpWebRequest.MaximumAutomaticRedirections
255 htc.MaxRedirects = 50;
256
257 if (StartHttpRequest(htc))
258 {
259 status = HttpInitialRequestStatus.OK;
260 return htc.ReqID;
261 }
262 else
263 {
264 status = HttpInitialRequestStatus.DISALLOWED_BY_FILTER;
265 return UUID.Zero;
266 }
267 }
268
269 /// <summary>
270 /// Would a caller to this module be allowed to make a request to the given URL?
271 /// </summary>
272 /// <returns></returns>
273 public bool CheckAllowed(Uri url)
274 {
275 return m_outboundUrlFilter.CheckAllowed(url);
276 }
277
278 public bool StartHttpRequest(HttpRequestClass req)
279 {
280 if (!CheckAllowed(new Uri(req.Url)))
281 return false;
282
245 lock (HttpListLock) 283 lock (HttpListLock)
246 { 284 {
247 m_pendingRequests.Add(reqID, htc); 285 m_pendingRequests.Add(req.ReqID, req);
248 } 286 }
249 287
250 htc.Process(); 288 req.Process();
251 289
252 return reqID; 290 return true;
253 } 291 }
254 292
255 public void StopHttpRequest(uint m_localID, UUID m_itemID) 293 public void StopHttpRequest(uint m_localID, UUID m_itemID)
@@ -320,6 +358,9 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
320 m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); 358 m_proxyurl = config.Configs["Startup"].GetString("HttpProxy");
321 m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); 359 m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions");
322 360
361<<<<<<< HEAD
362 m_outboundUrlFilter = new OutboundUrlFilter("Script HTTP request module", config);
363=======
323 int maxThreads = 15; 364 int maxThreads = 15;
324 365
325 IConfig httpConfig = config.Configs["HttpRequestModule"]; 366 IConfig httpConfig = config.Configs["HttpRequestModule"];
@@ -327,6 +368,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
327 { 368 {
328 maxThreads = httpConfig.GetInt("MaxPoolThreads", maxThreads); 369 maxThreads = httpConfig.GetInt("MaxPoolThreads", maxThreads);
329 } 370 }
371>>>>>>> avn/ubitvar
330 372
331 m_pendingRequests = new Dictionary<UUID, HttpRequestClass>(); 373 m_pendingRequests = new Dictionary<UUID, HttpRequestClass>();
332 374
@@ -385,7 +427,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
385 #endregion 427 #endregion
386 } 428 }
387 429
388 public class HttpRequestClass: IServiceRequest 430 public class HttpRequestClass : IServiceRequest
389 { 431 {
390 // Constants for parameters 432 // Constants for parameters
391 // public const int HTTP_BODY_MAXLENGTH = 2; 433 // public const int HTTP_BODY_MAXLENGTH = 2;
@@ -395,6 +437,12 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
395 // public const int HTTP_VERBOSE_THROTTLE = 4; 437 // public const int HTTP_VERBOSE_THROTTLE = 4;
396 // public const int HTTP_CUSTOM_HEADER = 5; 438 // public const int HTTP_CUSTOM_HEADER = 5;
397 // public const int HTTP_PRAGMA_NO_CACHE = 6; 439 // public const int HTTP_PRAGMA_NO_CACHE = 6;
440
441 /// <summary>
442 /// Module that made this request.
443 /// </summary>
444 public HttpRequestModule RequestModule { get; set; }
445
398 private bool _finished; 446 private bool _finished;
399 public bool Finished 447 public bool Finished
400 { 448 {
@@ -429,6 +477,17 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
429 public DateTime Next; 477 public DateTime Next;
430 public string proxyurl; 478 public string proxyurl;
431 public string proxyexcepts; 479 public string proxyexcepts;
480
481 /// <summary>
482 /// Number of HTTP redirects that this request has been through.
483 /// </summary>
484 public int Redirects { get; private set; }
485
486 /// <summary>
487 /// Maximum number of HTTP redirects allowed for this request.
488 /// </summary>
489 public int MaxRedirects { get; set; }
490
432 public string OutboundBody; 491 public string OutboundBody;
433 private UUID _reqID; 492 private UUID _reqID;
434 public UUID ReqID 493 public UUID ReqID
@@ -473,11 +532,16 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
473 532
474 try 533 try
475 { 534 {
535<<<<<<< HEAD
536 Request = (HttpWebRequest)WebRequest.Create(Url);
537 Request.AllowAutoRedirect = false;
538=======
476 Request = (HttpWebRequest) WebRequest.Create(Url); 539 Request = (HttpWebRequest) WebRequest.Create(Url);
477 540
478 //This works around some buggy HTTP Servers like Lighttpd 541 //This works around some buggy HTTP Servers like Lighttpd
479 Request.ServicePoint.Expect100Continue = false; 542 Request.ServicePoint.Expect100Continue = false;
480 543
544>>>>>>> avn/ubitvar
481 Request.Method = HttpMethod; 545 Request.Method = HttpMethod;
482 Request.ContentType = HttpMIMEType; 546 Request.ContentType = HttpMIMEType;
483 547
@@ -491,16 +555,19 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
491// { 555// {
492// Request.ConnectionGroupName="Verify"; 556// Request.ConnectionGroupName="Verify";
493// } 557// }
558
494 if (!HttpPragmaNoCache) 559 if (!HttpPragmaNoCache)
495 { 560 {
496 Request.Headers.Add("Pragma", "no-cache"); 561 Request.Headers.Add("Pragma", "no-cache");
497 } 562 }
563
498 if (HttpCustomHeaders != null) 564 if (HttpCustomHeaders != null)
499 { 565 {
500 for (int i = 0; i < HttpCustomHeaders.Count; i += 2) 566 for (int i = 0; i < HttpCustomHeaders.Count; i += 2)
501 Request.Headers.Add(HttpCustomHeaders[i], 567 Request.Headers.Add(HttpCustomHeaders[i],
502 HttpCustomHeaders[i+1]); 568 HttpCustomHeaders[i+1]);
503 } 569 }
570
504 if (!string.IsNullOrEmpty(proxyurl)) 571 if (!string.IsNullOrEmpty(proxyurl))
505 { 572 {
506 if (!string.IsNullOrEmpty(proxyexcepts)) 573 if (!string.IsNullOrEmpty(proxyexcepts))
@@ -526,9 +593,8 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
526 byte[] data = Util.UTF8.GetBytes(OutboundBody); 593 byte[] data = Util.UTF8.GetBytes(OutboundBody);
527 594
528 Request.ContentLength = data.Length; 595 Request.ContentLength = data.Length;
529 Stream bstream = Request.GetRequestStream(); 596 using (Stream bstream = Request.GetRequestStream())
530 bstream.Write(data, 0, data.Length); 597 bstream.Write(data, 0, data.Length);
531 bstream.Close();
532 } 598 }
533 599
534 Request.Timeout = HttpTimeout; 600 Request.Timeout = HttpTimeout;
@@ -610,6 +676,56 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
610 resStream.Close(); 676 resStream.Close();
611 if (response != null) 677 if (response != null)
612 response.Close(); 678 response.Close();
679<<<<<<< HEAD
680
681 // We need to resubmit
682 if (
683 (Status == (int)HttpStatusCode.MovedPermanently
684 || Status == (int)HttpStatusCode.Found
685 || Status == (int)HttpStatusCode.SeeOther
686 || Status == (int)HttpStatusCode.TemporaryRedirect))
687 {
688 if (Redirects >= MaxRedirects)
689 {
690 Status = (int)OSHttpStatusCode.ClientErrorJoker;
691 ResponseBody = "Number of redirects exceeded max redirects";
692 _finished = true;
693 }
694 else
695 {
696 string location = response.Headers["Location"];
697
698 if (location == null)
699 {
700 Status = (int)OSHttpStatusCode.ClientErrorJoker;
701 ResponseBody = "HTTP redirect code but no location header";
702 _finished = true;
703 }
704 else if (!RequestModule.CheckAllowed(new Uri(location)))
705 {
706 Status = (int)OSHttpStatusCode.ClientErrorJoker;
707 ResponseBody = "URL from HTTP redirect blocked: " + location;
708 _finished = true;
709 }
710 else
711 {
712 Status = 0;
713 Url = response.Headers["Location"];
714 Redirects++;
715 ResponseBody = null;
716
717// m_log.DebugFormat("Redirecting to [{0}]", Url);
718
719 Process();
720 }
721 }
722 }
723 else
724 {
725 _finished = true;
726 }
727=======
728>>>>>>> avn/ubitvar
613 } 729 }
614 730
615 if (ResponseBody == null) 731 if (ResponseBody == null)
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/Tests/ScriptsHttpRequestsTests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/Tests/ScriptsHttpRequestsTests.cs
index e812d81..d22487e 100644
--- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/Tests/ScriptsHttpRequestsTests.cs
+++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/Tests/ScriptsHttpRequestsTests.cs
@@ -41,7 +41,6 @@ using OpenSim.Framework;
41using OpenSim.Region.CoreModules.Scripting.HttpRequest; 41using OpenSim.Region.CoreModules.Scripting.HttpRequest;
42using OpenSim.Region.Framework.Scenes; 42using OpenSim.Region.Framework.Scenes;
43using OpenSim.Tests.Common; 43using OpenSim.Tests.Common;
44using OpenSim.Tests.Common.Mock;
45 44
46namespace OpenSim.Region.CoreModules.Scripting.HttpRequest.Tests 45namespace OpenSim.Region.CoreModules.Scripting.HttpRequest.Tests
47{ 46{
@@ -97,8 +96,10 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest.Tests
97 { 96 {
98 public string Response { get; set; } 97 public string Response { get; set; }
99 98
99#pragma warning disable 0618
100 public TestHttpWebResponse(SerializationInfo serializationInfo, StreamingContext streamingContext) 100 public TestHttpWebResponse(SerializationInfo serializationInfo, StreamingContext streamingContext)
101 : base(serializationInfo, streamingContext) {} 101 : base(serializationInfo, streamingContext) {}
102#pragma warning restore 0618
102 103
103 public override Stream GetResponseStream() 104 public override Stream GetResponseStream()
104 { 105 {
@@ -147,11 +148,11 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest.Tests
147 /// <summary> 148 /// <summary>
148 /// Test what happens when we get a 404 response from a call. 149 /// Test what happens when we get a 404 response from a call.
149 /// </summary> 150 /// </summary>
150 [Test] 151// [Test]
151 public void Test404Response() 152 public void Test404Response()
152 { 153 {
153 TestHelpers.InMethod(); 154 TestHelpers.InMethod();
154// TestHelpers.EnableLogging(); 155 TestHelpers.EnableLogging();
155 156
156 if (!Util.IsPlatformMono) 157 if (!Util.IsPlatformMono)
157 Assert.Ignore("Ignoring test since can only currently run on Mono"); 158 Assert.Ignore("Ignoring test since can only currently run on Mono");
diff --git a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs
index baf9f2f..7462ebd 100644
--- a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs
@@ -32,6 +32,7 @@ using System.Net;
32using Nini.Config; 32using Nini.Config;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenMetaverse.Imaging; 34using OpenMetaverse.Imaging;
35using OpenSim.Framework.Communications;
35using OpenSim.Region.CoreModules.Scripting.DynamicTexture; 36using OpenSim.Region.CoreModules.Scripting.DynamicTexture;
36using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
@@ -50,6 +51,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
50 private Scene m_scene; 51 private Scene m_scene;
51 private IDynamicTextureManager m_textureManager; 52 private IDynamicTextureManager m_textureManager;
52 53
54 private OutboundUrlFilter m_outboundUrlFilter;
53 private string m_proxyurl = ""; 55 private string m_proxyurl = "";
54 private string m_proxyexcepts = ""; 56 private string m_proxyexcepts = "";
55 57
@@ -88,8 +90,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
88 90
89 public bool AsyncConvertUrl(UUID id, string url, string extraParams) 91 public bool AsyncConvertUrl(UUID id, string url, string extraParams)
90 { 92 {
91 MakeHttpRequest(url, id); 93 return MakeHttpRequest(url, id);
92 return true;
93 } 94 }
94 95
95 public bool AsyncConvertData(UUID id, string bodyData, string extraParams) 96 public bool AsyncConvertData(UUID id, string bodyData, string extraParams)
@@ -110,6 +111,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
110 111
111 public void Initialise(IConfigSource config) 112 public void Initialise(IConfigSource config)
112 { 113 {
114 m_outboundUrlFilter = new OutboundUrlFilter("Script dynamic texture image module", config);
113 m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); 115 m_proxyurl = config.Configs["Startup"].GetString("HttpProxy");
114 m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); 116 m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions");
115 } 117 }
@@ -157,9 +159,13 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
157 159
158 #endregion 160 #endregion
159 161
160 private void MakeHttpRequest(string url, UUID requestID) 162 private bool MakeHttpRequest(string url, UUID requestID)
161 { 163 {
162 WebRequest request = HttpWebRequest.Create(url); 164 if (!m_outboundUrlFilter.CheckAllowed(new Uri(url)))
165 return false;
166
167 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
168 request.AllowAutoRedirect = false;
163 169
164 if (!string.IsNullOrEmpty(m_proxyurl)) 170 if (!string.IsNullOrEmpty(m_proxyurl))
165 { 171 {
@@ -174,12 +180,14 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
174 } 180 }
175 } 181 }
176 182
177 RequestState state = new RequestState((HttpWebRequest) request, requestID); 183 RequestState state = new RequestState(request, requestID);
178 // IAsyncResult result = request.BeginGetResponse(new AsyncCallback(HttpRequestReturn), state); 184 // IAsyncResult result = request.BeginGetResponse(new AsyncCallback(HttpRequestReturn), state);
179 request.BeginGetResponse(new AsyncCallback(HttpRequestReturn), state); 185 request.BeginGetResponse(new AsyncCallback(HttpRequestReturn), state);
180 186
181 TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1)); 187 TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1));
182 state.TimeOfRequest = (int) t.TotalSeconds; 188 state.TimeOfRequest = (int) t.TotalSeconds;
189
190 return true;
183 } 191 }
184 192
185 private void HttpRequestReturn(IAsyncResult result) 193 private void HttpRequestReturn(IAsyncResult result)
@@ -195,10 +203,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
195 Stream stream = null; 203 Stream stream = null;
196 byte[] imageJ2000 = new byte[0]; 204 byte[] imageJ2000 = new byte[0];
197 Size newSize = new Size(0, 0); 205 Size newSize = new Size(0, 0);
206 HttpWebResponse response = null;
198 207
199 try 208 try
200 { 209 {
201 HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result); 210 response = (HttpWebResponse)request.EndGetResponse(result);
202 if (response != null && response.StatusCode == HttpStatusCode.OK) 211 if (response != null && response.StatusCode == HttpStatusCode.OK)
203 { 212 {
204 stream = response.GetResponseStream(); 213 stream = response.GetResponseStream();
@@ -262,18 +271,32 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
262 finally 271 finally
263 { 272 {
264 if (stream != null) 273 if (stream != null)
265 {
266 stream.Close(); 274 stream.Close();
267 }
268 }
269 275
270 m_log.DebugFormat("[LOADIMAGEURLMODULE]: Returning {0} bytes of image data for request {1}", 276 if (response != null)
271 imageJ2000.Length, state.RequestID); 277 response.Close();
272 278
273 m_textureManager.ReturnData( 279 if (
274 state.RequestID, 280 response.StatusCode == HttpStatusCode.MovedPermanently
275 new OpenSim.Region.CoreModules.Scripting.DynamicTexture.DynamicTexture( 281 || response.StatusCode == HttpStatusCode.Found
276 request.RequestUri, null, imageJ2000, newSize, false)); 282 || response.StatusCode == HttpStatusCode.SeeOther
283 || response.StatusCode == HttpStatusCode.TemporaryRedirect)
284 {
285 string redirectedUrl = response.Headers["Location"];
286
287 MakeHttpRequest(redirectedUrl, state.RequestID);
288 }
289 else
290 {
291 m_log.DebugFormat("[LOADIMAGEURLMODULE]: Returning {0} bytes of image data for request {1}",
292 imageJ2000.Length, state.RequestID);
293
294 m_textureManager.ReturnData(
295 state.RequestID,
296 new OpenSim.Region.CoreModules.Scripting.DynamicTexture.DynamicTexture(
297 request.RequestUri, null, imageJ2000, newSize, false));
298 }
299 }
277 } 300 }
278 301
279 #region Nested type: RequestState 302 #region Nested type: RequestState
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs
index 7119137..ed255bf 100644
--- a/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs
@@ -40,7 +40,6 @@ using OpenSim.Region.CoreModules.Scripting.VectorRender;
40using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Region.Framework.Scenes.Serialization; 41using OpenSim.Region.Framework.Scenes.Serialization;
42using OpenSim.Tests.Common; 42using OpenSim.Tests.Common;
43using OpenSim.Tests.Common.Mock;
44 43
45namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests 44namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
46{ 45{
diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
index 87a0537..1c3a714 100644
--- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
@@ -380,6 +380,20 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
380 380
381 if (sp != null) 381 if (sp != null)
382 { 382 {
383<<<<<<< HEAD
384 // ignore if a child agent this is restricted to inside one
385 // region
386 if (sp.IsChildAgent)
387 return;
388
389 // Channel zero only goes to the avatar
390 // non zero channel messages only go to the attachments of the avatar.
391 if (channel != 0)
392 {
393 List<SceneObjectGroup> attachments = sp.GetAttachments();
394 if (attachments.Count == 0)
395 return;
396=======
383 // Send message to avatar 397 // Send message to avatar
384 if (channel == 0) 398 if (channel == 0)
385 { 399 {
@@ -387,6 +401,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
387 m_scene.SimChat(Utils.StringToBytes(msg), ChatTypeEnum.Broadcast, 0, pos, name, id, target, false, false); 401 m_scene.SimChat(Utils.StringToBytes(msg), ChatTypeEnum.Broadcast, 0, pos, name, id, target, false, false);
388 return true; 402 return true;
389 } 403 }
404>>>>>>> avn/ubitvar
390 405
391 List<SceneObjectGroup> attachments = sp.GetAttachments(); 406 List<SceneObjectGroup> attachments = sp.GetAttachments();
392 407
diff --git a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
index c6e05b1..87f4277 100644
--- a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
@@ -36,6 +36,7 @@ using Nini.Config;
36using Nwc.XmlRpc; 36using Nwc.XmlRpc;
37using OpenMetaverse; 37using OpenMetaverse;
38using OpenSim.Framework; 38using OpenSim.Framework;
39using OpenSim.Framework.Monitoring;
39using OpenSim.Framework.Servers; 40using OpenSim.Framework.Servers;
40using OpenSim.Framework.Servers.HttpServer; 41using OpenSim.Framework.Servers.HttpServer;
41using OpenSim.Region.Framework.Interfaces; 42using OpenSim.Region.Framework.Interfaces;
@@ -656,12 +657,8 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
656 657
657 public void Process() 658 public void Process()
658 { 659 {
659 httpThread = new Thread(SendRequest);
660 httpThread.Name = "HttpRequestThread";
661 httpThread.Priority = ThreadPriority.BelowNormal;
662 httpThread.IsBackground = true;
663 _finished = false; 660 _finished = false;
664 httpThread.Start(); 661 httpThread = WorkManager.StartThread(SendRequest, "HttpRequestThread", ThreadPriority.BelowNormal, true, false);
665 } 662 }
666 663
667 /* 664 /*
@@ -733,13 +730,19 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
733 } 730 }
734 731
735 _finished = true; 732 _finished = true;
733
734 Watchdog.RemoveThread();
736 } 735 }
737 736
738 public void Stop() 737 public void Stop()
739 { 738 {
740 try 739 try
741 { 740 {
742 httpThread.Abort(); 741 if (httpThread != null)
742 {
743 Watchdog.AbortThread(httpThread.ManagedThreadId);
744 httpThread = null;
745 }
743 } 746 }
744 catch (Exception) 747 catch (Exception)
745 { 748 {
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/AgentPreferences/LocalAgentPreferencesServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/AgentPreferences/LocalAgentPreferencesServiceConnector.cs
new file mode 100644
index 0000000..41ae53f
--- /dev/null
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/AgentPreferences/LocalAgentPreferencesServiceConnector.cs
@@ -0,0 +1,153 @@
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
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using log4net;
32using Mono.Addins;
33using Nini.Config;
34using OpenSim.Region.Framework.Interfaces;
35using OpenSim.Region.Framework.Scenes;
36using OpenSim.Server.Base;
37using OpenSim.Services.Interfaces;
38
39using OpenMetaverse;
40
41namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.AgentPreferences
42{
43 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalAgentPreferencesServicesConnector")]
44 public class LocalAgentPreferencesServicesConnector : ISharedRegionModule, IAgentPreferencesService
45 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47
48 private IAgentPreferencesService m_AgentPreferencesService;
49 private bool m_Enabled = false;
50
51 #region ISharedRegionModule
52
53 public Type ReplaceableInterface
54 {
55 get { return null; }
56 }
57
58 public string Name
59 {
60 get { return "LocalAgentPreferencesServicesConnector"; }
61 }
62
63 public void Initialise(IConfigSource source)
64 {
65 IConfig moduleConfig = source.Configs["Modules"];
66 if (moduleConfig != null)
67 {
68 string name = moduleConfig.GetString("AgentPreferencesServices", "");
69 if (name == Name)
70 {
71 IConfig userConfig = source.Configs["AgentPreferencesService"];
72 if (userConfig == null)
73 {
74 m_log.Error("[AGENT PREFERENCES CONNECTOR]: AgentPreferencesService missing from OpenSim.ini");
75 return;
76 }
77
78 string serviceDll = userConfig.GetString("LocalServiceModule", String.Empty);
79
80 if (String.IsNullOrEmpty(serviceDll))
81 {
82 m_log.Error("[AGENT PREFERENCES CONNECTOR]: No AgentPreferencesModule named in section AgentPreferencesService");
83 return;
84 }
85
86 Object[] args = new Object[] { source };
87 m_AgentPreferencesService = ServerUtils.LoadPlugin<IAgentPreferencesService>(serviceDll, args);
88
89 if (m_AgentPreferencesService == null)
90 {
91 m_log.Error("[AGENT PREFERENCES CONNECTOR]: Can't load agent preferences service");
92 return;
93 }
94 m_Enabled = true;
95 m_log.Info("[AGENT PREFERENCES CONNECTOR]: Local agent preferences connector enabled");
96 }
97 }
98 }
99
100 public void PostInitialise()
101 {
102 if (!m_Enabled)
103 return;
104 }
105
106 public void Close()
107 {
108 if (!m_Enabled)
109 return;
110 }
111
112 public void AddRegion(Scene scene)
113 {
114 if (!m_Enabled)
115 return;
116
117 scene.RegisterModuleInterface<IAgentPreferencesService>(this);
118 }
119
120 public void RemoveRegion(Scene scene)
121 {
122 if (!m_Enabled)
123 return;
124 }
125
126 public void RegionLoaded(Scene scene)
127 {
128 if (!m_Enabled)
129 return;
130 }
131
132 #endregion ISharedRegionModule
133
134 #region IAgentPreferencesService
135
136 public AgentPrefs GetAgentPreferences(UUID principalID)
137 {
138 return m_AgentPreferencesService.GetAgentPreferences(principalID);
139 }
140
141 public bool StoreAgentPreferences(AgentPrefs data)
142 {
143 return m_AgentPreferencesService.StoreAgentPreferences(data);
144 }
145
146 public string GetLang(UUID principalID)
147 {
148 return m_AgentPreferencesService.GetLang(principalID);
149 }
150
151 #endregion IAgentPreferencesService
152 }
153}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/AgentPreferences/RemoteAgentPreferencesServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/AgentPreferences/RemoteAgentPreferencesServiceConnector.cs
new file mode 100644
index 0000000..ad9544a
--- /dev/null
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/AgentPreferences/RemoteAgentPreferencesServiceConnector.cs
@@ -0,0 +1,116 @@
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
28
29using System;
30using System.Collections.Generic;
31using System.Reflection;
32
33using OpenSim.Region.Framework.Interfaces;
34using OpenSim.Region.Framework.Scenes;
35using OpenSim.Server.Base;
36using OpenSim.Services.Interfaces;
37using OpenSim.Services.Connectors;
38
39using OpenMetaverse;
40using log4net;
41using Mono.Addins;
42using Nini.Config;
43
44namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.AgentPreferences
45{
46 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteAgentPreferencesServicesConnector")]
47 public class RemoteAgentPreferencesServicesConnector : AgentPreferencesServicesConnector,
48 ISharedRegionModule, IAgentPreferencesService
49 {
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51
52 private bool m_Enabled = false;
53
54 public Type ReplaceableInterface
55 {
56 get { return null; }
57 }
58
59 public string Name
60 {
61 get { return "RemoteAgentPreferencesServicesConnector"; }
62 }
63
64 public override void Initialise(IConfigSource source)
65 {
66 IConfig moduleConfig = source.Configs["Modules"];
67 if (moduleConfig != null)
68 {
69 string name = moduleConfig.GetString("AgentPreferencesServices", "");
70 if (name == Name)
71 {
72 IConfig userConfig = source.Configs["AgentPreferencesService"];
73 if (userConfig == null)
74 {
75 m_log.Error("[AGENT PREFERENCES CONNECTOR]: AgentPreferencesService missing from OpenSim.ini");
76 return;
77 }
78
79 m_Enabled = true;
80
81 base.Initialise(source);
82
83 m_log.Info("[AGENT PREFERENCES CONNECTOR]: Remote agent preferences enabled");
84 }
85 }
86 }
87
88 public void PostInitialise()
89 {
90 /* no op */
91 }
92
93 public void Close()
94 {
95 /* no op */
96 }
97
98 public void AddRegion(Scene scene)
99 {
100 if (!m_Enabled)
101 return;
102
103 scene.RegisterModuleInterface<IAgentPreferencesService>(this);
104 }
105
106 public void RemoveRegion(Scene scene)
107 {
108 /* no op */
109 }
110
111 public void RegionLoaded(Scene scene)
112 {
113 /* no op */
114 }
115 }
116} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
index 9f58175..7fcfc74 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
@@ -69,6 +69,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
69 get { return "HGAssetBroker"; } 69 get { return "HGAssetBroker"; }
70 } 70 }
71 71
72 public HGAssetBroker() {}
73
74 public HGAssetBroker(IConfigSource config)
75 {
76 Initialise(config);
77 }
78
72 public void Initialise(IConfigSource source) 79 public void Initialise(IConfigSource source)
73 { 80 {
74 IConfig moduleConfig = source.Configs["Modules"]; 81 IConfig moduleConfig = source.Configs["Modules"];
@@ -288,7 +295,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
288 295
289 if (asset != null) 296 if (asset != null)
290 { 297 {
291 Util.FireAndForget(delegate { handler(id, sender, asset); }); 298 Util.FireAndForget(delegate { handler(id, sender, asset); }, null, "HGAssetBroker.GotFromCache");
292 return true; 299 return true;
293 } 300 }
294 301
@@ -312,6 +319,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
312 } 319 }
313 } 320 }
314 321
322 public virtual bool[] AssetsExist(string[] ids)
323 {
324 int numHG = 0;
325 foreach (string id in ids)
326 {
327 if (IsHG(id))
328 ++numHG;
329 }
330
331 if (numHG == 0)
332 return m_GridService.AssetsExist(ids);
333 else if (numHG == ids.Length)
334 return m_HGService.AssetsExist(ids);
335 else
336 throw new Exception("[HG ASSET CONNECTOR]: AssetsExist: all the assets must be either local or foreign");
337 }
338
315 public string Store(AssetBase asset) 339 public string Store(AssetBase asset)
316 { 340 {
317 bool isHG = IsHG(asset.ID); 341 bool isHG = IsHG(asset.ID);
@@ -329,7 +353,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
329 return asset.ID; 353 return asset.ID;
330 } 354 }
331 355
332 string id = string.Empty; 356 string id;
333 if (IsHG(asset.ID)) 357 if (IsHG(asset.ID))
334 { 358 {
335 if (m_AssetPerms.AllowedExport(asset.Type)) 359 if (m_AssetPerms.AllowedExport(asset.Type))
@@ -340,18 +364,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
340 else 364 else
341 id = m_GridService.Store(asset); 365 id = m_GridService.Store(asset);
342 366
343 if (id != String.Empty) 367 if (String.IsNullOrEmpty(id))
344 { 368 return string.Empty;
345 // Placing this here, so that this work with old asset servers that don't send any reply back 369
346 // SynchronousRestObjectRequester returns somethins that is not an empty string 370 asset.ID = id;
347 if (id != null)
348 asset.ID = id;
349 371
350 if (m_Cache != null) 372 if (m_Cache != null)
351 m_Cache.Cache(asset); 373 m_Cache.Cache(asset);
352 }
353 return id;
354 374
375 return id;
355 } 376 }
356 377
357 public bool UpdateContent(string id, byte[] data) 378 public bool UpdateContent(string id, byte[] data)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
index 52b1039..5f34450 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
@@ -236,7 +236,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
236 236
237 if (asset != null) 237 if (asset != null)
238 { 238 {
239 Util.FireAndForget(delegate { handler(id, sender, asset); }); 239 Util.FireAndForget(
240 o => handler(id, sender, asset), null, "LocalAssetServiceConnector.GotFromCacheCallback");
240 return true; 241 return true;
241 } 242 }
242 } 243 }
@@ -249,10 +250,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
249// if (null == a) 250// if (null == a)
250// m_log.WarnFormat("[LOCAL ASSET SERVICES CONNECTOR]: Could not asynchronously find asset with id {0}", id); 251// m_log.WarnFormat("[LOCAL ASSET SERVICES CONNECTOR]: Could not asynchronously find asset with id {0}", id);
251 252
252 Util.FireAndForget(delegate { handler(assetID, s, a); }); 253 Util.FireAndForget(
254 o => handler(assetID, s, a), null, "LocalAssetServiceConnector.GotFromServiceCallback");
253 }); 255 });
254 } 256 }
255 257
258 public bool[] AssetsExist(string[] ids)
259 {
260 return m_AssetService.AssetsExist(ids);
261 }
262
256 public string Store(AssetBase asset) 263 public string Store(AssetBase asset)
257 { 264 {
258 if (m_Cache != null) 265 if (m_Cache != null)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs
index 4470799..93dff1f 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs
@@ -89,35 +89,43 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
89 public bool IsAuthorizedForRegion( 89 public bool IsAuthorizedForRegion(
90 string user, string firstName, string lastName, string regionID, out string message) 90 string user, string firstName, string lastName, string regionID, out string message)
91 { 91 {
92 message = "authorized";
93
94 // This should not happen 92 // This should not happen
95 if (m_Scene.RegionInfo.RegionID.ToString() != regionID) 93 if (m_Scene.RegionInfo.RegionID.ToString() != regionID)
96 { 94 {
97 m_log.WarnFormat("[AuthorizationService]: Service for region {0} received request to authorize for region {1}", 95 m_log.WarnFormat("[AuthorizationService]: Service for region {0} received request to authorize for region {1}",
98 m_Scene.RegionInfo.RegionID, regionID); 96 m_Scene.RegionInfo.RegionID, regionID);
99 return true; 97 message = string.Format("Region {0} received request to authorize for region {1}", m_Scene.RegionInfo.RegionID, regionID);
98 return false;
100 } 99 }
101 100
102 if (m_accessValue == AccessFlags.None) 101 if (m_accessValue == AccessFlags.None)
102 {
103 message = "Authorized";
103 return true; 104 return true;
105 }
104 106
105 UUID userID = new UUID(user); 107 UUID userID = new UUID(user);
106 bool authorized = true; 108
107 if ((m_accessValue & AccessFlags.DisallowForeigners) == AccessFlags.DisallowForeigners) 109 if ((m_accessValue & AccessFlags.DisallowForeigners) != 0)
108 { 110 {
109 authorized = m_UserManagement.IsLocalGridUser(userID); 111 if (!m_UserManagement.IsLocalGridUser(userID))
110 if (!authorized) 112 {
111 message = "no foreigner users allowed in this region"; 113 message = "No foreign users allowed in this region";
114 return false;
115 }
112 } 116 }
113 if (authorized && (m_accessValue & AccessFlags.DisallowResidents) == AccessFlags.DisallowResidents) 117
118 if ((m_accessValue & AccessFlags.DisallowResidents) != 0)
114 { 119 {
115 authorized = m_Scene.Permissions.IsGod(userID) | m_Scene.Permissions.IsAdministrator(userID); 120 if (!(m_Scene.Permissions.IsGod(userID) || m_Scene.Permissions.IsAdministrator(userID)))
116 if (!authorized) 121 {
117 message = "only Admins and Managers allowed in this region"; 122 message = "Only Admins and Managers allowed in this region";
123 return false;
124 }
118 } 125 }
119 126
120 return authorized; 127 message = "Authorized";
128 return true;
121 } 129 }
122 130
123 } 131 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
index 8ccad39..1f782f5 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
@@ -48,6 +48,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
48 private static readonly ILog m_log = 48 private static readonly ILog m_log =
49 LogManager.GetLogger( 49 LogManager.GetLogger(
50 MethodBase.GetCurrentMethod().DeclaringType); 50 MethodBase.GetCurrentMethod().DeclaringType);
51 private static string LogHeader = "[LOCAL GRID SERVICE CONNECTOR]";
51 52
52 private IGridService m_GridService; 53 private IGridService m_GridService;
53 private Dictionary<UUID, RegionCache> m_LocalCache = new Dictionary<UUID, RegionCache>(); 54 private Dictionary<UUID, RegionCache> m_LocalCache = new Dictionary<UUID, RegionCache>();
@@ -56,12 +57,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
56 57
57 public LocalGridServicesConnector() 58 public LocalGridServicesConnector()
58 { 59 {
59 m_log.Debug("[LOCAL GRID SERVICE CONNECTOR]: LocalGridServicesConnector no parms."); 60 m_log.DebugFormat("{0} LocalGridServicesConnector no parms.", LogHeader);
60 } 61 }
61 62
62 public LocalGridServicesConnector(IConfigSource source) 63 public LocalGridServicesConnector(IConfigSource source)
63 { 64 {
64 m_log.Debug("[LOCAL GRID SERVICE CONNECTOR]: LocalGridServicesConnector instantiated directly."); 65 m_log.DebugFormat("{0} LocalGridServicesConnector instantiated directly.", LogHeader);
65 InitialiseService(source); 66 InitialiseService(source);
66 } 67 }
67 68
@@ -93,15 +94,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
93 94
94 private void InitialiseService(IConfigSource source) 95 private void InitialiseService(IConfigSource source)
95 { 96 {
96 IConfig assetConfig = source.Configs["GridService"]; 97 IConfig config = source.Configs["GridService"];
97 if (assetConfig == null) 98 if (config == null)
98 { 99 {
99 m_log.Error("[LOCAL GRID SERVICE CONNECTOR]: GridService missing from OpenSim.ini"); 100 m_log.Error("[LOCAL GRID SERVICE CONNECTOR]: GridService missing from OpenSim.ini");
100 return; 101 return;
101 } 102 }
102 103
103 string serviceDll = assetConfig.GetString("LocalServiceModule", 104 string serviceDll = config.GetString("LocalServiceModule", String.Empty);
104 String.Empty);
105 105
106 if (serviceDll == String.Empty) 106 if (serviceDll == String.Empty)
107 { 107 {
@@ -192,9 +192,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
192 return m_GridService.GetRegionByUUID(scopeID, regionID); 192 return m_GridService.GetRegionByUUID(scopeID, regionID);
193 } 193 }
194 194
195 // Get a region given its base coordinates.
196 // NOTE: this is NOT 'get a region by some point in the region'. The coordinate MUST
197 // be the base coordinate of the region.
195 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) 198 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
196 { 199 {
197 GridRegion region = null; 200 GridRegion region = null;
201 uint regionX = Util.WorldToRegionLoc((uint)x);
202 uint regionY = Util.WorldToRegionLoc((uint)y);
203
204 // Sanity check
205 if ((Util.RegionToWorldLoc(regionX) != (uint)x) || (Util.RegionToWorldLoc(regionY) != (uint)y))
206 {
207 m_log.WarnFormat("{0} GetRegionByPosition. Bad position requested: not the base of the region. Requested Pos=<{1},{2}>, Should Be=<{3},{4}>",
208 LogHeader, x, y, Util.RegionToWorldLoc(regionX), Util.RegionToWorldLoc(regionY));
209 }
198 210
199 // First see if it's a neighbour, even if it isn't on this sim. 211 // First see if it's a neighbour, even if it isn't on this sim.
200 // Neighbour data is cached in memory, so this is fast 212 // Neighbour data is cached in memory, so this is fast
@@ -206,13 +218,33 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
206 region = rcache.GetRegionByPosition(x, y); 218 region = rcache.GetRegionByPosition(x, y);
207 if (region != null) 219 if (region != null)
208 { 220 {
209 return region; 221 m_log.DebugFormat("{0} GetRegionByPosition. Found region {1} in cache (of region {2}). Pos=<{3},{4}>",
222 LogHeader, region.RegionName, rcache.RegionName,
223 Util.WorldToRegionLoc((uint)region.RegionLocX), Util.WorldToRegionLoc((uint)region.RegionLocY));
224 break;
210 } 225 }
211 } 226 }
212 } 227 }
213 228
214 // Then try on this sim (may be a lookup in DB if this is using MySql). 229 // Then try on this sim (may be a lookup in DB if this is using MySql).
215 return m_GridService.GetRegionByPosition(scopeID, x, y); 230 if (region == null)
231 {
232 region = m_GridService.GetRegionByPosition(scopeID, x, y);
233
234 if (region == null)
235 {
236 m_log.DebugFormat("{0} GetRegionByPosition. Region not found by grid service. Pos=<{1},{2}>",
237 LogHeader, regionX, regionY);
238 }
239 else
240 {
241 m_log.DebugFormat("{0} GetRegionByPosition. Got region {1} from grid service. Pos=<{2},{3}>",
242 LogHeader, region.RegionName,
243 Util.WorldToRegionLoc((uint)region.RegionLocX), Util.WorldToRegionLoc((uint)region.RegionLocY));
244 }
245 }
246
247 return region;
216 } 248 }
217 249
218 public GridRegion GetRegionByName(UUID scopeID, string regionName) 250 public GridRegion GetRegionByName(UUID scopeID, string regionName)
@@ -255,6 +287,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
255 return m_GridService.GetRegionFlags(scopeID, regionID); 287 return m_GridService.GetRegionFlags(scopeID, regionID);
256 } 288 }
257 289
290 public Dictionary<string, object> GetExtraFeatures()
291 {
292 return m_GridService.GetExtraFeatures();
293 }
294
258 #endregion 295 #endregion
259 296
260 public void HandleShowNeighboursCommand(string module, string[] cmdparams) 297 public void HandleShowNeighboursCommand(string module, string[] cmdparams)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
index 6a57d1f..68ae4fa 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
@@ -28,6 +28,7 @@
28using log4net; 28using log4net;
29using Mono.Addins; 29using Mono.Addins;
30using System; 30using System;
31using System.Collections;
31using System.Collections.Generic; 32using System.Collections.Generic;
32using System.Reflection; 33using System.Reflection;
33using Nini.Config; 34using Nini.Config;
@@ -186,18 +187,41 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
186 return rinfo; 187 return rinfo;
187 } 188 }
188 189
190 // Get a region given its base world coordinates (in meters).
191 // NOTE: this is NOT 'get a region by some point in the region'. The coordinate MUST
192 // be the base coordinate of the region.
193 // The coordinates are world coords (meters), NOT region units.
189 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) 194 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
190 { 195 {
196 ulong regionHandle = Util.RegionWorldLocToHandle((uint)x, (uint)y);
197 uint regionX = Util.WorldToRegionLoc((uint)x);
198 uint regionY = Util.WorldToRegionLoc((uint)y);
199
200 // Sanity check
201 if ((Util.RegionToWorldLoc(regionX) != (uint)x) || (Util.RegionToWorldLoc(regionY) != (uint)y))
202 {
203 m_log.WarnFormat("[REMOTE GRID CONNECTOR]: GetRegionByPosition. Bad position requested: not the base of the region. Requested Pos=<{0},{1}>, Should Be=<{2},{3}>",
204 x, y, Util.RegionToWorldLoc(regionX), Util.RegionToWorldLoc(regionY));
205 }
206
191 bool inCache = false; 207 bool inCache = false;
192 GridRegion rinfo = m_RegionInfoCache.Get(scopeID, Util.UIntsToLong((uint)x, (uint)y), out inCache); 208 GridRegion rinfo = m_RegionInfoCache.Get(scopeID, regionHandle, out inCache);
193 if (inCache) 209 if (inCache)
210 {
211 m_log.DebugFormat("[REMOTE GRID CONNECTOR]: GetRegionByPosition. Found region {0} in cache. Pos=<{1},{2}>, RegionHandle={3}",
212 (rinfo == null) ? "<missing>" : rinfo.RegionName, regionX, regionY, (rinfo == null) ? regionHandle : rinfo.RegionHandle);
194 return rinfo; 213 return rinfo;
214 }
195 215
196 rinfo = m_LocalGridService.GetRegionByPosition(scopeID, x, y); 216 rinfo = m_LocalGridService.GetRegionByPosition(scopeID, x, y);
197 if (rinfo == null) 217 if (rinfo == null)
198 rinfo = m_RemoteGridService.GetRegionByPosition(scopeID, x, y); 218 rinfo = m_RemoteGridService.GetRegionByPosition(scopeID, x, y);
199 219
200 m_RegionInfoCache.Cache(rinfo); 220 m_RegionInfoCache.Cache(rinfo);
221
222 m_log.DebugFormat("[REMOTE GRID CONNECTOR]: GetRegionByPosition. Added region {0} to the cache. Pos=<{1},{2}>, RegionHandle={3}",
223 (rinfo == null) ? "<missing>" : rinfo.RegionName, regionX, regionY, (rinfo == null) ? regionHandle : rinfo.RegionHandle);
224
201 return rinfo; 225 return rinfo;
202 } 226 }
203 227
@@ -345,6 +369,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
345 369
346 return flags; 370 return flags;
347 } 371 }
372
373 public Dictionary<string, object> GetExtraFeatures()
374 {
375 Dictionary<string, object> extraFeatures;
376 extraFeatures = m_LocalGridService.GetExtraFeatures();
377
378 if (extraFeatures.Count == 0)
379 extraFeatures = m_RemoteGridService.GetExtraFeatures();
380
381 return extraFeatures;
382 }
348 #endregion 383 #endregion
349 } 384 }
350} 385}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs
index 6a49ca7..8df30d4 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs
@@ -34,6 +34,7 @@ using log4net.Config;
34using Nini.Config; 34using Nini.Config;
35using NUnit.Framework; 35using NUnit.Framework;
36using OpenMetaverse; 36using OpenMetaverse;
37
37using OpenSim.Framework; 38using OpenSim.Framework;
38using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid; 39using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid;
39using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
@@ -84,7 +85,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
84 r1.ExternalHostName = "127.0.0.1"; 85 r1.ExternalHostName = "127.0.0.1";
85 r1.HttpPort = 9001; 86 r1.HttpPort = 9001;
86 r1.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0); 87 r1.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0);
87 Scene s = new Scene(new RegionInfo()); 88 Scene s = new Scene(new RegionInfo(), null);
88 s.RegionInfo.RegionID = r1.RegionID; 89 s.RegionInfo.RegionID = r1.RegionID;
89 m_LocalConnector.AddRegion(s); 90 m_LocalConnector.AddRegion(s);
90 91
@@ -96,7 +97,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
96 r2.ExternalHostName = "127.0.0.1"; 97 r2.ExternalHostName = "127.0.0.1";
97 r2.HttpPort = 9002; 98 r2.HttpPort = 9002;
98 r2.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0); 99 r2.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0);
99 s = new Scene(new RegionInfo()); 100 s = new Scene(new RegionInfo(), null);
100 s.RegionInfo.RegionID = r2.RegionID; 101 s.RegionInfo.RegionID = r2.RegionID;
101 m_LocalConnector.AddRegion(s); 102 m_LocalConnector.AddRegion(s);
102 103
@@ -108,7 +109,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
108 r3.ExternalHostName = "127.0.0.1"; 109 r3.ExternalHostName = "127.0.0.1";
109 r3.HttpPort = 9003; 110 r3.HttpPort = 9003;
110 r3.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0); 111 r3.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0);
111 s = new Scene(new RegionInfo()); 112 s = new Scene(new RegionInfo(), null);
112 s.RegionInfo.RegionID = r3.RegionID; 113 s.RegionInfo.RegionID = r3.RegionID;
113 m_LocalConnector.AddRegion(s); 114 m_LocalConnector.AddRegion(s);
114 115
@@ -120,7 +121,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
120 r4.ExternalHostName = "127.0.0.1"; 121 r4.ExternalHostName = "127.0.0.1";
121 r4.HttpPort = 9004; 122 r4.HttpPort = 9004;
122 r4.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0); 123 r4.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0);
123 s = new Scene(new RegionInfo()); 124 s = new Scene(new RegionInfo(), null);
124 s.RegionInfo.RegionID = r4.RegionID; 125 s.RegionInfo.RegionID = r4.RegionID;
125 m_LocalConnector.AddRegion(s); 126 m_LocalConnector.AddRegion(s);
126 127
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs
index e05d186..2238c90 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs
@@ -67,10 +67,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
67 { 67 {
68 if (sp.PresenceType != PresenceType.Npc) 68 if (sp.PresenceType != PresenceType.Npc)
69 { 69 {
70 string userid = sp.Scene.UserManagementModule.GetUserUUI(sp.UUID); 70 string userid;
71 //m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected root presence {0} in {1}", userid, sp.Scene.RegionInfo.RegionName); 71 //m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected root presence {0} in {1}", userid, sp.Scene.RegionInfo.RegionName);
72 m_GridUserService.SetLastPosition( 72 if (sp.Scene.UserManagementModule.GetUserUUI(sp.UUID, out userid))
73 userid, UUID.Zero, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); 73 {
74 /* we only setposition on known agents that have a valid lookup */
75 m_GridUserService.SetLastPosition(
76 userid, UUID.Zero, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
77 }
74 } 78 }
75 } 79 }
76 80
@@ -89,17 +93,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
89 if (client.SceneAgent.IsChildAgent) 93 if (client.SceneAgent.IsChildAgent)
90 return; 94 return;
91 95
92 string userId = client.AgentId.ToString(); 96 string userId;
97 /* without scene we cannot logout correctly at all since we do not know how to send the loggedout message then */
93 if (client.Scene is Scene) 98 if (client.Scene is Scene)
94 { 99 {
95 Scene s = (Scene)client.Scene; 100 Scene s = (Scene)client.Scene;
96 userId = s.UserManagementModule.GetUserUUI(client.AgentId); 101 userId = s.UserManagementModule.GetUserUUI(client.AgentId);
102 if(s.UserManagementModule.GetUserUUI(client.AgentId, out userId))
103 {
104 m_GridUserService.LoggedOut(
105 userId, client.SessionId, client.Scene.RegionInfo.RegionID,
106 client.SceneAgent.AbsolutePosition, client.SceneAgent.Lookat);
107 }
97 } 108 }
98 //m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected client logout {0} in {1}", userId, client.Scene.RegionInfo.RegionName);
99 109
100 m_GridUserService.LoggedOut(
101 userId, client.SessionId, client.Scene.RegionInfo.RegionID,
102 client.SceneAgent.AbsolutePosition, client.SceneAgent.Lookat);
103 } 110 }
104 } 111 }
105} 112}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index 77a3c82..48f228a 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -62,6 +62,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
62 62
63 private InventoryCache m_Cache = new InventoryCache(); 63 private InventoryCache m_Cache = new InventoryCache();
64 64
65 /// <summary>
66 /// Used to serialize inventory requests.
67 /// </summary>
68 private object m_Lock = new object();
69
65 protected IUserManagement m_UserManagement; 70 protected IUserManagement m_UserManagement;
66 protected IUserManagement UserManagementModule 71 protected IUserManagement UserManagementModule
67 { 72 {
@@ -244,7 +249,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
244 if (inventoryURL != null && inventoryURL != string.Empty) 249 if (inventoryURL != null && inventoryURL != string.Empty)
245 { 250 {
246 inventoryURL = inventoryURL.Trim(new char[] { '/' }); 251 inventoryURL = inventoryURL.Trim(new char[] { '/' });
247 m_InventoryURLs.Add(userID, inventoryURL); 252 m_InventoryURLs[userID] = inventoryURL;
248 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Added {0} to the cache of inventory URLs", inventoryURL); 253 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Added {0} to the cache of inventory URLs", inventoryURL);
249 return; 254 return;
250 } 255 }
@@ -301,7 +306,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
301 306
302 public bool CreateUserInventory(UUID userID) 307 public bool CreateUserInventory(UUID userID)
303 { 308 {
304 return m_LocalGridInventoryService.CreateUserInventory(userID); 309 lock (m_Lock)
310 return m_LocalGridInventoryService.CreateUserInventory(userID);
305 } 311 }
306 312
307 public List<InventoryFolderBase> GetInventorySkeleton(UUID userID) 313 public List<InventoryFolderBase> GetInventorySkeleton(UUID userID)
@@ -309,36 +315,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
309 string invURL = GetInventoryServiceURL(userID); 315 string invURL = GetInventoryServiceURL(userID);
310 316
311 if (invURL == null) // not there, forward to local inventory connector to resolve 317 if (invURL == null) // not there, forward to local inventory connector to resolve
312 return m_LocalGridInventoryService.GetInventorySkeleton(userID); 318 lock (m_Lock)
319 return m_LocalGridInventoryService.GetInventorySkeleton(userID);
313 320
314 IInventoryService connector = GetConnector(invURL); 321 IInventoryService connector = GetConnector(invURL);
315 322
316 return connector.GetInventorySkeleton(userID); 323 return connector.GetInventorySkeleton(userID);
317 } 324 }
318 325
319 public InventoryCollection GetUserInventory(UUID userID)
320 {
321 string invURL = GetInventoryServiceURL(userID);
322 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetUserInventory for {0} {1}", userID, invURL);
323
324 if (invURL == null) // not there, forward to local inventory connector to resolve
325 return m_LocalGridInventoryService.GetUserInventory(userID);
326
327 InventoryCollection c = m_Cache.GetUserInventory(userID);
328 if (c != null)
329 return c;
330
331 IInventoryService connector = GetConnector(invURL);
332 c = connector.GetUserInventory(userID);
333
334 m_Cache.Cache(userID, c);
335 return c;
336 }
337
338 public void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
339 {
340 }
341
342 public InventoryFolderBase GetRootFolder(UUID userID) 326 public InventoryFolderBase GetRootFolder(UUID userID)
343 { 327 {
344 //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetRootFolder for {0}", userID); 328 //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetRootFolder for {0}", userID);
@@ -349,7 +333,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
349 string invURL = GetInventoryServiceURL(userID); 333 string invURL = GetInventoryServiceURL(userID);
350 334
351 if (invURL == null) // not there, forward to local inventory connector to resolve 335 if (invURL == null) // not there, forward to local inventory connector to resolve
352 return m_LocalGridInventoryService.GetRootFolder(userID); 336 lock (m_Lock)
337 return m_LocalGridInventoryService.GetRootFolder(userID);
353 338
354 IInventoryService connector = GetConnector(invURL); 339 IInventoryService connector = GetConnector(invURL);
355 340
@@ -360,7 +345,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
360 return root; 345 return root;
361 } 346 }
362 347
363 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) 348 public InventoryFolderBase GetFolderForType(UUID userID, FolderType type)
364 { 349 {
365 //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetFolderForType {0} type {1}", userID, type); 350 //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetFolderForType {0} type {1}", userID, type);
366 InventoryFolderBase f = m_Cache.GetFolderForType(userID, type); 351 InventoryFolderBase f = m_Cache.GetFolderForType(userID, type);
@@ -370,7 +355,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
370 string invURL = GetInventoryServiceURL(userID); 355 string invURL = GetInventoryServiceURL(userID);
371 356
372 if (invURL == null) // not there, forward to local inventory connector to resolve 357 if (invURL == null) // not there, forward to local inventory connector to resolve
373 return m_LocalGridInventoryService.GetFolderForType(userID, type); 358 lock (m_Lock)
359 return m_LocalGridInventoryService.GetFolderForType(userID, type);
374 360
375 IInventoryService connector = GetConnector(invURL); 361 IInventoryService connector = GetConnector(invURL);
376 362
@@ -388,7 +374,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
388 string invURL = GetInventoryServiceURL(userID); 374 string invURL = GetInventoryServiceURL(userID);
389 375
390 if (invURL == null) // not there, forward to local inventory connector to resolve 376 if (invURL == null) // not there, forward to local inventory connector to resolve
391 return m_LocalGridInventoryService.GetFolderContent(userID, folderID); 377 lock (m_Lock)
378 return m_LocalGridInventoryService.GetFolderContent(userID, folderID);
392 379
393 InventoryCollection c = m_Cache.GetFolderContent(userID, folderID); 380 InventoryCollection c = m_Cache.GetFolderContent(userID, folderID);
394 if (c != null) 381 if (c != null)
@@ -398,8 +385,27 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
398 } 385 }
399 386
400 IInventoryService connector = GetConnector(invURL); 387 IInventoryService connector = GetConnector(invURL);
388
401 return connector.GetFolderContent(userID, folderID); 389 return connector.GetFolderContent(userID, folderID);
390 }
391
392 public InventoryCollection[] GetMultipleFoldersContent(UUID userID, UUID[] folderIDs)
393 {
394 string invURL = GetInventoryServiceURL(userID);
395
396 if (invURL == null) // not there, forward to local inventory connector to resolve
397 lock (m_Lock)
398 return m_LocalGridInventoryService.GetMultipleFoldersContent(userID, folderIDs);
399
400 else
401 {
402 InventoryCollection[] coll = new InventoryCollection[folderIDs.Length];
403 int i = 0;
404 foreach (UUID fid in folderIDs)
405 coll[i++] = GetFolderContent(userID, fid);
402 406
407 return coll;
408 }
403 } 409 }
404 410
405 public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) 411 public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
@@ -409,7 +415,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
409 string invURL = GetInventoryServiceURL(userID); 415 string invURL = GetInventoryServiceURL(userID);
410 416
411 if (invURL == null) // not there, forward to local inventory connector to resolve 417 if (invURL == null) // not there, forward to local inventory connector to resolve
412 return m_LocalGridInventoryService.GetFolderItems(userID, folderID); 418 lock (m_Lock)
419 return m_LocalGridInventoryService.GetFolderItems(userID, folderID);
413 420
414 List<InventoryItemBase> items = m_Cache.GetFolderItems(userID, folderID); 421 List<InventoryItemBase> items = m_Cache.GetFolderItems(userID, folderID);
415 if (items != null) 422 if (items != null)
@@ -419,8 +426,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
419 } 426 }
420 427
421 IInventoryService connector = GetConnector(invURL); 428 IInventoryService connector = GetConnector(invURL);
422 return connector.GetFolderItems(userID, folderID);
423 429
430 return connector.GetFolderItems(userID, folderID);
424 } 431 }
425 432
426 public bool AddFolder(InventoryFolderBase folder) 433 public bool AddFolder(InventoryFolderBase folder)
@@ -433,7 +440,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
433 string invURL = GetInventoryServiceURL(folder.Owner); 440 string invURL = GetInventoryServiceURL(folder.Owner);
434 441
435 if (invURL == null) // not there, forward to local inventory connector to resolve 442 if (invURL == null) // not there, forward to local inventory connector to resolve
436 return m_LocalGridInventoryService.AddFolder(folder); 443 lock (m_Lock)
444 return m_LocalGridInventoryService.AddFolder(folder);
437 445
438 IInventoryService connector = GetConnector(invURL); 446 IInventoryService connector = GetConnector(invURL);
439 447
@@ -450,7 +458,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
450 string invURL = GetInventoryServiceURL(folder.Owner); 458 string invURL = GetInventoryServiceURL(folder.Owner);
451 459
452 if (invURL == null) // not there, forward to local inventory connector to resolve 460 if (invURL == null) // not there, forward to local inventory connector to resolve
453 return m_LocalGridInventoryService.UpdateFolder(folder); 461 lock (m_Lock)
462 return m_LocalGridInventoryService.UpdateFolder(folder);
454 463
455 IInventoryService connector = GetConnector(invURL); 464 IInventoryService connector = GetConnector(invURL);
456 465
@@ -469,7 +478,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
469 string invURL = GetInventoryServiceURL(ownerID); 478 string invURL = GetInventoryServiceURL(ownerID);
470 479
471 if (invURL == null) // not there, forward to local inventory connector to resolve 480 if (invURL == null) // not there, forward to local inventory connector to resolve
472 return m_LocalGridInventoryService.DeleteFolders(ownerID, folderIDs); 481 lock (m_Lock)
482 return m_LocalGridInventoryService.DeleteFolders(ownerID, folderIDs);
473 483
474 IInventoryService connector = GetConnector(invURL); 484 IInventoryService connector = GetConnector(invURL);
475 485
@@ -486,7 +496,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
486 string invURL = GetInventoryServiceURL(folder.Owner); 496 string invURL = GetInventoryServiceURL(folder.Owner);
487 497
488 if (invURL == null) // not there, forward to local inventory connector to resolve 498 if (invURL == null) // not there, forward to local inventory connector to resolve
489 return m_LocalGridInventoryService.MoveFolder(folder); 499 lock (m_Lock)
500 return m_LocalGridInventoryService.MoveFolder(folder);
490 501
491 IInventoryService connector = GetConnector(invURL); 502 IInventoryService connector = GetConnector(invURL);
492 503
@@ -503,7 +514,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
503 string invURL = GetInventoryServiceURL(folder.Owner); 514 string invURL = GetInventoryServiceURL(folder.Owner);
504 515
505 if (invURL == null) // not there, forward to local inventory connector to resolve 516 if (invURL == null) // not there, forward to local inventory connector to resolve
506 return m_LocalGridInventoryService.PurgeFolder(folder); 517 lock (m_Lock)
518 return m_LocalGridInventoryService.PurgeFolder(folder);
507 519
508 IInventoryService connector = GetConnector(invURL); 520 IInventoryService connector = GetConnector(invURL);
509 521
@@ -520,7 +532,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
520 string invURL = GetInventoryServiceURL(item.Owner); 532 string invURL = GetInventoryServiceURL(item.Owner);
521 533
522 if (invURL == null) // not there, forward to local inventory connector to resolve 534 if (invURL == null) // not there, forward to local inventory connector to resolve
523 return m_LocalGridInventoryService.AddItem(item); 535 lock (m_Lock)
536 return m_LocalGridInventoryService.AddItem(item);
524 537
525 IInventoryService connector = GetConnector(invURL); 538 IInventoryService connector = GetConnector(invURL);
526 539
@@ -537,7 +550,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
537 string invURL = GetInventoryServiceURL(item.Owner); 550 string invURL = GetInventoryServiceURL(item.Owner);
538 551
539 if (invURL == null) // not there, forward to local inventory connector to resolve 552 if (invURL == null) // not there, forward to local inventory connector to resolve
540 return m_LocalGridInventoryService.UpdateItem(item); 553 lock (m_Lock)
554 return m_LocalGridInventoryService.UpdateItem(item);
541 555
542 IInventoryService connector = GetConnector(invURL); 556 IInventoryService connector = GetConnector(invURL);
543 557
@@ -556,7 +570,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
556 string invURL = GetInventoryServiceURL(ownerID); 570 string invURL = GetInventoryServiceURL(ownerID);
557 571
558 if (invURL == null) // not there, forward to local inventory connector to resolve 572 if (invURL == null) // not there, forward to local inventory connector to resolve
559 return m_LocalGridInventoryService.MoveItems(ownerID, items); 573 lock (m_Lock)
574 return m_LocalGridInventoryService.MoveItems(ownerID, items);
560 575
561 IInventoryService connector = GetConnector(invURL); 576 IInventoryService connector = GetConnector(invURL);
562 577
@@ -575,7 +590,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
575 string invURL = GetInventoryServiceURL(ownerID); 590 string invURL = GetInventoryServiceURL(ownerID);
576 591
577 if (invURL == null) // not there, forward to local inventory connector to resolve 592 if (invURL == null) // not there, forward to local inventory connector to resolve
578 return m_LocalGridInventoryService.DeleteItems(ownerID, itemIDs); 593 lock (m_Lock)
594 return m_LocalGridInventoryService.DeleteItems(ownerID, itemIDs);
579 595
580 IInventoryService connector = GetConnector(invURL); 596 IInventoryService connector = GetConnector(invURL);
581 597
@@ -591,13 +607,31 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
591 string invURL = GetInventoryServiceURL(item.Owner); 607 string invURL = GetInventoryServiceURL(item.Owner);
592 608
593 if (invURL == null) // not there, forward to local inventory connector to resolve 609 if (invURL == null) // not there, forward to local inventory connector to resolve
594 return m_LocalGridInventoryService.GetItem(item); 610 lock (m_Lock)
611 return m_LocalGridInventoryService.GetItem(item);
595 612
596 IInventoryService connector = GetConnector(invURL); 613 IInventoryService connector = GetConnector(invURL);
597 614
598 return connector.GetItem(item); 615 return connector.GetItem(item);
599 } 616 }
600 617
618 public InventoryItemBase[] GetMultipleItems(UUID userID, UUID[] itemIDs)
619 {
620 if (itemIDs == null)
621 return new InventoryItemBase[0];
622 //m_log.Debug("[HG INVENTORY CONNECTOR]: GetItem " + item.ID);
623
624 string invURL = GetInventoryServiceURL(userID);
625
626 if (invURL == null) // not there, forward to local inventory connector to resolve
627 lock (m_Lock)
628 return m_LocalGridInventoryService.GetMultipleItems(userID, itemIDs);
629
630 IInventoryService connector = GetConnector(invURL);
631
632 return connector.GetMultipleItems(userID, itemIDs);
633 }
634
601 public InventoryFolderBase GetFolder(InventoryFolderBase folder) 635 public InventoryFolderBase GetFolder(InventoryFolderBase folder)
602 { 636 {
603 if (folder == null) 637 if (folder == null)
@@ -608,7 +642,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
608 string invURL = GetInventoryServiceURL(folder.Owner); 642 string invURL = GetInventoryServiceURL(folder.Owner);
609 643
610 if (invURL == null) // not there, forward to local inventory connector to resolve 644 if (invURL == null) // not there, forward to local inventory connector to resolve
611 return m_LocalGridInventoryService.GetFolder(folder); 645 lock (m_Lock)
646 return m_LocalGridInventoryService.GetFolder(folder);
612 647
613 IInventoryService connector = GetConnector(invURL); 648 IInventoryService connector = GetConnector(invURL);
614 649
@@ -632,7 +667,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
632 string invURL = GetInventoryServiceURL(userID); 667 string invURL = GetInventoryServiceURL(userID);
633 668
634 if (invURL == null) // not there, forward to local inventory connector to resolve 669 if (invURL == null) // not there, forward to local inventory connector to resolve
635 return m_LocalGridInventoryService.GetAssetPermissions(userID, assetID); 670 lock (m_Lock)
671 return m_LocalGridInventoryService.GetAssetPermissions(userID, assetID);
636 672
637 IInventoryService connector = GetConnector(invURL); 673 IInventoryService connector = GetConnector(invURL);
638 674
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
index 2fc8ee3..3195e6b 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -41,7 +41,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
41 private const double CACHE_EXPIRATION_SECONDS = 3600.0; // 1 hour 41 private const double CACHE_EXPIRATION_SECONDS = 3600.0; // 1 hour
42 42
43 private static ExpiringCache<UUID, InventoryFolderBase> m_RootFolders = new ExpiringCache<UUID, InventoryFolderBase>(); 43 private static ExpiringCache<UUID, InventoryFolderBase> m_RootFolders = new ExpiringCache<UUID, InventoryFolderBase>();
44 private static ExpiringCache<UUID, Dictionary<AssetType, InventoryFolderBase>> m_FolderTypes = new ExpiringCache<UUID, Dictionary<AssetType, InventoryFolderBase>>(); 44 private static ExpiringCache<UUID, Dictionary<FolderType, InventoryFolderBase>> m_FolderTypes = new ExpiringCache<UUID, Dictionary<FolderType, InventoryFolderBase>>();
45 private static ExpiringCache<UUID, InventoryCollection> m_Inventories = new ExpiringCache<UUID, InventoryCollection>(); 45 private static ExpiringCache<UUID, InventoryCollection> m_Inventories = new ExpiringCache<UUID, InventoryCollection>();
46 46
47 public void Cache(UUID userID, InventoryFolderBase root) 47 public void Cache(UUID userID, InventoryFolderBase root)
@@ -58,12 +58,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
58 return null; 58 return null;
59 } 59 }
60 60
61 public void Cache(UUID userID, AssetType type, InventoryFolderBase folder) 61 public void Cache(UUID userID, FolderType type, InventoryFolderBase folder)
62 { 62 {
63 Dictionary<AssetType, InventoryFolderBase> ff = null; 63 Dictionary<FolderType, InventoryFolderBase> ff = null;
64 if (!m_FolderTypes.TryGetValue(userID, out ff)) 64 if (!m_FolderTypes.TryGetValue(userID, out ff))
65 { 65 {
66 ff = new Dictionary<AssetType, InventoryFolderBase>(); 66 ff = new Dictionary<FolderType, InventoryFolderBase>();
67 m_FolderTypes.Add(userID, ff, CACHE_EXPIRATION_SECONDS); 67 m_FolderTypes.Add(userID, ff, CACHE_EXPIRATION_SECONDS);
68 } 68 }
69 69
@@ -77,9 +77,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
77 } 77 }
78 } 78 }
79 79
80 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) 80 public InventoryFolderBase GetFolderForType(UUID userID, FolderType type)
81 { 81 {
82 Dictionary<AssetType, InventoryFolderBase> ff = null; 82 Dictionary<FolderType, InventoryFolderBase> ff = null;
83 if (m_FolderTypes.TryGetValue(userID, out ff)) 83 if (m_FolderTypes.TryGetValue(userID, out ff))
84 { 84 {
85 InventoryFolderBase f = null; 85 InventoryFolderBase f = null;
@@ -99,14 +99,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
99 m_Inventories.AddOrUpdate(userID, inv, 120); 99 m_Inventories.AddOrUpdate(userID, inv, 120);
100 } 100 }
101 101
102 public InventoryCollection GetUserInventory(UUID userID)
103 {
104 InventoryCollection inv = null;
105 if (m_Inventories.TryGetValue(userID, out inv))
106 return inv;
107 return null;
108 }
109
110 public InventoryCollection GetFolderContent(UUID userID, UUID folderID) 102 public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
111 { 103 {
112 InventoryCollection inv = null; 104 InventoryCollection inv = null;
@@ -114,7 +106,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
114 if (m_Inventories.TryGetValue(userID, out inv)) 106 if (m_Inventories.TryGetValue(userID, out inv))
115 { 107 {
116 c = new InventoryCollection(); 108 c = new InventoryCollection();
117 c.UserID = userID; 109 c.OwnerID = userID;
118 110
119 c.Folders = inv.Folders.FindAll(delegate(InventoryFolderBase f) 111 c.Folders = inv.Folders.FindAll(delegate(InventoryFolderBase f)
120 { 112 {
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
index 99913a9..20d4e02 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
@@ -33,6 +33,7 @@ using System;
33using System.Collections.Generic; 33using System.Collections.Generic;
34using System.Reflection; 34using System.Reflection;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Monitoring;
36using OpenSim.Data; 37using OpenSim.Data;
37using OpenSim.Server.Base; 38using OpenSim.Server.Base;
38using OpenSim.Region.Framework.Interfaces; 39using OpenSim.Region.Framework.Interfaces;
@@ -164,22 +165,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
164 return m_InventoryService.GetInventorySkeleton(userId); 165 return m_InventoryService.GetInventorySkeleton(userId);
165 } 166 }
166 167
167 public InventoryCollection GetUserInventory(UUID id)
168 {
169 return m_InventoryService.GetUserInventory(id);
170 }
171
172 public void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
173 {
174 m_InventoryService.GetUserInventory(userID, callback);
175 }
176
177 public InventoryFolderBase GetRootFolder(UUID userID) 168 public InventoryFolderBase GetRootFolder(UUID userID)
178 { 169 {
179 return m_InventoryService.GetRootFolder(userID); 170 return m_InventoryService.GetRootFolder(userID);
180 } 171 }
181 172
182 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) 173 public InventoryFolderBase GetFolderForType(UUID userID, FolderType type)
183 { 174 {
184 return m_InventoryService.GetFolderForType(userID, type); 175 return m_InventoryService.GetFolderForType(userID, type);
185 } 176 }
@@ -193,17 +184,30 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
193 // Protect ourselves against the caller subsequently modifying the items list 184 // Protect ourselves against the caller subsequently modifying the items list
194 List<InventoryItemBase> items = new List<InventoryItemBase>(invCol.Items); 185 List<InventoryItemBase> items = new List<InventoryItemBase>(invCol.Items);
195 186
196 Util.FireAndForget(delegate 187 WorkManager.RunInThread(delegate
197 { 188 {
198 foreach (InventoryItemBase item in items) 189 foreach (InventoryItemBase item in items)
199 if (!string.IsNullOrEmpty(item.CreatorData)) 190 if (!string.IsNullOrEmpty(item.CreatorData))
200 UserManager.AddUser(item.CreatorIdAsUuid, item.CreatorData); 191 UserManager.AddUser(item.CreatorIdAsUuid, item.CreatorData);
201 }); 192 }, null, string.Format("GetFolderContent (user {0}, folder {1})", userID, folderID));
202 } 193 }
203 194
204 return invCol; 195 return invCol;
205 } 196 }
206 197
198 public virtual InventoryCollection[] GetMultipleFoldersContent(UUID principalID, UUID[] folderIDs)
199 {
200 InventoryCollection[] invColl = new InventoryCollection[folderIDs.Length];
201 int i = 0;
202 foreach (UUID fid in folderIDs)
203 {
204 invColl[i++] = GetFolderContent(principalID, fid);
205 }
206
207 return invColl;
208
209 }
210
207 public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) 211 public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
208 { 212 {
209 return m_InventoryService.GetFolderItems(userID, folderID); 213 return m_InventoryService.GetFolderItems(userID, folderID);
@@ -303,6 +307,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
303 return item; 307 return item;
304 } 308 }
305 309
310 public InventoryItemBase[] GetMultipleItems(UUID userID, UUID[] itemIDs)
311 {
312 return m_InventoryService.GetMultipleItems(userID, itemIDs);
313 }
314
306 public InventoryFolderBase GetFolder(InventoryFolderBase folder) 315 public InventoryFolderBase GetFolder(InventoryFolderBase folder)
307 { 316 {
308 return m_InventoryService.GetFolder(folder); 317 return m_InventoryService.GetFolder(folder);
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
index 7f78076..978b9d9 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
@@ -172,21 +172,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
172 return m_RemoteConnector.GetInventorySkeleton(userId); 172 return m_RemoteConnector.GetInventorySkeleton(userId);
173 } 173 }
174 174
175 public InventoryCollection GetUserInventory(UUID userID)
176 {
177 return m_RemoteConnector.GetUserInventory(userID);
178 }
179
180 public void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
181 {
182 }
183
184 public InventoryFolderBase GetRootFolder(UUID userID) 175 public InventoryFolderBase GetRootFolder(UUID userID)
185 { 176 {
186 return m_RemoteConnector.GetRootFolder(userID); 177 return m_RemoteConnector.GetRootFolder(userID);
187 } 178 }
188 179
189 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) 180 public InventoryFolderBase GetFolderForType(UUID userID, FolderType type)
190 { 181 {
191 return m_RemoteConnector.GetFolderForType(userID, type); 182 return m_RemoteConnector.GetFolderForType(userID, type);
192 } 183 }
@@ -213,6 +204,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
213 return invCol; 204 return invCol;
214 } 205 }
215 206
207 public virtual InventoryCollection[] GetMultipleFoldersContent(UUID principalID, UUID[] folderIDs)
208 {
209 return m_RemoteConnector.GetMultipleFoldersContent(principalID, folderIDs);
210 }
211
216 public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) 212 public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
217 { 213 {
218 return m_RemoteConnector.GetFolderItems(userID, folderID); 214 return m_RemoteConnector.GetFolderItems(userID, folderID);
@@ -307,6 +303,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
307 return m_RemoteConnector.GetItem(item); 303 return m_RemoteConnector.GetItem(item);
308 } 304 }
309 305
306 public InventoryItemBase[] GetMultipleItems(UUID userID, UUID[] itemIDs)
307 {
308 if (itemIDs == null)
309 return new InventoryItemBase[0];
310
311 return m_RemoteConnector.GetMultipleItems(userID, itemIDs);
312 }
313
310 public InventoryFolderBase GetFolder(InventoryFolderBase folder) 314 public InventoryFolderBase GetFolder(InventoryFolderBase folder)
311 { 315 {
312 //m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetFolder {0}", folder.ID); 316 //m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetFolder {0}", folder.ID);
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs
index 2c17e0e..d786c80 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs
@@ -53,7 +53,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
53 /// </remarks> 53 /// </remarks>
54 54
55 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MapImageServiceModule")] 55 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MapImageServiceModule")]
56<<<<<<< HEAD
57 public class MapImageServiceModule : IMapImageUploadModule, ISharedRegionModule
58=======
56 public class MapImageServiceModule : ISharedRegionModule, IMapImageUploadModule 59 public class MapImageServiceModule : ISharedRegionModule, IMapImageUploadModule
60>>>>>>> avn/ubitvar
57 { 61 {
58 private static readonly ILog m_log = 62 private static readonly ILog m_log =
59 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 63 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -66,7 +70,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
66 70
67 private int m_refreshtime = 0; 71 private int m_refreshtime = 0;
68 private int m_lastrefresh = 0; 72 private int m_lastrefresh = 0;
69 private System.Timers.Timer m_refreshTimer = new System.Timers.Timer(); 73 private System.Timers.Timer m_refreshTimer;
70 74
71 #region ISharedRegionModule 75 #region ISharedRegionModule
72 76
@@ -93,15 +97,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
93 if (config == null) 97 if (config == null)
94 return; 98 return;
95 99
100<<<<<<< HEAD
101 int refreshminutes = Convert.ToInt32(config.GetString("RefreshTime"));
102
103 // if refresh is less than zero, disable the module
104=======
96 int refreshminutes = Convert.ToInt32(config.GetString("RefreshTime", "-1")); 105 int refreshminutes = Convert.ToInt32(config.GetString("RefreshTime", "-1"));
106>>>>>>> avn/ubitvar
97 if (refreshminutes < 0) 107 if (refreshminutes < 0)
98 { 108 {
99 m_log.WarnFormat("[MAP IMAGE SERVICE MODULE]: No refresh time given in config. Module disabled."); 109 m_log.WarnFormat("[MAP IMAGE SERVICE MODULE]: Negative refresh time given in config. Module disabled.");
100 return; 110 return;
101 } 111 }
102 112
103 m_refreshtime = refreshminutes * 60 * 1000; // convert from minutes to ms
104
105 string service = config.GetString("LocalServiceModule", string.Empty); 113 string service = config.GetString("LocalServiceModule", string.Empty);
106 if (service == string.Empty) 114 if (service == string.Empty)
107 { 115 {
@@ -116,7 +124,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
116 m_log.WarnFormat("[MAP IMAGE SERVICE MODULE]: Unable to load LocalServiceModule from {0}. MapService module disabled. Please fix the configuration.", service); 124 m_log.WarnFormat("[MAP IMAGE SERVICE MODULE]: Unable to load LocalServiceModule from {0}. MapService module disabled. Please fix the configuration.", service);
117 return; 125 return;
118 } 126 }
127
128 // we don't want the timer if the interval is zero, but we still want this module enables
129 if(refreshminutes > 0)
130 {
131 m_refreshtime = refreshminutes * 60 * 1000; // convert from minutes to ms
132
133 m_refreshTimer = new System.Timers.Timer();
134 m_refreshTimer.Enabled = true;
135 m_refreshTimer.AutoReset = true;
136 m_refreshTimer.Interval = m_refreshtime;
137 m_refreshTimer.Elapsed += new ElapsedEventHandler(HandleMaptileRefresh);
119 138
139<<<<<<< HEAD
140 m_log.InfoFormat("[MAP IMAGE SERVICE MODULE]: enabled with refresh time {0} min and service object {1}",
141=======
120 if (m_refreshtime > 0) 142 if (m_refreshtime > 0)
121 { 143 {
122 m_refreshTimer.Enabled = true; 144 m_refreshTimer.Enabled = true;
@@ -126,8 +148,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
126 } 148 }
127 149
128 m_log.InfoFormat("[MAP IMAGE SERVICE MODULE]: enabled with refresh time {0} min and service object {1}", 150 m_log.InfoFormat("[MAP IMAGE SERVICE MODULE]: enabled with refresh time {0} min and service object {1}",
151>>>>>>> avn/ubitvar
129 refreshminutes, service); 152 refreshminutes, service);
130 153 }
154 else
155 {
156 m_log.InfoFormat("[MAP IMAGE SERVICE MODULE]: enabled with no refresh and service object {0}", service);
157 }
131 m_enabled = true; 158 m_enabled = true;
132 } 159 }
133 160
@@ -147,6 +174,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
147 // v2 Map generation on startup is now handled by scene to allow bmp to be shared with 174 // v2 Map generation on startup is now handled by scene to allow bmp to be shared with
148 // v1 service and not generate map tiles twice as was previous behavior 175 // v1 service and not generate map tiles twice as was previous behavior
149 //scene.EventManager.OnRegionReadyStatusChange += s => { if (s.Ready) UploadMapTile(s); }; 176 //scene.EventManager.OnRegionReadyStatusChange += s => { if (s.Ready) UploadMapTile(s); };
177<<<<<<< HEAD
178
179=======
180>>>>>>> avn/ubitvar
150 scene.RegisterModuleInterface<IMapImageUploadModule>(this); 181 scene.RegisterModuleInterface<IMapImageUploadModule>(this);
151 } 182 }
152 183
@@ -204,9 +235,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
204 // If the region/maptile is legacy sized, just upload the one tile like it has always been done 235 // If the region/maptile is legacy sized, just upload the one tile like it has always been done
205 if (mapTile.Width == Constants.RegionSize && mapTile.Height == Constants.RegionSize) 236 if (mapTile.Width == Constants.RegionSize && mapTile.Height == Constants.RegionSize)
206 { 237 {
238<<<<<<< HEAD
239 ConvertAndUploadMaptile(mapTile,
240 scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY,
241 scene.RegionInfo.RegionName);
242=======
207 ConvertAndUploadMaptile(mapTile, scene, 243 ConvertAndUploadMaptile(mapTile, scene,
208 scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY, 244 scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY,
209 scene.RegionInfo.RegionName); 245 scene.RegionInfo.RegionName);
246>>>>>>> avn/ubitvar
210 } 247 }
211 else 248 else
212 { 249 {
@@ -226,10 +263,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
226 (int)Constants.RegionSize, (int)Constants.RegionSize); 263 (int)Constants.RegionSize, (int)Constants.RegionSize);
227 using (Bitmap subMapTile = mapTile.Clone(rect, mapTile.PixelFormat)) 264 using (Bitmap subMapTile = mapTile.Clone(rect, mapTile.PixelFormat))
228 { 265 {
266<<<<<<< HEAD
267 ConvertAndUploadMaptile(subMapTile,
268 scene.RegionInfo.RegionLocX + (xx / Constants.RegionSize),
269 scene.RegionInfo.RegionLocY + (yy / Constants.RegionSize),
270 scene.Name);
271=======
229 ConvertAndUploadMaptile(subMapTile, scene, 272 ConvertAndUploadMaptile(subMapTile, scene,
230 scene.RegionInfo.RegionLocX + (xx / Constants.RegionSize), 273 scene.RegionInfo.RegionLocX + (xx / Constants.RegionSize),
231 scene.RegionInfo.RegionLocY + (yy / Constants.RegionSize), 274 scene.RegionInfo.RegionLocY + (yy / Constants.RegionSize),
232 scene.Name); 275 scene.Name);
276>>>>>>> avn/ubitvar
233 } 277 }
234 } 278 }
235 } 279 }
@@ -241,8 +285,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
241 ///</summary> 285 ///</summary>
242 public void UploadMapTile(IScene scene) 286 public void UploadMapTile(IScene scene)
243 { 287 {
288<<<<<<< HEAD
289=======
244 m_log.DebugFormat("{0}: upload maptile for {1}", LogHeader, scene.RegionInfo.RegionName); 290 m_log.DebugFormat("{0}: upload maptile for {1}", LogHeader, scene.RegionInfo.RegionName);
245 291
292>>>>>>> avn/ubitvar
246 // Create a JPG map tile and upload it to the AddMapTile API 293 // Create a JPG map tile and upload it to the AddMapTile API
247 IMapImageGenerator tileGenerator = scene.RequestModuleInterface<IMapImageGenerator>(); 294 IMapImageGenerator tileGenerator = scene.RequestModuleInterface<IMapImageGenerator>();
248 if (tileGenerator == null) 295 if (tileGenerator == null)
@@ -253,6 +300,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
253 300
254 using (Bitmap mapTile = tileGenerator.CreateMapTile()) 301 using (Bitmap mapTile = tileGenerator.CreateMapTile())
255 { 302 {
303<<<<<<< HEAD
304 if (mapTile != null)
305 {
306 UploadMapTile(scene, mapTile);
307 }
308 else
309 {
310 m_log.WarnFormat("{0} Tile image generation failed", LogHeader);
311 }
312 }
313 }
314
315 private void ConvertAndUploadMaptile(Image tileImage, uint locX, uint locY, string regionName)
316 {
317 byte[] jpgData = Utils.EmptyBytes;
318
319=======
256 // XXX: The MapImageModule will return a null if the user has chosen not to create map tiles and there 320 // XXX: The MapImageModule will return a null if the user has chosen not to create map tiles and there
257 // is no static map tile. 321 // is no static map tile.
258 if (mapTile == null) 322 if (mapTile == null)
@@ -266,6 +330,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
266 { 330 {
267 byte[] jpgData = Utils.EmptyBytes; 331 byte[] jpgData = Utils.EmptyBytes;
268 332
333>>>>>>> avn/ubitvar
269 using (MemoryStream stream = new MemoryStream()) 334 using (MemoryStream stream = new MemoryStream())
270 { 335 {
271 tileImage.Save(stream, ImageFormat.Jpeg); 336 tileImage.Save(stream, ImageFormat.Jpeg);
@@ -274,7 +339,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
274 if (jpgData != Utils.EmptyBytes) 339 if (jpgData != Utils.EmptyBytes)
275 { 340 {
276 string reason = string.Empty; 341 string reason = string.Empty;
342<<<<<<< HEAD
343 if (!m_MapService.AddMapTile((int)locX, (int)locY, jpgData, out reason))
344=======
277 if (!m_MapService.AddMapTile((int)locX, (int)locY, jpgData, scene.RegionInfo.ScopeID, out reason)) 345 if (!m_MapService.AddMapTile((int)locX, (int)locY, jpgData, scene.RegionInfo.ScopeID, out reason))
346>>>>>>> avn/ubitvar
278 { 347 {
279 m_log.DebugFormat("{0} Unable to upload tile image for {1} at {2}-{3}: {4}", LogHeader, 348 m_log.DebugFormat("{0} Unable to upload tile image for {1} at {2}-{3}: {4}", LogHeader,
280 regionName, locX, locY, reason); 349 regionName, locX, locY, reason);
@@ -282,7 +351,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
282 } 351 }
283 else 352 else
284 { 353 {
354<<<<<<< HEAD
355 m_log.WarnFormat("{0} Tile image generation failed for region {1}", LogHeader, regionName);
356=======
285 m_log.WarnFormat("{0} Tile image generation failed for region {1}", LogHeader, scene.RegionInfo.RegionName); 357 m_log.WarnFormat("{0} Tile image generation failed for region {1}", LogHeader, scene.RegionInfo.RegionName);
358>>>>>>> avn/ubitvar
286 } 359 }
287 } 360 }
288 } 361 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs
index 516ad40..50c252c 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs
@@ -69,7 +69,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
69 public void OnMakeRootAgent(ScenePresence sp) 69 public void OnMakeRootAgent(ScenePresence sp)
70 { 70 {
71// m_log.DebugFormat("[PRESENCE DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName); 71// m_log.DebugFormat("[PRESENCE DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName);
72 m_PresenceService.ReportAgent(sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID); 72 if (sp.PresenceType != PresenceType.Npc)
73 m_PresenceService.ReportAgent(sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID);
73 } 74 }
74 75
75 public void OnNewClient(IClientAPI client) 76 public void OnNewClient(IClientAPI client)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index 81990d5..50238a5 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -52,6 +52,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
52 /// Currently valid versions are "SIMULATION/0.1" and "SIMULATION/0.2" 52 /// Currently valid versions are "SIMULATION/0.1" and "SIMULATION/0.2"
53 /// </remarks> 53 /// </remarks>
54 public string ServiceVersion { get; set; } 54 public string ServiceVersion { get; set; }
55 private float m_VersionNumber = 0.3f;
55 56
56 /// <summary> 57 /// <summary>
57 /// Map region ID to scene. 58 /// Map region ID to scene.
@@ -93,6 +94,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
93 if (ServiceVersion != "SIMULATION/0.1" && ServiceVersion != "SIMULATION/0.2" && ServiceVersion != "SIMULATION/0.3") 94 if (ServiceVersion != "SIMULATION/0.1" && ServiceVersion != "SIMULATION/0.2" && ServiceVersion != "SIMULATION/0.3")
94 throw new Exception(string.Format("Invalid ConnectorProtocolVersion {0}", ServiceVersion)); 95 throw new Exception(string.Format("Invalid ConnectorProtocolVersion {0}", ServiceVersion));
95 96
97 string[] versionComponents = ServiceVersion.Split(new char[] { '/' });
98 if (versionComponents.Length >= 2)
99 float.TryParse(versionComponents[1], out m_VersionNumber);
100
96 m_log.InfoFormat( 101 m_log.InfoFormat(
97 "[LOCAL SIMULATION CONNECTOR]: Initialized with connector protocol version {0}", ServiceVersion); 102 "[LOCAL SIMULATION CONNECTOR]: Initialized with connector protocol version {0}", ServiceVersion);
98 } 103 }
@@ -205,7 +210,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
205 * Agent-related communications 210 * Agent-related communications
206 */ 211 */
207 212
208 public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) 213 public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason)
209 { 214 {
210 if (destination == null) 215 if (destination == null)
211 { 216 {
@@ -217,7 +222,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
217 if (m_scenes.ContainsKey(destination.RegionID)) 222 if (m_scenes.ContainsKey(destination.RegionID))
218 { 223 {
219// m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Found region {0} to send SendCreateChildAgent", destination.RegionName); 224// m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Found region {0} to send SendCreateChildAgent", destination.RegionName);
220 return m_scenes[destination.RegionID].NewUserConnection(aCircuit, teleportFlags, out reason); 225 return m_scenes[destination.RegionID].NewUserConnection(aCircuit, teleportFlags, source, out reason);
221 } 226 }
222 227
223 reason = "Did not find region " + destination.RegionName; 228 reason = "Did not find region " + destination.RegionName;
@@ -264,7 +269,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
264 return true; 269 return true;
265 } 270 }
266 271
272<<<<<<< HEAD
273 public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string theirversion, List<UUID> features, out string version, out string reason)
274=======
267 public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string theirversion, out string version, out string reason) 275 public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string theirversion, out string version, out string reason)
276>>>>>>> avn/ubitvar
268 { 277 {
269 reason = "Communications failure"; 278 reason = "Communications failure";
270 version = ServiceVersion; 279 version = ServiceVersion;
@@ -276,7 +285,26 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
276// m_log.DebugFormat( 285// m_log.DebugFormat(
277// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", 286// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
278// s.RegionInfo.RegionName, destination.RegionHandle); 287// s.RegionInfo.RegionName, destination.RegionHandle);
288 uint size = m_scenes[destination.RegionID].RegionInfo.RegionSizeX;
289
290 float theirVersionNumber = 0f;
291 string[] versionComponents = theirversion.Split(new char[] { '/' });
292 if (versionComponents.Length >= 2)
293 float.TryParse(versionComponents[1], out theirVersionNumber);
294
295 // Var regions here, and the requesting simulator is in an older version.
296 // We will forbide this, because it crashes the viewers
297 if (theirVersionNumber < 0.3f && size > 256)
298 {
299 reason = "Destination is a variable-sized region, and source is an old simulator. Consider upgrading.";
300 m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Request to access this variable-sized region from {0} simulator was denied", theirVersionNumber);
301 return false;
302
303 }
279 304
305<<<<<<< HEAD
306 return m_scenes[destination.RegionID].QueryAccess(agentID, agentHomeURI, viaTeleport, position, features, out reason);
307=======
280 308
281 // not really need on a grid running var regions sims 309 // not really need on a grid running var regions sims
282 310
@@ -296,6 +324,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
296 return false; 324 return false;
297 } 325 }
298 return m_scenes[destination.RegionID].QueryAccess(agentID, position, out reason); 326 return m_scenes[destination.RegionID].QueryAccess(agentID, position, out reason);
327>>>>>>> avn/ubitvar
299 } 328 }
300 329
301 //m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess"); 330 //m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess");
@@ -390,4 +419,4 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
390 419
391 #endregion 420 #endregion
392 } 421 }
393} \ No newline at end of file 422}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
index 580109e..7044d92 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic;
30using System.IO; 31using System.IO;
31using System.Net; 32using System.Net;
32using System.Reflection; 33using System.Reflection;
@@ -60,7 +61,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
60 protected SimulationServiceConnector m_remoteConnector; 61 protected SimulationServiceConnector m_remoteConnector;
61 62
62 protected bool m_safemode; 63 protected bool m_safemode;
63 protected IPAddress m_thisIP;
64 64
65 #region Region Module interface 65 #region Region Module interface
66 66
@@ -141,7 +141,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
141 { 141 {
142 m_aScene = scene; 142 m_aScene = scene;
143 //m_regionClient = new RegionToRegionClient(m_aScene, m_hyperlinkService); 143 //m_regionClient = new RegionToRegionClient(m_aScene, m_hyperlinkService);
144 m_thisIP = Util.GetHostFromDNS(scene.RegionInfo.ExternalHostName);
145 } 144 }
146 145
147 #endregion 146 #endregion
@@ -162,7 +161,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
162 * Agent-related communications 161 * Agent-related communications
163 */ 162 */
164 163
165 public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason) 164 public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason)
166 { 165 {
167 if (destination == null) 166 if (destination == null)
168 { 167 {
@@ -172,13 +171,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
172 } 171 }
173 172
174 // Try local first 173 // Try local first
175 if (m_localBackend.CreateAgent(destination, aCircuit, teleportFlags, out reason)) 174 if (m_localBackend.CreateAgent(source, destination, aCircuit, teleportFlags, out reason))
176 return true; 175 return true;
177 176
178 // else do the remote thing 177 // else do the remote thing
179 if (!m_localBackend.IsLocalRegion(destination.RegionID)) 178 if (!m_localBackend.IsLocalRegion(destination.RegionID))
180 { 179 {
181 return m_remoteConnector.CreateAgent(destination, aCircuit, teleportFlags, out reason); 180 return m_remoteConnector.CreateAgent(source, destination, aCircuit, teleportFlags, out reason);
182 } 181 }
183 return false; 182 return false;
184 } 183 }
@@ -207,7 +206,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
207 return m_remoteConnector.UpdateAgent(destination, cAgentData); 206 return m_remoteConnector.UpdateAgent(destination, cAgentData);
208 } 207 }
209 208
209<<<<<<< HEAD
210 public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string sversion, List<UUID> features, out string version, out string reason)
211=======
210 public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string sversion, out string version, out string reason) 212 public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string sversion, out string version, out string reason)
213>>>>>>> avn/ubitvar
211 { 214 {
212 reason = "Communications failure"; 215 reason = "Communications failure";
213 version = "Unknown"; 216 version = "Unknown";
@@ -216,14 +219,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
216 return false; 219 return false;
217 220
218 // Try local first 221 // Try local first
222<<<<<<< HEAD
223 if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, features, out version, out reason))
224=======
219 if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, out version, out reason)) 225 if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, out version, out reason))
220 return true; 226 return true;
227>>>>>>> avn/ubitvar
221 return true; 228 return true;
222 229
223 // else do the remote thing 230 // else do the remote thing
224 if (!m_localBackend.IsLocalRegion(destination.RegionID)) 231 if (!m_localBackend.IsLocalRegion(destination.RegionID))
232<<<<<<< HEAD
233 return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, features, out version, out reason);
234=======
225 return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, out version, out reason); 235 return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, out version, out reason);
226 236
237>>>>>>> avn/ubitvar
227 238
228 return false; 239 return false;
229 } 240 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs
index ea4ade5..cf9a7b4 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs
@@ -196,7 +196,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
196 // 196 //
197 public bool StoreUserAccount(UserAccount data) 197 public bool StoreUserAccount(UserAccount data)
198 { 198 {
199 return UserAccountService.StoreUserAccount(data); 199 bool ret = UserAccountService.StoreUserAccount(data);
200 if (ret)
201 m_Cache.Cache(data.PrincipalID, data);
202 return ret;
203 }
204
205 public void InvalidateCache(UUID userID)
206 {
207 m_Cache.Invalidate(userID);
200 } 208 }
201 209
202 #endregion 210 #endregion
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs
index cbe2eaa..53610d9 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -61,6 +61,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
61 //m_log.DebugFormat("[USER CACHE]: cached user {0}", userID); 61 //m_log.DebugFormat("[USER CACHE]: cached user {0}", userID);
62 } 62 }
63 63
64 public void Invalidate(UUID userID)
65 {
66 m_UUIDCache.Remove(userID);
67 }
68
64 public UserAccount Get(UUID userID, out bool inCache) 69 public UserAccount Get(UUID userID, out bool inCache)
65 { 70 {
66 UserAccount account = null; 71 UserAccount account = null;
diff --git a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs
index 1599f15..f567cab 100644
--- a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs
+++ b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs
@@ -91,13 +91,17 @@ namespace OpenSim.Region.CoreModules.World
91 91
92 public void AddRegion(Scene scene) 92 public void AddRegion(Scene scene)
93 { 93 {
94 if (!m_SceneList.Contains(scene)) 94 lock (m_SceneList)
95 m_SceneList.Add(scene); 95 {
96 if (!m_SceneList.Contains(scene))
97 m_SceneList.Add(scene);
98 }
96 } 99 }
97 100
98 public void RemoveRegion(Scene scene) 101 public void RemoveRegion(Scene scene)
99 { 102 {
100 m_SceneList.Remove(scene); 103 lock (m_SceneList)
104 m_SceneList.Remove(scene);
101 } 105 }
102 106
103 public void RegionLoaded(Scene scene) 107 public void RegionLoaded(Scene scene)
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index 5d41125..f0b0f4a 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -36,6 +36,7 @@ using System.Xml;
36using log4net; 36using log4net;
37using OpenMetaverse; 37using OpenMetaverse;
38using OpenSim.Framework; 38using OpenSim.Framework;
39using OpenSim.Framework.Monitoring;
39using OpenSim.Framework.Serialization; 40using OpenSim.Framework.Serialization;
40using OpenSim.Framework.Serialization.External; 41using OpenSim.Framework.Serialization.External;
41using OpenSim.Region.CoreModules.World.Terrain; 42using OpenSim.Region.CoreModules.World.Terrain;
@@ -96,6 +97,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
96 97
97 /// <value> 98 /// <value>
98 /// Should the archive being loaded be merged with what is already on the region? 99 /// Should the archive being loaded be merged with what is already on the region?
100 /// Merging usually suppresses terrain and parcel loading
99 /// </value> 101 /// </value>
100 protected bool m_merge; 102 protected bool m_merge;
101 103
@@ -160,7 +162,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver
160 162
161 private UUID m_defaultUser; 163 private UUID m_defaultUser;
162 164
165<<<<<<< HEAD
166 private UUID m_defaultUser;
167
168 public ArchiveReadRequest(Scene scene, string loadPath, Guid requestId, Dictionary<string,object>options)
169=======
163 public ArchiveReadRequest(Scene scene, string loadPath, Guid requestId, Dictionary<string, object> options) 170 public ArchiveReadRequest(Scene scene, string loadPath, Guid requestId, Dictionary<string, object> options)
171>>>>>>> avn/ubitvar
164 { 172 {
165 m_rootScene = scene; 173 m_rootScene = scene;
166 174
@@ -169,7 +177,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
169 m_defaultUser = (UUID)options["default-user"]; 177 m_defaultUser = (UUID)options["default-user"];
170 m_log.InfoFormat("Using User {0} as default user", m_defaultUser.ToString()); 178 m_log.InfoFormat("Using User {0} as default user", m_defaultUser.ToString());
171 } 179 }
180<<<<<<< HEAD
181 else
182=======
172 else 183 else
184>>>>>>> avn/ubitvar
173 { 185 {
174 m_defaultUser = scene.RegionInfo.EstateSettings.EstateOwner; 186 m_defaultUser = scene.RegionInfo.EstateSettings.EstateOwner;
175 } 187 }
@@ -188,7 +200,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver
188 } 200 }
189 201
190 m_errorMessage = String.Empty; 202 m_errorMessage = String.Empty;
203<<<<<<< HEAD
204=======
191 205
206>>>>>>> avn/ubitvar
192 m_merge = options.ContainsKey("merge"); 207 m_merge = options.ContainsKey("merge");
193 m_forceTerrain = options.ContainsKey("force-terrain"); 208 m_forceTerrain = options.ContainsKey("force-terrain");
194 m_forceParcels = options.ContainsKey("force-parcels"); 209 m_forceParcels = options.ContainsKey("force-parcels");
@@ -197,6 +212,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver
197 m_requestId = requestId; 212 m_requestId = requestId;
198 m_displacement = options.ContainsKey("displacement") ? (Vector3)options["displacement"] : Vector3.Zero; 213 m_displacement = options.ContainsKey("displacement") ? (Vector3)options["displacement"] : Vector3.Zero;
199 m_rotation = options.ContainsKey("rotation") ? (float)options["rotation"] : 0f; 214 m_rotation = options.ContainsKey("rotation") ? (float)options["rotation"] : 0f;
215<<<<<<< HEAD
216 m_rotationCenter = options.ContainsKey("rotation-center") ? (Vector3)options["rotation-center"]
217 : new Vector3(scene.RegionInfo.RegionSizeX / 2f, scene.RegionInfo.RegionSizeY / 2f, 0f);
218
219 // Zero can never be a valid user or group id
220 m_validUserUuids[UUID.Zero] = false;
221 m_validGroupUuids[UUID.Zero] = false;
222=======
200 m_rotationCenter = options.ContainsKey("rotation-center") ? (Vector3)options["rotation-center"] 223 m_rotationCenter = options.ContainsKey("rotation-center") ? (Vector3)options["rotation-center"]
201 : new Vector3(scene.RegionInfo.RegionSizeX / 2f, scene.RegionInfo.RegionSizeY / 2f, 0f); 224 : new Vector3(scene.RegionInfo.RegionSizeX / 2f, scene.RegionInfo.RegionSizeY / 2f, 0f);
202 225
@@ -206,12 +229,17 @@ namespace OpenSim.Region.CoreModules.World.Archiver
206 m_validUserUuids[UUID.Zero] = false; 229 m_validUserUuids[UUID.Zero] = false;
207 m_validGroupUuids[UUID.Zero] = false; 230 m_validGroupUuids[UUID.Zero] = false;
208 231
232>>>>>>> avn/ubitvar
209 233
210 m_groupsModule = m_rootScene.RequestModuleInterface<IGroupsModule>(); 234 m_groupsModule = m_rootScene.RequestModuleInterface<IGroupsModule>();
211 m_assetService = m_rootScene.AssetService; 235 m_assetService = m_rootScene.AssetService;
212 } 236 }
213 237
238<<<<<<< HEAD
239 public ArchiveReadRequest(Scene scene, Stream loadStream, Guid requestId, Dictionary<string, object>options)
240=======
214 public ArchiveReadRequest(Scene scene, Stream loadStream, Guid requestId, Dictionary<string, object> options) 241 public ArchiveReadRequest(Scene scene, Stream loadStream, Guid requestId, Dictionary<string, object> options)
242>>>>>>> avn/ubitvar
215 { 243 {
216 m_rootScene = scene; 244 m_rootScene = scene;
217 m_loadPath = null; 245 m_loadPath = null;
@@ -221,7 +249,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
221 m_requestId = requestId; 249 m_requestId = requestId;
222 250
223 m_defaultUser = scene.RegionInfo.EstateSettings.EstateOwner; 251 m_defaultUser = scene.RegionInfo.EstateSettings.EstateOwner;
252<<<<<<< HEAD
253
254=======
224 255
256>>>>>>> avn/ubitvar
225 // Zero can never be a valid user id 257 // Zero can never be a valid user id
226 m_validUserUuids[UUID.Zero] = false; 258 m_validUserUuids[UUID.Zero] = false;
227 259
@@ -295,15 +327,24 @@ namespace OpenSim.Region.CoreModules.World.Archiver
295 if ((successfulAssetRestores + failedAssetRestores) % 250 == 0) 327 if ((successfulAssetRestores + failedAssetRestores) % 250 == 0)
296 m_log.Debug("[ARCHIVER]: Loaded " + successfulAssetRestores + " assets and failed to load " + failedAssetRestores + " assets..."); 328 m_log.Debug("[ARCHIVER]: Loaded " + successfulAssetRestores + " assets and failed to load " + failedAssetRestores + " assets...");
297 } 329 }
330<<<<<<< HEAD
331 else if (filePath.StartsWith(ArchiveConstants.TERRAINS_PATH) && (!m_merge || m_forceTerrain))
332=======
298 else if ((!m_merge || m_forceTerrain) && filePath.StartsWith(ArchiveConstants.TERRAINS_PATH)) 333 else if ((!m_merge || m_forceTerrain) && filePath.StartsWith(ArchiveConstants.TERRAINS_PATH))
334>>>>>>> avn/ubitvar
299 { 335 {
300 LoadTerrain(scene, filePath, data); 336 LoadTerrain(scene, filePath, data);
301 } 337 }
302 else if (!m_merge && filePath.StartsWith(ArchiveConstants.SETTINGS_PATH)) 338 else if (!m_merge && filePath.StartsWith(ArchiveConstants.SETTINGS_PATH))
303 { 339 {
304 LoadRegionSettings(scene, filePath, data, dearchivedScenes); 340 LoadRegionSettings(scene, filePath, data, dearchivedScenes);
341<<<<<<< HEAD
342 }
343 else if (filePath.StartsWith(ArchiveConstants.LANDDATA_PATH) && (!m_merge || m_forceParcels))
344=======
305 } 345 }
306 else if ((!m_merge || m_forceParcels) && filePath.StartsWith(ArchiveConstants.LANDDATA_PATH)) 346 else if ((!m_merge || m_forceParcels) && filePath.StartsWith(ArchiveConstants.LANDDATA_PATH))
347>>>>>>> avn/ubitvar
307 { 348 {
308 sceneContext.SerialisedParcels.Add(Encoding.UTF8.GetString(data)); 349 sceneContext.SerialisedParcels.Add(Encoding.UTF8.GetString(data));
309 } 350 }
@@ -373,7 +414,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
373 // Start the scripts. We delayed this because we want the OAR to finish loading ASAP, so 414 // Start the scripts. We delayed this because we want the OAR to finish loading ASAP, so
374 // that users can enter the scene. If we allow the scripts to start in the loop above 415 // that users can enter the scene. If we allow the scripts to start in the loop above
375 // then they significantly increase the time until the OAR finishes loading. 416 // then they significantly increase the time until the OAR finishes loading.
376 Util.FireAndForget(delegate(object o) 417 WorkManager.RunInThread(o =>
377 { 418 {
378 Thread.Sleep(15000); 419 Thread.Sleep(15000);
379 m_log.Info("[ARCHIVER]: Starting scripts in scene objects"); 420 m_log.Info("[ARCHIVER]: Starting scripts in scene objects");
@@ -388,7 +429,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
388 429
389 sceneContext.SceneObjects.Clear(); 430 sceneContext.SceneObjects.Clear();
390 } 431 }
391 }); 432 }, null, string.Format("ReadArchiveStartScripts (request {0})", m_requestId));
392 433
393 m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive"); 434 m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive");
394 435
@@ -524,6 +565,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver
524 } 565 }
525 } 566 }
526 567
568<<<<<<< HEAD
569
570=======
571>>>>>>> avn/ubitvar
527 bool isTelehub = (sceneObject.UUID == oldTelehubUUID) && (oldTelehubUUID != UUID.Zero); 572 bool isTelehub = (sceneObject.UUID == oldTelehubUUID) && (oldTelehubUUID != UUID.Zero);
528 573
529 // For now, give all incoming scene objects new uuids. This will allow scenes to be cloned 574 // For now, give all incoming scene objects new uuids. This will allow scenes to be cloned
@@ -540,7 +585,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver
540 } 585 }
541 586
542 ModifySceneObject(scene, sceneObject); 587 ModifySceneObject(scene, sceneObject);
588<<<<<<< HEAD
589=======
543 590
591>>>>>>> avn/ubitvar
544 592
545 if (scene.AddRestoredSceneObject(sceneObject, true, false)) 593 if (scene.AddRestoredSceneObject(sceneObject, true, false))
546 { 594 {
@@ -601,6 +649,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
601 // being no copy/no mod for everyone 649 // being no copy/no mod for everyone
602 lock (part.TaskInventory) 650 lock (part.TaskInventory)
603 { 651 {
652<<<<<<< HEAD
653=======
604 // And zap any troublesome sit target information 654 // And zap any troublesome sit target information
605 part.SitTargetOrientation = new Quaternion(0, 0, 0, 1); 655 part.SitTargetOrientation = new Quaternion(0, 0, 0, 1);
606 part.SitTargetPosition = new Vector3(0, 0, 0); 656 part.SitTargetPosition = new Vector3(0, 0, 0);
@@ -609,6 +659,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
609 // Not doing so results in inventory items 659 // Not doing so results in inventory items
610 // being no copy/no mod for everyone 660 // being no copy/no mod for everyone
611 part.TaskInventory.LockItemsForRead(true); 661 part.TaskInventory.LockItemsForRead(true);
662>>>>>>> avn/ubitvar
612 TaskInventoryDictionary inv = part.TaskInventory; 663 TaskInventoryDictionary inv = part.TaskInventory;
613 foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv) 664 foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv)
614 { 665 {
@@ -629,11 +680,18 @@ namespace OpenSim.Region.CoreModules.World.Archiver
629 if (!ResolveGroupUuid(kvp.Value.GroupID)) 680 if (!ResolveGroupUuid(kvp.Value.GroupID))
630 kvp.Value.GroupID = UUID.Zero; 681 kvp.Value.GroupID = UUID.Zero;
631 } 682 }
683<<<<<<< HEAD
684=======
632 part.TaskInventory.LockItemsForRead(false); 685 part.TaskInventory.LockItemsForRead(false);
686>>>>>>> avn/ubitvar
633 } 687 }
634 } 688 }
635 } 689 }
636 690
691<<<<<<< HEAD
692
693=======
694>>>>>>> avn/ubitvar
637 /// <summary> 695 /// <summary>
638 /// Load serialized parcels. 696 /// Load serialized parcels.
639 /// </summary> 697 /// </summary>
@@ -654,25 +712,45 @@ namespace OpenSim.Region.CoreModules.World.Archiver
654 parcel.AABBMin += parcelDisp; 712 parcel.AABBMin += parcelDisp;
655 parcel.AABBMax += parcelDisp; 713 parcel.AABBMax += parcelDisp;
656 } 714 }
715<<<<<<< HEAD
716
717=======
657 718
719>>>>>>> avn/ubitvar
658 // Validate User and Group UUID's 720 // Validate User and Group UUID's
659 721
722 if (!ResolveGroupUuid(parcel.GroupID))
723 parcel.GroupID = UUID.Zero;
724
660 if (parcel.IsGroupOwned) 725 if (parcel.IsGroupOwned)
661 { 726 {
662 if (!ResolveGroupUuid(parcel.GroupID)) 727 if (parcel.GroupID != UUID.Zero)
663 { 728 {
729 // In group-owned parcels, OwnerID=GroupID. This should already be the case, but let's make sure.
730 parcel.OwnerID = parcel.GroupID;
731 }
732 else
733 {
734<<<<<<< HEAD
735 parcel.OwnerID = m_rootScene.RegionInfo.EstateSettings.EstateOwner;
736=======
664 parcel.OwnerID = m_defaultUser; 737 parcel.OwnerID = m_defaultUser;
665 parcel.GroupID = UUID.Zero; 738 parcel.GroupID = UUID.Zero;
739>>>>>>> avn/ubitvar
666 parcel.IsGroupOwned = false; 740 parcel.IsGroupOwned = false;
667 } 741 }
668 } 742 }
669 else 743 else
670 { 744 {
671 if (!ResolveUserUuid(scene, parcel.OwnerID)) 745 if (!ResolveUserUuid(scene, parcel.OwnerID))
746<<<<<<< HEAD
747 parcel.OwnerID = m_rootScene.RegionInfo.EstateSettings.EstateOwner;
748=======
672 parcel.OwnerID = m_defaultUser; 749 parcel.OwnerID = m_defaultUser;
673 750
674 if (!ResolveGroupUuid(parcel.GroupID)) 751 if (!ResolveGroupUuid(parcel.GroupID))
675 parcel.GroupID = UUID.Zero; 752 parcel.GroupID = UUID.Zero;
753>>>>>>> avn/ubitvar
676 } 754 }
677 755
678 List<LandAccessEntry> accessList = new List<LandAccessEntry>(); 756 List<LandAccessEntry> accessList = new List<LandAccessEntry>();
@@ -730,9 +808,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
730 /// <returns></returns> 808 /// <returns></returns>
731 private bool ResolveGroupUuid(UUID uuid) 809 private bool ResolveGroupUuid(UUID uuid)
732 { 810 {
733 if (uuid == UUID.Zero)
734 return true; // this means the object has no group
735
736 lock (m_validGroupUuids) 811 lock (m_validGroupUuids)
737 { 812 {
738 if (!m_validGroupUuids.ContainsKey(uuid)) 813 if (!m_validGroupUuids.ContainsKey(uuid))
@@ -804,6 +879,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver
804 if (data == null) 879 if (data == null)
805 return false; 880 return false;
806 } 881 }
882<<<<<<< HEAD
883
884=======
885>>>>>>> avn/ubitvar
807 //m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); 886 //m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType);
808 887
809 AssetBase asset = new AssetBase(new UUID(uuid), String.Empty, assetType, UUID.Zero.ToString()); 888 AssetBase asset = new AssetBase(new UUID(uuid), String.Empty, assetType, UUID.Zero.ToString());
@@ -925,7 +1004,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
925 private bool LoadTerrain(Scene scene, string terrainPath, byte[] data) 1004 private bool LoadTerrain(Scene scene, string terrainPath, byte[] data)
926 { 1005 {
927 ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>(); 1006 ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>();
1007<<<<<<< HEAD
1008
1009=======
928 1010
1011>>>>>>> avn/ubitvar
929 using (MemoryStream ms = new MemoryStream(data)) 1012 using (MemoryStream ms = new MemoryStream(data))
930 { 1013 {
931 if (m_displacement != Vector3.Zero || m_rotation != 0f) 1014 if (m_displacement != Vector3.Zero || m_rotation != 0f)
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs
index cd95ee9..cb2c7f1 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs
@@ -36,6 +36,7 @@ using System.Xml;
36using log4net; 36using log4net;
37using OpenMetaverse; 37using OpenMetaverse;
38using OpenSim.Framework; 38using OpenSim.Framework;
39using OpenSim.Framework.Monitoring;
39using OpenSim.Framework.Serialization; 40using OpenSim.Framework.Serialization;
40using OpenSim.Region.CoreModules.World.Terrain; 41using OpenSim.Region.CoreModules.World.Terrain;
41using OpenSim.Region.Framework.Interfaces; 42using OpenSim.Region.Framework.Interfaces;
@@ -43,6 +44,7 @@ using OpenSim.Region.Framework.Scenes;
43using Ionic.Zlib; 44using Ionic.Zlib;
44using GZipStream = Ionic.Zlib.GZipStream; 45using GZipStream = Ionic.Zlib.GZipStream;
45using CompressionMode = Ionic.Zlib.CompressionMode; 46using CompressionMode = Ionic.Zlib.CompressionMode;
47using CompressionLevel = Ionic.Zlib.CompressionLevel;
46using OpenSim.Framework.Serialization.External; 48using OpenSim.Framework.Serialization.External;
47using PermissionMask = OpenSim.Framework.PermissionMask; 49using PermissionMask = OpenSim.Framework.PermissionMask;
48 50
@@ -79,7 +81,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
79 /// Determines which objects will be included in the archive, according to their permissions. 81 /// Determines which objects will be included in the archive, according to their permissions.
80 /// Default is null, meaning no permission checks. 82 /// Default is null, meaning no permission checks.
81 /// </summary> 83 /// </summary>
82 public string CheckPermissions { get; set; } 84 public string FilterContent { get; set; }
83 85
84 protected Scene m_rootScene; 86 protected Scene m_rootScene;
85 protected Stream m_saveStream; 87 protected Stream m_saveStream;
@@ -130,7 +132,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
130 132
131 MultiRegionFormat = false; 133 MultiRegionFormat = false;
132 SaveAssets = true; 134 SaveAssets = true;
133 CheckPermissions = null; 135 FilterContent = null;
134 } 136 }
135 137
136 /// <summary> 138 /// <summary>
@@ -149,7 +151,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
149 151
150 Object temp; 152 Object temp;
151 if (options.TryGetValue("checkPermissions", out temp)) 153 if (options.TryGetValue("checkPermissions", out temp))
152 CheckPermissions = (string)temp; 154 FilterContent = (string)temp;
153 155
154 156
155 // Find the regions to archive 157 // Find the regions to archive
@@ -199,7 +201,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
199 m_rootScene.AssetService, m_rootScene.UserAccountService, 201 m_rootScene.AssetService, m_rootScene.UserAccountService,
200 m_rootScene.RegionInfo.ScopeID, options, ReceivedAllAssets); 202 m_rootScene.RegionInfo.ScopeID, options, ReceivedAllAssets);
201 203
202 Util.FireAndForget(o => ar.Execute()); 204 WorkManager.RunInThread(o => ar.Execute(), null, "Archive Assets Request");
203 205
204 // CloseArchive() will be called from ReceivedAllAssets() 206 // CloseArchive() will be called from ReceivedAllAssets()
205 } 207 }
@@ -218,7 +220,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
218 220
219 private void ArchiveOneRegion(Scene scene, string regionDir, Dictionary<UUID, sbyte> assetUuids) 221 private void ArchiveOneRegion(Scene scene, string regionDir, Dictionary<UUID, sbyte> assetUuids)
220 { 222 {
221 m_log.InfoFormat("[ARCHIVER]: Writing region {0}", scene.RegionInfo.RegionName); 223 m_log.InfoFormat("[ARCHIVER]: Writing region {0}", scene.Name);
222 224
223 EntityBase[] entities = scene.GetEntities(); 225 EntityBase[] entities = scene.GetEntities();
224 List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>(); 226 List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>();
@@ -237,7 +239,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
237 239
238 if (!sceneObject.IsDeleted && !sceneObject.IsAttachment) 240 if (!sceneObject.IsDeleted && !sceneObject.IsAttachment)
239 { 241 {
240 if (!CanUserArchiveObject(scene.RegionInfo.EstateSettings.EstateOwner, sceneObject, CheckPermissions, permissionsModule)) 242 if (!CanUserArchiveObject(scene.RegionInfo.EstateSettings.EstateOwner, sceneObject, FilterContent, permissionsModule))
241 { 243 {
242 // The user isn't allowed to copy/transfer this object, so it will not be included in the OAR. 244 // The user isn't allowed to copy/transfer this object, so it will not be included in the OAR.
243 ++numObjectsSkippedPermissions; 245 ++numObjectsSkippedPermissions;
@@ -252,13 +254,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver
252 254
253 if (SaveAssets) 255 if (SaveAssets)
254 { 256 {
255 UuidGatherer assetGatherer = new UuidGatherer(scene.AssetService); 257 UuidGatherer assetGatherer = new UuidGatherer(scene.AssetService, assetUuids);
256 int prevAssets = assetUuids.Count; 258 int prevAssets = assetUuids.Count;
257 259
258 foreach (SceneObjectGroup sceneObject in sceneObjects) 260 foreach (SceneObjectGroup sceneObject in sceneObjects)
259 { 261 assetGatherer.AddForInspection(sceneObject);
260 assetGatherer.GatherAssetUuids(sceneObject, assetUuids); 262
261 } 263 assetGatherer.GatherAll();
262 264
263 m_log.DebugFormat( 265 m_log.DebugFormat(
264 "[ARCHIVER]: {0} scene objects to serialize requiring save of {1} assets", 266 "[ARCHIVER]: {0} scene objects to serialize requiring save of {1} assets",
@@ -295,12 +297,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver
295 /// </summary> 297 /// </summary>
296 /// <param name="user">The user</param> 298 /// <param name="user">The user</param>
297 /// <param name="objGroup">The object group</param> 299 /// <param name="objGroup">The object group</param>
298 /// <param name="checkPermissions">Which permissions to check: "C" = Copy, "T" = Transfer</param> 300 /// <param name="filterContent">Which permissions to check: "C" = Copy, "T" = Transfer</param>
299 /// <param name="permissionsModule">The scene's permissions module</param> 301 /// <param name="permissionsModule">The scene's permissions module</param>
300 /// <returns>Whether the user is allowed to export the object to an OAR</returns> 302 /// <returns>Whether the user is allowed to export the object to an OAR</returns>
301 private bool CanUserArchiveObject(UUID user, SceneObjectGroup objGroup, string checkPermissions, IPermissionsModule permissionsModule) 303 private bool CanUserArchiveObject(UUID user, SceneObjectGroup objGroup, string filterContent, IPermissionsModule permissionsModule)
302 { 304 {
303 if (checkPermissions == null) 305 if (filterContent == null)
304 return true; 306 return true;
305 307
306 if (permissionsModule == null) 308 if (permissionsModule == null)
@@ -342,9 +344,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
342 canTransfer |= (obj.EveryoneMask & (uint)PermissionMask.Copy) != 0; 344 canTransfer |= (obj.EveryoneMask & (uint)PermissionMask.Copy) != 0;
343 345
344 bool partPermitted = true; 346 bool partPermitted = true;
345 if (checkPermissions.Contains("C") && !canCopy) 347 if (filterContent.Contains("C") && !canCopy)
346 partPermitted = false; 348 partPermitted = false;
347 if (checkPermissions.Contains("T") && !canTransfer) 349 if (filterContent.Contains("T") && !canTransfer)
348 partPermitted = false; 350 partPermitted = false;
349 351
350 // If the user is the Creator of the object then it can always be included in the OAR 352 // If the user is the Creator of the object then it can always be included in the OAR
@@ -569,10 +571,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
569 string terrainPath = String.Format("{0}{1}{2}.r32", 571 string terrainPath = String.Format("{0}{1}{2}.r32",
570 regionDir, ArchiveConstants.TERRAINS_PATH, scene.RegionInfo.RegionName); 572 regionDir, ArchiveConstants.TERRAINS_PATH, scene.RegionInfo.RegionName);
571 573
572 MemoryStream ms = new MemoryStream(); 574 using (MemoryStream ms = new MemoryStream())
573 scene.RequestModuleInterface<ITerrainModule>().SaveToStream(terrainPath, ms); 575 {
574 m_archiveWriter.WriteFile(terrainPath, ms.ToArray()); 576 scene.RequestModuleInterface<ITerrainModule>().SaveToStream(terrainPath, ms);
575 ms.Close(); 577 m_archiveWriter.WriteFile(terrainPath, ms.ToArray());
578 }
576 579
577 m_log.InfoFormat("[ARCHIVER]: Adding scene objects to archive."); 580 m_log.InfoFormat("[ARCHIVER]: Adding scene objects to archive.");
578 581
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
index 8a8e392..0fb8a32 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
@@ -33,6 +33,7 @@ using log4net;
33using NDesk.Options; 33using NDesk.Options;
34using Nini.Config; 34using Nini.Config;
35using Mono.Addins; 35using Mono.Addins;
36
36using OpenSim.Framework; 37using OpenSim.Framework;
37using OpenSim.Framework.Console; 38using OpenSim.Framework.Console;
38using OpenSim.Region.Framework.Interfaces; 39using OpenSim.Region.Framework.Interfaces;
@@ -110,6 +111,19 @@ namespace OpenSim.Region.CoreModules.World.Archiver
110 String defaultUser = ""; 111 String defaultUser = "";
111 float rotation = 0f; 112 float rotation = 0f;
112 Vector3 rotationCenter = new Vector3(Constants.RegionSize / 2f, Constants.RegionSize / 2f, 0); 113 Vector3 rotationCenter = new Vector3(Constants.RegionSize / 2f, Constants.RegionSize / 2f, 0);
114<<<<<<< HEAD
115
116 OptionSet options = new OptionSet();
117 options.Add("m|merge", delegate (string v) { mergeOar = (v != null); });
118 options.Add("s|skip-assets", delegate (string v) { skipAssets = (v != null); });
119 options.Add("force-terrain", delegate (string v) { forceTerrain = (v != null); });
120 options.Add("forceterrain", delegate (string v) { forceTerrain = (v != null); }); // downward compatibility
121 options.Add("force-parcels", delegate (string v) { forceParcels = (v != null); });
122 options.Add("forceparcels", delegate (string v) { forceParcels = (v != null); }); // downward compatibility
123 options.Add("no-objects", delegate (string v) { noObjects = (v != null); });
124 options.Add("default-user=", delegate(string v) { defaultUser = (v == null) ? "" : v; });
125 options.Add("displacement=", delegate (string v) {
126=======
113 127
114 OptionSet options = new OptionSet(); 128 OptionSet options = new OptionSet();
115 options.Add("m|merge", delegate(string v) { mergeOar = (v != null); }); 129 options.Add("m|merge", delegate(string v) { mergeOar = (v != null); });
@@ -122,6 +136,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
122 options.Add("default-user=", delegate(string v) { defaultUser = (v == null) ? "" : v; }); 136 options.Add("default-user=", delegate(string v) { defaultUser = (v == null) ? "" : v; });
123 options.Add("displacement=", delegate(string v) 137 options.Add("displacement=", delegate(string v)
124 { 138 {
139>>>>>>> avn/ubitvar
125 try 140 try
126 { 141 {
127 displacement = v == null ? Vector3.Zero : Vector3.Parse(v); 142 displacement = v == null ? Vector3.Zero : Vector3.Parse(v);
@@ -148,8 +163,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver
148 // Convert to radians for internals 163 // Convert to radians for internals
149 rotation = Util.Clamp<float>(rotation, -359f, 359f) / 180f * (float)Math.PI; 164 rotation = Util.Clamp<float>(rotation, -359f, 359f) / 180f * (float)Math.PI;
150 }); 165 });
166<<<<<<< HEAD
167 options.Add("rotation-center=", delegate (string v) {
168=======
151 options.Add("rotation-center=", delegate(string v) 169 options.Add("rotation-center=", delegate(string v)
152 { 170 {
171>>>>>>> avn/ubitvar
153 try 172 try
154 { 173 {
155 rotationCenter = v == null ? Vector3.Zero : Vector3.Parse(v); 174 rotationCenter = v == null ? Vector3.Zero : Vector3.Parse(v);
@@ -289,12 +308,21 @@ namespace OpenSim.Region.CoreModules.World.Archiver
289 Dictionary<string, object> archiveOptions = new Dictionary<string, object>(); 308 Dictionary<string, object> archiveOptions = new Dictionary<string, object>();
290 DearchiveRegion(loadPath, Guid.Empty, archiveOptions); 309 DearchiveRegion(loadPath, Guid.Empty, archiveOptions);
291 } 310 }
311<<<<<<< HEAD
312
313 public void DearchiveRegion(string loadPath, Guid requestId, Dictionary<string,object> options)
314 {
315 m_log.InfoFormat(
316 "[ARCHIVER]: Loading archive to region {0} from {1}", Scene.RegionInfo.RegionName, loadPath);
317
318=======
292 319
293 public void DearchiveRegion(string loadPath, Guid requestId, Dictionary<string, object> options) 320 public void DearchiveRegion(string loadPath, Guid requestId, Dictionary<string, object> options)
294 { 321 {
295 m_log.InfoFormat( 322 m_log.InfoFormat(
296 "[ARCHIVER]: Loading archive to region {0} from {1}", Scene.RegionInfo.RegionName, loadPath); 323 "[ARCHIVER]: Loading archive to region {0} from {1}", Scene.RegionInfo.RegionName, loadPath);
297 324
325>>>>>>> avn/ubitvar
298 new ArchiveReadRequest(Scene, loadPath, requestId, options).DearchiveRegion(); 326 new ArchiveReadRequest(Scene, loadPath, requestId, options).DearchiveRegion();
299 } 327 }
300 328
@@ -303,7 +331,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
303 Dictionary<string, object> archiveOptions = new Dictionary<string, object>(); 331 Dictionary<string, object> archiveOptions = new Dictionary<string, object>();
304 DearchiveRegion(loadStream, Guid.Empty, archiveOptions); 332 DearchiveRegion(loadStream, Guid.Empty, archiveOptions);
305 } 333 }
334<<<<<<< HEAD
335
336=======
306 337
338>>>>>>> avn/ubitvar
307 public void DearchiveRegion(Stream loadStream, Guid requestId, Dictionary<string, object> options) 339 public void DearchiveRegion(Stream loadStream, Guid requestId, Dictionary<string, object> options)
308 { 340 {
309 new ArchiveReadRequest(Scene, loadStream, requestId, options).DearchiveRegion(); 341 new ArchiveReadRequest(Scene, loadStream, requestId, options).DearchiveRegion();
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
index 6c2a631..895b55d 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
@@ -33,6 +33,7 @@ using System.Timers;
33using log4net; 33using log4net;
34using OpenMetaverse; 34using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Monitoring;
36using OpenSim.Framework.Serialization; 37using OpenSim.Framework.Serialization;
37using OpenSim.Framework.Serialization.External; 38using OpenSim.Framework.Serialization.External;
38using OpenSim.Services.Interfaces; 39using OpenSim.Services.Interfaces;
@@ -143,7 +144,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
143 m_requestState = RequestState.Running; 144 m_requestState = RequestState.Running;
144 145
145 m_log.DebugFormat("[ARCHIVER]: AssetsRequest executed looking for {0} possible assets", m_repliesRequired); 146 m_log.DebugFormat("[ARCHIVER]: AssetsRequest executed looking for {0} possible assets", m_repliesRequired);
146 147
147 // We can stop here if there are no assets to fetch 148 // We can stop here if there are no assets to fetch
148 if (m_repliesRequired == 0) 149 if (m_repliesRequired == 0)
149 { 150 {
@@ -226,7 +227,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
226 finally 227 finally
227 { 228 {
228 if (timedOut) 229 if (timedOut)
229 Util.FireAndForget(PerformAssetsRequestCallback, true); 230 WorkManager.RunInThread(PerformAssetsRequestCallback, true, "Archive Assets Request Callback");
230 } 231 }
231 } 232 }
232 233
@@ -291,7 +292,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
291 292
292 // We want to stop using the asset cache thread asap 293 // We want to stop using the asset cache thread asap
293 // as we now need to do the work of producing the rest of the archive 294 // as we now need to do the work of producing the rest of the archive
294 Util.FireAndForget(PerformAssetsRequestCallback, false); 295 WorkManager.RunInThread(PerformAssetsRequestCallback, false, "Archive Assets Request Callback");
295 } 296 }
296 else 297 else
297 { 298 {
@@ -330,7 +331,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
330 if (asset.Type == (sbyte)AssetType.Object && asset.Data != null && m_options.ContainsKey("home")) 331 if (asset.Type == (sbyte)AssetType.Object && asset.Data != null && m_options.ContainsKey("home"))
331 { 332 {
332 //m_log.DebugFormat("[ARCHIVER]: Rewriting object data for {0}", asset.ID); 333 //m_log.DebugFormat("[ARCHIVER]: Rewriting object data for {0}", asset.ID);
333 string xml = ExternalRepresentationUtils.RewriteSOP(Utils.BytesToString(asset.Data), m_options["home"].ToString(), m_userAccountService, m_scopeID); 334 string xml = ExternalRepresentationUtils.RewriteSOP(Utils.BytesToString(asset.Data), string.Empty, m_options["home"].ToString(), m_userAccountService, m_scopeID);
334 asset.Data = Utils.StringToBytes(xml); 335 asset.Data = Utils.StringToBytes(xml);
335 } 336 }
336 return asset; 337 return asset;
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index 53f41f9..9f197f5 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -45,7 +45,6 @@ using OpenSim.Region.Framework.Scenes;
45using OpenSim.Region.Framework.Scenes.Serialization; 45using OpenSim.Region.Framework.Scenes.Serialization;
46using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups; 46using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups;
47using OpenSim.Tests.Common; 47using OpenSim.Tests.Common;
48using OpenSim.Tests.Common.Mock;
49using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants; 48using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants;
50using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader; 49using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader;
51using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter; 50using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter;
@@ -579,13 +578,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
579 ArchiveConstants.CONTROL_FILE_PATH, 578 ArchiveConstants.CONTROL_FILE_PATH,
580 new ArchiveWriteRequest(m_scene, (Stream)null, Guid.Empty).CreateControlFile(new ArchiveScenesGroup())); 579 new ArchiveWriteRequest(m_scene, (Stream)null, Guid.Empty).CreateControlFile(new ArchiveScenesGroup()));
581 580
582 LandObject lo = new LandObject(groupID, true, null); 581 LandObject lo = new LandObject(groupID, true, m_scene);
583 lo.SetLandBitmap(lo.BasicFullRegionLandBitmap()); 582 lo.SetLandBitmap(lo.BasicFullRegionLandBitmap());
584 LandData ld = lo.LandData; 583 LandData ld = lo.LandData;
585 ld.GlobalID = landID; 584 ld.GlobalID = landID;
586 585
587 string ldPath = ArchiveConstants.CreateOarLandDataPath(ld); 586 string ldPath = ArchiveConstants.CreateOarLandDataPath(ld);
588 tar.WriteFile(ldPath, LandDataSerializer.Serialize(ld, null)); 587 Dictionary<string, object> options = new Dictionary<string, object>();
588 tar.WriteFile(ldPath, LandDataSerializer.Serialize(ld, options));
589 tar.Close(); 589 tar.Close();
590 590
591 oarStream = new MemoryStream(oarStream.ToArray()); 591 oarStream = new MemoryStream(oarStream.ToArray());
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs
index 1659493..702b503 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs
@@ -39,6 +39,7 @@ using OpenSim.Framework.Console;
39using OpenSim.Region.CoreModules.Framework.InterfaceCommander; 39using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
40using OpenSim.Region.Framework.Interfaces; 40using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Region.Framework.Scenes; 41using OpenSim.Region.Framework.Scenes;
42using OpenSim.Services.Interfaces;
42 43
43namespace OpenSim.Region.CoreModules.World.Estate 44namespace OpenSim.Region.CoreModules.World.Estate
44{ 45{
@@ -50,9 +51,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51 52
52 protected EstateManagementModule m_module; 53 protected EstateManagementModule m_module;
53 54
54 protected Commander m_commander = new Commander("estate");
55
56 public EstateManagementCommands(EstateManagementModule module) 55 public EstateManagementCommands(EstateManagementModule module)
57 { 56 {
58 m_module = module; 57 m_module = module;
@@ -82,13 +81,13 @@ namespace OpenSim.Region.CoreModules.World.Estate
82 "Specify -1 in <x> or <y> to wildcard that coordinate.", 81 "Specify -1 in <x> or <y> to wildcard that coordinate.",
83 consoleSetWaterHeight); 82 consoleSetWaterHeight);
84 83
85
86 m_module.Scene.AddCommand( 84 m_module.Scene.AddCommand(
87 "Estates", m_module, "estate show", "estate show", "Shows all estates on the simulator.", ShowEstatesCommand); 85 "Estates", m_module, "estate show", "estate show", "Shows all estates on the simulator.", ShowEstatesCommand);
88 } 86 }
89 87
90 public void Close() {} 88 public void Close() {}
91 89
90 #region CommandHandlers
92 protected void consoleSetTerrainTexture(string module, string[] args) 91 protected void consoleSetTerrainTexture(string module, string[] args)
93 { 92 {
94 string num = args[3]; 93 string num = args[3];
@@ -225,6 +224,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
225 es.EstateName, es.EstateID, m_module.UserManager.GetUserName(es.EstateOwner)); 224 es.EstateName, es.EstateID, m_module.UserManager.GetUserName(es.EstateOwner));
226 225
227 MainConsole.Instance.Output(report.ToString()); 226 MainConsole.Instance.Output(report.ToString());
228 } 227 }
228 #endregion
229 } 229 }
230} \ No newline at end of file 230} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 47390e7..e6e6485 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -40,6 +40,7 @@ using OpenMetaverse;
40using OpenSim.Framework; 40using OpenSim.Framework;
41using OpenSim.Region.Framework.Interfaces; 41using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.Framework.Scenes; 42using OpenSim.Region.Framework.Scenes;
43using OpenSim.Services.Interfaces;
43using RegionFlags = OpenMetaverse.RegionFlags; 44using RegionFlags = OpenMetaverse.RegionFlags;
44 45
45namespace OpenSim.Region.CoreModules.World.Estate 46namespace OpenSim.Region.CoreModules.World.Estate
@@ -67,8 +68,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
67 public event ChangeDelegate OnEstateInfoChange; 68 public event ChangeDelegate OnEstateInfoChange;
68 public event MessageDelegate OnEstateMessage; 69 public event MessageDelegate OnEstateMessage;
69 70
70 private int m_delayCount = 0;
71
72 #region Region Module interface 71 #region Region Module interface
73 72
74 public string Name { get { return "EstateManagementModule"; } } 73 public string Name { get { return "EstateManagementModule"; } }
@@ -120,6 +119,274 @@ namespace OpenSim.Region.CoreModules.World.Estate
120 119
121 #endregion 120 #endregion
122 121
122 #region IEstateModule Functions
123 public uint GetRegionFlags()
124 {
125 RegionFlags flags = RegionFlags.None;
126
127 // Fully implemented
128 //
129 if (Scene.RegionInfo.RegionSettings.AllowDamage)
130 flags |= RegionFlags.AllowDamage;
131 if (Scene.RegionInfo.RegionSettings.BlockTerraform)
132 flags |= RegionFlags.BlockTerraform;
133 if (!Scene.RegionInfo.RegionSettings.AllowLandResell)
134 flags |= RegionFlags.BlockLandResell;
135 if (Scene.RegionInfo.RegionSettings.DisableCollisions)
136 flags |= RegionFlags.SkipCollisions;
137 if (Scene.RegionInfo.RegionSettings.DisableScripts)
138 flags |= RegionFlags.SkipScripts;
139 if (Scene.RegionInfo.RegionSettings.DisablePhysics)
140 flags |= RegionFlags.SkipPhysics;
141 if (Scene.RegionInfo.RegionSettings.BlockFly)
142 flags |= RegionFlags.NoFly;
143 if (Scene.RegionInfo.RegionSettings.RestrictPushing)
144 flags |= RegionFlags.RestrictPushObject;
145 if (Scene.RegionInfo.RegionSettings.AllowLandJoinDivide)
146 flags |= RegionFlags.AllowParcelChanges;
147 if (Scene.RegionInfo.RegionSettings.BlockShowInSearch)
148 flags |= RegionFlags.BlockParcelSearch;
149
150 if (Scene.RegionInfo.RegionSettings.FixedSun)
151 flags |= RegionFlags.SunFixed;
152 if (Scene.RegionInfo.RegionSettings.Sandbox)
153 flags |= RegionFlags.Sandbox;
154 if (Scene.RegionInfo.EstateSettings.AllowVoice)
155 flags |= RegionFlags.AllowVoice;
156 if (Scene.RegionInfo.EstateSettings.AllowLandmark)
157 flags |= RegionFlags.AllowLandmark;
158 if (Scene.RegionInfo.EstateSettings.AllowSetHome)
159 flags |= RegionFlags.AllowSetHome;
160 if (Scene.RegionInfo.EstateSettings.BlockDwell)
161 flags |= RegionFlags.BlockDwell;
162 if (Scene.RegionInfo.EstateSettings.ResetHomeOnTeleport)
163 flags |= RegionFlags.ResetHomeOnTeleport;
164
165
166 // TODO: SkipUpdateInterestList
167
168 // Omitted
169 //
170 // Omitted: NullLayer (what is that?)
171 // Omitted: SkipAgentAction (what does it do?)
172
173 return (uint)flags;
174 }
175
176 public bool IsManager(UUID avatarID)
177 {
178 if (avatarID == Scene.RegionInfo.EstateSettings.EstateOwner)
179 return true;
180
181 List<UUID> ems = new List<UUID>(Scene.RegionInfo.EstateSettings.EstateManagers);
182 if (ems.Contains(avatarID))
183 return true;
184
185 return false;
186 }
187
188 public void sendRegionHandshakeToAll()
189 {
190 Scene.ForEachClient(sendRegionHandshake);
191 }
192
193 public void TriggerEstateInfoChange()
194 {
195 ChangeDelegate change = OnEstateInfoChange;
196
197 if (change != null)
198 change(Scene.RegionInfo.RegionID);
199 }
200
201 public void TriggerRegionInfoChange()
202 {
203 m_regionChangeTimer.Stop();
204 m_regionChangeTimer.Start();
205
206 ChangeDelegate change = OnRegionInfoChange;
207
208 if (change != null)
209 change(Scene.RegionInfo.RegionID);
210 }
211
212 public void setEstateTerrainBaseTexture(int level, UUID texture)
213 {
214 setEstateTerrainBaseTexture(null, level, texture);
215 sendRegionHandshakeToAll();
216 }
217
218 public void setEstateTerrainTextureHeights(int corner, float lowValue, float highValue)
219 {
220 setEstateTerrainTextureHeights(null, corner, lowValue, highValue);
221 }
222
223 public bool IsTerrainXfer(ulong xferID)
224 {
225 lock (this)
226 {
227 if (TerrainUploader == null)
228 return false;
229 else
230 return TerrainUploader.XferID == xferID;
231 }
232 }
233
234 public string SetEstateOwner(int estateID, UserAccount account)
235 {
236 string response;
237
238 // get the current settings from DB
239 EstateSettings dbSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
240 if (dbSettings.EstateID == 0)
241 {
242 response = String.Format("No estate found with ID {0}", estateID);
243 }
244 else if (account.PrincipalID == dbSettings.EstateOwner)
245 {
246 response = String.Format("Estate already belongs to {0} ({1} {2})", account.PrincipalID, account.FirstName, account.LastName);
247 }
248 else
249 {
250 dbSettings.EstateOwner = account.PrincipalID;
251 Scene.EstateDataService.StoreEstateSettings(dbSettings);
252 response = String.Empty;
253
254 // make sure there's a log entry to document the change
255 m_log.InfoFormat("[ESTATE]: Estate Owner for {0} changed to {1} ({2} {3})", dbSettings.EstateName,
256 account.PrincipalID, account.FirstName, account.LastName);
257
258 // propagate the change
259 List<UUID> regions = Scene.GetEstateRegions(estateID);
260 UUID regionId = (regions.Count() > 0) ? regions.ElementAt(0) : UUID.Zero;
261 if (regionId != UUID.Zero)
262 {
263 ChangeDelegate change = OnEstateInfoChange;
264
265 if (change != null)
266 change(regionId);
267 }
268
269 }
270 return response;
271 }
272
273 public string SetEstateName(int estateID, string newName)
274 {
275 string response;
276
277 // get the current settings from DB
278 EstateSettings dbSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
279
280 if (dbSettings.EstateID == 0)
281 {
282 response = String.Format("No estate found with ID {0}", estateID);
283 }
284 else if (newName == dbSettings.EstateName)
285 {
286 response = String.Format("Estate {0} is already named \"{1}\"", estateID, newName);
287 }
288 else
289 {
290 List<int> estates = Scene.EstateDataService.GetEstates(newName);
291 if (estates.Count() > 0)
292 {
293 response = String.Format("An estate named \"{0}\" already exists.", newName);
294 }
295 else
296 {
297 string oldName = dbSettings.EstateName;
298 dbSettings.EstateName = newName;
299 Scene.EstateDataService.StoreEstateSettings(dbSettings);
300 response = String.Empty;
301
302 // make sure there's a log entry to document the change
303 m_log.InfoFormat("[ESTATE]: Estate {0} renamed from \"{1}\" to \"{2}\"", estateID, oldName, newName);
304
305 // propagate the change
306 List<UUID> regions = Scene.GetEstateRegions(estateID);
307 UUID regionId = (regions.Count() > 0) ? regions.ElementAt(0) : UUID.Zero;
308 if (regionId != UUID.Zero)
309 {
310 ChangeDelegate change = OnEstateInfoChange;
311
312 if (change != null)
313 change(regionId);
314 }
315 }
316 }
317 return response;
318 }
319
320 public string SetRegionEstate(RegionInfo regionInfo, int estateID)
321 {
322 string response;
323
324 if (regionInfo.EstateSettings.EstateID == estateID)
325 {
326 response = String.Format("\"{0}\" is already part of estate {1}", regionInfo.RegionName, estateID);
327 }
328 else
329 {
330 // get the current settings from DB
331 EstateSettings dbSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
332 if (dbSettings.EstateID == 0)
333 {
334 response = String.Format("No estate found with ID {0}", estateID);
335 }
336 else if (Scene.EstateDataService.LinkRegion(regionInfo.RegionID, estateID))
337 {
338 // make sure there's a log entry to document the change
339 m_log.InfoFormat("[ESTATE]: Region {0} ({1}) moved to Estate {2} ({3}).", regionInfo.RegionID, regionInfo.RegionName, estateID, dbSettings.EstateName);
340
341 // propagate the change
342 ChangeDelegate change = OnEstateInfoChange;
343
344 if (change != null)
345 change(regionInfo.RegionID);
346
347 response = String.Empty;
348 }
349 else
350 {
351 response = String.Format("Could not move \"{0}\" to estate {1}", regionInfo.RegionName, estateID);
352 }
353 }
354 return response;
355 }
356
357 public string CreateEstate(string estateName, UUID ownerID)
358 {
359 string response;
360 if (string.IsNullOrEmpty(estateName))
361 {
362 response = "No estate name specified.";
363 }
364 else
365 {
366 List<int> estates = Scene.EstateDataService.GetEstates(estateName);
367 if (estates.Count() > 0)
368 {
369 response = String.Format("An estate named \"{0}\" already exists.", estateName);
370 }
371 else
372 {
373 EstateSettings settings = Scene.EstateDataService.CreateNewEstate();
374 if (settings == null)
375 response = String.Format("Unable to create estate \"{0}\" at this simulator", estateName);
376 else
377 {
378 settings.EstateOwner = ownerID;
379 settings.EstateName = estateName;
380 Scene.EstateDataService.StoreEstateSettings(settings);
381 response = String.Empty;
382 }
383 }
384 }
385 return response;
386 }
387
388 #endregion
389
123 #region Packet Data Responders 390 #region Packet Data Responders
124 391
125 private void clientSendDetailedEstateData(IClientAPI remote_client, UUID invoice) 392 private void clientSendDetailedEstateData(IClientAPI remote_client, UUID invoice)
@@ -227,12 +494,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
227 sendRegionInfoPacketToAll(); 494 sendRegionInfoPacketToAll();
228 } 495 }
229 496
230 public void setEstateTerrainBaseTexture(int level, UUID texture)
231 {
232 setEstateTerrainBaseTexture(null, level, texture);
233 sendRegionHandshakeToAll();
234 }
235
236 public void setEstateTerrainBaseTexture(IClientAPI remoteClient, int level, UUID texture) 497 public void setEstateTerrainBaseTexture(IClientAPI remoteClient, int level, UUID texture)
237 { 498 {
238 if (texture == UUID.Zero) 499 if (texture == UUID.Zero)
@@ -259,11 +520,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
259 sendRegionInfoPacketToAll(); 520 sendRegionInfoPacketToAll();
260 } 521 }
261 522
262 public void setEstateTerrainTextureHeights(int corner, float lowValue, float highValue)
263 {
264 setEstateTerrainTextureHeights(null, corner, lowValue, highValue);
265 }
266
267 public void setEstateTerrainTextureHeights(IClientAPI client, int corner, float lowValue, float highValue) 523 public void setEstateTerrainTextureHeights(IClientAPI client, int corner, float lowValue, float highValue)
268 { 524 {
269 switch (corner) 525 switch (corner)
@@ -399,13 +655,13 @@ namespace OpenSim.Region.CoreModules.World.Estate
399 { 655 {
400 estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); 656 estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
401 estateSettings.AddEstateUser(user); 657 estateSettings.AddEstateUser(user);
402 estateSettings.Save(); 658 Scene.EstateDataService.StoreEstateSettings(estateSettings);
403 } 659 }
404 } 660 }
405 } 661 }
406 662
407 Scene.RegionInfo.EstateSettings.AddEstateUser(user); 663 Scene.RegionInfo.EstateSettings.AddEstateUser(user);
408 Scene.RegionInfo.EstateSettings.Save(); 664 Scene.EstateDataService.StoreEstateSettings(Scene.RegionInfo.EstateSettings);
409 665
410 TriggerEstateInfoChange(); 666 TriggerEstateInfoChange();
411 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID); 667 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID);
@@ -432,13 +688,13 @@ namespace OpenSim.Region.CoreModules.World.Estate
432 { 688 {
433 estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); 689 estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
434 estateSettings.RemoveEstateUser(user); 690 estateSettings.RemoveEstateUser(user);
435 estateSettings.Save(); 691 Scene.EstateDataService.StoreEstateSettings(estateSettings);
436 } 692 }
437 } 693 }
438 } 694 }
439 695
440 Scene.RegionInfo.EstateSettings.RemoveEstateUser(user); 696 Scene.RegionInfo.EstateSettings.RemoveEstateUser(user);
441 Scene.RegionInfo.EstateSettings.Save(); 697 Scene.EstateDataService.StoreEstateSettings(Scene.RegionInfo.EstateSettings);
442 698
443 TriggerEstateInfoChange(); 699 TriggerEstateInfoChange();
444 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID); 700 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID);
@@ -464,13 +720,13 @@ namespace OpenSim.Region.CoreModules.World.Estate
464 { 720 {
465 estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); 721 estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
466 estateSettings.AddEstateGroup(user); 722 estateSettings.AddEstateGroup(user);
467 estateSettings.Save(); 723 Scene.EstateDataService.StoreEstateSettings(estateSettings);
468 } 724 }
469 } 725 }
470 } 726 }
471 727
472 Scene.RegionInfo.EstateSettings.AddEstateGroup(user); 728 Scene.RegionInfo.EstateSettings.AddEstateGroup(user);
473 Scene.RegionInfo.EstateSettings.Save(); 729 Scene.EstateDataService.StoreEstateSettings(Scene.RegionInfo.EstateSettings);
474 730
475 TriggerEstateInfoChange(); 731 TriggerEstateInfoChange();
476 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID); 732 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID);
@@ -496,13 +752,13 @@ namespace OpenSim.Region.CoreModules.World.Estate
496 { 752 {
497 estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); 753 estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
498 estateSettings.RemoveEstateGroup(user); 754 estateSettings.RemoveEstateGroup(user);
499 estateSettings.Save(); 755 Scene.EstateDataService.StoreEstateSettings(estateSettings);
500 } 756 }
501 } 757 }
502 } 758 }
503 759
504 Scene.RegionInfo.EstateSettings.RemoveEstateGroup(user); 760 Scene.RegionInfo.EstateSettings.RemoveEstateGroup(user);
505 Scene.RegionInfo.EstateSettings.Save(); 761 Scene.EstateDataService.StoreEstateSettings(Scene.RegionInfo.EstateSettings);
506 762
507 TriggerEstateInfoChange(); 763 TriggerEstateInfoChange();
508 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID); 764 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID);
@@ -551,7 +807,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
551 807
552 estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); 808 estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
553 estateSettings.AddBan(bitem); 809 estateSettings.AddBan(bitem);
554 estateSettings.Save(); 810 Scene.EstateDataService.StoreEstateSettings(estateSettings);
555 } 811 }
556 } 812 }
557 } 813 }
@@ -564,7 +820,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
564 item.BannedHostIPMask = "0.0.0.0"; 820 item.BannedHostIPMask = "0.0.0.0";
565 821
566 Scene.RegionInfo.EstateSettings.AddBan(item); 822 Scene.RegionInfo.EstateSettings.AddBan(item);
567 Scene.RegionInfo.EstateSettings.Save(); 823 Scene.EstateDataService.StoreEstateSettings(Scene.RegionInfo.EstateSettings);
568 824
569 TriggerEstateInfoChange(); 825 TriggerEstateInfoChange();
570 826
@@ -627,13 +883,13 @@ namespace OpenSim.Region.CoreModules.World.Estate
627 { 883 {
628 estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); 884 estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
629 estateSettings.RemoveBan(user); 885 estateSettings.RemoveBan(user);
630 estateSettings.Save(); 886 Scene.EstateDataService.StoreEstateSettings(estateSettings);
631 } 887 }
632 } 888 }
633 } 889 }
634 890
635 Scene.RegionInfo.EstateSettings.RemoveBan(listitem.BannedUserID); 891 Scene.RegionInfo.EstateSettings.RemoveBan(listitem.BannedUserID);
636 Scene.RegionInfo.EstateSettings.Save(); 892 Scene.EstateDataService.StoreEstateSettings(Scene.RegionInfo.EstateSettings);
637 893
638 TriggerEstateInfoChange(); 894 TriggerEstateInfoChange();
639 } 895 }
@@ -666,13 +922,13 @@ namespace OpenSim.Region.CoreModules.World.Estate
666 { 922 {
667 estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); 923 estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
668 estateSettings.AddEstateManager(user); 924 estateSettings.AddEstateManager(user);
669 estateSettings.Save(); 925 Scene.EstateDataService.StoreEstateSettings(estateSettings);
670 } 926 }
671 } 927 }
672 } 928 }
673 929
674 Scene.RegionInfo.EstateSettings.AddEstateManager(user); 930 Scene.RegionInfo.EstateSettings.AddEstateManager(user);
675 Scene.RegionInfo.EstateSettings.Save(); 931 Scene.EstateDataService.StoreEstateSettings(Scene.RegionInfo.EstateSettings);
676 932
677 TriggerEstateInfoChange(); 933 TriggerEstateInfoChange();
678 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID); 934 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID);
@@ -698,13 +954,13 @@ namespace OpenSim.Region.CoreModules.World.Estate
698 { 954 {
699 estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); 955 estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
700 estateSettings.RemoveEstateManager(user); 956 estateSettings.RemoveEstateManager(user);
701 estateSettings.Save(); 957 Scene.EstateDataService.StoreEstateSettings(estateSettings);
702 } 958 }
703 } 959 }
704 } 960 }
705 961
706 Scene.RegionInfo.EstateSettings.RemoveEstateManager(user); 962 Scene.RegionInfo.EstateSettings.RemoveEstateManager(user);
707 Scene.RegionInfo.EstateSettings.Save(); 963 Scene.EstateDataService.StoreEstateSettings(Scene.RegionInfo.EstateSettings);
708 964
709 TriggerEstateInfoChange(); 965 TriggerEstateInfoChange();
710 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID); 966 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID);
@@ -869,18 +1125,18 @@ namespace OpenSim.Region.CoreModules.World.Estate
869 1125
870 TerrainUploader = null; 1126 TerrainUploader = null;
871 } 1127 }
1128
1129 m_log.DebugFormat("[CLIENT]: Terrain upload from {0} to {1} complete.", remoteClient.Name, Scene.Name);
872 remoteClient.SendAlertMessage("Terrain Upload Complete. Loading...."); 1130 remoteClient.SendAlertMessage("Terrain Upload Complete. Loading....");
1131
873 ITerrainModule terr = Scene.RequestModuleInterface<ITerrainModule>(); 1132 ITerrainModule terr = Scene.RequestModuleInterface<ITerrainModule>();
874 1133
875 if (terr != null) 1134 if (terr != null)
876 { 1135 {
877 m_log.Warn("[CLIENT]: Got Request to Send Terrain in region " + Scene.RegionInfo.RegionName);
878
879 try 1136 try
880 { 1137 {
881 MemoryStream terrainStream = new MemoryStream(terrainData); 1138 using (MemoryStream terrainStream = new MemoryStream(terrainData))
882 terr.LoadFromStream(filename, terrainStream); 1139 terr.LoadFromStream(filename, terrainStream);
883 terrainStream.Close();
884 1140
885 FileInfo x = new FileInfo(filename); 1141 FileInfo x = new FileInfo(filename);
886 remoteClient.SendAlertMessage("Your terrain was loaded as a " + x.Extension + " file. It may take a few moments to appear."); 1142 remoteClient.SendAlertMessage("Your terrain was loaded as a " + x.Extension + " file. It may take a few moments to appear.");
@@ -924,7 +1180,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
924 { 1180 {
925 if (TerrainUploader == null) 1181 if (TerrainUploader == null)
926 { 1182 {
927 m_log.DebugFormat("Starting to receive uploaded terrain"); 1183 m_log.DebugFormat(
1184 "[TERRAIN]: Started receiving terrain upload for region {0} from {1}",
1185 Scene.Name, remote_client.Name);
1186
928 TerrainUploader = new EstateTerrainXferHandler(remote_client, clientFileName); 1187 TerrainUploader = new EstateTerrainXferHandler(remote_client, clientFileName);
929 remote_client.OnXferReceive += TerrainUploader.XferReceive; 1188 remote_client.OnXferReceive += TerrainUploader.XferReceive;
930 remote_client.OnAbortXfer += AbortTerrainXferHandler; 1189 remote_client.OnAbortXfer += AbortTerrainXferHandler;
@@ -938,17 +1197,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
938 } 1197 }
939 } 1198 }
940 1199
941 public bool IsTerrainXfer(ulong xferID)
942 {
943 lock (this)
944 {
945 if (TerrainUploader == null)
946 return false;
947 else
948 return TerrainUploader.XferID == xferID;
949 }
950 }
951
952 private void handleTerrainRequest(IClientAPI remote_client, string clientFileName) 1200 private void handleTerrainRequest(IClientAPI remote_client, string clientFileName)
953 { 1201 {
954 // Save terrain here 1202 // Save terrain here
@@ -956,7 +1204,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
956 1204
957 if (terr != null) 1205 if (terr != null)
958 { 1206 {
959 m_log.Warn("[CLIENT]: Got Request to Send Terrain in region " + Scene.RegionInfo.RegionName); 1207// m_log.Warn("[CLIENT]: Got Request to Send Terrain in region " + Scene.RegionInfo.RegionName);
960 if (File.Exists(Util.dataDir() + "/terrain.raw")) 1208 if (File.Exists(Util.dataDir() + "/terrain.raw"))
961 { 1209 {
962 File.Delete(Util.dataDir() + "/terrain.raw"); 1210 File.Delete(Util.dataDir() + "/terrain.raw");
@@ -968,8 +1216,9 @@ namespace OpenSim.Region.CoreModules.World.Estate
968 input.Read(bdata, 0, (int)input.Length); 1216 input.Read(bdata, 0, (int)input.Length);
969 remote_client.SendAlertMessage("Terrain file written, starting download..."); 1217 remote_client.SendAlertMessage("Terrain file written, starting download...");
970 Scene.XferManager.AddNewFile("terrain.raw", bdata); 1218 Scene.XferManager.AddNewFile("terrain.raw", bdata);
971 // Tell client about it 1219
972 m_log.Warn("[CLIENT]: Sending Terrain to " + remote_client.Name); 1220 m_log.DebugFormat("[CLIENT]: Sending terrain for region {0} to {1}", Scene.Name, remote_client.Name);
1221
973 remote_client.SendInitiateDownload("terrain.raw", clientFileName); 1222 remote_client.SendInitiateDownload("terrain.raw", clientFileName);
974 } 1223 }
975 } 1224 }
@@ -1130,11 +1379,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
1130 remoteClient.SendRegionHandshake(Scene.RegionInfo,args); 1379 remoteClient.SendRegionHandshake(Scene.RegionInfo,args);
1131 } 1380 }
1132 1381
1133 public void sendRegionHandshakeToAll()
1134 {
1135 Scene.ForEachClient(sendRegionHandshake);
1136 }
1137
1138 public void handleEstateChangeInfo(IClientAPI remoteClient, UUID invoice, UUID senderID, UInt32 parms1, UInt32 parms2) 1382 public void handleEstateChangeInfo(IClientAPI remoteClient, UUID invoice, UUID senderID, UInt32 parms1, UInt32 parms2)
1139 { 1383 {
1140 if (parms2 == 0) 1384 if (parms2 == 0)
@@ -1189,7 +1433,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
1189 else 1433 else
1190 Scene.RegionInfo.EstateSettings.DenyMinors = false; 1434 Scene.RegionInfo.EstateSettings.DenyMinors = false;
1191 1435
1192 Scene.RegionInfo.EstateSettings.Save(); 1436 Scene.EstateDataService.StoreEstateSettings(Scene.RegionInfo.EstateSettings);
1193 TriggerEstateInfoChange(); 1437 TriggerEstateInfoChange();
1194 1438
1195 Scene.TriggerEstateSunUpdate(); 1439 Scene.TriggerEstateSunUpdate();
@@ -1216,7 +1460,8 @@ namespace OpenSim.Region.CoreModules.World.Estate
1216 sendRegionInfoPacketToAll(); 1460 sendRegionInfoPacketToAll();
1217 } 1461 }
1218 1462
1219 #endregion 1463
1464 #endregion
1220 1465
1221 private void EventManager_OnNewClient(IClientAPI client) 1466 private void EventManager_OnNewClient(IClientAPI client)
1222 { 1467 {
@@ -1246,6 +1491,9 @@ namespace OpenSim.Region.CoreModules.World.Estate
1246 sendRegionHandshake(client); 1491 sendRegionHandshake(client);
1247 } 1492 }
1248 1493
1494<<<<<<< HEAD
1495 private uint GetEstateFlags()
1496=======
1249 public uint GetRegionFlags() 1497 public uint GetRegionFlags()
1250 { 1498 {
1251 RegionFlags flags = RegionFlags.None; 1499 RegionFlags flags = RegionFlags.None;
@@ -1304,6 +1552,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
1304 } 1552 }
1305 1553
1306 public uint GetEstateFlags() 1554 public uint GetEstateFlags()
1555>>>>>>> avn/ubitvar
1307 { 1556 {
1308 RegionFlags flags = RegionFlags.None; 1557 RegionFlags flags = RegionFlags.None;
1309 1558
@@ -1344,40 +1593,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
1344 return (uint)flags; 1593 return (uint)flags;
1345 } 1594 }
1346 1595
1347 public bool IsManager(UUID avatarID)
1348 {
1349 if (avatarID == Scene.RegionInfo.EstateSettings.EstateOwner)
1350 return true;
1351
1352 List<UUID> ems = new List<UUID>(Scene.RegionInfo.EstateSettings.EstateManagers);
1353 if (ems.Contains(avatarID))
1354 return true;
1355
1356 return false;
1357 }
1358
1359 public void TriggerRegionInfoChange()
1360 {
1361 m_regionChangeTimer.Stop();
1362 m_regionChangeTimer.Start();
1363 }
1364
1365 protected void RaiseRegionInfoChange(object sender, ElapsedEventArgs e)
1366 {
1367 ChangeDelegate change = OnRegionInfoChange;
1368
1369 if (change != null)
1370 change(Scene.RegionInfo.RegionID);
1371 }
1372
1373 public void TriggerEstateInfoChange()
1374 {
1375 ChangeDelegate change = OnEstateInfoChange;
1376
1377 if (change != null)
1378 change(Scene.RegionInfo.RegionID);
1379 }
1380
1381 public void TriggerEstateMessage(UUID fromID, string fromName, string message) 1596 public void TriggerEstateMessage(UUID fromID, string fromName, string message)
1382 { 1597 {
1383 MessageDelegate onmessage = OnEstateMessage; 1598 MessageDelegate onmessage = OnEstateMessage;
diff --git a/OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs b/OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs
index 2366767..ec5af2b 100644
--- a/OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/XEstateRequestHandler.cs
@@ -281,18 +281,8 @@ namespace OpenSim.Region.CoreModules.World.Estate
281 281
282 rootElement.AppendChild(result); 282 rootElement.AppendChild(result);
283 283
284 return DocToBytes(doc); 284 return Util.DocToBytes(doc);
285 } 285 }
286 286
287 private byte[] DocToBytes(XmlDocument doc)
288 {
289 MemoryStream ms = new MemoryStream();
290 XmlTextWriter xw = new XmlTextWriter(ms, null);
291 xw.Formatting = Formatting.Indented;
292 doc.WriteTo(xw);
293 xw.Flush();
294
295 return ms.ToArray();
296 }
297 } 287 }
298} 288}
diff --git a/OpenSim/Region/CoreModules/World/Land/DwellModule.cs b/OpenSim/Region/CoreModules/World/Land/DwellModule.cs
index bd22155..d17c517 100644
--- a/OpenSim/Region/CoreModules/World/Land/DwellModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/DwellModule.cs
@@ -52,10 +52,12 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
52 52
53namespace OpenSim.Region.CoreModules.World.Land 53namespace OpenSim.Region.CoreModules.World.Land
54{ 54{
55 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DwellModule")] 55 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DefaultDwellModule")]
56 public class DwellModule : IDwellModule, INonSharedRegionModule 56 public class DefaultDwellModule : IDwellModule, INonSharedRegionModule
57 { 57 {
58 private Scene m_scene; 58 private Scene m_scene;
59 private IConfigSource m_Config;
60 private bool m_Enabled = false;
59 61
60 public Type ReplaceableInterface 62 public Type ReplaceableInterface
61 { 63 {
@@ -64,15 +66,27 @@ namespace OpenSim.Region.CoreModules.World.Land
64 66
65 public string Name 67 public string Name
66 { 68 {
67 get { return "DwellModule"; } 69 get { return "DefaultDwellModule"; }
68 } 70 }
69 71
70 public void Initialise(IConfigSource source) 72 public void Initialise(IConfigSource source)
71 { 73 {
74 m_Config = source;
75
76 IConfig DwellConfig = m_Config.Configs ["Dwell"];
77
78 if (DwellConfig == null) {
79 m_Enabled = false;
80 return;
81 }
82 m_Enabled = (DwellConfig.GetString ("DwellModule", "DefaultDwellModule") == "DefaultDwellModule");
72 } 83 }
73 84
74 public void AddRegion(Scene scene) 85 public void AddRegion(Scene scene)
75 { 86 {
87 if (!m_Enabled)
88 return;
89
76 m_scene = scene; 90 m_scene = scene;
77 91
78 m_scene.EventManager.OnNewClient += OnNewClient; 92 m_scene.EventManager.OnNewClient += OnNewClient;
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 6f3249d..8bd46f6 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -69,13 +69,18 @@ namespace OpenSim.Region.CoreModules.World.Land
69 /// <summary> 69 /// <summary>
70 /// Minimum land unit size in region co-ordinates. 70 /// Minimum land unit size in region co-ordinates.
71 /// </summary> 71 /// </summary>
72<<<<<<< HEAD
73 public const int LandUnit = 4;
74=======
72 public const int landUnit = 4; 75 public const int landUnit = 4;
76>>>>>>> avn/ubitvar
73 77
74 private static readonly string remoteParcelRequestPath = "0009/"; 78 private static readonly string remoteParcelRequestPath = "0009/";
75 79
76 private LandChannel landChannel; 80 private LandChannel landChannel;
77 private Scene m_scene; 81 private Scene m_scene;
78 82
83 protected IGroupsModule m_groupManager;
79 protected IUserManagement m_userManager; 84 protected IUserManagement m_userManager;
80 protected IPrimCountModule m_primCountModule; 85 protected IPrimCountModule m_primCountModule;
81 protected IDialogModule m_Dialog; 86 protected IDialogModule m_Dialog;
@@ -101,8 +106,22 @@ namespace OpenSim.Region.CoreModules.World.Land
101 106
102 // caches ExtendedLandData 107 // caches ExtendedLandData
103 private Cache parcelInfoCache; 108 private Cache parcelInfoCache;
109<<<<<<< HEAD
110
111
112 /// <summary>
113 /// Record positions that avatar's are currently being forced to move to due to parcel entry restrictions.
114 /// </summary>
115 private Dictionary<UUID, Vector3> forcedPosition = new Dictionary<UUID, Vector3>();
116=======
104 private Dictionary<UUID, Vector3> forcedPosition = 117 private Dictionary<UUID, Vector3> forcedPosition =
105 new Dictionary<UUID, Vector3>(); 118 new Dictionary<UUID, Vector3>();
119>>>>>>> avn/ubitvar
120
121 // Enables limiting parcel layer info transmission when doing simple updates
122 private bool shouldLimitParcelLayerInfoToViewDistance { get; set; }
123 // "View distance" for sending parcel layer info if asked for from a view point in the region
124 private int parcelLayerViewDistance { get; set; }
106 125
107 #region INonSharedRegionModule Members 126 #region INonSharedRegionModule Members
108 127
@@ -113,18 +132,32 @@ namespace OpenSim.Region.CoreModules.World.Land
113 132
114 public void Initialise(IConfigSource source) 133 public void Initialise(IConfigSource source)
115 { 134 {
135<<<<<<< HEAD
136 shouldLimitParcelLayerInfoToViewDistance = true;
137 parcelLayerViewDistance = 128;
138 IConfig landManagementConfig = source.Configs["LandManagement"];
139 if (landManagementConfig != null)
140 {
141 shouldLimitParcelLayerInfoToViewDistance = landManagementConfig.GetBoolean("LimitParcelLayerUpdateDistance", shouldLimitParcelLayerInfoToViewDistance);
142 parcelLayerViewDistance = landManagementConfig.GetInt("ParcelLayerViewDistance", parcelLayerViewDistance);
143=======
116 IConfig cnf = source.Configs["LandManagement"]; 144 IConfig cnf = source.Configs["LandManagement"];
117 if (cnf != null) 145 if (cnf != null)
118 { 146 {
119 DefaultGodParcelGroup = new UUID(cnf.GetString("DefaultAdministratorGroupUUID", UUID.Zero.ToString())); 147 DefaultGodParcelGroup = new UUID(cnf.GetString("DefaultAdministratorGroupUUID", UUID.Zero.ToString()));
120 DefaultGodParcelName = cnf.GetString("DefaultAdministratorParcelName", "Default Parcel"); 148 DefaultGodParcelName = cnf.GetString("DefaultAdministratorParcelName", "Default Parcel");
149>>>>>>> avn/ubitvar
121 } 150 }
122 } 151 }
123 152
124 public void AddRegion(Scene scene) 153 public void AddRegion(Scene scene)
125 { 154 {
126 m_scene = scene; 155 m_scene = scene;
156<<<<<<< HEAD
157 m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit];
158=======
127 m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit]; 159 m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit];
160>>>>>>> avn/ubitvar
128 landChannel = new LandChannel(scene, this); 161 landChannel = new LandChannel(scene, this);
129 162
130 parcelInfoCache = new Cache(); 163 parcelInfoCache = new Cache();
@@ -158,9 +191,10 @@ namespace OpenSim.Region.CoreModules.World.Land
158 191
159 public void RegionLoaded(Scene scene) 192 public void RegionLoaded(Scene scene)
160 { 193 {
161 m_userManager = m_scene.RequestModuleInterface<IUserManagement>(); 194 m_userManager = m_scene.RequestModuleInterface<IUserManagement>();
162 m_primCountModule = m_scene.RequestModuleInterface<IPrimCountModule>(); 195 m_groupManager = m_scene.RequestModuleInterface<IGroupsModule>();
163 m_Dialog = m_scene.RequestModuleInterface<IDialogModule>(); 196 m_primCountModule = m_scene.RequestModuleInterface<IPrimCountModule>();
197 m_Dialog = m_scene.RequestModuleInterface<IDialogModule>();
164 } 198 }
165 199
166 public void RemoveRegion(Scene scene) 200 public void RemoveRegion(Scene scene)
@@ -265,7 +299,11 @@ namespace OpenSim.Region.CoreModules.World.Land
265 { 299 {
266 m_landList.Clear(); 300 m_landList.Clear();
267 m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; 301 m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1;
302<<<<<<< HEAD
303 m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit];
304=======
268 m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit]; 305 m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit];
306>>>>>>> avn/ubitvar
269 } 307 }
270 } 308 }
271 309
@@ -275,9 +313,16 @@ namespace OpenSim.Region.CoreModules.World.Land
275 /// <returns>The parcel created.</returns> 313 /// <returns>The parcel created.</returns>
276 protected ILandObject CreateDefaultParcel() 314 protected ILandObject CreateDefaultParcel()
277 { 315 {
316<<<<<<< HEAD
317 m_log.DebugFormat(
318 "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName);
319
320 ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene);
321=======
278 m_log.DebugFormat("{0} Creating default parcel for region {1}", LogHeader, m_scene.RegionInfo.RegionName); 322 m_log.DebugFormat("{0} Creating default parcel for region {1}", LogHeader, m_scene.RegionInfo.RegionName);
279 323
280 ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); 324 ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene);
325>>>>>>> avn/ubitvar
281 fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, 326 fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0,
282 (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY)); 327 (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY));
283 fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; 328 fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
@@ -411,10 +456,15 @@ namespace OpenSim.Region.CoreModules.World.Land
411 456
412 public void SendLandUpdate(ScenePresence avatar, bool force) 457 public void SendLandUpdate(ScenePresence avatar, bool force)
413 { 458 {
459<<<<<<< HEAD
460 ILandObject over = GetLandObject((int)Math.Min(((int)m_scene.RegionInfo.RegionSizeX - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.X))),
461 (int)Math.Min(((int)m_scene.RegionInfo.RegionSizeY - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.Y))));
462=======
414 if (avatar.IsChildAgent) 463 if (avatar.IsChildAgent)
415 return; 464 return;
416 465
417 ILandObject over = GetLandObjectClipedXY(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); 466 ILandObject over = GetLandObjectClipedXY(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
467>>>>>>> avn/ubitvar
418 468
419 if (over != null) 469 if (over != null)
420 { 470 {
@@ -487,16 +537,13 @@ namespace OpenSim.Region.CoreModules.World.Land
487 /// </summary> 537 /// </summary>
488 /// <param name="avatar"></param> 538 /// <param name="avatar"></param>
489 public void EventManagerOnClientMovement(ScenePresence avatar) 539 public void EventManagerOnClientMovement(ScenePresence avatar)
490 //
491 { 540 {
492 ILandObject over = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); 541 Vector3 pos = avatar.AbsolutePosition;
542 ILandObject over = GetLandObject(pos.X, pos.Y);
493 if (over != null) 543 if (over != null)
494 { 544 {
495 if (!over.IsRestrictedFromLand(avatar.UUID) && (!over.IsBannedFromLand(avatar.UUID) || avatar.AbsolutePosition.Z >= LandChannel.BAN_LINE_SAFETY_HIEGHT)) 545 if (!over.IsRestrictedFromLand(avatar.UUID) && (!over.IsBannedFromLand(avatar.UUID) || pos.Z >= LandChannel.BAN_LINE_SAFETY_HIEGHT))
496 { 546 avatar.lastKnownAllowedPosition = pos;
497 avatar.lastKnownAllowedPosition =
498 new Vector3(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z);
499 }
500 } 547 }
501 } 548 }
502 549
@@ -555,7 +602,10 @@ namespace OpenSim.Region.CoreModules.World.Land
555 /// <summary> 602 /// <summary>
556 /// Adds a land object to the stored list and adds them to the landIDList to what they own 603 /// Adds a land object to the stored list and adds them to the landIDList to what they own
557 /// </summary> 604 /// </summary>
558 /// <param name="new_land">The land object being added</param> 605 /// <param name="new_land">
606 /// The land object being added.
607 /// Will return null if this overlaps with an existing parcel that has not had its bitmap adjusted.
608 /// </param>
559 public ILandObject AddLandObject(ILandObject land) 609 public ILandObject AddLandObject(ILandObject land)
560 { 610 {
561 ILandObject new_land = land.Copy(); 611 ILandObject new_land = land.Copy();
@@ -567,21 +617,32 @@ namespace OpenSim.Region.CoreModules.World.Land
567 617
568 lock (m_landList) 618 lock (m_landList)
569 { 619 {
570 int newLandLocalID = ++m_lastLandLocalID; 620 int newLandLocalID = m_lastLandLocalID + 1;
571 new_land.LandData.LocalID = newLandLocalID; 621 new_land.LandData.LocalID = newLandLocalID;
572 622
573 bool[,] landBitmap = new_land.GetLandBitmap(); 623 bool[,] landBitmap = new_land.GetLandBitmap();
624<<<<<<< HEAD
625 // m_log.DebugFormat("{0} AddLandObject. new_land.bitmapSize=({1},{2}). newLocalID={3}",
626 // LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), newLandLocalID);
627
628=======
629>>>>>>> avn/ubitvar
574 if (landBitmap.GetLength(0) != m_landIDList.GetLength(0) || landBitmap.GetLength(1) != m_landIDList.GetLength(1)) 630 if (landBitmap.GetLength(0) != m_landIDList.GetLength(0) || landBitmap.GetLength(1) != m_landIDList.GetLength(1))
575 { 631 {
576 // Going to variable sized regions can cause mismatches 632 // Going to variable sized regions can cause mismatches
577 m_log.ErrorFormat("{0} AddLandObject. Added land bitmap different size than region ID map. bitmapSize=({1},{2}), landIDSize=({3},{4})", 633 m_log.ErrorFormat("{0} AddLandObject. Added land bitmap different size than region ID map. bitmapSize=({1},{2}), landIDSize=({3},{4})",
634<<<<<<< HEAD
635 LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), m_landIDList.GetLength(0), m_landIDList.GetLength(1) );
636=======
578 LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), m_landIDList.GetLength(0), m_landIDList.GetLength(1)); 637 LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), m_landIDList.GetLength(0), m_landIDList.GetLength(1));
638>>>>>>> avn/ubitvar
579 } 639 }
580 else 640 else
581 { 641 {
582 // If other land objects still believe that they occupy any parts of the same space, 642 // If other land objects still believe that they occupy any parts of the same space,
583 // then do not allow the add to proceed. 643 // then do not allow the add to proceed.
584 for (int x = 0; x < landBitmap.GetLength(0); x++) 644 for (int x = 0; x < landBitmap.GetLength(0); x++)
645<<<<<<< HEAD
585 { 646 {
586 for (int y = 0; y < landBitmap.GetLength(1); y++) 647 for (int y = 0; y < landBitmap.GetLength(1); y++)
587 { 648 {
@@ -597,6 +658,40 @@ namespace OpenSim.Region.CoreModules.World.Land
597 { 658 {
598 m_log.ErrorFormat( 659 m_log.ErrorFormat(
599 "{0}: Cannot add parcel \"{1}\", local ID {2} at tile {3},{4} because this is still occupied by parcel \"{5}\", local ID {6} in {7}", 660 "{0}: Cannot add parcel \"{1}\", local ID {2} at tile {3},{4} because this is still occupied by parcel \"{5}\", local ID {6} in {7}",
661 LogHeader, new_land.LandData.Name, new_land.LandData.LocalID, x, y,
662 lastRecordedLo.LandData.Name, lastRecordedLo.LandData.LocalID, m_scene.Name);
663
664 return null;
665 }
666 }
667 }
668 }
669 }
670
671 for (int x = 0; x < landBitmap.GetLength(0); x++)
672=======
673>>>>>>> avn/ubitvar
674 {
675 for (int y = 0; y < landBitmap.GetLength(1); y++)
676 {
677 if (landBitmap[x, y])
678 {
679<<<<<<< HEAD
680 // m_log.DebugFormat(
681 // "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}",
682 // new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName);
683
684=======
685 int lastRecordedLandId = m_landIDList[x, y];
686
687 if (lastRecordedLandId > 0)
688 {
689 ILandObject lastRecordedLo = m_landList[lastRecordedLandId];
690
691 if (lastRecordedLo.LandBitmap[x, y])
692 {
693 m_log.ErrorFormat(
694 "{0}: Cannot add parcel \"{1}\", local ID {2} at tile {3},{4} because this is still occupied by parcel \"{5}\", local ID {6} in {7}",
600 LogHeader, new_land.LandData.Name, new_land.LandData.LocalID, x, y, 695 LogHeader, new_land.LandData.Name, new_land.LandData.LocalID, x, y,
601 lastRecordedLo.LandData.Name, lastRecordedLo.LandData.LocalID, m_scene.Name); 696 lastRecordedLo.LandData.Name, lastRecordedLo.LandData.LocalID, m_scene.Name);
602 697
@@ -617,6 +712,7 @@ namespace OpenSim.Region.CoreModules.World.Land
617 // "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}", 712 // "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}",
618 // new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName); 713 // new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName);
619 714
715>>>>>>> avn/ubitvar
620 m_landIDList[x, y] = newLandLocalID; 716 m_landIDList[x, y] = newLandLocalID;
621 } 717 }
622 } 718 }
@@ -624,10 +720,12 @@ namespace OpenSim.Region.CoreModules.World.Land
624 } 720 }
625 721
626 m_landList.Add(newLandLocalID, new_land); 722 m_landList.Add(newLandLocalID, new_land);
723 m_lastLandLocalID++;
627 } 724 }
628 725
629 new_land.ForceUpdateLandInfo(); 726 new_land.ForceUpdateLandInfo();
630 m_scene.EventManager.TriggerLandObjectAdded(new_land); 727 m_scene.EventManager.TriggerLandObjectAdded(new_land);
728
631 return new_land; 729 return new_land;
632 } 730 }
633 731
@@ -731,6 +829,33 @@ namespace OpenSim.Region.CoreModules.World.Land
731 /// <returns>Land object at the point supplied</returns> 829 /// <returns>Land object at the point supplied</returns>
732 public ILandObject GetLandObject(float x_float, float y_float) 830 public ILandObject GetLandObject(float x_float, float y_float)
733 { 831 {
832<<<<<<< HEAD
833 return GetLandObject((int)x_float, (int)y_float, true /* returnNullIfLandObjectNotFound */);
834 /*
835 int x;
836 int y;
837
838 if (x_float >= m_scene.RegionInfo.RegionSizeX || x_float < 0 || y_float >= m_scene.RegionInfo.RegionSizeX || y_float < 0)
839 return null;
840
841 try
842 {
843 x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / (float)landUnit));
844 y = Convert.ToInt32(Math.Floor(Convert.ToDouble(y_float) / (float)landUnit));
845 }
846 catch (OverflowException)
847 {
848 return null;
849 }
850
851 if (x >= (m_scene.RegionInfo.RegionSizeX / landUnit)
852 || y >= (m_scene.RegionInfo.RegionSizeY / landUnit)
853 || x < 0
854 || y < 0)
855 {
856 return null;
857 }
858=======
734 return GetLandObject((int)x_float, (int)y_float, true); 859 return GetLandObject((int)x_float, (int)y_float, true);
735 } 860 }
736 861
@@ -750,9 +875,34 @@ namespace OpenSim.Region.CoreModules.World.Land
750 avy = 0; 875 avy = 0;
751 else if (avy >= m_scene.RegionInfo.RegionSizeY) 876 else if (avy >= m_scene.RegionInfo.RegionSizeY)
752 avy = (int)Constants.RegionSize - 1; 877 avy = (int)Constants.RegionSize - 1;
878>>>>>>> avn/ubitvar
753 879
754 lock (m_landIDList) 880 lock (m_landIDList)
755 { 881 {
882<<<<<<< HEAD
883 // Corner case. If an autoreturn happens during sim startup
884 // we will come here with the list uninitialized
885 //
886// int landId = m_landIDList[x, y];
887
888// if (landId == 0)
889// m_log.DebugFormat(
890// "[LAND MANAGEMENT MODULE]: No land object found at ({0}, {1}) on {2}",
891// x, y, m_scene.RegionInfo.RegionName);
892
893 try
894 {
895 if (m_landList.ContainsKey(m_landIDList[x, y]))
896 return m_landList[m_landIDList[x, y]];
897 }
898 catch (Exception e)
899 {
900 m_log.DebugFormat("{0} GetLandObject exception. x={1}, y={2}, m_landIDList.len=({3},{4})",
901 LogHeader, x, y, m_landIDList.GetLength(0), m_landIDList.GetLength(1));
902 }
903
904 return null;
905=======
756 try 906 try
757 { 907 {
758 return m_landList[m_landIDList[avx / landUnit, avy / landUnit]]; 908 return m_landList[m_landIDList[avx / landUnit, avy / landUnit]];
@@ -761,23 +911,50 @@ namespace OpenSim.Region.CoreModules.World.Land
761 { 911 {
762 return null; 912 return null;
763 } 913 }
914>>>>>>> avn/ubitvar
764 } 915 }
916 */
765 } 917 }
766 918
919 // Public entry.
920 // Throws exception if land object is not found
767 public ILandObject GetLandObject(int x, int y) 921 public ILandObject GetLandObject(int x, int y)
768 { 922 {
769 return GetLandObject(x, y, false /* returnNullIfLandObjectNotFound */); 923 return GetLandObject(x, y, false /* returnNullIfLandObjectNotFound */);
770 } 924 }
771 925
926<<<<<<< HEAD
927 /// <summary>
928 /// Given a region position, return the parcel land object for that location
929 /// </summary>
930 /// <returns>
931 /// The land object.
932 /// </returns>
933 /// <param name='x'></param>
934 /// <param name='y'></param>
935 /// <param name='returnNullIfLandObjectNotFound'>
936 /// Return null if the land object requested is not within the region's bounds.
937 /// </param>
938 private ILandObject GetLandObject(int x, int y, bool returnNullIfLandObjectOutsideBounds)
939 {
940 if (x >= m_scene.RegionInfo.RegionSizeX || y >= m_scene.RegionInfo.RegionSizeY || x < 0 || y < 0)
941=======
772 public ILandObject GetLandObject(int x, int y, bool returnNullIfLandObjectOutsideBounds) 942 public ILandObject GetLandObject(int x, int y, bool returnNullIfLandObjectOutsideBounds)
773 { 943 {
774 if (x >= m_scene.RegionInfo.RegionSizeX || y >= m_scene.RegionInfo.RegionSizeY || x < 0 || y < 0) 944 if (x >= m_scene.RegionInfo.RegionSizeX || y >= m_scene.RegionInfo.RegionSizeY || x < 0 || y < 0)
945>>>>>>> avn/ubitvar
775 { 946 {
776 // These exceptions here will cause a lot of complaints from the users specifically because 947 // These exceptions here will cause a lot of complaints from the users specifically because
777 // they happen every time at border crossings 948 // they happen every time at border crossings
778 if (returnNullIfLandObjectOutsideBounds) 949 if (returnNullIfLandObjectOutsideBounds)
779 return null; 950 return null;
780 else 951 else
952<<<<<<< HEAD
953 throw new Exception(
954 String.Format("{0} GetLandObject for non-existent position. Region={1}, pos=<{2},{3}",
955 LogHeader, m_scene.RegionInfo.RegionName, x, y)
956 );
957=======
781 throw new Exception("Error: Parcel not found at point " + x + ", " + y); 958 throw new Exception("Error: Parcel not found at point " + x + ", " + y);
782 } 959 }
783 960
@@ -791,7 +968,23 @@ namespace OpenSim.Region.CoreModules.World.Land
791 { 968 {
792 return null; 969 return null;
793 } 970 }
971>>>>>>> avn/ubitvar
794 } 972 }
973
974 return m_landList[m_landIDList[x / 4, y / 4]];
975 }
976
977 // Create a 'parcel is here' bitmap for the parcel identified by the passed landID
978 private bool[,] CreateBitmapForID(int landID)
979 {
980 bool[,] ret = new bool[m_landIDList.GetLength(0), m_landIDList.GetLength(1)];
981
982 for (int xx = 0; xx < m_landIDList.GetLength(0); xx++)
983 for (int yy = 0; yy < m_landIDList.GetLength(0); yy++)
984 if (m_landIDList[xx, yy] == landID)
985 ret[xx, yy] = true;
986
987 return ret;
795 } 988 }
796 989
797 // Create a 'parcel is here' bitmap for the parcel identified by the passed landID 990 // Create a 'parcel is here' bitmap for the parcel identified by the passed landID
@@ -976,10 +1169,19 @@ namespace OpenSim.Region.CoreModules.World.Land
976 1169
977 //Now add the new land object 1170 //Now add the new land object
978 ILandObject result = AddLandObject(newLand); 1171 ILandObject result = AddLandObject(newLand);
1172<<<<<<< HEAD
1173
1174 if (result != null)
1175 {
1176 UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData);
1177 result.SendLandUpdateToAvatarsOverMe();
1178 }
1179=======
979 UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData); 1180 UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData);
980 result.SendLandUpdateToAvatarsOverMe(); 1181 result.SendLandUpdateToAvatarsOverMe();
981 startLandObject.SendLandUpdateToAvatarsOverMe(); 1182 startLandObject.SendLandUpdateToAvatarsOverMe();
982 m_scene.ForEachClient(SendParcelOverlay); 1183 m_scene.ForEachClient(SendParcelOverlay);
1184>>>>>>> avn/ubitvar
983 } 1185 }
984 1186
985 /// <summary> 1187 /// <summary>
@@ -1061,12 +1263,29 @@ namespace OpenSim.Region.CoreModules.World.Land
1061 1263
1062 #region Parcel Updating 1264 #region Parcel Updating
1063 1265
1266<<<<<<< HEAD
1267 // Send parcel layer info for the whole region
1268 public void SendParcelOverlay(IClientAPI remote_client)
1269 {
1270 SendParcelOverlay(remote_client, 0, 0, (int)Constants.MaximumRegionSize);
1271 }
1272=======
1273>>>>>>> avn/ubitvar
1064 1274
1065 /// <summary> 1275 /// <summary>
1066 /// Where we send the ParcelOverlay packet to the client 1276 /// Send the parcel overlay blocks to the client. We send the overlay packets
1277 /// around a location and limited by the 'parcelLayerViewDistance'. This number
1278 /// is usually 128 and the code is arranged so it sends all the parcel overlay
1279 /// information for a whole region if the region is legacy sized (256x256). If
1280 /// the region is larger, only the parcel layer information is sent around
1281 /// the point specified. This reduces the problem of parcel layer information
1282 /// blocks increasing exponentially as region size increases.
1067 /// </summary> 1283 /// </summary>
1068 /// <param name="remote_client">The object representing the client</param> 1284 /// <param name="remote_client">The object representing the client</param>
1069 public void SendParcelOverlay(IClientAPI remote_client) 1285 /// <param name="xPlace">X position in the region to send surrounding parcel layer info</param>
1286 /// <param name="yPlace">y position in the region to send surrounding parcel layer info</param>
1287 /// <param name="layerViewDistance">Distance from x,y position to send parcel layer info</param>
1288 private void SendParcelOverlay(IClientAPI remote_client, int xPlace, int yPlace, int layerViewDistance)
1070 { 1289 {
1071 if (remote_client.SceneAgent.PresenceType == PresenceType.Npc) 1290 if (remote_client.SceneAgent.PresenceType == PresenceType.Npc)
1072 return; 1291 return;
@@ -1076,18 +1295,149 @@ namespace OpenSim.Region.CoreModules.World.Land
1076 byte[] byteArray = new byte[LAND_BLOCKS_PER_PACKET]; 1295 byte[] byteArray = new byte[LAND_BLOCKS_PER_PACKET];
1077 int byteArrayCount = 0; 1296 int byteArrayCount = 0;
1078 int sequenceID = 0; 1297 int sequenceID = 0;
1298<<<<<<< HEAD
1299
1300 int xLow = 0;
1301 int xHigh = (int)m_scene.RegionInfo.RegionSizeX;
1302 int yLow = 0;
1303 int yHigh = (int)m_scene.RegionInfo.RegionSizeY;
1304
1305 if (shouldLimitParcelLayerInfoToViewDistance)
1306 {
1307 // Compute view distance around the given point
1308 int txLow = xPlace - layerViewDistance;
1309 int txHigh = xPlace + layerViewDistance;
1310 // If the distance is outside the region area, move the view distance to ba all in the region
1311 if (txLow < xLow)
1312=======
1079 1313
1080 // Layer data is in landUnit (4m) chunks 1314 // Layer data is in landUnit (4m) chunks
1081 for (int y = 0; y < m_scene.RegionInfo.RegionSizeY; y += landUnit) 1315 for (int y = 0; y < m_scene.RegionInfo.RegionSizeY; y += landUnit)
1082 { 1316 {
1083 for (int x = 0; x < m_scene.RegionInfo.RegionSizeX; x += landUnit) 1317 for (int x = 0; x < m_scene.RegionInfo.RegionSizeX; x += landUnit)
1318>>>>>>> avn/ubitvar
1084 { 1319 {
1085 byte tempByte = 0; //This represents the byte for the current 4x4 1320 txLow = xLow;
1321 txHigh = Math.Min(yLow + (layerViewDistance * 2), xHigh);
1322 }
1323 if (txHigh > xHigh)
1324 {
1325 txLow = Math.Max(xLow, xHigh - (layerViewDistance * 2));
1326 txHigh = xHigh;
1327 }
1328 xLow = txLow;
1329 xHigh = txHigh;
1086 1330
1331<<<<<<< HEAD
1332 int tyLow = yPlace - layerViewDistance;
1333 int tyHigh = yPlace + layerViewDistance;
1334 if (tyLow < yLow)
1335 {
1336 tyLow = yLow;
1337 tyHigh = Math.Min(yLow + (layerViewDistance * 2), yHigh);
1338 }
1339 if (tyHigh > yHigh)
1340 {
1341 tyLow = Math.Max(yLow, yHigh - (layerViewDistance * 2));
1342 tyHigh = yHigh;
1343 }
1344 yLow = tyLow;
1345 yHigh = tyHigh;
1346 }
1347 // m_log.DebugFormat("{0} SendParcelOverlay: place=<{1},{2}>, vDist={3}, xLH=<{4},{5}, yLH=<{6},{7}>",
1348 // LogHeader, xPlace, yPlace, layerViewDistance, xLow, xHigh, yLow, yHigh);
1349=======
1087 ILandObject currentParcelBlock = GetLandObject(x, y); 1350 ILandObject currentParcelBlock = GetLandObject(x, y);
1351>>>>>>> avn/ubitvar
1088 1352
1089 if (currentParcelBlock != null) 1353 // Layer data is in landUnit (4m) chunks
1354 for (int y = yLow; y < yHigh / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); y++)
1355 {
1356 for (int x = xLow; x < xHigh / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); x++)
1357 {
1358 byteArray[byteArrayCount] = BuildLayerByte(GetLandObject(x * LandUnit, y * LandUnit), x, y, remote_client);
1359 byteArrayCount++;
1360 if (byteArrayCount >= LAND_BLOCKS_PER_PACKET)
1090 { 1361 {
1362<<<<<<< HEAD
1363 // m_log.DebugFormat("{0} SendParcelOverlay, sending packet, bytes={1}", LogHeader, byteArray.Length);
1364 remote_client.SendLandParcelOverlay(byteArray, sequenceID);
1365 byteArrayCount = 0;
1366 sequenceID++;
1367 byteArray = new byte[LAND_BLOCKS_PER_PACKET];
1368 }
1369
1370 }
1371 }
1372
1373 if (byteArrayCount != 0)
1374 {
1375 remote_client.SendLandParcelOverlay(byteArray, sequenceID);
1376 // m_log.DebugFormat("{0} SendParcelOverlay, complete sending packet, bytes={1}", LogHeader, byteArray.Length);
1377 }
1378 }
1379
1380 private byte BuildLayerByte(ILandObject currentParcelBlock, int x, int y, IClientAPI remote_client)
1381 {
1382 byte tempByte = 0; //This represents the byte for the current 4x4
1383
1384 if (currentParcelBlock != null)
1385 {
1386 if (currentParcelBlock.LandData.OwnerID == remote_client.AgentId)
1387 {
1388 //Owner Flag
1389 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER);
1390 }
1391 else if (currentParcelBlock.LandData.SalePrice > 0 &&
1392 (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero ||
1393 currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId))
1394 {
1395 //Sale Flag
1396 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_IS_FOR_SALE);
1397 }
1398 else if (currentParcelBlock.LandData.OwnerID == UUID.Zero)
1399 {
1400 //Public Flag
1401 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_PUBLIC);
1402 }
1403 else
1404 {
1405 //Other Flag
1406 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_OTHER);
1407 }
1408
1409 //Now for border control
1410
1411 ILandObject westParcel = null;
1412 ILandObject southParcel = null;
1413 if (x > 0)
1414 {
1415 westParcel = GetLandObject((x - 1) * LandUnit, y * LandUnit);
1416 }
1417 if (y > 0)
1418 {
1419 southParcel = GetLandObject(x * LandUnit, (y - 1) * LandUnit);
1420 }
1421
1422 if (x == 0)
1423 {
1424 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_WEST);
1425 }
1426 else if (westParcel != null && westParcel != currentParcelBlock)
1427 {
1428 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_WEST);
1429 }
1430
1431 if (y == 0)
1432 {
1433 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH);
1434 }
1435 else if (southParcel != null && southParcel != currentParcelBlock)
1436 {
1437 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH);
1438 }
1439
1440=======
1091 // types 1441 // types
1092 if (currentParcelBlock.LandData.OwnerID == remote_client.AgentId) 1442 if (currentParcelBlock.LandData.OwnerID == remote_client.AgentId)
1093 { 1443 {
@@ -1175,7 +1525,10 @@ namespace OpenSim.Region.CoreModules.World.Land
1175 if (byteArrayCount > 0) 1525 if (byteArrayCount > 0)
1176 { 1526 {
1177 remote_client.SendLandParcelOverlay(byteArray, sequenceID); 1527 remote_client.SendLandParcelOverlay(byteArray, sequenceID);
1528>>>>>>> avn/ubitvar
1178 } 1529 }
1530
1531 return tempByte;
1179 } 1532 }
1180 1533
1181 public void ClientOnParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, 1534 public void ClientOnParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id,
@@ -1216,6 +1569,10 @@ namespace OpenSim.Region.CoreModules.World.Land
1216 temp[i].SendLandProperties(sequence_id, snap_selection, requestResult, remote_client); 1569 temp[i].SendLandProperties(sequence_id, snap_selection, requestResult, remote_client);
1217 } 1570 }
1218 1571
1572<<<<<<< HEAD
1573 // Also send the layer data around the point of interest
1574 SendParcelOverlay(remote_client, (start_x + end_x) / 2, (start_y + end_y) / 2, parcelLayerViewDistance);
1575=======
1219// SendParcelOverlay(remote_client); 1576// SendParcelOverlay(remote_client);
1220 } 1577 }
1221 1578
@@ -1255,6 +1612,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1255 avatar.currentParcelUUID = parcelID; // force parcel flags review 1612 avatar.currentParcelUUID = parcelID; // force parcel flags review
1256 }); 1613 });
1257 } 1614 }
1615>>>>>>> avn/ubitvar
1258 } 1616 }
1259 1617
1260 public void ClientOnParcelPropertiesUpdateRequest(LandUpdateArgs args, int localID, IClientAPI remote_client) 1618 public void ClientOnParcelPropertiesUpdateRequest(LandUpdateArgs args, int localID, IClientAPI remote_client)
@@ -1325,6 +1683,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1325 land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); 1683 land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory);
1326 m_scene.ForEachClient(SendParcelOverlay); 1684 m_scene.ForEachClient(SendParcelOverlay);
1327 land.SendLandUpdateToClient(true, remote_client); 1685 land.SendLandUpdateToClient(true, remote_client);
1686 UpdateLandObject(land.LandData.LocalID, land.LandData);
1328 } 1687 }
1329 } 1688 }
1330 } 1689 }
@@ -1345,8 +1704,10 @@ namespace OpenSim.Region.CoreModules.World.Land
1345 land.LandData.GroupID = UUID.Zero; 1704 land.LandData.GroupID = UUID.Zero;
1346 land.LandData.IsGroupOwned = false; 1705 land.LandData.IsGroupOwned = false;
1347 land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); 1706 land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory);
1707
1348 m_scene.ForEachClient(SendParcelOverlay); 1708 m_scene.ForEachClient(SendParcelOverlay);
1349 land.SendLandUpdateToClient(true, remote_client); 1709 land.SendLandUpdateToClient(true, remote_client);
1710 UpdateLandObject(land.LandData.LocalID, land.LandData);
1350 } 1711 }
1351 } 1712 }
1352 } 1713 }
@@ -1372,6 +1733,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1372 land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); 1733 land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory);
1373 m_scene.ForEachClient(SendParcelOverlay); 1734 m_scene.ForEachClient(SendParcelOverlay);
1374 land.SendLandUpdateToClient(true, remote_client); 1735 land.SendLandUpdateToClient(true, remote_client);
1736 UpdateLandObject(land.LandData.LocalID, land.LandData);
1375 } 1737 }
1376 } 1738 }
1377 } 1739 }
@@ -1452,24 +1814,42 @@ namespace OpenSim.Region.CoreModules.World.Land
1452 1814
1453 #region Land Object From Storage Functions 1815 #region Land Object From Storage Functions
1454 1816
1455 public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) 1817 private void EventManagerOnIncomingLandDataFromStorage(List<LandData> data)
1456 { 1818 {
1457 lock (m_landList) 1819 lock (m_landList)
1458 { 1820 {
1459 for (int i = 0; i < data.Count; i++) 1821 for (int i = 0; i < data.Count; i++)
1460 IncomingLandObjectFromStorage(data[i]); 1822 IncomingLandObjectFromStorage(data[i]);
1461 1823
1824<<<<<<< HEAD
1825 // Prevent race conditions from any auto-creation of new parcels for varregions whilst we are still loading
1826 // the existing parcels.
1827 lock (m_landList)
1828 {
1829 for (int i = 0; i < data.Count; i++)
1830 IncomingLandObjectFromStorage(data[i]);
1831
1832 // Layer data is in landUnit (4m) chunks
1833 for (int y = 0; y < m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); y++)
1834 {
1835 for (int x = 0; x < m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); x++)
1836=======
1462 // Layer data is in landUnit (4m) chunks 1837 // Layer data is in landUnit (4m) chunks
1463 for (int y = 0; y < m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / landUnit); y++) 1838 for (int y = 0; y < m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / landUnit); y++)
1464 { 1839 {
1465 for (int x = 0; x < m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / landUnit); x++) 1840 for (int x = 0; x < m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / landUnit); x++)
1841>>>>>>> avn/ubitvar
1466 { 1842 {
1467 if (m_landIDList[x, y] == 0) 1843 if (m_landIDList[x, y] == 0)
1468 { 1844 {
1469 if (m_landList.Count == 1) 1845 if (m_landList.Count == 1)
1470 { 1846 {
1471 m_log.DebugFormat( 1847 m_log.DebugFormat(
1848<<<<<<< HEAD
1849 "[{0}]: Auto-extending land parcel as landID at {1},{2} is 0 and only one land parcel is present in {3}",
1850=======
1472 "[{0}]: Auto-extending land parcel as landID at {1},{2} is 0 and only one land parcel is present in {3}", 1851 "[{0}]: Auto-extending land parcel as landID at {1},{2} is 0 and only one land parcel is present in {3}",
1852>>>>>>> avn/ubitvar
1473 LogHeader, x, y, m_scene.Name); 1853 LogHeader, x, y, m_scene.Name);
1474 1854
1475 int onlyParcelID = 0; 1855 int onlyParcelID = 0;
@@ -1492,11 +1872,19 @@ namespace OpenSim.Region.CoreModules.World.Land
1492 else if (m_landList.Count > 1) 1872 else if (m_landList.Count > 1)
1493 { 1873 {
1494 m_log.DebugFormat( 1874 m_log.DebugFormat(
1875<<<<<<< HEAD
1876 "{0}: Auto-creating land parcel as landID at {1},{2} is 0 and more than one land parcel is present in {3}",
1877 LogHeader, x, y, m_scene.Name);
1878
1879 // There are several other parcels so we must create a new one for the unassigned space
1880 ILandObject newLand = new LandObject(UUID.Zero, false, m_scene);
1881=======
1495 "{0}: Auto-creating land parcel as landID at {1},{2} is 0 and more than one land parcel is present in {3}", 1882 "{0}: Auto-creating land parcel as landID at {1},{2} is 0 and more than one land parcel is present in {3}",
1496 LogHeader, x, y, m_scene.Name); 1883 LogHeader, x, y, m_scene.Name);
1497 1884
1498 // There are several other parcels so we must create a new one for the unassigned space 1885 // There are several other parcels so we must create a new one for the unassigned space
1499 ILandObject newLand = new LandObject(UUID.Zero, false, m_scene); 1886 ILandObject newLand = new LandObject(UUID.Zero, false, m_scene);
1887>>>>>>> avn/ubitvar
1500 // Claim all the unclaimed "0" ids 1888 // Claim all the unclaimed "0" ids
1501 newLand.SetLandBitmap(CreateBitmapForID(0)); 1889 newLand.SetLandBitmap(CreateBitmapForID(0));
1502 newLand.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; 1890 newLand.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
@@ -1507,7 +1895,11 @@ namespace OpenSim.Region.CoreModules.World.Land
1507 { 1895 {
1508 // We should never reach this point as the separate code path when no land data exists should have fired instead. 1896 // We should never reach this point as the separate code path when no land data exists should have fired instead.
1509 m_log.WarnFormat( 1897 m_log.WarnFormat(
1898<<<<<<< HEAD
1899 "{0}: Ignoring request to auto-create parcel in {1} as there are no other parcels present",
1900=======
1510 "{0}: Ignoring request to auto-create parcel in {1} as there are no other parcels present", 1901 "{0}: Ignoring request to auto-create parcel in {1} as there are no other parcels present",
1902>>>>>>> avn/ubitvar
1511 LogHeader, m_scene.Name); 1903 LogHeader, m_scene.Name);
1512 } 1904 }
1513 } 1905 }
@@ -1516,11 +1908,15 @@ namespace OpenSim.Region.CoreModules.World.Land
1516 } 1908 }
1517 } 1909 }
1518 1910
1519 public void IncomingLandObjectFromStorage(LandData data) 1911 private void IncomingLandObjectFromStorage(LandData data)
1520 { 1912 {
1913<<<<<<< HEAD
1914 ILandObject new_land = new LandObject(data, m_scene);
1915=======
1521 1916
1522 ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); 1917 ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene);
1523 new_land.LandData = data.Copy(); 1918 new_land.LandData = data.Copy();
1919>>>>>>> avn/ubitvar
1524 new_land.SetLandBitmapFromByteArray(); 1920 new_land.SetLandBitmapFromByteArray();
1525 AddLandObject(new_land); 1921 AddLandObject(new_land);
1526// new_land.SendLandUpdateToAvatarsOverMe(); 1922// new_land.SendLandUpdateToAvatarsOverMe();
@@ -2057,21 +2453,38 @@ namespace OpenSim.Region.CoreModules.World.Land
2057 telehub = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject); 2453 telehub = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject);
2058 2454
2059 // Can the user set home here? 2455 // Can the user set home here?
2060 if (// (a) gods and land managers can set home 2456 if (// Required: local user; foreign users cannot set home
2061 m_scene.Permissions.IsAdministrator(remoteClient.AgentId) || 2457 m_scene.UserManagementModule.IsLocalGridUser(remoteClient.AgentId) &&
2062 m_scene.Permissions.IsGod(remoteClient.AgentId) || 2458 (// (a) gods and land managers can set home
2063 // (b) land owners can set home 2459 m_scene.Permissions.IsAdministrator(remoteClient.AgentId) ||
2064 remoteClient.AgentId == land.LandData.OwnerID || 2460 m_scene.Permissions.IsGod(remoteClient.AgentId) ||
2065 // (c) members of the land-associated group in roles that can set home 2461 // (b) land owners can set home
2066 ((gpowers & (ulong)GroupPowers.AllowSetHome) == (ulong)GroupPowers.AllowSetHome) || 2462 remoteClient.AgentId == land.LandData.OwnerID ||
2067 // (d) parcels with telehubs can be the home of anyone 2463 // (c) members of the land-associated group in roles that can set home
2068 (telehub != null && land.ContainsPoint((int)telehub.AbsolutePosition.X, (int)telehub.AbsolutePosition.Y))) 2464 ((gpowers & (ulong)GroupPowers.AllowSetHome) == (ulong)GroupPowers.AllowSetHome) ||
2069 { 2465 // (d) parcels with telehubs can be the home of anyone
2070 if (m_scene.GridUserService.SetHome(remoteClient.AgentId.ToString(), land.RegionUUID, position, lookAt)) 2466 (telehub != null && land.ContainsPoint((int)telehub.AbsolutePosition.X, (int)telehub.AbsolutePosition.Y))))
2467 {
2468 string userId;
2469 UUID test;
2470 if (!m_scene.UserManagementModule.GetUserUUI(remoteClient.AgentId, out userId))
2471 {
2472 /* Do not set a home position in this grid for a HG visitor */
2473 m_Dialog.SendAlertToUser(remoteClient, "Set Home request failed. (User Lookup)");
2474 }
2475 else if (!UUID.TryParse(userId, out test))
2476 {
2477 m_Dialog.SendAlertToUser(remoteClient, "Set Home request failed. (HG visitor)");
2478 }
2479 else if (m_scene.GridUserService.SetHome(userId, land.RegionUUID, position, lookAt))
2480 {
2071 // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. 2481 // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot.
2072 m_Dialog.SendAlertToUser(remoteClient, "Home position set."); 2482 m_Dialog.SendAlertToUser(remoteClient, "Home position set.");
2483 }
2073 else 2484 else
2485 {
2074 m_Dialog.SendAlertToUser(remoteClient, "Set Home request failed."); 2486 m_Dialog.SendAlertToUser(remoteClient, "Set Home request failed.");
2487 }
2075 } 2488 }
2076 else 2489 else
2077 m_Dialog.SendAlertToUser(remoteClient, "You are not allowed to set your home location in this parcel."); 2490 m_Dialog.SendAlertToUser(remoteClient, "You are not allowed to set your home location in this parcel.");
@@ -2155,6 +2568,17 @@ namespace OpenSim.Region.CoreModules.World.Land
2155 2568
2156 private void AppendParcelsSummaryReport(StringBuilder report) 2569 private void AppendParcelsSummaryReport(StringBuilder report)
2157 { 2570 {
2571<<<<<<< HEAD
2572 report.AppendFormat("Land information for {0}\n", m_scene.Name);
2573
2574 ConsoleDisplayTable cdt = new ConsoleDisplayTable();
2575 cdt.AddColumn("Parcel Name", ConsoleDisplayUtil.ParcelNameSize);
2576 cdt.AddColumn("ID", 3);
2577 cdt.AddColumn("Area", 6);
2578 cdt.AddColumn("Starts", ConsoleDisplayUtil.VectorSize);
2579 cdt.AddColumn("Ends", ConsoleDisplayUtil.VectorSize);
2580 cdt.AddColumn("Owner", ConsoleDisplayUtil.UserNameSize);
2581=======
2158 report.AppendFormat("Land information for {0}\n", m_scene.RegionInfo.RegionName); 2582 report.AppendFormat("Land information for {0}\n", m_scene.RegionInfo.RegionName);
2159 report.AppendFormat( 2583 report.AppendFormat(
2160 "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n", 2584 "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n",
@@ -2164,12 +2588,27 @@ namespace OpenSim.Region.CoreModules.World.Land
2164 "AABBMin", 2588 "AABBMin",
2165 "AABBMax", 2589 "AABBMax",
2166 "Owner"); 2590 "Owner");
2591>>>>>>> avn/ubitvar
2167 2592
2168 lock (m_landList) 2593 lock (m_landList)
2169 { 2594 {
2170 foreach (ILandObject lo in m_landList.Values) 2595 foreach (ILandObject lo in m_landList.Values)
2171 { 2596 {
2172 LandData ld = lo.LandData; 2597 LandData ld = lo.LandData;
2598<<<<<<< HEAD
2599 string ownerName;
2600 if (ld.IsGroupOwned)
2601 {
2602 GroupRecord rec = m_groupManager.GetGroupRecord(ld.GroupID);
2603 ownerName = (rec != null) ? rec.GroupName : "Unknown Group";
2604 }
2605 else
2606 {
2607 ownerName = m_userManager.GetUserName(ld.OwnerID);
2608 }
2609 cdt.AddRow(
2610 ld.Name, ld.LocalID, ld.Area, lo.StartPoint, lo.EndPoint, ownerName);
2611=======
2173 2612
2174 report.AppendFormat( 2613 report.AppendFormat(
2175 "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n", 2614 "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n",
@@ -2197,8 +2636,11 @@ namespace OpenSim.Region.CoreModules.World.Land
2197 else 2636 else
2198 { 2637 {
2199 ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition); 2638 ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition);
2639>>>>>>> avn/ubitvar
2200 } 2640 }
2201 } 2641 }
2642
2643 report.Append(cdt.ToString());
2202 } 2644 }
2203 2645
2204 private void AppendParcelReport(StringBuilder report, ILandObject lo) 2646 private void AppendParcelReport(StringBuilder report, ILandObject lo)
@@ -2213,8 +2655,17 @@ namespace OpenSim.Region.CoreModules.World.Land
2213 cdl.AddRow("Area", ld.Area); 2655 cdl.AddRow("Area", ld.Area);
2214 cdl.AddRow("AABB Min", ld.AABBMin); 2656 cdl.AddRow("AABB Min", ld.AABBMin);
2215 cdl.AddRow("AABB Max", ld.AABBMax); 2657 cdl.AddRow("AABB Max", ld.AABBMax);
2216 2658 string ownerName;
2217 cdl.AddRow("Owner", m_userManager.GetUserName(ld.OwnerID)); 2659 if (ld.IsGroupOwned)
2660 {
2661 GroupRecord rec = m_groupManager.GetGroupRecord(ld.GroupID);
2662 ownerName = (rec != null) ? rec.GroupName : "Unknown Group";
2663 }
2664 else
2665 {
2666 ownerName = m_userManager.GetUserName(ld.OwnerID);
2667 }
2668 cdl.AddRow("Owner", ownerName);
2218 cdl.AddRow("Is group owned?", ld.IsGroupOwned); 2669 cdl.AddRow("Is group owned?", ld.IsGroupOwned);
2219 cdl.AddRow("GroupID", ld.GroupID); 2670 cdl.AddRow("GroupID", ld.GroupID);
2220 2671
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 5858d6c..3b81d6b 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -46,12 +46,20 @@ namespace OpenSim.Region.CoreModules.World.Land
46 46
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 private static readonly string LogHeader = "[LAND OBJECT]"; 48 private static readonly string LogHeader = "[LAND OBJECT]";
49<<<<<<< HEAD
50
51 private readonly int landUnit = 4;
52
53 private int m_lastSeqId = 0;
54
55=======
49 56
50 private readonly int landUnit = 4; 57 private readonly int landUnit = 4;
51 58
52 private int m_lastSeqId = 0; 59 private int m_lastSeqId = 0;
53 private int m_expiryCounter = 0; 60 private int m_expiryCounter = 0;
54 61
62>>>>>>> avn/ubitvar
55 protected Scene m_scene; 63 protected Scene m_scene;
56 protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); 64 protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>();
57 protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>(); 65 protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>();
@@ -59,22 +67,29 @@ namespace OpenSim.Region.CoreModules.World.Land
59 protected ExpiringCache<UUID, bool> m_groupMemberCache = new ExpiringCache<UUID, bool>(); 67 protected ExpiringCache<UUID, bool> m_groupMemberCache = new ExpiringCache<UUID, bool>();
60 protected TimeSpan m_groupMemberCacheTimeout = TimeSpan.FromSeconds(30); // cache invalidation after 30 seconds 68 protected TimeSpan m_groupMemberCacheTimeout = TimeSpan.FromSeconds(30); // cache invalidation after 30 seconds
61 69
70<<<<<<< HEAD
71 public bool[,] LandBitmap { get; set; }
72=======
62 private bool[,] m_landBitmap; 73 private bool[,] m_landBitmap;
63 public bool[,] LandBitmap 74 public bool[,] LandBitmap
64 { 75 {
65 get { return m_landBitmap; } 76 get { return m_landBitmap; }
66 set { m_landBitmap = value; } 77 set { m_landBitmap = value; }
67 } 78 }
79>>>>>>> avn/ubitvar
68 80
69 #endregion 81 #endregion
70 82
71 public int GetPrimsFree() 83 public int GetPrimsFree()
72 { 84 {
73 m_scene.EventManager.TriggerParcelPrimCountUpdate(); 85 m_scene.EventManager.TriggerParcelPrimCountUpdate();
74 int free = GetSimulatorMaxPrimCount() - m_landData.SimwidePrims; 86 int free = GetSimulatorMaxPrimCount() - LandData.SimwidePrims;
75 return free; 87 return free;
76 } 88 }
77 89
90<<<<<<< HEAD
91 public LandData LandData { get; set; }
92=======
78 protected LandData m_landData; 93 protected LandData m_landData;
79 public LandData LandData 94 public LandData LandData
80 { 95 {
@@ -82,6 +97,7 @@ namespace OpenSim.Region.CoreModules.World.Land
82 97
83 set { m_landData = value; } 98 set { m_landData = value; }
84 } 99 }
100>>>>>>> avn/ubitvar
85 101
86 public IPrimCounts PrimCounts { get; set; } 102 public IPrimCounts PrimCounts { get; set; }
87 103
@@ -103,6 +119,8 @@ namespace OpenSim.Region.CoreModules.World.Land
103 } 119 }
104 } 120 }
105 121
122 m_log.ErrorFormat("{0} StartPoint. No start point found. bitmapSize=<{1},{2}>",
123 LogHeader, LandBitmap.GetLength(0), LandBitmap.GetLength(1));
106 return new Vector3(-1, -1, -1); 124 return new Vector3(-1, -1, -1);
107 } 125 }
108 } 126 }
@@ -122,6 +140,8 @@ namespace OpenSim.Region.CoreModules.World.Land
122 } 140 }
123 } 141 }
124 142
143 m_log.ErrorFormat("{0} EndPoint. No end point found. bitmapSize=<{1},{2}>",
144 LogHeader, LandBitmap.GetLength(0), LandBitmap.GetLength(1));
125 return new Vector3(-1, -1, -1); 145 return new Vector3(-1, -1, -1);
126 } 146 }
127 } 147 }
@@ -179,12 +199,8 @@ namespace OpenSim.Region.CoreModules.World.Land
179 199
180 public ILandObject Copy() 200 public ILandObject Copy()
181 { 201 {
182 ILandObject newLand = new LandObject(LandData.OwnerID, LandData.IsGroupOwned, m_scene); 202 ILandObject newLand = new LandObject(LandData, m_scene);
183
184 //Place all new variables here!
185 newLand.LandBitmap = (bool[,]) (LandBitmap.Clone()); 203 newLand.LandBitmap = (bool[,]) (LandBitmap.Clone());
186 newLand.LandData = LandData.Copy();
187
188 return newLand; 204 return newLand;
189 } 205 }
190 206
@@ -209,6 +225,12 @@ namespace OpenSim.Region.CoreModules.World.Land
209 else 225 else
210 { 226 {
211 // Normal Calculations 227 // Normal Calculations
228<<<<<<< HEAD
229 int parcelMax = (int)(((float)LandData.Area / (m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY))
230 * (float)m_scene.RegionInfo.ObjectCapacity
231 * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus);
232 // TODO: The calculation of ObjectBonus should be refactored. It does still not work in the same manner as SL!
233=======
212 int parcelMax = (int)( (long)LandData.Area 234 int parcelMax = (int)( (long)LandData.Area
213 * (long)m_scene.RegionInfo.ObjectCapacity 235 * (long)m_scene.RegionInfo.ObjectCapacity
214 * (long)m_scene.RegionInfo.RegionSettings.ObjectBonus 236 * (long)m_scene.RegionInfo.RegionSettings.ObjectBonus
@@ -230,6 +252,7 @@ namespace OpenSim.Region.CoreModules.World.Land
230 int parcelMax = (int)((long)LandData.Area 252 int parcelMax = (int)((long)LandData.Area
231 * (long)m_scene.RegionInfo.ObjectCapacity 253 * (long)m_scene.RegionInfo.ObjectCapacity
232 / 65536L); 254 / 65536L);
255>>>>>>> avn/ubitvar
233 return parcelMax; 256 return parcelMax;
234 } 257 }
235 } 258 }
@@ -243,10 +266,15 @@ namespace OpenSim.Region.CoreModules.World.Land
243 else 266 else
244 { 267 {
245 //Normal Calculations 268 //Normal Calculations
269<<<<<<< HEAD
270 int simMax = (int)(((float)LandData.SimwideArea / (m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY))
271 * (float)m_scene.RegionInfo.ObjectCapacity);
272=======
246 int simMax = (int)( (long)LandData.SimwideArea 273 int simMax = (int)( (long)LandData.SimwideArea
247 * (long)m_scene.RegionInfo.ObjectCapacity 274 * (long)m_scene.RegionInfo.ObjectCapacity
248 / (long)(m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY) ); 275 / (long)(m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY) );
249 // m_log.DebugFormat("Simwide Area: {0}, Capacity {1}, SimMax {2}", LandData.SimwideArea, m_scene.RegionInfo.ObjectCapacity, simMax); 276 // m_log.DebugFormat("Simwide Area: {0}, Capacity {1}, SimMax {2}", LandData.SimwideArea, m_scene.RegionInfo.ObjectCapacity, simMax);
277>>>>>>> avn/ubitvar
250 return simMax; 278 return simMax;
251 } 279 }
252 } 280 }
@@ -261,7 +289,12 @@ namespace OpenSim.Region.CoreModules.World.Land
261 return; 289 return;
262 290
263 IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>(); 291 IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>();
264 uint regionFlags = 336723974 & ~((uint)(RegionFlags.AllowLandmark | RegionFlags.AllowSetHome)); 292 // uint regionFlags = 336723974 & ~((uint)(RegionFlags.AllowLandmark | RegionFlags.AllowSetHome));
293 uint regionFlags = (uint)(RegionFlags.PublicAllowed
294 | RegionFlags.AllowDirectTeleport
295 | RegionFlags.AllowParcelChanges
296 | RegionFlags.AllowVoice );
297
265 if (estateModule != null) 298 if (estateModule != null)
266 regionFlags = estateModule.GetRegionFlags(); 299 regionFlags = estateModule.GetRegionFlags();
267 300
@@ -406,6 +439,12 @@ namespace OpenSim.Region.CoreModules.World.Land
406 { 439 {
407 uint preserve = LandData.Flags & ~allowedDelta; 440 uint preserve = LandData.Flags & ~allowedDelta;
408 newData.Flags = preserve | (args.ParcelFlags & allowedDelta); 441 newData.Flags = preserve | (args.ParcelFlags & allowedDelta);
442<<<<<<< HEAD
443
444 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
445 SendLandUpdateToAvatarsOverMe(snap_selection);
446 }
447=======
409 448
410 uint curdelta = LandData.Flags ^ newData.Flags; 449 uint curdelta = LandData.Flags ^ newData.Flags;
411 curdelta &= (uint)(ParcelFlags.SoundLocal); 450 curdelta &= (uint)(ParcelFlags.SoundLocal);
@@ -417,6 +456,7 @@ namespace OpenSim.Region.CoreModules.World.Land
417 return true; 456 return true;
418 } 457 }
419 return false; 458 return false;
459>>>>>>> avn/ubitvar
420 } 460 }
421 461
422 public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area) 462 public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area)
@@ -431,9 +471,16 @@ namespace OpenSim.Region.CoreModules.World.Land
431 newData.SalePrice = 0; 471 newData.SalePrice = 0;
432 newData.AuthBuyerID = UUID.Zero; 472 newData.AuthBuyerID = UUID.Zero;
433 newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); 473 newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory);
474
475 bool sellObjects = (LandData.Flags & (uint)(ParcelFlags.SellParcelObjects)) != 0
476 && !LandData.IsGroupOwned && !groupOwned;
477 UUID previousOwner = LandData.OwnerID;
478
434 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); 479 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
435// m_scene.EventManager.TriggerParcelPrimCountUpdate(); 480// m_scene.EventManager.TriggerParcelPrimCountUpdate();
436 SendLandUpdateToAvatarsOverMe(true); 481 SendLandUpdateToAvatarsOverMe(true);
482
483 if (sellObjects) SellLandObjects(previousOwner);
437 } 484 }
438 485
439 public void DeedToGroup(UUID groupID) 486 public void DeedToGroup(UUID groupID)
@@ -759,10 +806,17 @@ namespace OpenSim.Region.CoreModules.World.Land
759 /// </summary> 806 /// </summary>
760 private void UpdateAABBAndAreaValues() 807 private void UpdateAABBAndAreaValues()
761 { 808 {
809<<<<<<< HEAD
810 int min_x = 10000;
811 int min_y = 10000;
812 int max_x = 0;
813 int max_y = 0;
814=======
762 int min_x = Int32.MaxValue; 815 int min_x = Int32.MaxValue;
763 int min_y = Int32.MaxValue; 816 int min_y = Int32.MaxValue;
764 int max_x = Int32.MinValue; 817 int max_x = Int32.MinValue;
765 int max_y = Int32.MinValue; 818 int max_y = Int32.MinValue;
819>>>>>>> avn/ubitvar
766 int tempArea = 0; 820 int tempArea = 0;
767 int x, y; 821 int x, y;
768 for (x = 0; x < LandBitmap.GetLength(0); x++) 822 for (x = 0; x < LandBitmap.GetLength(0); x++)
@@ -771,6 +825,12 @@ namespace OpenSim.Region.CoreModules.World.Land
771 { 825 {
772 if (LandBitmap[x, y] == true) 826 if (LandBitmap[x, y] == true)
773 { 827 {
828<<<<<<< HEAD
829 if (min_x > x) min_x = x;
830 if (min_y > y) min_y = y;
831 if (max_x < x) max_x = x;
832 if (max_y < y) max_y = y;
833=======
774 if (min_x > x) 834 if (min_x > x)
775 min_x = x; 835 min_x = x;
776 if (min_y > y) 836 if (min_y > y)
@@ -779,6 +839,7 @@ namespace OpenSim.Region.CoreModules.World.Land
779 max_x = x; 839 max_x = x;
780 if (max_y < y) 840 if (max_y < y)
781 max_y = y; 841 max_y = y;
842>>>>>>> avn/ubitvar
782 tempArea += landUnit * landUnit; //16sqm peice of land 843 tempArea += landUnit * landUnit; //16sqm peice of land
783 } 844 }
784 } 845 }
@@ -786,6 +847,26 @@ namespace OpenSim.Region.CoreModules.World.Land
786 int tx = min_x * landUnit; 847 int tx = min_x * landUnit;
787 if (tx > ((int)m_scene.RegionInfo.RegionSizeX - 1)) 848 if (tx > ((int)m_scene.RegionInfo.RegionSizeX - 1))
788 tx = ((int)m_scene.RegionInfo.RegionSizeX - 1); 849 tx = ((int)m_scene.RegionInfo.RegionSizeX - 1);
850<<<<<<< HEAD
851 int ty = min_y * landUnit;
852 if (ty > ((int)m_scene.RegionInfo.RegionSizeY - 1))
853 ty = ((int)m_scene.RegionInfo.RegionSizeY - 1);
854
855 LandData.AABBMin =
856 new Vector3(
857 (float)(min_x * landUnit), (float)(min_y * landUnit), m_scene != null ? (float)m_scene.Heightmap[tx, ty] : 0);
858
859 tx = max_x * landUnit;
860 if (tx > ((int)m_scene.RegionInfo.RegionSizeX - 1))
861 tx = ((int)m_scene.RegionInfo.RegionSizeX - 1);
862 ty = max_y * landUnit;
863 if (ty > ((int)m_scene.RegionInfo.RegionSizeY - 1))
864 ty = ((int)m_scene.RegionInfo.RegionSizeY - 1);
865
866 LandData.AABBMax
867 = new Vector3(
868 (float)(max_x * landUnit), (float)(max_y * landUnit), m_scene != null ? (float)m_scene.Heightmap[tx, ty] : 0);
869=======
789 870
790 int htx; 871 int htx;
791 if (tx >= ((int)m_scene.RegionInfo.RegionSizeX)) 872 if (tx >= ((int)m_scene.RegionInfo.RegionSizeX))
@@ -823,6 +904,7 @@ namespace OpenSim.Region.CoreModules.World.Land
823 LandData.AABBMax 904 LandData.AABBMax
824 = new Vector3( 905 = new Vector3(
825 (float)(tx), (float)(ty), m_scene != null ? (float)m_scene.Heightmap[htx, hty] : 0); 906 (float)(tx), (float)(ty), m_scene != null ? (float)m_scene.Heightmap[htx, hty] : 0);
907>>>>>>> avn/ubitvar
826 908
827 LandData.Area = tempArea; 909 LandData.Area = tempArea;
828 } 910 }
@@ -838,6 +920,10 @@ namespace OpenSim.Region.CoreModules.World.Land
838 public void SetLandBitmap(bool[,] bitmap) 920 public void SetLandBitmap(bool[,] bitmap)
839 { 921 {
840 LandBitmap = bitmap; 922 LandBitmap = bitmap;
923<<<<<<< HEAD
924 // m_log.DebugFormat("{0} SetLandBitmap. BitmapSize=<{1},{2}>", LogHeader, LandBitmap.GetLength(0), LandBitmap.GetLength(1));
925=======
926>>>>>>> avn/ubitvar
841 ForceUpdateLandInfo(); 927 ForceUpdateLandInfo();
842 } 928 }
843 929
@@ -863,6 +949,8 @@ namespace OpenSim.Region.CoreModules.World.Land
863 949
864 // Fill the bitmap square area specified by state and end 950 // Fill the bitmap square area specified by state and end
865 tempBitmap = ModifyLandBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true); 951 tempBitmap = ModifyLandBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true);
952 // m_log.DebugFormat("{0} GetSquareLandBitmap. tempBitmapSize=<{1},{2}>",
953 // LogHeader, tempBitmap.GetLength(0), tempBitmap.GetLength(1));
866 return tempBitmap; 954 return tempBitmap;
867 } 955 }
868 956
@@ -891,6 +979,8 @@ namespace OpenSim.Region.CoreModules.World.Land
891 } 979 }
892 } 980 }
893 } 981 }
982 // m_log.DebugFormat("{0} ModifyLandBitmapSquare. startXY=<{1},{2}>, endXY=<{3},{4}>, val={5}, landBitmapSize=<{6},{7}>",
983 // LogHeader, start_x, start_y, end_x, end_y, set_value, land_bitmap.GetLength(0), land_bitmap.GetLength(1));
894 return land_bitmap; 984 return land_bitmap;
895 } 985 }
896 986
@@ -934,10 +1024,16 @@ namespace OpenSim.Region.CoreModules.World.Land
934 private byte[] ConvertLandBitmapToBytes() 1024 private byte[] ConvertLandBitmapToBytes()
935 { 1025 {
936 byte[] tempConvertArr = new byte[LandBitmap.GetLength(0) * LandBitmap.GetLength(1) / 8]; 1026 byte[] tempConvertArr = new byte[LandBitmap.GetLength(0) * LandBitmap.GetLength(1) / 8];
1027<<<<<<< HEAD
1028 byte tempByte = 0;
1029 int byteNum = 0;
1030 int i = 0;
1031=======
937 int tempByte = 0; 1032 int tempByte = 0;
938 int i, byteNum = 0; 1033 int i, byteNum = 0;
939 int mask = 1; 1034 int mask = 1;
940 i = 0; 1035 i = 0;
1036>>>>>>> avn/ubitvar
941 for (int y = 0; y < LandBitmap.GetLength(1); y++) 1037 for (int y = 0; y < LandBitmap.GetLength(1); y++)
942 { 1038 {
943 for (int x = 0; x < LandBitmap.GetLength(0); x++) 1039 for (int x = 0; x < LandBitmap.GetLength(0); x++)
@@ -967,7 +1063,14 @@ namespace OpenSim.Region.CoreModules.World.Land
967 i = 0; 1063 i = 0;
968 byteNum++; 1064 byteNum++;
969 } 1065 }
1066<<<<<<< HEAD
1067 }
1068 }
1069 // m_log.DebugFormat("{0} ConvertLandBitmapToBytes. BitmapSize=<{1},{2}>",
1070 // LogHeader, LandBitmap.GetLength(0), LandBitmap.GetLength(1));
1071=======
970 */ 1072 */
1073>>>>>>> avn/ubitvar
971 return tempConvertArr; 1074 return tempConvertArr;
972 } 1075 }
973 1076
@@ -1148,6 +1251,43 @@ namespace OpenSim.Region.CoreModules.World.Land
1148 1251
1149 #endregion 1252 #endregion
1150 1253
1254 #region Object Sales
1255
1256 public void SellLandObjects(UUID previousOwner)
1257 {
1258 // m_log.DebugFormat(
1259 // "[LAND OBJECT]: Request to sell objects in {0} from {1}", LandData.Name, previousOwner);
1260
1261 if (LandData.IsGroupOwned)
1262 return;
1263
1264 IBuySellModule m_BuySellModule = m_scene.RequestModuleInterface<IBuySellModule>();
1265 if (m_BuySellModule == null)
1266 {
1267 m_log.Error("[LAND OBJECT]: BuySellModule not found");
1268 return;
1269 }
1270
1271 ScenePresence sp;
1272 if (!m_scene.TryGetScenePresence(LandData.OwnerID, out sp))
1273 {
1274 m_log.Error("[LAND OBJECT]: New owner is not present in scene");
1275 return;
1276 }
1277
1278 lock (primsOverMe)
1279 {
1280 foreach (SceneObjectGroup obj in primsOverMe)
1281 {
1282 if (obj.OwnerID == previousOwner && obj.GroupID == UUID.Zero &&
1283 (obj.GetEffectivePermissions() & (uint)(OpenSim.Framework.PermissionMask.Transfer)) != 0)
1284 m_BuySellModule.BuyObject(sp.ControllingClient, UUID.Zero, obj.LocalId, 1, 0);
1285 }
1286 }
1287 }
1288
1289 #endregion
1290
1151 #region Object Returning 1291 #region Object Returning
1152 1292
1153 public void ReturnObject(SceneObjectGroup obj) 1293 public void ReturnObject(SceneObjectGroup obj)
@@ -1170,7 +1310,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1170 { 1310 {
1171 foreach (SceneObjectGroup obj in primsOverMe) 1311 foreach (SceneObjectGroup obj in primsOverMe)
1172 { 1312 {
1173 if (obj.OwnerID == m_landData.OwnerID) 1313 if (obj.OwnerID == LandData.OwnerID)
1174 { 1314 {
1175 if (!returns.ContainsKey(obj.OwnerID)) 1315 if (!returns.ContainsKey(obj.OwnerID))
1176 returns[obj.OwnerID] = 1316 returns[obj.OwnerID] =
@@ -1179,11 +1319,11 @@ namespace OpenSim.Region.CoreModules.World.Land
1179 } 1319 }
1180 } 1320 }
1181 } 1321 }
1182 else if (type == (uint)ObjectReturnType.Group && m_landData.GroupID != UUID.Zero) 1322 else if (type == (uint)ObjectReturnType.Group && LandData.GroupID != UUID.Zero)
1183 { 1323 {
1184 foreach (SceneObjectGroup obj in primsOverMe) 1324 foreach (SceneObjectGroup obj in primsOverMe)
1185 { 1325 {
1186 if (obj.GroupID == m_landData.GroupID) 1326 if (obj.GroupID == LandData.GroupID)
1187 { 1327 {
1188 if (!returns.ContainsKey(obj.OwnerID)) 1328 if (!returns.ContainsKey(obj.OwnerID))
1189 returns[obj.OwnerID] = 1329 returns[obj.OwnerID] =
@@ -1196,9 +1336,9 @@ namespace OpenSim.Region.CoreModules.World.Land
1196 { 1336 {
1197 foreach (SceneObjectGroup obj in primsOverMe) 1337 foreach (SceneObjectGroup obj in primsOverMe)
1198 { 1338 {
1199 if (obj.OwnerID != m_landData.OwnerID && 1339 if (obj.OwnerID != LandData.OwnerID &&
1200 (obj.GroupID != m_landData.GroupID || 1340 (obj.GroupID != LandData.GroupID ||
1201 m_landData.GroupID == UUID.Zero)) 1341 LandData.GroupID == UUID.Zero))
1202 { 1342 {
1203 if (!returns.ContainsKey(obj.OwnerID)) 1343 if (!returns.ContainsKey(obj.OwnerID))
1204 returns[obj.OwnerID] = 1344 returns[obj.OwnerID] =
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/LandManagementModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/LandManagementModuleTests.cs
new file mode 100644
index 0000000..4ed67f3
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Land/Tests/LandManagementModuleTests.cs
@@ -0,0 +1,266 @@
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
28using System;
29using NUnit.Framework;
30using OpenMetaverse;
31using OpenSim.Framework;
32using OpenSim.Region.Framework.Scenes;
33using OpenSim.Tests.Common;
34
35namespace OpenSim.Region.CoreModules.World.Land.Tests
36{
37 public class LandManagementModuleTests : OpenSimTestCase
38 {
39 [Test]
40 public void TestAddLandObject()
41 {
42 TestHelpers.InMethod();
43// TestHelpers.EnableLogging();
44
45 UUID userId = TestHelpers.ParseTail(0x1);
46
47 LandManagementModule lmm = new LandManagementModule();
48 Scene scene = new SceneHelpers().SetupScene();
49 SceneHelpers.SetupSceneModules(scene, lmm);
50
51 ILandObject lo = new LandObject(userId, false, scene);
52 lo.LandData.Name = "lo1";
53 lo.SetLandBitmap(
54 lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
55 lo = lmm.AddLandObject(lo);
56
57 // TODO: Should add asserts to check that land object was added properly.
58
59 // At the moment, this test just makes sure that we can't add a land object that overlaps the areas that
60 // the first still holds.
61 ILandObject lo2 = new LandObject(userId, false, scene);
62 lo2.SetLandBitmap(
63 lo2.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
64 lo2.LandData.Name = "lo2";
65 lo2 = lmm.AddLandObject(lo2);
66
67 {
68 ILandObject loAtCoord = lmm.GetLandObject(0, 0);
69 Assert.That(loAtCoord.LandData.LocalID, Is.EqualTo(lo.LandData.LocalID));
70 Assert.That(loAtCoord.LandData.GlobalID, Is.EqualTo(lo.LandData.GlobalID));
71 }
72
73 {
74 ILandObject loAtCoord = lmm.GetLandObject((int)Constants.RegionSize - 1, ((int)Constants.RegionSize - 1));
75 Assert.That(loAtCoord.LandData.LocalID, Is.EqualTo(lo.LandData.LocalID));
76 Assert.That(loAtCoord.LandData.GlobalID, Is.EqualTo(lo.LandData.GlobalID));
77 }
78 }
79
80 /// <summary>
81 /// Test parcels on region when no land data exists to be loaded.
82 /// </summary>
83 [Test]
84 public void TestLoadWithNoParcels()
85 {
86 TestHelpers.InMethod();
87// TestHelpers.EnableLogging();
88
89 SceneHelpers sh = new SceneHelpers();
90 LandManagementModule lmm = new LandManagementModule();
91 Scene scene = sh.SetupScene();
92 SceneHelpers.SetupSceneModules(scene, lmm);
93
94 scene.loadAllLandObjectsFromStorage(scene.RegionInfo.RegionID);
95
96 ILandObject loAtCoord1 = lmm.GetLandObject(0, 0);
97 Assert.That(loAtCoord1.LandData.LocalID, Is.Not.EqualTo(0));
98 Assert.That(loAtCoord1.LandData.GlobalID, Is.Not.EqualTo(UUID.Zero));
99
100 ILandObject loAtCoord2 = lmm.GetLandObject((int)Constants.RegionSize - 1, ((int)Constants.RegionSize - 1));
101 Assert.That(loAtCoord2.LandData.LocalID, Is.EqualTo(loAtCoord1.LandData.LocalID));
102 Assert.That(loAtCoord2.LandData.GlobalID, Is.EqualTo(loAtCoord1.LandData.GlobalID));
103 }
104
105 /// <summary>
106 /// Test parcels on region when a single parcel already exists but it does not cover the whole region.
107 /// </summary>
108 [Test]
109 public void TestLoadWithSinglePartialCoveringParcel()
110 {
111 TestHelpers.InMethod();
112// TestHelpers.EnableLogging();
113
114 UUID userId = TestHelpers.ParseTail(0x1);
115
116 SceneHelpers sh = new SceneHelpers();
117 LandManagementModule lmm = new LandManagementModule();
118 Scene scene = sh.SetupScene();
119 SceneHelpers.SetupSceneModules(scene, lmm);
120
121 ILandObject originalLo1 = new LandObject(userId, false, scene);
122 originalLo1.LandData.Name = "lo1";
123 originalLo1.SetLandBitmap(
124 originalLo1.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize / 2));
125
126 sh.SimDataService.StoreLandObject(originalLo1);
127
128 scene.loadAllLandObjectsFromStorage(scene.RegionInfo.RegionID);
129
130 ILandObject loAtCoord1 = lmm.GetLandObject(0, 0);
131 Assert.That(loAtCoord1.LandData.Name, Is.EqualTo(originalLo1.LandData.Name));
132 Assert.That(loAtCoord1.LandData.GlobalID, Is.EqualTo(originalLo1.LandData.GlobalID));
133
134 ILandObject loAtCoord2 = lmm.GetLandObject((int)Constants.RegionSize - 1, ((int)Constants.RegionSize - 1));
135 Assert.That(loAtCoord2.LandData.LocalID, Is.EqualTo(loAtCoord1.LandData.LocalID));
136 Assert.That(loAtCoord2.LandData.GlobalID, Is.EqualTo(loAtCoord1.LandData.GlobalID));
137 }
138
139 /// <summary>
140 /// Test parcels on region when a single parcel already exists but it does not cover the whole region.
141 /// </summary>
142 [Test]
143 public void TestLoadWithMultiplePartialCoveringParcels()
144 {
145 TestHelpers.InMethod();
146// TestHelpers.EnableLogging();
147
148 UUID userId = TestHelpers.ParseTail(0x1);
149
150 SceneHelpers sh = new SceneHelpers();
151 LandManagementModule lmm = new LandManagementModule();
152 Scene scene = sh.SetupScene();
153 SceneHelpers.SetupSceneModules(scene, lmm);
154
155 ILandObject originalLo1 = new LandObject(userId, false, scene);
156 originalLo1.LandData.Name = "lo1";
157 originalLo1.SetLandBitmap(
158 originalLo1.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize / 2));
159
160 sh.SimDataService.StoreLandObject(originalLo1);
161
162 ILandObject originalLo2 = new LandObject(userId, false, scene);
163 originalLo2.LandData.Name = "lo2";
164 originalLo2.SetLandBitmap(
165 originalLo2.GetSquareLandBitmap(
166 0, (int)Constants.RegionSize / 2, (int)Constants.RegionSize, ((int)Constants.RegionSize / 4) * 3));
167
168 sh.SimDataService.StoreLandObject(originalLo2);
169
170 scene.loadAllLandObjectsFromStorage(scene.RegionInfo.RegionID);
171
172 ILandObject loAtCoord1 = lmm.GetLandObject(0, 0);
173 Assert.That(loAtCoord1.LandData.Name, Is.EqualTo(originalLo1.LandData.Name));
174 Assert.That(loAtCoord1.LandData.GlobalID, Is.EqualTo(originalLo1.LandData.GlobalID));
175
176 ILandObject loAtCoord2
177 = lmm.GetLandObject((int)Constants.RegionSize - 1, (((int)Constants.RegionSize / 4) * 3) - 1);
178 Assert.That(loAtCoord2.LandData.Name, Is.EqualTo(originalLo2.LandData.Name));
179 Assert.That(loAtCoord2.LandData.GlobalID, Is.EqualTo(originalLo2.LandData.GlobalID));
180
181 ILandObject loAtCoord3 = lmm.GetLandObject((int)Constants.RegionSize - 1, ((int)Constants.RegionSize - 1));
182 Assert.That(loAtCoord3.LandData.LocalID, Is.Not.EqualTo(loAtCoord1.LandData.LocalID));
183 Assert.That(loAtCoord3.LandData.LocalID, Is.Not.EqualTo(loAtCoord2.LandData.LocalID));
184 Assert.That(loAtCoord3.LandData.GlobalID, Is.Not.EqualTo(loAtCoord1.LandData.GlobalID));
185 Assert.That(loAtCoord3.LandData.GlobalID, Is.Not.EqualTo(loAtCoord2.LandData.GlobalID));
186 }
187
188 /// <summary>
189 /// Test parcels on region when whole region is parcelled (which should normally always be the case).
190 /// </summary>
191 [Test]
192 public void TestLoad()
193 {
194 TestHelpers.InMethod();
195// TestHelpers.EnableLogging();
196
197 UUID userId = TestHelpers.ParseTail(0x1);
198
199 SceneHelpers sh = new SceneHelpers();
200 LandManagementModule lmm = new LandManagementModule();
201 Scene scene = sh.SetupScene();
202 SceneHelpers.SetupSceneModules(scene, lmm);
203
204 ILandObject originalLo1 = new LandObject(userId, false, scene);
205 originalLo1.LandData.Name = "lo1";
206 originalLo1.SetLandBitmap(
207 originalLo1.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize / 2));
208
209 sh.SimDataService.StoreLandObject(originalLo1);
210
211 ILandObject originalLo2 = new LandObject(userId, false, scene);
212 originalLo2.LandData.Name = "lo2";
213 originalLo2.SetLandBitmap(
214 originalLo2.GetSquareLandBitmap(0, (int)Constants.RegionSize / 2, (int)Constants.RegionSize, (int)Constants.RegionSize));
215
216 sh.SimDataService.StoreLandObject(originalLo2);
217
218 scene.loadAllLandObjectsFromStorage(scene.RegionInfo.RegionID);
219
220 {
221 ILandObject loAtCoord = lmm.GetLandObject(0, 0);
222 Assert.That(loAtCoord.LandData.Name, Is.EqualTo(originalLo1.LandData.Name));
223 Assert.That(loAtCoord.LandData.GlobalID, Is.EqualTo(originalLo1.LandData.GlobalID));
224 }
225
226 {
227 ILandObject loAtCoord = lmm.GetLandObject((int)Constants.RegionSize - 1, ((int)Constants.RegionSize - 1));
228 Assert.That(loAtCoord.LandData.Name, Is.EqualTo(originalLo2.LandData.Name));
229 Assert.That(loAtCoord.LandData.GlobalID, Is.EqualTo(originalLo2.LandData.GlobalID));
230 }
231 }
232
233 [Test]
234 public void TestSubdivide()
235 {
236 TestHelpers.InMethod();
237// TestHelpers.EnableLogging();
238
239 UUID userId = TestHelpers.ParseTail(0x1);
240
241 LandManagementModule lmm = new LandManagementModule();
242 Scene scene = new SceneHelpers().SetupScene();
243 SceneHelpers.SetupSceneModules(scene, lmm);
244
245 ILandObject lo = new LandObject(userId, false, scene);
246 lo.LandData.Name = "lo1";
247 lo.SetLandBitmap(
248 lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
249 lo = lmm.AddLandObject(lo);
250
251 lmm.Subdivide(0, 0, LandManagementModule.LandUnit, LandManagementModule.LandUnit, userId);
252
253 {
254 ILandObject loAtCoord = lmm.GetLandObject(0, 0);
255 Assert.That(loAtCoord.LandData.LocalID, Is.Not.EqualTo(lo.LandData.LocalID));
256 Assert.That(loAtCoord.LandData.GlobalID, Is.Not.EqualTo(lo.LandData.GlobalID));
257 }
258
259 {
260 ILandObject loAtCoord = lmm.GetLandObject(LandManagementModule.LandUnit, LandManagementModule.LandUnit);
261 Assert.That(loAtCoord.LandData.LocalID, Is.EqualTo(lo.LandData.LocalID));
262 Assert.That(loAtCoord.LandData.GlobalID, Is.EqualTo(lo.LandData.GlobalID));
263 }
264 }
265 }
266} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
index 0945b43..949acb6 100644
--- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
+++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
@@ -36,7 +36,6 @@ using OpenSim.Framework;
36using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Tests.Common; 38using OpenSim.Tests.Common;
39using OpenSim.Tests.Common.Mock;
40 39
41namespace OpenSim.Region.CoreModules.World.Land.Tests 40namespace OpenSim.Region.CoreModules.World.Land.Tests
42{ 41{
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
index c7ffeaf..a228e7a 100644
--- a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
@@ -91,17 +91,29 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
91 91
92 if (generateMaptiles) 92 if (generateMaptiles)
93 { 93 {
94 if (textureTerrain) 94 if (String.IsNullOrEmpty(m_scene.RegionInfo.MaptileStaticFile))
95 { 95 {
96 terrainRenderer = new TexturedMapTileRenderer(); 96 if (textureTerrain)
97 } 97 {
98 else 98 terrainRenderer = new TexturedMapTileRenderer();
99 { 99 }
100 terrainRenderer = new ShadedMapTileRenderer(); 100 else
101 } 101 {
102 102 terrainRenderer = new ShadedMapTileRenderer();
103 terrainRenderer.Initialise(m_scene, m_config); 103 }
104 104
105 terrainRenderer.Initialise(m_scene, m_config);
106
107<<<<<<< HEAD
108 mapbmp = new Bitmap((int)m_scene.Heightmap.Width, (int)m_scene.Heightmap.Height,
109 System.Drawing.Imaging.PixelFormat.Format24bppRgb);
110 //long t = System.Environment.TickCount;
111 //for (int i = 0; i < 10; ++i) {
112 terrainRenderer.TerrainToBitmap(mapbmp);
113 //}
114 //t = System.Environment.TickCount - t;
115 //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t);
116=======
105 mapbmp = new Bitmap((int)m_scene.Heightmap.Width, (int)m_scene.Heightmap.Height, 117 mapbmp = new Bitmap((int)m_scene.Heightmap.Width, (int)m_scene.Heightmap.Height,
106 System.Drawing.Imaging.PixelFormat.Format24bppRgb); 118 System.Drawing.Imaging.PixelFormat.Format24bppRgb);
107 //long t = System.Environment.TickCount; 119 //long t = System.Environment.TickCount;
@@ -110,10 +122,32 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
110 //} 122 //}
111 //t = System.Environment.TickCount - t; 123 //t = System.Environment.TickCount - t;
112 //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t); 124 //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t);
125>>>>>>> avn/ubitvar
113 126
114 if (drawPrimVolume) 127 if (drawPrimVolume)
128 {
129 DrawObjectVolume(m_scene, mapbmp);
130 }
131 }
132 else
115 { 133 {
116 DrawObjectVolume(m_scene, mapbmp); 134 try
135 {
136 mapbmp = new Bitmap(m_scene.RegionInfo.MaptileStaticFile);
137 }
138 catch (Exception)
139 {
140 m_log.ErrorFormat(
141 "[MAPTILE]: Failed to load Static map image texture file: {0} for {1}",
142 m_scene.RegionInfo.MaptileStaticFile, m_scene.Name);
143 //mapbmp = new Bitmap((int)m_scene.Heightmap.Width, (int)m_scene.Heightmap.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
144 mapbmp = null;
145 }
146
147 if (mapbmp != null)
148 m_log.DebugFormat(
149 "[MAPTILE]: Static map image texture file {0} found for {1}",
150 m_scene.RegionInfo.MaptileStaticFile, m_scene.Name);
117 } 151 }
118 } 152 }
119 else 153 else
@@ -288,8 +322,6 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
288 322
289 try 323 try
290 { 324 {
291 //SortedList<float, RectangleDrawStruct> z_sort = new SortedList<float, RectangleDrawStruct>();
292
293 lock (objs) 325 lock (objs)
294 { 326 {
295 foreach (EntityBase obj in objs) 327 foreach (EntityBase obj in objs)
@@ -299,7 +331,6 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
299 { 331 {
300 SceneObjectGroup mapdot = (SceneObjectGroup)obj; 332 SceneObjectGroup mapdot = (SceneObjectGroup)obj;
301 Color mapdotspot = Color.Gray; // Default color when prim color is white 333 Color mapdotspot = Color.Gray; // Default color when prim color is white
302
303 // Loop over prim in group 334 // Loop over prim in group
304 foreach (SceneObjectPart part in mapdot.Parts) 335 foreach (SceneObjectPart part in mapdot.Parts)
305 { 336 {
@@ -417,7 +448,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
417 || mapdrawendY > (hm.Height - 1)) 448 || mapdrawendY > (hm.Height - 1))
418 continue; 449 continue;
419 450
420 #region obb face reconstruction part duex 451 #region obb face reconstruction part duex
421 Vector3[] vertexes = new Vector3[8]; 452 Vector3[] vertexes = new Vector3[8];
422 453
423 // float[] distance = new float[6]; 454 // float[] distance = new float[6];
@@ -521,7 +552,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
521 FaceD[2] = vertexes[7]; 552 FaceD[2] = vertexes[7];
522 FaceC[3] = vertexes[7]; 553 FaceC[3] = vertexes[7];
523 FaceD[5] = vertexes[7]; 554 FaceD[5] = vertexes[7];
524 #endregion 555 #endregion
525 556
526 //int wy = 0; 557 //int wy = 0;
527 558
@@ -552,27 +583,25 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
552 z_localIDs.Add(part.LocalId); 583 z_localIDs.Add(part.LocalId);
553 z_sortheights.Add(pos.Z); 584 z_sortheights.Add(pos.Z);
554 585
555 //for (int wx = mapdrawstartX; wx < mapdrawendX; wx++) 586 // for (int wx = mapdrawstartX; wx < mapdrawendX; wx++)
556 //{ 587 // {
557 //for (wy = mapdrawstartY; wy < mapdrawendY; wy++) 588 // for (wy = mapdrawstartY; wy < mapdrawendY; wy++)
558 //{ 589 // {
559 //m_log.InfoFormat("[MAPDEBUG]: {0},{1}({2})", wx, (255 - wy),wy); 590 // m_log.InfoFormat("[MAPDEBUG]: {0},{1}({2})", wx, (255 - wy),wy);
560 //try 591 // try
561 //{ 592 // {
562 // Remember, flip the y! 593 // // Remember, flip the y!
563 // mapbmp.SetPixel(wx, (255 - wy), mapdotspot); 594 // mapbmp.SetPixel(wx, (255 - wy), mapdotspot);
564 //} 595 // }
565 //catch (ArgumentException) 596 // catch (ArgumentException)
566 //{ 597 // {
567 // breakYN = true; 598 // breakYN = true;
568 //} 599 // }
569 600 // }
570 //if (breakYN) 601 // if (breakYN)
571 // break; 602 // break;
572 //} 603 // }
573 604 // }
574 //if (breakYN)
575 // break;
576 //} 605 //}
577 } // Object is within 256m Z of terrain 606 } // Object is within 256m Z of terrain
578 } // object is at least a meter wide 607 } // object is at least a meter wide
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs
index 15533ba..a9cc993 100644
--- a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs
+++ b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs
@@ -124,8 +124,8 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
124 { 124 {
125 #region Constants 125 #region Constants
126 126
127 private static readonly ILog m_log = 127 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
128 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 128 private static readonly string LogHeader = "[TEXTURED MAPTILE RENDERER]";
129 129
130 // some hardcoded terrain UUIDs that work with SL 1.20 (the four default textures and "Blank"). 130 // some hardcoded terrain UUIDs that work with SL 1.20 (the four default textures and "Blank").
131 // The color-values were choosen because they "look right" (at least to me) ;-) 131 // The color-values were choosen because they "look right" (at least to me) ;-)
@@ -175,7 +175,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
175 private Bitmap fetchTexture(UUID id) 175 private Bitmap fetchTexture(UUID id)
176 { 176 {
177 AssetBase asset = m_scene.AssetService.Get(id.ToString()); 177 AssetBase asset = m_scene.AssetService.Get(id.ToString());
178 m_log.DebugFormat("[TEXTURED MAP TILE RENDERER]: Fetched texture {0}, found: {1}", id, asset != null); 178 m_log.DebugFormat("{0} Fetched texture {1}, found: {2}", LogHeader, id, asset != null);
179 if (asset == null) return null; 179 if (asset == null) return null;
180 180
181 ManagedImage managedImage; 181 ManagedImage managedImage;
@@ -190,18 +190,15 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
190 } 190 }
191 catch (DllNotFoundException) 191 catch (DllNotFoundException)
192 { 192 {
193 m_log.ErrorFormat("[TEXTURED MAP TILE RENDERER]: OpenJpeg is not installed correctly on this system. Asset Data is empty for {0}", id); 193 m_log.ErrorFormat("{0} OpenJpeg is not installed correctly on this system. Asset Data is empty for {1}", LogHeader, id);
194
195 } 194 }
196 catch (IndexOutOfRangeException) 195 catch (IndexOutOfRangeException)
197 { 196 {
198 m_log.ErrorFormat("[TEXTURED MAP TILE RENDERER]: OpenJpeg was unable to encode this. Asset Data is empty for {0}", id); 197 m_log.ErrorFormat("{0} OpenJpeg was unable to encode this. Asset Data is empty for {1}", LogHeader, id);
199
200 } 198 }
201 catch (Exception) 199 catch (Exception)
202 { 200 {
203 m_log.ErrorFormat("[TEXTURED MAP TILE RENDERER]: OpenJpeg was unable to encode this. Asset Data is empty for {0}", id); 201 m_log.ErrorFormat("{0} OpenJpeg was unable to encode this. Asset Data is empty for {1}", LogHeader, id);
204
205 } 202 }
206 return null; 203 return null;
207 204
@@ -273,9 +270,14 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
273 270
274 // the heigthfield might have some jumps in values. Rendered land is smooth, though, 271 // the heigthfield might have some jumps in values. Rendered land is smooth, though,
275 // as a slope is rendered at that place. So average 4 neighbour values to emulate that. 272 // as a slope is rendered at that place. So average 4 neighbour values to emulate that.
273<<<<<<< HEAD
274 private float getHeight(ITerrainChannel hm, int x, int y) {
275 if (x < (hm.Width - 1) && y < (hm.Height - 1))
276=======
276 private float getHeight(ITerrainChannel hm, int x, int y) 277 private float getHeight(ITerrainChannel hm, int x, int y)
277 { 278 {
278 if (x < ((int)Constants.RegionSize - 1) && y < ((int)Constants.RegionSize - 1)) 279 if (x < ((int)Constants.RegionSize - 1) && y < ((int)Constants.RegionSize - 1))
280>>>>>>> avn/ubitvar
279 return (float)(hm[x, y] * .444 + (hm[x + 1, y] + hm[x, y + 1]) * .222 + hm[x + 1, y +1] * .112); 281 return (float)(hm[x, y] * .444 + (hm[x + 1, y] + hm[x, y + 1]) * .222 + hm[x + 1, y +1] * .112);
280 else 282 else
281 return (float)hm[x, y]; 283 return (float)hm[x, y];
@@ -285,7 +287,15 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
285 public void TerrainToBitmap(Bitmap mapbmp) 287 public void TerrainToBitmap(Bitmap mapbmp)
286 { 288 {
287 int tc = Environment.TickCount; 289 int tc = Environment.TickCount;
288 m_log.Debug("[TEXTURED MAP TILE RENDERER]: Generating Maptile Step 1: Terrain"); 290 m_log.DebugFormat("{0} Generating Maptile Step 1: Terrain", LogHeader);
291
292 ITerrainChannel hm = m_scene.Heightmap;
293
294 if (mapbmp.Width != hm.Width || mapbmp.Height != hm.Height)
295 {
296 m_log.ErrorFormat("{0} TerrainToBitmap. Passed bitmap wrong dimensions. passed=<{1},{2}>, size=<{3},{4}>",
297 LogHeader, mapbmp.Width, mapbmp.Height, hm.Width, hm.Height);
298 }
289 299
290 ITerrainChannel hm = m_scene.Heightmap; 300 ITerrainChannel hm = m_scene.Heightmap;
291 301
@@ -429,4 +439,4 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
429 m_log.Debug("[TEXTURED MAP TILE RENDERER]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms"); 439 m_log.Debug("[TEXTURED MAP TILE RENDERER]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms");
430 } 440 }
431 } 441 }
432} \ No newline at end of file 442}
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
index 601e81e..46b0470 100644
--- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
+++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
@@ -595,6 +595,9 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap
595 /// <returns>true if the url matches an entry on the whitelist, false otherwise</returns> 595 /// <returns>true if the url matches an entry on the whitelist, false otherwise</returns>
596 protected bool CheckUrlAgainstWhitelist(string rawUrl, string[] whitelist) 596 protected bool CheckUrlAgainstWhitelist(string rawUrl, string[] whitelist)
597 { 597 {
598 if (whitelist == null)
599 return false;
600
598 Uri url = new Uri(rawUrl); 601 Uri url = new Uri(rawUrl);
599 602
600 foreach (string origWlUrl in whitelist) 603 foreach (string origWlUrl in whitelist)
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs
index 03a96a4..ee57aed 100644
--- a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs
+++ b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs
@@ -39,7 +39,6 @@ using OpenSim.Region.CoreModules.World.Media.Moap;
39using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
40using OpenSim.Region.Framework.Scenes.Serialization; 40using OpenSim.Region.Framework.Scenes.Serialization;
41using OpenSim.Tests.Common; 41using OpenSim.Tests.Common;
42using OpenSim.Tests.Common.Mock;
43 42
44namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests 43namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests
45{ 44{
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
index 014c845..0e0f05f 100644
--- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
@@ -141,6 +141,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
141 141
142 part.ObjectSaleType = 0; 142 part.ObjectSaleType = 0;
143 part.SalePrice = 10; 143 part.SalePrice = 10;
144 part.ClickAction = Convert.ToByte(0);
144 145
145 group.HasGroupChanged = true; 146 group.HasGroupChanged = true;
146 part.SendPropertiesToClient(remoteClient); 147 part.SendPropertiesToClient(remoteClient);
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 928755d..12e8fb1 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Linq;
30using System.Reflection; 31using System.Reflection;
31using log4net; 32using log4net;
32using Nini.Config; 33using Nini.Config;
@@ -160,7 +161,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
160 string permissionModules = Util.GetConfigVarFromSections<string>(config, "permissionmodules", 161 string permissionModules = Util.GetConfigVarFromSections<string>(config, "permissionmodules",
161 new string[] { "Startup", "Permissions" }, "DefaultPermissionsModule"); 162 new string[] { "Startup", "Permissions" }, "DefaultPermissionsModule");
162 163
163 List<string> modules = new List<string>(permissionModules.Split(',')); 164 List<string> modules = new List<string>(permissionModules.Split(',').Select(m => m.Trim()));
164 165
165 if (!modules.Contains("DefaultPermissionsModule")) 166 if (!modules.Contains("DefaultPermissionsModule"))
166 return; 167 return;
@@ -468,7 +469,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
468 469
469 return false; 470 return false;
470 } 471 }
471 472
472 /// <summary> 473 /// <summary>
473 /// Parse a user set configuration setting 474 /// Parse a user set configuration setting
474 /// </summary> 475 /// </summary>
@@ -800,8 +801,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions
800 801
801 // Friends with benefits should be able to edit the objects too 802 // Friends with benefits should be able to edit the objects too
802 if (IsFriendWithPerms(currentUser, objectOwner)) 803 if (IsFriendWithPerms(currentUser, objectOwner))
804 {
803 // Return immediately, so that the administrator can share objects with friends 805 // Return immediately, so that the administrator can share objects with friends
804 return true; 806 return true;
807 }
805 808
806 // Users should be able to edit what is over their land. 809 // Users should be able to edit what is over their land.
807 ILandObject parcel = m_scene.LandChannel.GetLandObject(group.AbsolutePosition.X, group.AbsolutePosition.Y); 810 ILandObject parcel = m_scene.LandChannel.GetLandObject(group.AbsolutePosition.X, group.AbsolutePosition.Y);
@@ -900,7 +903,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
900 return permission; 903 return permission;
901 } 904 }
902 905
903 protected bool GenericParcelOwnerPermission(UUID user, ILandObject parcel, ulong groupPowers) 906 protected bool GenericParcelOwnerPermission(UUID user, ILandObject parcel, ulong groupPowers, bool allowEstateManager)
904 { 907 {
905 if (parcel.LandData.OwnerID == user) 908 if (parcel.LandData.OwnerID == user)
906 { 909 {
@@ -915,7 +918,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
915 return true; 918 return true;
916 } 919 }
917 920
918 if (IsEstateManager(user)) 921 if (allowEstateManager && IsEstateManager(user))
919 { 922 {
920 return true; 923 return true;
921 } 924 }
@@ -942,7 +945,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
942 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 945 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
943 if (m_bypassPermissions) return m_bypassPermissionsValue; 946 if (m_bypassPermissions) return m_bypassPermissionsValue;
944 947
945 return GenericParcelOwnerPermission(user, parcel, (ulong)GroupPowers.LandRelease); 948 return GenericParcelOwnerPermission(user, parcel, (ulong)GroupPowers.LandRelease, false);
946 } 949 }
947 950
948 private bool CanReclaimParcel(UUID user, ILandObject parcel, Scene scene) 951 private bool CanReclaimParcel(UUID user, ILandObject parcel, Scene scene)
@@ -950,7 +953,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
950 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 953 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
951 if (m_bypassPermissions) return m_bypassPermissionsValue; 954 if (m_bypassPermissions) return m_bypassPermissionsValue;
952 955
953 return GenericParcelOwnerPermission(user, parcel, 0); 956 return GenericParcelOwnerPermission(user, parcel, 0,true);
954 } 957 }
955 958
956 private bool CanDeedParcel(UUID user, ILandObject parcel, Scene scene) 959 private bool CanDeedParcel(UUID user, ILandObject parcel, Scene scene)
@@ -967,7 +970,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
967 if ((client.GetGroupPowers(parcel.LandData.GroupID) & (ulong)GroupPowers.LandDeed) == 0) 970 if ((client.GetGroupPowers(parcel.LandData.GroupID) & (ulong)GroupPowers.LandDeed) == 0)
968 return false; 971 return false;
969 972
970 return GenericParcelOwnerPermission(user, parcel, (ulong)GroupPowers.LandDeed); 973 return GenericParcelOwnerPermission(user, parcel, (ulong)GroupPowers.LandDeed, false);
971 } 974 }
972 975
973 private bool CanDeedObject(UUID user, UUID group, Scene scene) 976 private bool CanDeedObject(UUID user, UUID group, Scene scene)
@@ -1008,9 +1011,11 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1008 return false; 1011 return false;
1009 1012
1010 if (part.OwnerID == owner) 1013 if (part.OwnerID == owner)
1011 return ((part.OwnerMask & PERM_COPY) != 0); 1014 {
1012 1015 if ((part.OwnerMask & PERM_COPY) == 0)
1013 if (part.GroupID != UUID.Zero) 1016 return false;
1017 }
1018 else if (part.GroupID != UUID.Zero)
1014 { 1019 {
1015 if ((part.OwnerID == part.GroupID) && ((owner != part.LastOwnerID) || ((part.GroupMask & PERM_TRANS) == 0))) 1020 if ((part.OwnerID == part.GroupID) && ((owner != part.LastOwnerID) || ((part.GroupMask & PERM_TRANS) == 0)))
1016 return false; 1021 return false;
@@ -1052,7 +1057,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1052 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1057 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1053 if (m_bypassPermissions) return m_bypassPermissionsValue; 1058 if (m_bypassPermissions) return m_bypassPermissionsValue;
1054 1059
1055 return GenericParcelOwnerPermission(user, parcel, (ulong)p); 1060 return GenericParcelOwnerPermission(user, parcel, (ulong)p, false);
1056 } 1061 }
1057 1062
1058 /// <summary> 1063 /// <summary>
@@ -1451,29 +1456,33 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1451 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1456 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1452 if (m_bypassPermissions) return m_bypassPermissionsValue; 1457 if (m_bypassPermissions) return m_bypassPermissionsValue;
1453 1458
1454 bool permission = false;
1455
1456// m_log.DebugFormat("[PERMISSIONS MODULE]: Checking rez object at {0} in {1}", objectPosition, m_scene.Name); 1459// m_log.DebugFormat("[PERMISSIONS MODULE]: Checking rez object at {0} in {1}", objectPosition, m_scene.Name);
1457 1460
1458 ILandObject land = m_scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y); 1461 ILandObject parcel = m_scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
1459 if (land == null) return false; 1462 if (parcel == null)
1460 1463 return false;
1461 if ((land.LandData.Flags & ((int)ParcelFlags.CreateObjects)) ==
1462 (int)ParcelFlags.CreateObjects)
1463 permission = true;
1464 1464
1465 if (IsAdministrator(owner)) 1465 if ((parcel.LandData.Flags & (uint)ParcelFlags.CreateObjects) != 0)
1466 { 1466 {
1467 permission = true; 1467 return true;
1468 } 1468 }
1469 1469 else if ((owner == parcel.LandData.OwnerID) || IsAdministrator(owner))
1470 // Powers are zero, because GroupPowers.AllowRez is not a precondition for rezzing objects
1471 if (GenericParcelPermission(owner, objectPosition, 0))
1472 { 1470 {
1473 permission = true; 1471 return true;
1472 }
1473 else if (((parcel.LandData.Flags & (uint)ParcelFlags.CreateGroupObjects) != 0)
1474 && (parcel.LandData.GroupID != UUID.Zero) && IsGroupMember(parcel.LandData.GroupID, owner, 0))
1475 {
1476 return true;
1477 }
1478 else if (parcel.LandData.GroupID != UUID.Zero && IsGroupMember(parcel.LandData.GroupID, owner, (ulong)GroupPowers.AllowRez))
1479 {
1480 return true;
1481 }
1482 else
1483 {
1484 return false;
1474 } 1485 }
1475
1476 return permission;
1477 } 1486 }
1478 1487
1479 private bool CanRunConsoleCommand(UUID user, Scene requestFromScene) 1488 private bool CanRunConsoleCommand(UUID user, Scene requestFromScene)
@@ -1498,7 +1507,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1498 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1507 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1499 if (m_bypassPermissions) return m_bypassPermissionsValue; 1508 if (m_bypassPermissions) return m_bypassPermissionsValue;
1500 1509
1501 return GenericParcelOwnerPermission(user, parcel, (ulong)GroupPowers.LandSetSale); 1510 return GenericParcelOwnerPermission(user, parcel, (ulong)GroupPowers.LandSetSale, false);
1502 } 1511 }
1503 1512
1504 private bool CanTakeObject(UUID objectID, UUID stealer, Scene scene) 1513 private bool CanTakeObject(UUID objectID, UUID stealer, Scene scene)
@@ -1515,6 +1524,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1515 if (m_bypassPermissions) return m_bypassPermissionsValue; 1524 if (m_bypassPermissions) return m_bypassPermissionsValue;
1516 1525
1517 bool permission = GenericObjectPermission(userID, objectID, false); 1526 bool permission = GenericObjectPermission(userID, objectID, false);
1527
1528 SceneObjectGroup so = (SceneObjectGroup)m_scene.Entities[objectID];
1529
1518 if (!permission) 1530 if (!permission)
1519 { 1531 {
1520 if (!m_scene.Entities.ContainsKey(objectID)) 1532 if (!m_scene.Entities.ContainsKey(objectID))
@@ -1528,31 +1540,23 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1528 return false; 1540 return false;
1529 } 1541 }
1530 1542
1531 SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objectID];
1532 // UUID taskOwner = null; 1543 // UUID taskOwner = null;
1533 // Added this because at this point in time it wouldn't be wise for 1544 // Added this because at this point in time it wouldn't be wise for
1534 // the administrator object permissions to take effect. 1545 // the administrator object permissions to take effect.
1535 // UUID objectOwner = task.OwnerID; 1546 // UUID objectOwner = task.OwnerID;
1536 1547
1537 if ((task.RootPart.EveryoneMask & PERM_COPY) != 0) 1548 if ((so.RootPart.EveryoneMask & PERM_COPY) != 0)
1538 permission = true; 1549 permission = true;
1550 }
1539 1551
1540 if (task.OwnerID != userID) 1552 if (so.OwnerID != userID)
1541 { 1553 {
1542 if ((task.GetEffectivePermissions() & (PERM_COPY | PERM_TRANS)) != (PERM_COPY | PERM_TRANS)) 1554 if ((so.GetEffectivePermissions() & (PERM_COPY | PERM_TRANS)) != (PERM_COPY | PERM_TRANS))
1543 permission = false; 1555 permission = false;
1544 }
1545 else
1546 {
1547 if ((task.GetEffectivePermissions() & PERM_COPY) != PERM_COPY)
1548 permission = false;
1549 }
1550 } 1556 }
1551 else 1557 else
1552 { 1558 {
1553 SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objectID]; 1559 if ((so.GetEffectivePermissions() & PERM_COPY) != PERM_COPY)
1554
1555 if ((task.GetEffectivePermissions() & (PERM_COPY | PERM_TRANS)) != (PERM_COPY | PERM_TRANS))
1556 permission = false; 1560 permission = false;
1557 } 1561 }
1558 1562
diff --git a/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs b/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs
index 7d35473..710c8da 100644
--- a/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Region/RegionCommandsModule.cs
@@ -81,7 +81,32 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
81 m_console.Commands.AddCommand( 81 m_console.Commands.AddCommand(
82 "Regions", false, "show scene", 82 "Regions", false, "show scene",
83 "show scene", 83 "show scene",
84 "Show live scene information for the currently selected region.", HandleShowScene); 84 "Show live information for the currently selected scene (fps, prims, etc.).", HandleShowScene);
85
86 m_console.Commands.AddCommand(
87 "Regions", false, "show region",
88 "show region",
89 "Show control information for the currently selected region (host name, max physical prim size, etc).",
90 "A synonym for \"region get\"",
91 HandleShowRegion);
92
93 m_console.Commands.AddCommand(
94 "Regions", false, "region get",
95 "region get",
96 "Show control information for the currently selected region (host name, max physical prim size, etc).",
97 "Some parameters can be set with the \"region set\" command.\n"
98 + "Others must be changed via a viewer (usually via the region/estate dialog box).",
99 HandleShowRegion);
100
101 m_console.Commands.AddCommand(
102 "Regions", false, "region set",
103 "region get",
104 "Set control information for the currently selected region.",
105 "Currently, the following parameters can be set:\n"
106 + "agent-limit <int> - Current root agent limit. This is persisted over restart.\n"
107 + "max-agent-limit <int> - Maximum root agent limit. agent-limit cannot exceed this."
108 + " This is not persisted over restart - to set it every time you must add a MaxAgents entry to your regions file.",
109 HandleRegionSet);
85 } 110 }
86 111
87 public void RemoveRegion(Scene scene) 112 public void RemoveRegion(Scene scene)
@@ -94,6 +119,139 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
94// m_log.DebugFormat("[REGION COMMANDS MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); 119// m_log.DebugFormat("[REGION COMMANDS MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName);
95 } 120 }
96 121
122 private void HandleShowRegion(string module, string[] cmd)
123 {
124 if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene))
125 return;
126
127 RegionInfo ri = m_scene.RegionInfo;
128 RegionSettings rs = ri.RegionSettings;
129
130 StringBuilder sb = new StringBuilder();
131 sb.AppendFormat("Region information for {0}\n", m_scene.Name);
132
133 ConsoleDisplayList dispList = new ConsoleDisplayList();
134 dispList.AddRow("Region ID", ri.RegionID);
135 dispList.AddRow("Region handle", ri.RegionHandle);
136 dispList.AddRow("Region location", string.Format("{0},{1}", ri.RegionLocX, ri.RegionLocY));
137 dispList.AddRow("Region size", string.Format("{0}x{1}", ri.RegionSizeX, ri.RegionSizeY));
138 //dispList.AddRow("Region type", ri.RegionType);
139 dispList.AddRow("Maturity", rs.Maturity);
140 dispList.AddRow("Region address", ri.ServerURI);
141 dispList.AddRow("From region file", ri.RegionFile);
142 dispList.AddRow("External endpoint", ri.ExternalEndPoint);
143 dispList.AddRow("Internal endpoint", ri.InternalEndPoint);
144 dispList.AddRow("Access level", ri.AccessLevel);
145 dispList.AddRow("Agent limit", rs.AgentLimit);
146 dispList.AddRow("Max agent limit", ri.AgentCapacity);
147 dispList.AddRow("Linkset capacity", ri.LinksetCapacity <= 0 ? "not set" : ri.LinksetCapacity.ToString());
148 dispList.AddRow("Prim capacity", ri.ObjectCapacity);
149 dispList.AddRow("Prim bonus", rs.ObjectBonus);
150 dispList.AddRow("Max prims per user", ri.MaxPrimsPerUser < 0 ? "n/a" : ri.MaxPrimsPerUser.ToString());
151 dispList.AddRow("Clamp prim size", ri.ClampPrimSize);
152 dispList.AddRow("Non physical prim min size", ri.NonphysPrimMin <= 0 ? "not set" : string.Format("{0} m", ri.NonphysPrimMin));
153 dispList.AddRow("Non physical prim max size", ri.NonphysPrimMax <= 0 ? "not set" : string.Format("{0} m", ri.NonphysPrimMax));
154 dispList.AddRow("Physical prim min size", ri.PhysPrimMin <= 0 ? "not set" : string.Format("{0} m", ri.PhysPrimMin));
155 dispList.AddRow("Physical prim max size", ri.PhysPrimMax <= 0 ? "not set" : string.Format("{0} m", ri.PhysPrimMax));
156
157 dispList.AddRow("Allow Damage", rs.AllowDamage);
158 dispList.AddRow("Allow Land join/divide", rs.AllowLandJoinDivide);
159 dispList.AddRow("Allow land resell", rs.AllowLandResell);
160 dispList.AddRow("Block fly", rs.BlockFly);
161 dispList.AddRow("Block show in search", rs.BlockShowInSearch);
162 dispList.AddRow("Block terraform", rs.BlockTerraform);
163 dispList.AddRow("Covenant UUID", rs.Covenant);
164 dispList.AddRow("Convenant change Unix time", rs.CovenantChangedDateTime);
165 dispList.AddRow("Disable collisions", rs.DisableCollisions);
166 dispList.AddRow("Disable physics", rs.DisablePhysics);
167 dispList.AddRow("Disable scripts", rs.DisableScripts);
168 dispList.AddRow("Restrict pushing", rs.RestrictPushing);
169 dispList.AddRow("Fixed sun", rs.FixedSun);
170 dispList.AddRow("Sun position", rs.SunPosition);
171 dispList.AddRow("Sun vector", rs.SunVector);
172 dispList.AddRow("Use estate sun", rs.UseEstateSun);
173 dispList.AddRow("Telehub UUID", rs.TelehubObject);
174 dispList.AddRow("Terrain lower limit", string.Format("{0} m", rs.TerrainLowerLimit));
175 dispList.AddRow("Terrain raise limit", string.Format("{0} m", rs.TerrainRaiseLimit));
176 dispList.AddRow("Water height", string.Format("{0} m", rs.WaterHeight));
177
178 dispList.AddRow("Maptile static file", ri.MaptileStaticFile);
179 dispList.AddRow("Maptile static UUID", ri.MaptileStaticUUID);
180 dispList.AddRow("Last map refresh", ri.lastMapRefresh);
181 dispList.AddRow("Last map UUID", ri.lastMapUUID);
182
183 dispList.AddToStringBuilder(sb);
184
185 MainConsole.Instance.Output(sb.ToString());
186 }
187
188 private void HandleRegionSet(string module, string[] args)
189 {
190 if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene))
191 return;
192
193 if (args.Length != 4)
194 {
195 MainConsole.Instance.OutputFormat("Usage: region set <param> <value>");
196 return;
197 }
198
199 string param = args[2];
200 string rawValue = args[3];
201
202 if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene))
203 return;
204
205 RegionInfo ri = m_scene.RegionInfo;
206 RegionSettings rs = ri.RegionSettings;
207
208 if (param == "agent-limit")
209 {
210 int newValue;
211
212 if (!ConsoleUtil.TryParseConsoleNaturalInt(MainConsole.Instance, rawValue, out newValue))
213 return;
214
215 if (newValue > ri.AgentCapacity)
216 {
217 MainConsole.Instance.OutputFormat(
218 "Cannot set {0} to {1} in {2} as max-agent-limit is {3}", "agent-limit",
219 newValue, m_scene.Name, ri.AgentCapacity);
220 }
221 else
222 {
223 rs.AgentLimit = newValue;
224
225 MainConsole.Instance.OutputFormat(
226 "{0} set to {1} in {2}", "agent-limit", newValue, m_scene.Name);
227 }
228
229 rs.Save();
230 }
231 else if (param == "max-agent-limit")
232 {
233 int newValue;
234
235 if (!ConsoleUtil.TryParseConsoleNaturalInt(MainConsole.Instance, rawValue, out newValue))
236 return;
237
238 ri.AgentCapacity = newValue;
239
240 MainConsole.Instance.OutputFormat(
241 "{0} set to {1} in {2}", "max-agent-limit", newValue, m_scene.Name);
242
243 if (ri.AgentCapacity < rs.AgentLimit)
244 {
245 rs.AgentLimit = ri.AgentCapacity;
246
247 MainConsole.Instance.OutputFormat(
248 "Reducing {0} to {1} in {2}", "agent-limit", rs.AgentLimit, m_scene.Name);
249 }
250
251 rs.Save();
252 }
253 }
254
97 private void HandleShowScene(string module, string[] cmd) 255 private void HandleShowScene(string module, string[] cmd)
98 { 256 {
99 if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene)) 257 if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene))
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs
index 328fbf0..65f464a 100644
--- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs
+++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs
@@ -54,13 +54,14 @@ namespace OpenSim.Region.CoreModules.World.Serialiser
54 { 54 {
55 string xmlstream = GetObjectXml(scene); 55 string xmlstream = GetObjectXml(scene);
56 56
57 MemoryStream stream = ReformatXmlString(xmlstream); 57 using (MemoryStream stream = ReformatXmlString(xmlstream))
58 58 {
59 stream.Seek(0, SeekOrigin.Begin); 59 stream.Seek(0, SeekOrigin.Begin);
60 CreateXmlFile(stream, fileName); 60 CreateXmlFile(stream, fileName);
61 61
62 stream.Seek(0, SeekOrigin.Begin); 62 stream.Seek(0, SeekOrigin.Begin);
63 CreateCompressedXmlFile(stream, fileName); 63 CreateCompressedXmlFile(stream, fileName);
64 }
64 } 65 }
65 66
66 private static MemoryStream ReformatXmlString(string xmlstream) 67 private static MemoryStream ReformatXmlString(string xmlstream)
@@ -112,13 +113,16 @@ namespace OpenSim.Region.CoreModules.World.Serialiser
112 { 113 {
113 #region GZip Compressed Version 114 #region GZip Compressed Version
114 115
115 FileStream objectsFileCompressed = new FileStream(fileName + ".gzs", FileMode.Create); 116 using (FileStream objectsFileCompressed = new FileStream(fileName + ".gzs", FileMode.Create))
116 MemoryStream gzipMSStream = new MemoryStream(); 117 using (MemoryStream gzipMSStream = new MemoryStream())
117 GZipStream gzipStream = new GZipStream(gzipMSStream, CompressionMode.Compress); 118 {
118 xmlStream.WriteTo(gzipStream); 119 using (GZipStream gzipStream = new GZipStream(gzipMSStream, CompressionMode.Compress, true))
119 gzipMSStream.WriteTo(objectsFileCompressed); 120 {
120 objectsFileCompressed.Flush(); 121 xmlStream.WriteTo(gzipStream);
121 objectsFileCompressed.Close(); 122 }
123
124 gzipMSStream.WriteTo(objectsFileCompressed);
125 }
122 126
123 #endregion 127 #endregion
124 } 128 }
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
index 66059fb..a5bb1a7 100644
--- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
+++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
@@ -27,6 +27,7 @@
27 27
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.IO; 29using System.IO;
30using System.Text;
30using System.Xml; 31using System.Xml;
31using log4net.Config; 32using log4net.Config;
32using NUnit.Framework; 33using NUnit.Framework;
@@ -42,128 +43,351 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
42 [TestFixture] 43 [TestFixture]
43 public class SerialiserTests : OpenSimTestCase 44 public class SerialiserTests : OpenSimTestCase
44 { 45 {
45 private string xml = @" 46 private const string ObjectRootPartStubXml =
46 <SceneObjectGroup> 47@"<SceneObjectGroup>
47 <RootPart> 48 <RootPart>
48 <SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""> 49 <SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
49 <AllowedDrop>false</AllowedDrop> 50 <AllowedDrop>false</AllowedDrop>
50 <CreatorID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></CreatorID> 51 <CreatorID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></CreatorID>
51 <FolderID><Guid>e6a5a05e-e8cc-4816-8701-04165e335790</Guid></FolderID> 52 <FolderID><Guid>e6a5a05e-e8cc-4816-8701-04165e335790</Guid></FolderID>
52 <InventorySerial>1</InventorySerial> 53 <InventorySerial>1</InventorySerial>
53 <TaskInventory /> 54 <TaskInventory />
54 <ObjectFlags>0</ObjectFlags> 55 <ObjectFlags>0</ObjectFlags>
55 <UUID><Guid>e6a5a05e-e8cc-4816-8701-04165e335790</Guid></UUID> 56 <UUID><Guid>e6a5a05e-e8cc-4816-8701-04165e335790</Guid></UUID>
56 <LocalId>2698615125</LocalId> 57 <LocalId>2698615125</LocalId>
57 <Name>PrimMyRide</Name> 58 <Name>PrimMyRide</Name>
58 <Material>0</Material> 59 <Material>0</Material>
59 <PassTouches>false</PassTouches> 60 <PassTouches>false</PassTouches>
60 <RegionHandle>1099511628032000</RegionHandle> 61 <RegionHandle>1099511628032000</RegionHandle>
61 <ScriptAccessPin>0</ScriptAccessPin> 62 <ScriptAccessPin>0</ScriptAccessPin>
62 <GroupPosition><X>147.23</X><Y>92.698</Y><Z>22.78084</Z></GroupPosition> 63 <GroupPosition><X>147.23</X><Y>92.698</Y><Z>22.78084</Z></GroupPosition>
63 <OffsetPosition><X>0</X><Y>0</Y><Z>0</Z></OffsetPosition> 64 <OffsetPosition><X>0</X><Y>0</Y><Z>0</Z></OffsetPosition>
64 <RotationOffset><X>-4.371139E-08</X><Y>-1</Y><Z>-4.371139E-08</Z><W>0</W></RotationOffset> 65 <RotationOffset><X>-4.371139E-08</X><Y>-1</Y><Z>-4.371139E-08</Z><W>0</W></RotationOffset>
65 <Velocity><X>0</X><Y>0</Y><Z>0</Z></Velocity> 66 <Velocity><X>0</X><Y>0</Y><Z>0</Z></Velocity>
66 <RotationalVelocity><X>0</X><Y>0</Y><Z>0</Z></RotationalVelocity> 67 <RotationalVelocity><X>0</X><Y>0</Y><Z>0</Z></RotationalVelocity>
67 <AngularVelocity><X>0</X><Y>0</Y><Z>0</Z></AngularVelocity> 68 <AngularVelocity><X>0</X><Y>0</Y><Z>0</Z></AngularVelocity>
68 <Acceleration><X>0</X><Y>0</Y><Z>0</Z></Acceleration> 69 <Acceleration><X>0</X><Y>0</Y><Z>0</Z></Acceleration>
69 <Description /> 70 <Description />
70 <Color /> 71 <Color />
71 <Text /> 72 <Text />
72 <SitName /> 73 <SitName />
73 <TouchName /> 74 <TouchName />
74 <LinkNum>0</LinkNum> 75 <LinkNum>0</LinkNum>
75 <ClickAction>0</ClickAction> 76 <ClickAction>0</ClickAction>
76 <Shape> 77 <Shape>
77 <ProfileCurve>1</ProfileCurve> 78 <ProfileCurve>1</ProfileCurve>
78 <TextureEntry>AAAAAAAAERGZmQAAAAAABQCVlZUAAAAAQEAAAABAQAAAAAAAAAAAAAAAAAAAAA==</TextureEntry> 79 <TextureEntry>AAAAAAAAERGZmQAAAAAABQCVlZUAAAAAQEAAAABAQAAAAAAAAAAAAAAAAAAAAA==</TextureEntry>
79 <ExtraParams>AA==</ExtraParams> 80 <ExtraParams>AA==</ExtraParams>
80 <PathBegin>0</PathBegin> 81 <PathBegin>0</PathBegin>
81 <PathCurve>16</PathCurve> 82 <PathCurve>16</PathCurve>
82 <PathEnd>0</PathEnd> 83 <PathEnd>0</PathEnd>
83 <PathRadiusOffset>0</PathRadiusOffset> 84 <PathRadiusOffset>0</PathRadiusOffset>
84 <PathRevolutions>0</PathRevolutions> 85 <PathRevolutions>0</PathRevolutions>
85 <PathScaleX>100</PathScaleX> 86 <PathScaleX>100</PathScaleX>
86 <PathScaleY>100</PathScaleY> 87 <PathScaleY>100</PathScaleY>
87 <PathShearX>0</PathShearX> 88 <PathShearX>0</PathShearX>
88 <PathShearY>0</PathShearY> 89 <PathShearY>0</PathShearY>
89 <PathSkew>0</PathSkew> 90 <PathSkew>0</PathSkew>
90 <PathTaperX>0</PathTaperX> 91 <PathTaperX>0</PathTaperX>
91 <PathTaperY>0</PathTaperY> 92 <PathTaperY>0</PathTaperY>
92 <PathTwist>0</PathTwist> 93 <PathTwist>0</PathTwist>
93 <PathTwistBegin>0</PathTwistBegin> 94 <PathTwistBegin>0</PathTwistBegin>
94 <PCode>9</PCode> 95 <PCode>9</PCode>
95 <ProfileBegin>0</ProfileBegin> 96 <ProfileBegin>0</ProfileBegin>
96 <ProfileEnd>0</ProfileEnd> 97 <ProfileEnd>0</ProfileEnd>
97 <ProfileHollow>0</ProfileHollow> 98 <ProfileHollow>0</ProfileHollow>
98 <Scale><X>10</X><Y>10</Y><Z>0.5</Z></Scale> 99 <Scale><X>10</X><Y>10</Y><Z>0.5</Z></Scale>
99 <State>0</State> 100 <State>0</State>
100 <ProfileShape>Square</ProfileShape> 101 <ProfileShape>Square</ProfileShape>
101 <HollowShape>Same</HollowShape> 102 <HollowShape>Same</HollowShape>
102 <SculptTexture><Guid>00000000-0000-0000-0000-000000000000</Guid></SculptTexture> 103 <SculptTexture><Guid>00000000-0000-0000-0000-000000000000</Guid></SculptTexture>
103 <SculptType>0</SculptType><SculptData /> 104 <SculptType>0</SculptType><SculptData />
104 <FlexiSoftness>0</FlexiSoftness> 105 <FlexiSoftness>0</FlexiSoftness>
105 <FlexiTension>0</FlexiTension> 106 <FlexiTension>0</FlexiTension>
106 <FlexiDrag>0</FlexiDrag> 107 <FlexiDrag>0</FlexiDrag>
107 <FlexiGravity>0</FlexiGravity> 108 <FlexiGravity>0</FlexiGravity>
108 <FlexiWind>0</FlexiWind> 109 <FlexiWind>0</FlexiWind>
109 <FlexiForceX>0</FlexiForceX> 110 <FlexiForceX>0</FlexiForceX>
110 <FlexiForceY>0</FlexiForceY> 111 <FlexiForceY>0</FlexiForceY>
111 <FlexiForceZ>0</FlexiForceZ> 112 <FlexiForceZ>0</FlexiForceZ>
112 <LightColorR>0</LightColorR> 113 <LightColorR>0</LightColorR>
113 <LightColorG>0</LightColorG> 114 <LightColorG>0</LightColorG>
114 <LightColorB>0</LightColorB> 115 <LightColorB>0</LightColorB>
115 <LightColorA>1</LightColorA> 116 <LightColorA>1</LightColorA>
116 <LightRadius>0</LightRadius> 117 <LightRadius>0</LightRadius>
117 <LightCutoff>0</LightCutoff> 118 <LightCutoff>0</LightCutoff>
118 <LightFalloff>0</LightFalloff> 119 <LightFalloff>0</LightFalloff>
119 <LightIntensity>1</LightIntensity> 120 <LightIntensity>1</LightIntensity>
120 <FlexiEntry>false</FlexiEntry> 121 <FlexiEntry>false</FlexiEntry>
121 <LightEntry>false</LightEntry> 122 <LightEntry>false</LightEntry>
122 <SculptEntry>false</SculptEntry> 123 <SculptEntry>false</SculptEntry>
123 </Shape> 124 </Shape>
124 <Scale><X>10</X><Y>10</Y><Z>0.5</Z></Scale> 125 <Scale><X>10</X><Y>10</Y><Z>0.5</Z></Scale>
125 <UpdateFlag>0</UpdateFlag> 126 <UpdateFlag>0</UpdateFlag>
126 <SitTargetOrientation><X>0</X><Y>0</Y><Z>0</Z><W>1</W></SitTargetOrientation> 127 <SitTargetOrientation><X>0</X><Y>0</Y><Z>0</Z><W>1</W></SitTargetOrientation>
127 <SitTargetPosition><X>0</X><Y>0</Y><Z>0</Z></SitTargetPosition> 128 <SitTargetPosition><X>0</X><Y>0</Y><Z>0</Z></SitTargetPosition>
128 <SitTargetPositionLL><X>0</X><Y>0</Y><Z>0</Z></SitTargetPositionLL> 129 <SitTargetPositionLL><X>0</X><Y>0</Y><Z>0</Z></SitTargetPositionLL>
129 <SitTargetOrientationLL><X>0</X><Y>0</Y><Z>0</Z><W>1</W></SitTargetOrientationLL> 130 <SitTargetOrientationLL><X>0</X><Y>0</Y><Z>0</Z><W>1</W></SitTargetOrientationLL>
130 <ParentID>0</ParentID> 131 <ParentID>0</ParentID>
131 <CreationDate>1211330445</CreationDate> 132 <CreationDate>1211330445</CreationDate>
132 <Category>0</Category> 133 <Category>0</Category>
133 <SalePrice>0</SalePrice> 134 <SalePrice>0</SalePrice>
134 <ObjectSaleType>0</ObjectSaleType> 135 <ObjectSaleType>0</ObjectSaleType>
135 <OwnershipCost>0</OwnershipCost> 136 <OwnershipCost>0</OwnershipCost>
136 <GroupID><Guid>00000000-0000-0000-0000-000000000000</Guid></GroupID> 137 <GroupID><Guid>00000000-0000-0000-0000-000000000000</Guid></GroupID>
137 <OwnerID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></OwnerID> 138 <OwnerID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></OwnerID>
138 <LastOwnerID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></LastOwnerID> 139 <LastOwnerID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></LastOwnerID>
139 <BaseMask>2147483647</BaseMask> 140 <BaseMask>2147483647</BaseMask>
140 <OwnerMask>2147483647</OwnerMask> 141 <OwnerMask>2147483647</OwnerMask>
141 <GroupMask>0</GroupMask> 142 <GroupMask>0</GroupMask>
142 <EveryoneMask>0</EveryoneMask> 143 <EveryoneMask>0</EveryoneMask>
143 <NextOwnerMask>2147483647</NextOwnerMask> 144 <NextOwnerMask>2147483647</NextOwnerMask>
144 <Flags>None</Flags> 145 <Flags>None</Flags>
145 <CollisionSound><Guid>00000000-0000-0000-0000-000000000000</Guid></CollisionSound> 146 <CollisionSound><Guid>00000000-0000-0000-0000-000000000000</Guid></CollisionSound>
146 <CollisionSoundVolume>0</CollisionSoundVolume> 147 <CollisionSoundVolume>0</CollisionSoundVolume>
147 <DynAttrs> 148 <DynAttrs>
148 <llsd> 149 <llsd>
149 <map> 150 <map>
150 <key>MyNamespace</key> 151 <key>MyNamespace</key>
151 <map> 152 <map>
152 <key>MyStore</key> 153 <key>MyStore</key>
153 <map> 154 <map>
154 <key>the answer</key> 155 <key>the answer</key>
155 <integer>42</integer> 156 <integer>42</integer>
156 </map>
157 </map>
158 </map> 157 </map>
159 </llsd> 158 </map>
160 </DynAttrs> 159 </map>
161 </SceneObjectPart> 160 </llsd>
162 </RootPart> 161 </DynAttrs>
163 <OtherParts /> 162 </SceneObjectPart>
164 </SceneObjectGroup>"; 163 </RootPart>";
165 164
166 private string badFloatsXml = @" 165 private const string ObjectWithNoOtherPartsXml = ObjectRootPartStubXml +
166@"
167 <OtherParts />
168</SceneObjectGroup>";
169
170 private const string ObjectWithOtherPartsXml = ObjectRootPartStubXml +
171@"
172 <OtherParts>
173 <Part>
174 <SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
175 <AllowedDrop>false</AllowedDrop>
176 <CreatorID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></CreatorID>
177 <FolderID><Guid>9958feb1-02a6-49e4-a4ce-eba6f578ee13</Guid></FolderID>
178 <InventorySerial>3</InventorySerial>
179 <UUID><Guid>9958feb1-02a6-49e4-a4ce-eba6f578ee13</Guid></UUID>
180 <LocalId>1154704500</LocalId>
181 <Name>Alien Head 1</Name>
182 <Material>3</Material>
183 <PassTouches>false</PassTouches>
184 <PassCollisions>false</PassCollisions>
185 <RegionHandle>21990232560640000</RegionHandle>
186 <ScriptAccessPin>0</ScriptAccessPin>
187 <GroupPosition><X>125.5655</X><Y>127.346</Y><Z>22.48036</Z></GroupPosition>
188 <OffsetPosition><X>-0.2171936</X><Y>0.1083984</Y><Z>0.0009994507</Z></OffsetPosition>
189 <RotationOffset><X>-0.5122106</X><Y>0.4851225</Y><Z>-0.4957454</Z><W>0.5064908</W></RotationOffset>
190 <Velocity><X>0</X><Y>0</Y><Z>0</Z></Velocity>
191 <AngularVelocity><X>0</X><Y>0</Y><Z>0</Z></AngularVelocity>
192 <Acceleration><X>0</X><Y>0</Y><Z>0</Z></Acceleration>
193 <Description>(No Description)</Description>
194 <Color><R>0</R><G>0</G><B>0</B><A>255</A></Color>
195 <Text/>
196 <SitName/>
197 <TouchName/>
198 <LinkNum>253</LinkNum>
199 <ClickAction>0</ClickAction>
200 <Shape>
201 <ProfileCurve>5</ProfileCurve>
202 <TextureEntry>Vw3dpvgTRUOiIUOGsnpWlAB/f38AAAAAgL8AAACAPwAAAAAAAAAF4ABAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</TextureEntry>
203 <ExtraParams>AA==</ExtraParams>
204 <PathBegin>0</PathBegin>
205 <PathCurve>32</PathCurve>
206 <PathEnd>0</PathEnd>
207 <PathRadiusOffset>0</PathRadiusOffset>
208 <PathRevolutions>0</PathRevolutions>
209 <PathScaleX>100</PathScaleX>
210 <PathScaleY>100</PathScaleY>
211 <PathShearX>0</PathShearX>
212 <PathShearY>0</PathShearY>
213 <PathSkew>0</PathSkew>
214 <PathTaperX>0</PathTaperX>
215 <PathTaperY>0</PathTaperY>
216 <PathTwist>0</PathTwist>
217 <PathTwistBegin>0</PathTwistBegin>
218 <PCode>9</PCode>
219 <ProfileBegin>0</ProfileBegin>
220 <ProfileEnd>0</ProfileEnd>
221 <ProfileHollow>0</ProfileHollow>
222 <State>9</State>
223 <LastAttachPoint>0</LastAttachPoint>
224 <ProfileShape>HalfCircle</ProfileShape>
225 <HollowShape>Same</HollowShape>
226 <SculptTexture><Guid>00000000-0000-0000-0000-000000000000</Guid></SculptTexture>
227 <SculptType>0</SculptType>
228 <FlexiSoftness>0</FlexiSoftness>
229 <FlexiTension>0</FlexiTension>
230 <FlexiDrag>0</FlexiDrag>
231 <FlexiGravity>0</FlexiGravity>
232 <FlexiWind>0</FlexiWind>
233 <FlexiForceX>0</FlexiForceX>
234 <FlexiForceY>0</FlexiForceY>
235 <FlexiForceZ>0</FlexiForceZ>
236 <LightColorR>0</LightColorR>
237 <LightColorG>0</LightColorG>
238 <LightColorB>0</LightColorB>
239 <LightColorA>1</LightColorA>
240 <LightRadius>0</LightRadius>
241 <LightCutoff>0</LightCutoff>
242 <LightFalloff>0</LightFalloff>
243 <LightIntensity>1</LightIntensity>
244 <FlexiEntry>false</FlexiEntry>
245 <LightEntry>false</LightEntry>
246 <SculptEntry>false</SculptEntry>
247 </Shape>
248 <Scale><X>0.1148195</X><Y>0.0143891</Y><Z>0.02768878</Z></Scale>
249 <SitTargetOrientation><X>0</X><Y>0</Y><Z>0</Z><W>1</W></SitTargetOrientation>
250 <SitTargetPosition><X>0</X><Y>0</Y><Z>0</Z></SitTargetPosition>
251 <SitTargetPositionLL><X>0</X><Y>0</Y><Z>0</Z></SitTargetPositionLL>
252 <SitTargetOrientationLL><X>0</X><Y>0</Y><Z>0</Z><W>1</W></SitTargetOrientationLL>
253 <ParentID>1154704499</ParentID>
254 <CreationDate>1256611042</CreationDate>
255 <Category>0</Category>
256 <SalePrice>10</SalePrice>
257 <ObjectSaleType>0</ObjectSaleType>
258 <OwnershipCost>0</OwnershipCost>
259 <GroupID><Guid>00000000-0000-0000-0000-000000000000</Guid></GroupID>
260 <OwnerID><Guid>7b2022f0-5f19-488c-b7e5-829d8f96b448</Guid></OwnerID>
261 <LastOwnerID><Guid>7b2022f0-5f19-488c-b7e5-829d8f96b448</Guid></LastOwnerID>
262 <BaseMask>647168</BaseMask>
263 <OwnerMask>647168</OwnerMask>
264 <GroupMask>0</GroupMask>
265 <EveryoneMask>0</EveryoneMask>
266 <NextOwnerMask>581632</NextOwnerMask>
267 <Flags>None</Flags>
268 <CollisionSound><Guid>00000000-0000-0000-0000-000000000000</Guid></CollisionSound>
269 <CollisionSoundVolume>0</CollisionSoundVolume>
270 <AttachedPos><X>0</X><Y>0</Y><Z>0</Z></AttachedPos>
271 <TextureAnimation/>
272 <ParticleSystem/>
273 <PayPrice0>-2</PayPrice0>
274 <PayPrice1>-2</PayPrice1>
275 <PayPrice2>-2</PayPrice2>
276 <PayPrice3>-2</PayPrice3>
277 <PayPrice4>-2</PayPrice4>
278 </SceneObjectPart>
279 </Part>
280 <Part>
281 <SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
282 <AllowedDrop>false</AllowedDrop>
283 <CreatorID><Guid>a6dacf01-4636-4bb9-8a97-30609438af9d</Guid></CreatorID>
284 <FolderID><Guid>674b6b86-f5aa-439a-8e00-0d75bc08c80a</Guid></FolderID>
285 <InventorySerial>3</InventorySerial>
286 <UUID><Guid>674b6b86-f5aa-439a-8e00-0d75bc08c80a</Guid></UUID>
287 <LocalId>1154704501</LocalId>
288 <Name>Alien Head 2</Name>
289 <Material>3</Material>
290 <PassTouches>false</PassTouches>
291 <PassCollisions>false</PassCollisions>
292 <RegionHandle>21990232560640000</RegionHandle>
293 <ScriptAccessPin>0</ScriptAccessPin>
294 <GroupPosition><X>125.5655</X><Y>127.346</Y><Z>22.48036</Z></GroupPosition>
295 <OffsetPosition><X>-0.2490997</X><Y>0.08520126</Y><Z>0.0009002686</Z></OffsetPosition>
296 <RotationOffset><X>-0.4765368</X><Y>0.5194498</Y><Z>-0.5301372</Z><W>0.4712104</W></RotationOffset>
297 <Velocity><X>0</X><Y>0</Y><Z>0</Z></Velocity>
298 <AngularVelocity><X>0</X><Y>0</Y><Z>0</Z></AngularVelocity>
299 <Acceleration><X>0</X><Y>0</Y><Z>0</Z></Acceleration>
300 <Description>(No Description)</Description>
301 <Color><R>0</R><G>0</G><B>0</B><A>255</A></Color>
302 <Text/>
303 <SitName/>
304 <TouchName/>
305 <LinkNum>252</LinkNum>
306 <ClickAction>0</ClickAction>
307 <Shape>
308 <ProfileCurve>0</ProfileCurve>
309 <TextureEntry>Vw3dpvgTRUOiIUOGsnpWlAB/f38AAAAAgL8AAACAPwAAAAAAAAAF4ABAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</TextureEntry>
310 <ExtraParams>AA==</ExtraParams>
311 <PathBegin>0</PathBegin>
312 <PathCurve>32</PathCurve>
313 <PathEnd>0</PathEnd>
314 <PathRadiusOffset>0</PathRadiusOffset>
315 <PathRevolutions>0</PathRevolutions>
316 <PathScaleX>100</PathScaleX>
317 <PathScaleY>150</PathScaleY>
318 <PathShearX>0</PathShearX>
319 <PathShearY>0</PathShearY>
320 <PathSkew>0</PathSkew>
321 <PathTaperX>0</PathTaperX>
322 <PathTaperY>0</PathTaperY>
323 <PathTwist>0</PathTwist>
324 <PathTwistBegin>0</PathTwistBegin>
325 <PCode>9</PCode>
326 <ProfileBegin>0</ProfileBegin>
327 <ProfileEnd>0</ProfileEnd>
328 <ProfileHollow>0</ProfileHollow>
329 <State>9</State>
330 <LastAttachPoint>0</LastAttachPoint>
331 <ProfileShape>Circle</ProfileShape>
332 <HollowShape>Same</HollowShape>
333 <SculptTexture><Guid>00000000-0000-0000-0000-000000000000</Guid></SculptTexture>
334 <SculptType>0</SculptType>
335 <FlexiSoftness>0</FlexiSoftness>
336 <FlexiTension>0</FlexiTension>
337 <FlexiDrag>0</FlexiDrag>
338 <FlexiGravity>0</FlexiGravity>
339 <FlexiWind>0</FlexiWind>
340 <FlexiForceX>0</FlexiForceX>
341 <FlexiForceY>0</FlexiForceY>
342 <FlexiForceZ>0</FlexiForceZ>
343 <LightColorR>0</LightColorR>
344 <LightColorG>0</LightColorG>
345 <LightColorB>0</LightColorB>
346 <LightColorA>1</LightColorA>
347 <LightRadius>0</LightRadius>
348 <LightCutoff>0</LightCutoff>
349 <LightFalloff>0</LightFalloff>
350 <LightIntensity>1</LightIntensity>
351 <FlexiEntry>false</FlexiEntry>
352 <LightEntry>false</LightEntry>
353 <SculptEntry>false</SculptEntry>
354 </Shape>
355 <Scale><X>0.03574385</X><Y>0.05958032</Y><Z>0.04764182</Z></Scale>
356 <SitTargetOrientation><X>0</X><Y>0</Y><Z>0</Z><W>1</W></SitTargetOrientation>
357 <SitTargetPosition><X>0</X><Y>0</Y><Z>0</Z></SitTargetPosition>
358 <SitTargetPositionLL><X>0</X><Y>0</Y><Z>0</Z></SitTargetPositionLL>
359 <SitTargetOrientationLL><X>0</X><Y>0</Y><Z>0</Z><W>1</W></SitTargetOrientationLL>
360 <ParentID>1154704499</ParentID>
361 <CreationDate>1256611042</CreationDate>
362 <Category>0</Category>
363 <SalePrice>10</SalePrice>
364 <ObjectSaleType>0</ObjectSaleType>
365 <OwnershipCost>0</OwnershipCost>
366 <GroupID><Guid>00000000-0000-0000-0000-000000000000</Guid></GroupID>
367 <OwnerID><Guid>7b2022f0-5f19-488c-b7e5-829d8f96b448</Guid></OwnerID>
368 <LastOwnerID><Guid>7b2022f0-5f19-488c-b7e5-829d8f96b448</Guid></LastOwnerID>
369 <BaseMask>647168</BaseMask>
370 <OwnerMask>647168</OwnerMask>
371 <GroupMask>0</GroupMask>
372 <EveryoneMask>0</EveryoneMask>
373 <NextOwnerMask>581632</NextOwnerMask>
374 <Flags>None</Flags>
375 <CollisionSound><Guid>00000000-0000-0000-0000-000000000000</Guid></CollisionSound>
376 <CollisionSoundVolume>0</CollisionSoundVolume>
377 <AttachedPos><X>0</X><Y>0</Y><Z>0</Z></AttachedPos>
378 <TextureAnimation/>
379 <ParticleSystem/>
380 <PayPrice0>-2</PayPrice0>
381 <PayPrice1>-2</PayPrice1>
382 <PayPrice2>-2</PayPrice2>
383 <PayPrice3>-2</PayPrice3>
384 <PayPrice4>-2</PayPrice4>
385 </SceneObjectPart>
386 </Part>
387 </OtherParts>
388</SceneObjectGroup>";
389
390 private const string ObjectWithBadFloatsXml = @"
167 <SceneObjectGroup> 391 <SceneObjectGroup>
168 <RootPart> 392 <RootPart>
169 <SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""> 393 <SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
@@ -270,7 +494,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
270 <OtherParts /> 494 <OtherParts />
271 </SceneObjectGroup>"; 495 </SceneObjectGroup>";
272 496
273 private string xml2 = @" 497 private const string ObjectWithNoPartsXml2 = @"
274 <SceneObjectGroup> 498 <SceneObjectGroup>
275 <SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""> 499 <SceneObjectPart xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
276 <CreatorID><UUID>b46ef588-411e-4a8b-a284-d7dcfe8e74ef</UUID></CreatorID> 500 <CreatorID><UUID>b46ef588-411e-4a8b-a284-d7dcfe8e74ef</UUID></CreatorID>
@@ -377,12 +601,12 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
377 } 601 }
378 602
379 [Test] 603 [Test]
380 public void TestDeserializeXml() 604 public void TestDeserializeXmlObjectWithNoOtherParts()
381 { 605 {
382 TestHelpers.InMethod(); 606 TestHelpers.InMethod();
383 //log4net.Config.XmlConfigurator.Configure(); 607 TestHelpers.EnableLogging();
384 608
385 SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(xml); 609 SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(ObjectWithNoOtherPartsXml);
386 SceneObjectPart rootPart = so.RootPart; 610 SceneObjectPart rootPart = so.RootPart;
387 611
388 Assert.That(rootPart.UUID, Is.EqualTo(new UUID("e6a5a05e-e8cc-4816-8701-04165e335790"))); 612 Assert.That(rootPart.UUID, Is.EqualTo(new UUID("e6a5a05e-e8cc-4816-8701-04165e335790")));
@@ -395,12 +619,51 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
395 } 619 }
396 620
397 [Test] 621 [Test]
622 public void TestDeserializeXmlObjectWithOtherParts()
623 {
624 TestHelpers.InMethod();
625 TestHelpers.EnableLogging();
626
627 SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(ObjectWithOtherPartsXml);
628 SceneObjectPart[] parts = so.Parts;
629 Assert.AreEqual(3, so.Parts.Length);
630
631 {
632 SceneObjectPart part = parts[0];
633
634 Assert.That(part.UUID, Is.EqualTo(new UUID("e6a5a05e-e8cc-4816-8701-04165e335790")));
635 Assert.That(part.CreatorID, Is.EqualTo(new UUID("a6dacf01-4636-4bb9-8a97-30609438af9d")));
636 Assert.That(part.Name, Is.EqualTo("PrimMyRide"));
637 OSDMap store = part.DynAttrs.GetStore("MyNamespace", "MyStore");
638 Assert.AreEqual(42, store["the answer"].AsInteger());
639 }
640
641 {
642 SceneObjectPart part = parts[1];
643
644 Assert.That(part.UUID, Is.EqualTo(new UUID("9958feb1-02a6-49e4-a4ce-eba6f578ee13")));
645 Assert.That(part.CreatorID, Is.EqualTo(new UUID("a6dacf01-4636-4bb9-8a97-30609438af9d")));
646 Assert.That(part.Name, Is.EqualTo("Alien Head 1"));
647 }
648
649 {
650 SceneObjectPart part = parts[2];
651
652 Assert.That(part.UUID, Is.EqualTo(new UUID("674b6b86-f5aa-439a-8e00-0d75bc08c80a")));
653 Assert.That(part.CreatorID, Is.EqualTo(new UUID("a6dacf01-4636-4bb9-8a97-30609438af9d")));
654 Assert.That(part.Name, Is.EqualTo("Alien Head 2"));
655 }
656
657 // TODO: Check other properties
658 }
659
660 [Test]
398 public void TestDeserializeBadFloatsXml() 661 public void TestDeserializeBadFloatsXml()
399 { 662 {
400 TestHelpers.InMethod(); 663 TestHelpers.InMethod();
401// log4net.Config.XmlConfigurator.Configure(); 664// log4net.Config.XmlConfigurator.Configure();
402 665
403 SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(badFloatsXml); 666 SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(ObjectWithBadFloatsXml);
404 SceneObjectPart rootPart = so.RootPart; 667 SceneObjectPart rootPart = so.RootPart;
405 668
406 Assert.That(rootPart.UUID, Is.EqualTo(new UUID("e6a5a05e-e8cc-4816-8701-04165e335790"))); 669 Assert.That(rootPart.UUID, Is.EqualTo(new UUID("e6a5a05e-e8cc-4816-8701-04165e335790")));
@@ -517,7 +780,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
517 TestHelpers.InMethod(); 780 TestHelpers.InMethod();
518 //log4net.Config.XmlConfigurator.Configure(); 781 //log4net.Config.XmlConfigurator.Configure();
519 782
520 SceneObjectGroup so = m_serialiserModule.DeserializeGroupFromXml2(xml2); 783 SceneObjectGroup so = m_serialiserModule.DeserializeGroupFromXml2(ObjectWithNoPartsXml2);
521 SceneObjectPart rootPart = so.RootPart; 784 SceneObjectPart rootPart = so.RootPart;
522 785
523 Assert.That(rootPart.UUID, Is.EqualTo(new UUID("9be68fdd-f740-4a0f-9675-dfbbb536b946"))); 786 Assert.That(rootPart.UUID, Is.EqualTo(new UUID("9be68fdd-f740-4a0f-9675-dfbbb536b946")));
diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
index 6f344c8..d0318eb 100644
--- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
+++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
@@ -68,9 +68,6 @@ namespace OpenSim.Region.CoreModules
68 // updating those region settings in GenSunPos() 68 // updating those region settings in GenSunPos()
69 private bool receivedEstateToolsSunUpdate = false; 69 private bool receivedEstateToolsSunUpdate = false;
70 70
71 // Configurable values
72 private string m_RegionMode = "SL";
73
74 // Sun's position information is updated and sent to clients every m_UpdateInterval frames 71 // Sun's position information is updated and sent to clients every m_UpdateInterval frames
75 private int m_UpdateInterval = 0; 72 private int m_UpdateInterval = 0;
76 73
@@ -90,7 +87,6 @@ namespace OpenSim.Region.CoreModules
90 // private double m_longitude = 0; 87 // private double m_longitude = 0;
91 // private double m_latitude = 0; 88 // private double m_latitude = 0;
92 // Configurable defaults Defaults close to SL 89 // Configurable defaults Defaults close to SL
93 private string d_mode = "SL";
94 private int d_frame_mod = 100; // Every 10 seconds (actually less) 90 private int d_frame_mod = 100; // Every 10 seconds (actually less)
95 private double d_day_length = 4; // A VW day is 4 RW hours long 91 private double d_day_length = 4; // A VW day is 4 RW hours long
96 private int d_year_length = 60; // There are 60 VW days in a VW year 92 private int d_year_length = 60; // There are 60 VW days in a VW year
@@ -134,12 +130,15 @@ namespace OpenSim.Region.CoreModules
134 130
135 private const int TICKS_PER_SECOND = 10000000; 131 private const int TICKS_PER_SECOND = 10000000;
136 132
133 private ulong m_CurrentTimeOffset = 0;
134
137 // Current time in elapsed seconds since Jan 1st 1970 135 // Current time in elapsed seconds since Jan 1st 1970
138 private ulong CurrentTime 136 private ulong CurrentTime
139 { 137 {
140 get 138 get
141 { 139 {
142 return (ulong)(((DateTime.Now.Ticks) - TicksToEpoch + TicksUTCOffset) / TICKS_PER_SECOND); 140 ulong ctime = (ulong)(((DateTime.Now.Ticks) - TicksToEpoch + TicksUTCOffset) / TICKS_PER_SECOND);
141 return ctime + m_CurrentTimeOffset;
143 } 142 }
144 } 143 }
145 144
@@ -262,10 +261,8 @@ namespace OpenSim.Region.CoreModules
262 261
263 private float GetCurrentTimeAsLindenSunHour() 262 private float GetCurrentTimeAsLindenSunHour()
264 { 263 {
265 if (m_SunFixed) 264 float curtime = m_SunFixed ? m_SunFixedHour : GetCurrentSunHour();
266 return m_SunFixedHour + 6; 265 return (curtime + 6.0f) % 24.0f;
267
268 return GetCurrentSunHour() + 6.0f;
269 } 266 }
270 267
271 #region INonSharedRegion Methods 268 #region INonSharedRegion Methods
@@ -291,8 +288,6 @@ namespace OpenSim.Region.CoreModules
291 try 288 try
292 { 289 {
293 // Mode: determines how the sun is handled 290 // Mode: determines how the sun is handled
294 m_RegionMode = config.Configs["Sun"].GetString("mode", d_mode);
295 // Mode: determines how the sun is handled
296 // m_latitude = config.Configs["Sun"].GetDouble("latitude", d_latitude); 291 // m_latitude = config.Configs["Sun"].GetDouble("latitude", d_latitude);
297 // Mode: determines how the sun is handled 292 // Mode: determines how the sun is handled
298 // m_longitude = config.Configs["Sun"].GetDouble("longitude", d_longitude); 293 // m_longitude = config.Configs["Sun"].GetDouble("longitude", d_longitude);
@@ -314,7 +309,6 @@ namespace OpenSim.Region.CoreModules
314 catch (Exception e) 309 catch (Exception e)
315 { 310 {
316 m_log.Debug("[SUN]: Configuration access failed, using defaults. Reason: " + e.Message); 311 m_log.Debug("[SUN]: Configuration access failed, using defaults. Reason: " + e.Message);
317 m_RegionMode = d_mode;
318 m_YearLengthDays = d_year_length; 312 m_YearLengthDays = d_year_length;
319 m_DayLengthHours = d_day_length; 313 m_DayLengthHours = d_day_length;
320 m_HorizonShift = d_day_night; 314 m_HorizonShift = d_day_night;
@@ -325,40 +319,28 @@ namespace OpenSim.Region.CoreModules
325 // m_longitude = d_longitude; 319 // m_longitude = d_longitude;
326 } 320 }
327 321
328 switch (m_RegionMode) 322 SecondsPerSunCycle = (uint) (m_DayLengthHours * 60 * 60);
329 { 323 SecondsPerYear = (uint) (SecondsPerSunCycle*m_YearLengthDays);
330 case "T1":
331 default:
332 case "SL":
333 // Time taken to complete a cycle (day and season)
334
335 SecondsPerSunCycle = (uint) (m_DayLengthHours * 60 * 60);
336 SecondsPerYear = (uint) (SecondsPerSunCycle*m_YearLengthDays);
337
338 // Ration of real-to-virtual time
339 324
340 // VWTimeRatio = 24/m_day_length; 325 // Ration of real-to-virtual time
341 326
342 // Speed of rotation needed to complete a cycle in the 327 // VWTimeRatio = 24/m_day_length;
343 // designated period (day and season)
344 328
345 SunSpeed = m_SunCycle/SecondsPerSunCycle; 329 // Speed of rotation needed to complete a cycle in the
346 SeasonSpeed = m_SeasonalCycle/SecondsPerYear; 330 // designated period (day and season)
347 331
348 // Horizon translation 332 SunSpeed = m_SunCycle/SecondsPerSunCycle;
333 SeasonSpeed = m_SeasonalCycle/SecondsPerYear;
349 334
350 HorizonShift = m_HorizonShift; // Z axis translation 335 // Horizon translation
351 // HoursToRadians = (SunCycle/24)*VWTimeRatio;
352 336
353 m_log.Debug("[SUN]: Mode is " + m_RegionMode); 337 HorizonShift = m_HorizonShift; // Z axis translation
354 m_log.Debug("[SUN]: Initialization completed. Day is " + SecondsPerSunCycle + " seconds, and year is " + m_YearLengthDays + " days"); 338 // HoursToRadians = (SunCycle/24)*VWTimeRatio;
355 m_log.Debug("[SUN]: Axis offset is " + m_HorizonShift);
356 m_log.Debug("[SUN]: Percentage of time for daylight " + m_DayTimeSunHourScale);
357 m_log.Debug("[SUN]: Positional data updated every " + m_UpdateInterval + " frames");
358
359 break;
360 }
361 339
340 m_log.Debug("[SUN]: Initialization completed. Day is " + SecondsPerSunCycle + " seconds, and year is " + m_YearLengthDays + " days");
341 m_log.Debug("[SUN]: Axis offset is " + m_HorizonShift);
342 m_log.Debug("[SUN]: Percentage of time for daylight " + m_DayTimeSunHourScale);
343 m_log.Debug("[SUN]: Positional data updated every " + m_UpdateInterval + " frames");
362 } 344 }
363 345
364 public Type ReplaceableInterface 346 public Type ReplaceableInterface
@@ -385,7 +367,8 @@ namespace OpenSim.Region.CoreModules
385 string sunCommand = string.Format("sun {0}", kvp.Key); 367 string sunCommand = string.Format("sun {0}", kvp.Key);
386 m_scene.AddCommand("Regions", this, sunCommand, string.Format("{0} [<value>]", sunCommand), kvp.Value, "", HandleSunConsoleCommand); 368 m_scene.AddCommand("Regions", this, sunCommand, string.Format("{0} [<value>]", sunCommand), kvp.Value, "", HandleSunConsoleCommand);
387 } 369 }
388 370 m_scene.AddCommand("Regions", this, "sun help", "sun help", "list parameters that can be changed", "", HandleSunConsoleCommand);
371 m_scene.AddCommand("Regions", this, "sun list", "sun list", "list parameters that can be changed", "", HandleSunConsoleCommand);
389 ready = true; 372 ready = true;
390 } 373 }
391 374
@@ -419,23 +402,22 @@ namespace OpenSim.Region.CoreModules
419 402
420 public void SunToClient(IClientAPI client) 403 public void SunToClient(IClientAPI client)
421 { 404 {
422 if (m_RegionMode != "T1") 405 if (ready)
423 { 406 {
424 if (ready) 407 if (m_SunFixed)
425 { 408 {
426 if (m_SunFixed) 409 // m_log.DebugFormat("[SUN]: Fixed SunHour {0}, Position {1}, PosTime {2}, OrbitalPosition : {3} ",
427 { 410 // m_SunFixedHour, Position.ToString(), PosTime.ToString(), OrbitalPosition.ToString());
428 // m_log.DebugFormat("[SUN]: SunHour {0}, Position {1}, PosTime {2}, OrbitalPosition : {3} ", m_SunFixedHour, Position.ToString(), PosTime.ToString(), OrbitalPosition.ToString()); 411 client.SendSunPos(Position, Velocity, PosTime, SecondsPerSunCycle, SecondsPerYear, OrbitalPosition);
429 client.SendSunPos(Position, Velocity, PosTime, SecondsPerSunCycle, SecondsPerYear, OrbitalPosition); 412 }
430 } 413 else
431 else 414 {
432 { 415 // m_log.DebugFormat("[SUN]: SunHour {0}, Position {1}, PosTime {2}, OrbitalPosition : {3} ",
433 // m_log.DebugFormat("[SUN]: SunHour {0}, Position {1}, PosTime {2}, OrbitalPosition : {3} ", m_SunFixedHour, Position.ToString(), PosTime.ToString(), OrbitalPosition.ToString()); 416 // m_SunFixedHour, Position.ToString(), PosTime.ToString(), OrbitalPosition.ToString());
434 client.SendSunPos(Position, Velocity, CurrentTime, SecondsPerSunCycle, SecondsPerYear, OrbitalPosition); 417 client.SendSunPos(Position, Velocity, CurrentTime, SecondsPerSunCycle, SecondsPerYear, OrbitalPosition);
435 }
436 } 418 }
437 } 419 }
438 } 420 }
439 421
440 public void SunUpdate() 422 public void SunUpdate()
441 { 423 {
@@ -532,6 +514,9 @@ namespace OpenSim.Region.CoreModules
532 case "update_interval": 514 case "update_interval":
533 return m_UpdateInterval; 515 return m_UpdateInterval;
534 516
517 case "current_time":
518 return GetCurrentTimeAsLindenSunHour();
519
535 default: 520 default:
536 throw new Exception("Unknown sun parameter."); 521 throw new Exception("Unknown sun parameter.");
537 } 522 }
@@ -539,7 +524,51 @@ namespace OpenSim.Region.CoreModules
539 524
540 public void SetSunParameter(string param, double value) 525 public void SetSunParameter(string param, double value)
541 { 526 {
542 HandleSunConsoleCommand("sun", new string[] {param, value.ToString() }); 527 switch (param)
528 {
529 case "year_length":
530 m_YearLengthDays = (int)value;
531 SecondsPerYear = (uint) (SecondsPerSunCycle*m_YearLengthDays);
532 SeasonSpeed = m_SeasonalCycle/SecondsPerYear;
533 break;
534
535 case "day_length":
536 m_DayLengthHours = value;
537 SecondsPerSunCycle = (uint) (m_DayLengthHours * 60 * 60);
538 SecondsPerYear = (uint) (SecondsPerSunCycle*m_YearLengthDays);
539 SunSpeed = m_SunCycle/SecondsPerSunCycle;
540 SeasonSpeed = m_SeasonalCycle/SecondsPerYear;
541 break;
542
543 case "day_night_offset":
544 m_HorizonShift = value;
545 HorizonShift = m_HorizonShift;
546 break;
547
548 case "day_time_sun_hour_scale":
549 m_DayTimeSunHourScale = value;
550 break;
551
552 case "update_interval":
553 m_UpdateInterval = (int)value;
554 break;
555
556 case "current_time":
557 value = (value + 18.0) % 24.0;
558 // set the current offset so that the effective sun time is the parameter
559 m_CurrentTimeOffset = 0; // clear this first so we use raw time
560 m_CurrentTimeOffset = (ulong)(SecondsPerSunCycle * value/ 24.0) - (CurrentTime % SecondsPerSunCycle);
561 break;
562
563 default:
564 throw new Exception("Unknown sun parameter.");
565 }
566
567 // Generate shared values
568 GenSunPos();
569
570 // When sun settings are updated, we should update all clients with new settings.
571 SunUpdateToAllClients();
543 } 572 }
544 573
545 public float GetCurrentSunHour() 574 public float GetCurrentSunHour()
@@ -572,7 +601,7 @@ namespace OpenSim.Region.CoreModules
572 601
573 foreach (string output in ParseCmdParams(cmdparams)) 602 foreach (string output in ParseCmdParams(cmdparams))
574 { 603 {
575 m_log.Info("[SUN] " + output); 604 MainConsole.Instance.Output(output);
576 } 605 }
577 } 606 }
578 607
@@ -581,10 +610,11 @@ namespace OpenSim.Region.CoreModules
581 Dictionary<string, string> Params = new Dictionary<string, string>(); 610 Dictionary<string, string> Params = new Dictionary<string, string>();
582 611
583 Params.Add("year_length", "number of days to a year"); 612 Params.Add("year_length", "number of days to a year");
584 Params.Add("day_length", "number of seconds to a day"); 613 Params.Add("day_length", "number of hours to a day");
585 Params.Add("day_night_offset", "induces a horizon shift"); 614 Params.Add("day_night_offset", "induces a horizon shift");
586 Params.Add("update_interval", "how often to update the sun's position in frames"); 615 Params.Add("update_interval", "how often to update the sun's position in frames");
587 Params.Add("day_time_sun_hour_scale", "scales day light vs nite hours to change day/night ratio"); 616 Params.Add("day_time_sun_hour_scale", "scales day light vs nite hours to change day/night ratio");
617 Params.Add("current_time", "time in seconds of the simulator");
588 618
589 return Params; 619 return Params;
590 } 620 }
@@ -618,46 +648,15 @@ namespace OpenSim.Region.CoreModules
618 } 648 }
619 else if (args.Length == 3) 649 else if (args.Length == 3)
620 { 650 {
621 float value = 0.0f; 651 double value = 0.0;
622 if (!float.TryParse(args[2], out value)) 652 if (! double.TryParse(args[2], out value))
623 { 653 {
624 Output.Add(String.Format("The parameter value {0} is not a valid number.", args[2])); 654 Output.Add(String.Format("The parameter value {0} is not a valid number.", args[2]));
655 return Output;
625 } 656 }
626 657
627 switch (args[1].ToLower()) 658 SetSunParameter(args[1].ToLower(), value);
628 {
629 case "year_length":
630 m_YearLengthDays = (int)value;
631 break;
632
633 case "day_length":
634 m_DayLengthHours = value;
635 break;
636
637 case "day_night_offset":
638 m_HorizonShift = value;
639 break;
640
641 case "day_time_sun_hour_scale":
642 m_DayTimeSunHourScale = value;
643 break;
644
645 case "update_interval":
646 m_UpdateInterval = (int)value;
647 break;
648
649 default:
650 Output.Add(String.Format("Unknown parameter {0}.", args[1]));
651 return Output;
652 }
653
654 Output.Add(String.Format("Parameter {0} set to {1}.", args[1], value.ToString())); 659 Output.Add(String.Format("Parameter {0} set to {1}.", args[1], value.ToString()));
655
656 // Generate shared values
657 GenSunPos();
658
659 // When sun settings are updated, we should update all clients with new settings.
660 SunUpdateToAllClients();
661 } 660 }
662 661
663 return Output; 662 return Output;
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs
index 62d232e..be1fb24 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.IO; 29using System.IO;
30using OpenSim.Framework;
30using OpenSim.Region.Framework.Interfaces; 31using OpenSim.Region.Framework.Interfaces;
31using OpenSim.Region.Framework.Scenes; 32using OpenSim.Region.Framework.Scenes;
32 33
@@ -73,12 +74,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
73 public ITerrainChannel LoadFile(string filename) 74 public ITerrainChannel LoadFile(string filename)
74 { 75 {
75 FileInfo file = new FileInfo(filename); 76 FileInfo file = new FileInfo(filename);
76 FileStream s = file.Open(FileMode.Open, FileAccess.Read);
77 ITerrainChannel retval = LoadStream(s);
78 77
79 s.Close(); 78 ITerrainChannel channel;
80 79
81 return retval; 80 using (FileStream s = file.Open(FileMode.Open, FileAccess.Read))
81 channel = LoadStream(s);
82
83 return channel;
82 } 84 }
83 85
84 public ITerrainChannel LoadFile(string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int sectionWidth, int sectionHeight) 86 public ITerrainChannel LoadFile(string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int sectionWidth, int sectionHeight)
@@ -86,153 +88,159 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
86 TerrainChannel retval = new TerrainChannel(sectionWidth, sectionHeight); 88 TerrainChannel retval = new TerrainChannel(sectionWidth, sectionHeight);
87 89
88 FileInfo file = new FileInfo(filename); 90 FileInfo file = new FileInfo(filename);
89 FileStream s = file.Open(FileMode.Open, FileAccess.Read);
90 BinaryReader bs = new BinaryReader(s);
91 91
92 int currFileYOffset = fileHeight - 1; 92 using (FileStream s = file.Open(FileMode.Open, FileAccess.Read))
93 93 using (BinaryReader bs = new BinaryReader(s))
94 // if our region isn't on the first Y section of the areas to be landscaped, then
95 // advance to our section of the file
96 while (currFileYOffset > offsetY)
97 { 94 {
98 // read a whole strip of regions 95 int currFileYOffset = fileHeight - 1;
99 int heightsToRead = sectionHeight * (fileWidth * sectionWidth);
100 bs.ReadBytes(heightsToRead * 13); // because there are 13 fun channels
101 currFileYOffset--;
102 }
103 96
104 // got to the Y start offset within the file of our region 97 // if our region isn't on the first Y section of the areas to be landscaped, then
105 // so read the file bits associated with our region 98 // advance to our section of the file
106 int y; 99 while (currFileYOffset > offsetY)
107 // for each Y within our Y offset
108 for (y = sectionHeight - 1; y >= 0; y--)
109 {
110 int currFileXOffset = 0;
111
112 // if our region isn't the first X section of the areas to be landscaped, then
113 // advance the stream to the X start pos of our section in the file
114 // i.e. eat X upto where we start
115 while (currFileXOffset < offsetX)
116 { 100 {
117 bs.ReadBytes(sectionWidth * 13); 101 // read a whole strip of regions
118 currFileXOffset++; 102 int heightsToRead = sectionHeight * (fileWidth * sectionWidth);
103 bs.ReadBytes(heightsToRead * 13); // because there are 13 fun channels
104 currFileYOffset--;
119 } 105 }
120 106
121 // got to our X offset, so write our regions X line 107 // got to the Y start offset within the file of our region
122 int x; 108 // so read the file bits associated with our region
123 for (x = 0; x < sectionWidth; x++) 109 int y;
124 {
125 // Read a strip and continue
126 retval[x, y] = bs.ReadByte() * (bs.ReadByte() / 128.0);
127 bs.ReadBytes(11);
128 }
129 // record that we wrote it
130 currFileXOffset++;
131 110
132 // if our region isn't the last X section of the areas to be landscaped, then 111 // for each Y within our Y offset
133 // advance the stream to the end of this Y column 112 for (y = sectionHeight - 1; y >= 0; y--)
134 while (currFileXOffset < fileWidth)
135 { 113 {
136 // eat the next regions x line 114 int currFileXOffset = 0;
137 bs.ReadBytes(sectionWidth * 13); //The 13 channels again 115
116 // if our region isn't the first X section of the areas to be landscaped, then
117 // advance the stream to the X start pos of our section in the file
118 // i.e. eat X upto where we start
119 while (currFileXOffset < offsetX)
120 {
121 bs.ReadBytes(sectionWidth * 13);
122 currFileXOffset++;
123 }
124
125 // got to our X offset, so write our regions X line
126 int x;
127 for (x = 0; x < sectionWidth; x++)
128 {
129 // Read a strip and continue
130 retval[x, y] = bs.ReadByte() * (bs.ReadByte() / 128.0);
131 bs.ReadBytes(11);
132 }
133 // record that we wrote it
138 currFileXOffset++; 134 currFileXOffset++;
135
136 // if our region isn't the last X section of the areas to be landscaped, then
137 // advance the stream to the end of this Y column
138 while (currFileXOffset < fileWidth)
139 {
140 // eat the next regions x line
141 bs.ReadBytes(sectionWidth * 13); //The 13 channels again
142 currFileXOffset++;
143 }
139 } 144 }
140 } 145 }
141 146
142 bs.Close();
143 s.Close();
144
145 return retval; 147 return retval;
146 } 148 }
147 149
148 public ITerrainChannel LoadStream(Stream s) 150 public ITerrainChannel LoadStream(Stream s)
149 { 151 {
150 TerrainChannel retval = new TerrainChannel(); 152 // The raw format doesn't contain any dimension information.
153 // Guess the square dimensions by using the length of the raw file.
154 double dimension = Math.Sqrt((double)(s.Length / 13));
155 // Regions are always multiples of 256.
156 int trimmedDimension = (int)dimension - ((int)dimension % (int)Constants.RegionSize);
157 if (trimmedDimension < Constants.RegionSize)
158 trimmedDimension = (int)Constants.RegionSize;
159
160 TerrainChannel retval = new TerrainChannel(trimmedDimension, trimmedDimension);
151 161
152 BinaryReader bs = new BinaryReader(s); 162 using (BinaryReader bs = new BinaryReader(s))
153 int y;
154 for (y = 0; y < retval.Height; y++)
155 { 163 {
156 int x; 164 int y;
157 for (x = 0; x < retval.Width; x++) 165 for (y = 0; y < retval.Height; y++)
158 { 166 {
159 retval[x, (retval.Height - 1) - y] = bs.ReadByte() * (bs.ReadByte() / 128.0); 167 int x;
160 bs.ReadBytes(11); // Advance the stream to next bytes. 168 for (x = 0; x < retval.Width; x++)
169 {
170 retval[x, (retval.Height - 1) - y] = bs.ReadByte() * (bs.ReadByte() / 128.0);
171 bs.ReadBytes(11); // Advance the stream to next bytes.
172 }
161 } 173 }
162 } 174 }
163 175
164 bs.Close();
165
166 return retval; 176 return retval;
167 } 177 }
168 178
169 public void SaveFile(string filename, ITerrainChannel map) 179 public void SaveFile(string filename, ITerrainChannel map)
170 { 180 {
171 FileInfo file = new FileInfo(filename); 181 FileInfo file = new FileInfo(filename);
172 FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write);
173 SaveStream(s, map);
174 182
175 s.Close(); 183 using (FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write))
184 SaveStream(s, map);
176 } 185 }
177 186
178 public void SaveStream(Stream s, ITerrainChannel map) 187 public void SaveStream(Stream s, ITerrainChannel map)
179 { 188 {
180 BinaryWriter binStream = new BinaryWriter(s); 189 using (BinaryWriter binStream = new BinaryWriter(s))
181
182 // Output the calculated raw
183 for (int y = 0; y < map.Height; y++)
184 { 190 {
185 for (int x = 0; x < map.Width; x++) 191 // Output the calculated raw
192 for (int y = 0; y < map.Height; y++)
186 { 193 {
187 double t = map[x, (map.Height - 1) - y]; 194 for (int x = 0; x < map.Width; x++)
188 //if height is less than 0, set it to 0 as
189 //can't save -ve values in a LLRAW file
190 if (t < 0d)
191 { 195 {
192 t = 0d; 196 double t = map[x, (map.Height - 1) - y];
197 //if height is less than 0, set it to 0 as
198 //can't save -ve values in a LLRAW file
199 if (t < 0d)
200 {
201 t = 0d;
202 }
203
204 int index = 0;
205
206 // The lookup table is pre-sorted, so we either find an exact match or
207 // the next closest (smaller) match with a binary search
208 index = Array.BinarySearch<HeightmapLookupValue>(LookupHeightTable, new HeightmapLookupValue(0, (float)t));
209 if (index < 0)
210 index = ~index - 1;
211
212 index = LookupHeightTable[index].Index;
213
214 byte red = (byte) (index & 0xFF);
215 byte green = (byte) ((index >> 8) & 0xFF);
216 const byte blue = 20;
217 const byte alpha1 = 0;
218 const byte alpha2 = 0;
219 const byte alpha3 = 0;
220 const byte alpha4 = 0;
221 const byte alpha5 = 255;
222 const byte alpha6 = 255;
223 const byte alpha7 = 255;
224 const byte alpha8 = 255;
225 byte alpha9 = red;
226 byte alpha10 = green;
227
228 binStream.Write(red);
229 binStream.Write(green);
230 binStream.Write(blue);
231 binStream.Write(alpha1);
232 binStream.Write(alpha2);
233 binStream.Write(alpha3);
234 binStream.Write(alpha4);
235 binStream.Write(alpha5);
236 binStream.Write(alpha6);
237 binStream.Write(alpha7);
238 binStream.Write(alpha8);
239 binStream.Write(alpha9);
240 binStream.Write(alpha10);
193 } 241 }
194
195 int index = 0;
196
197 // The lookup table is pre-sorted, so we either find an exact match or
198 // the next closest (smaller) match with a binary search
199 index = Array.BinarySearch<HeightmapLookupValue>(LookupHeightTable, new HeightmapLookupValue(0, (float)t));
200 if (index < 0)
201 index = ~index - 1;
202
203 index = LookupHeightTable[index].Index;
204
205 byte red = (byte) (index & 0xFF);
206 byte green = (byte) ((index >> 8) & 0xFF);
207 const byte blue = 20;
208 const byte alpha1 = 0;
209 const byte alpha2 = 0;
210 const byte alpha3 = 0;
211 const byte alpha4 = 0;
212 const byte alpha5 = 255;
213 const byte alpha6 = 255;
214 const byte alpha7 = 255;
215 const byte alpha8 = 255;
216 byte alpha9 = red;
217 byte alpha10 = green;
218
219 binStream.Write(red);
220 binStream.Write(green);
221 binStream.Write(blue);
222 binStream.Write(alpha1);
223 binStream.Write(alpha2);
224 binStream.Write(alpha3);
225 binStream.Write(alpha4);
226 binStream.Write(alpha5);
227 binStream.Write(alpha6);
228 binStream.Write(alpha7);
229 binStream.Write(alpha8);
230 binStream.Write(alpha9);
231 binStream.Write(alpha10);
232 } 242 }
233 } 243 }
234
235 binStream.Close();
236 } 244 }
237 245
238 public string FileExtension 246 public string FileExtension
@@ -259,7 +267,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
259 public bool SupportsTileSave() 267 public bool SupportsTileSave()
260 { 268 {
261 return false; 269 return false;
262 } 270 }
263
264 } 271 }
265} 272} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs
index a7e4d9f..219011e 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs
@@ -65,7 +65,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
65 bool eof = false; 65 bool eof = false;
66 66
67 int fileXPoints = 0; 67 int fileXPoints = 0;
68// int fileYPoints = 0; 68 int fileYPoints = 0;
69 69
70 // Terragen file 70 // Terragen file
71 while (eof == false) 71 while (eof == false)
@@ -75,7 +75,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
75 { 75 {
76 case "SIZE": 76 case "SIZE":
77 fileXPoints = bs.ReadInt16() + 1; 77 fileXPoints = bs.ReadInt16() + 1;
78// fileYPoints = fileXPoints; 78 fileYPoints = fileXPoints;
79 bs.ReadInt16(); 79 bs.ReadInt16();
80 break; 80 break;
81 case "XPTS": 81 case "XPTS":
@@ -83,8 +83,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
83 bs.ReadInt16(); 83 bs.ReadInt16();
84 break; 84 break;
85 case "YPTS": 85 case "YPTS":
86// fileYPoints = bs.ReadInt16(); 86 fileYPoints = bs.ReadInt16();
87 bs.ReadInt16();
88 bs.ReadInt16(); 87 bs.ReadInt16();
89 break; 88 break;
90 case "ALTW": 89 case "ALTW":
@@ -138,7 +137,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
138 bs.ReadInt16(); 137 bs.ReadInt16();
139 } 138 }
140 139
141
142 break; 140 break;
143 default: 141 default:
144 bs.ReadInt32(); 142 bs.ReadInt32();
@@ -206,9 +204,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
206 } 204 }
207 } 205 }
208 } 206 }
209
210 bs.Close(); 207 bs.Close();
211
212 return retval; 208 return retval;
213 } 209 }
214 210
@@ -298,7 +294,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
298 } 294 }
299 } 295 }
300 296
301 //This is only necessary for older versions of Terragen. 297 //This is necessary for older versions of Terragen.
302 bs.Write(enc.GetBytes("EOF ")); 298 bs.Write(enc.GetBytes("EOF "));
303 299
304 bs.Close(); 300 bs.Close();
@@ -342,7 +338,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
342 if (BitConverter.IsLittleEndian == false) 338 if (BitConverter.IsLittleEndian == false)
343 { 339 {
344 byte[] tmp = new byte[4]; 340 byte[] tmp = new byte[4];
345 for (int i = 0; i < 4; i++) 341 for (int i = 3; i >= 0; i--)
346 { 342 {
347 tmp[i] = retVal[3 - i]; 343 tmp[i] = retVal[3 - i];
348 } 344 }
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs
index d634e8b..236584a 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs
@@ -46,6 +46,10 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes
46 if (fillArea[x, y]) 46 if (fillArea[x, y])
47 { 47 {
48 double noise = TerrainUtil.PerlinNoise2D((double) x / map.Width, (double) y / map.Height, 8, 1.0); 48 double noise = TerrainUtil.PerlinNoise2D((double) x / map.Width, (double) y / map.Height, 8, 1.0);
49<<<<<<< HEAD
50
51=======
52>>>>>>> avn/ubitvar
49 map[x, y] += noise * strength; 53 map[x, y] += noise * strength;
50 } 54 }
51 } 55 }
diff --git a/OpenSim/Region/CoreModules/World/Terrain/ITerrainFeature.cs b/OpenSim/Region/CoreModules/World/Terrain/ITerrainFeature.cs
new file mode 100644
index 0000000..78a43db
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Terrain/ITerrainFeature.cs
@@ -0,0 +1,60 @@
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
28using System;
29using OpenSim.Region.Framework.Interfaces;
30
31namespace OpenSim.Region.CoreModules.World.Terrain
32{
33 public interface ITerrainFeature
34 {
35 /// <summary>
36 /// Creates the feature.
37 /// </summary>
38 /// <returns>
39 /// Empty string if successful, otherwise error message.
40 /// </returns>
41 /// <param name='map'>
42 /// ITerrainChannel holding terrain data.
43 /// </param>
44 /// <param name='args'>
45 /// command-line arguments from console.
46 /// </param>
47 string CreateFeature(ITerrainChannel map, string[] args);
48
49 /// <summary>
50 /// Gets a string describing the usage.
51 /// </summary>
52 /// <returns>
53 /// A string describing parameters for creating the feature.
54 /// Format is "feature-name <arg1> <arg2> ..."
55 /// </returns>
56 string GetUsage();
57 }
58
59}
60
diff --git a/OpenSim/Region/CoreModules/World/Terrain/ITerrainModifier.cs b/OpenSim/Region/CoreModules/World/Terrain/ITerrainModifier.cs
new file mode 100644
index 0000000..0e0a0e4
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Terrain/ITerrainModifier.cs
@@ -0,0 +1,77 @@
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
28using System;
29using OpenSim.Region.Framework.Interfaces;
30
31namespace OpenSim.Region.CoreModules.World.Terrain
32{
33 public interface ITerrainModifier
34 {
35 /// <summary>
36 /// Creates the feature.
37 /// </summary>
38 /// <returns>
39 /// Empty string if successful, otherwise error message.
40 /// </returns>
41 /// <param name='map'>
42 /// ITerrainChannel holding terrain data.
43 /// </param>
44 /// <param name='args'>
45 /// command-line arguments from console.
46 /// </param>
47 string ModifyTerrain(ITerrainChannel map, string[] args);
48
49 /// <summary>
50 /// Gets a string describing the usage.
51 /// </summary>
52 /// <returns>
53 /// A string describing parameters for creating the feature.
54 /// Format is "feature-name <arg1> <arg2> ..."
55 /// </returns>
56 string GetUsage();
57
58 /// <summary>
59 /// Apply the appropriate operation on the specified map, at (x, y).
60 /// </summary>
61 /// <param name='map'>
62 /// Map.
63 /// </param>
64 /// <param name='data'>
65 /// Data.
66 /// </param>
67 /// <param name='x'>
68 /// X.
69 /// </param>
70 /// <param name='y'>
71 /// Y.
72 /// </param>
73 double operate(double[,] map, TerrainModifierData data, int x, int y);
74 }
75
76}
77
diff --git a/OpenSim/Region/CoreModules/World/Terrain/Modifiers/FillModifier.cs b/OpenSim/Region/CoreModules/World/Terrain/Modifiers/FillModifier.cs
new file mode 100644
index 0000000..32f1de9
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Terrain/Modifiers/FillModifier.cs
@@ -0,0 +1,93 @@
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 */
27using System;
28
29using OpenSim.Region.CoreModules.World.Terrain;
30using OpenSim.Region.Framework.Interfaces;
31
32namespace OpenSim.Region.CoreModules.World.Terrain.Modifiers
33{
34 public class FillModifier : TerrainModifier
35 {
36
37 public FillModifier(ITerrainModule module) : base(module)
38 {
39 }
40
41 public override string ModifyTerrain(ITerrainChannel map, string[] args)
42 {
43 string result;
44 if (args.Length < 3)
45 {
46 result = "Usage: " + GetUsage();
47 }
48 else
49 {
50 TerrainModifierData data;
51 result = this.parseParameters(args, out data);
52
53 // Context-specific validation
54 if (result == String.Empty)
55 {
56 if (data.shape == String.Empty)
57 {
58 data.shape = "rectangle";
59 data.x0 = 0;
60 data.y0 = 0;
61 data.dx = map.Width;
62 data.dy = map.Height;
63 }
64 }
65
66 // if it's all good, then do the work
67 if (result == String.Empty)
68 {
69 this.applyModification(map, data);
70 }
71 }
72
73 return result;
74 }
75
76 public override string GetUsage()
77 {
78 string val = "fill <height> [ -rec=x1,y1,dx[,dy] | -ell=x0,y0,rx[,ry] ] [-taper=<height2>]"
79 + "\nSets all points within the specified range to the specified value.";
80 return val;
81 }
82
83 public override double operate(double[,] map, TerrainModifierData data, int x, int y)
84 {
85 double factor = this.computeBevel(data, x, y);
86 double result = data.elevation - (data.elevation - data.bevelevation) * factor;
87 return result;
88 }
89
90 }
91
92}
93
diff --git a/OpenSim/Region/CoreModules/World/Terrain/Modifiers/LowerModifier.cs b/OpenSim/Region/CoreModules/World/Terrain/Modifiers/LowerModifier.cs
new file mode 100644
index 0000000..2ab4bcc
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Terrain/Modifiers/LowerModifier.cs
@@ -0,0 +1,92 @@
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 */
27using System;
28using OpenSim.Region.CoreModules.World.Terrain;
29using OpenSim.Region.Framework.Interfaces;
30
31namespace OpenSim.Region.CoreModules.World.Terrain.Modifiers
32{
33 public class LowerModifier : TerrainModifier
34 {
35 public LowerModifier(ITerrainModule module) : base(module)
36 {
37 }
38
39 public override string ModifyTerrain(ITerrainChannel map, string[] args)
40 {
41 string result;
42 if (args.Length < 3)
43 {
44 result = "Usage: " + GetUsage();
45 }
46 else
47 {
48 TerrainModifierData data;
49 result = this.parseParameters(args, out data);
50
51 // Context-specific validation
52 if (result == String.Empty)
53 {
54 if (data.shape == String.Empty)
55 {
56 data.shape = "rectangle";
57 data.x0 = 0;
58 data.y0 = 0;
59 data.dx = map.Width;
60 data.dy = map.Height;
61 }
62 }
63
64 // if it's all good, then do the work
65 if (result == String.Empty)
66 {
67 this.applyModification(map, data);
68 }
69 }
70
71 return result;
72 }
73
74 public override string GetUsage()
75 {
76 string val = "lower <delta> [ -rec=x1,y1,dx[,dy] | -ell=x0,y0,rx[,ry] ] [-taper=<delta2>]"
77 + "\nLowers all points within the specified range by the specified amount.";
78 return val;
79
80 }
81
82 public override double operate(double[,] map, TerrainModifierData data, int x, int y)
83 {
84 double factor = this.computeBevel(data, x, y);
85 double result = map[x, y] - (data.elevation - (data.elevation - data.bevelevation) * factor);
86 return result;
87 }
88
89 }
90
91}
92
diff --git a/OpenSim/Region/CoreModules/World/Terrain/Modifiers/MaxModifier.cs b/OpenSim/Region/CoreModules/World/Terrain/Modifiers/MaxModifier.cs
new file mode 100644
index 0000000..0939c0a
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Terrain/Modifiers/MaxModifier.cs
@@ -0,0 +1,92 @@
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 */
27using System;
28using OpenSim.Region.CoreModules.World.Terrain;
29using OpenSim.Region.Framework.Interfaces;
30
31namespace OpenSim.Region.CoreModules.World.Terrain.Modifiers
32{
33 public class MaxModifier : TerrainModifier
34 {
35 public MaxModifier(ITerrainModule module) : base(module)
36 {
37 }
38
39 public override string ModifyTerrain(ITerrainChannel map, string[] args)
40 {
41 string result;
42 if (args.Length < 3)
43 {
44 result = "Usage: " + GetUsage();
45 }
46 else
47 {
48 TerrainModifierData data;
49 result = this.parseParameters(args, out data);
50
51 // Context-specific validation
52 if (result == String.Empty)
53 {
54 if (data.shape == String.Empty)
55 {
56 data.shape = "rectangle";
57 data.x0 = 0;
58 data.y0 = 0;
59 data.dx = map.Width;
60 data.dy = map.Height;
61 }
62 }
63
64 // if it's all good, then do the work
65 if (result == String.Empty)
66 {
67 this.applyModification(map, data);
68 }
69 }
70
71 return result;
72 }
73
74 public override string GetUsage()
75 {
76 string val = "max <height> [ -rec=x1,y1,dx[,dy] | -ell=x0,y0,rx[,ry] ] [-taper=<height2>]"
77 + "\nEnsures that all points within the specified range are no higher than the specified value.";
78 return val;
79
80 }
81
82 public override double operate(double[,] map, TerrainModifierData data, int x, int y)
83 {
84 double factor = this.computeBevel(data, x, y);
85 double result = Math.Min(data.elevation - (data.elevation - data.bevelevation) * factor, map[x, y]);
86 return result;
87 }
88
89 }
90
91}
92
diff --git a/OpenSim/Region/CoreModules/World/Terrain/Modifiers/MinModifier.cs b/OpenSim/Region/CoreModules/World/Terrain/Modifiers/MinModifier.cs
new file mode 100644
index 0000000..cbbccc0
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Terrain/Modifiers/MinModifier.cs
@@ -0,0 +1,92 @@
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 */
27using System;
28using OpenSim.Region.CoreModules.World.Terrain;
29using OpenSim.Region.Framework.Interfaces;
30
31namespace OpenSim.Region.CoreModules.World.Terrain.Modifiers
32{
33 public class MinModifier : TerrainModifier
34 {
35 public MinModifier(ITerrainModule module) : base(module)
36 {
37 }
38
39 public override string ModifyTerrain(ITerrainChannel map, string[] args)
40 {
41 string result;
42 if (args.Length < 3)
43 {
44 result = "Usage: " + GetUsage();
45 }
46 else
47 {
48 TerrainModifierData data;
49 result = this.parseParameters(args, out data);
50
51 // Context-specific validation
52 if (result == String.Empty)
53 {
54 if (data.shape == String.Empty)
55 {
56 data.shape = "rectangle";
57 data.x0 = 0;
58 data.y0 = 0;
59 data.dx = map.Width;
60 data.dy = map.Height;
61 }
62 }
63
64 // if it's all good, then do the work
65 if (result == String.Empty)
66 {
67 this.applyModification(map, data);
68 }
69 }
70
71 return result;
72 }
73
74 public override string GetUsage()
75 {
76 string val = "min <height> [ -rec=x1,y1,dx[,dy] | -ell=x0,y0,rx[,ry] ] [-taper=<height2>]"
77 + "\nEnsures that all points within the specified range are no lower than the specified value.";
78 return val;
79
80 }
81
82 public override double operate(double[,] map, TerrainModifierData data, int x, int y)
83 {
84 double factor = this.computeBevel(data, x, y);
85 double result = Math.Max(data.elevation - (data.elevation - data.bevelevation) * factor, map[x, y]);
86 return result;
87 }
88
89 }
90
91}
92
diff --git a/OpenSim/Region/CoreModules/World/Terrain/Modifiers/NoiseModifier.cs b/OpenSim/Region/CoreModules/World/Terrain/Modifiers/NoiseModifier.cs
new file mode 100644
index 0000000..d6b95d0
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Terrain/Modifiers/NoiseModifier.cs
@@ -0,0 +1,108 @@
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 */
27using System;
28using OpenSim.Region.CoreModules.World.Terrain;
29using OpenSim.Region.Framework.Interfaces;
30using OpenSim.Region.Framework.Scenes;
31
32namespace OpenSim.Region.CoreModules.World.Terrain.Modifiers
33{
34 public class NoiseModifier : TerrainModifier
35 {
36 public NoiseModifier(ITerrainModule module) : base(module)
37 {
38 }
39
40 public override string ModifyTerrain(ITerrainChannel map, string[] args)
41 {
42 string result;
43 if (args.Length < 3)
44 {
45 result = "Usage: " + GetUsage();
46 }
47 else
48 {
49 TerrainModifierData data;
50 result = this.parseParameters(args, out data);
51
52 // Context-specific validation
53 if (result == String.Empty)
54 {
55 if (data.bevel == "taper")
56 {
57 if (data.bevelevation < 0.0 || data.bevelevation > 1.0)
58 {
59 result = String.Format("Taper must be 0.0 to 1.0: {0}", data.bevelevation);
60 }
61 }
62 else
63 {
64 data.bevelevation = 1.0f;
65 }
66
67 if (data.elevation < 0.0 || data.elevation > 1.0)
68 {
69 result = String.Format("Noise strength must be 0.0 to 1.0: {0}", data.elevation);
70 }
71
72 if (data.shape == String.Empty)
73 {
74 data.shape = "rectangle";
75 data.x0 = 0;
76 data.y0 = 0;
77 data.dx = map.Width;
78 data.dy = map.Height;
79 }
80 }
81
82 // if it's all good, then do the work
83 if (result == String.Empty)
84 {
85 this.applyModification(map, data);
86 }
87 }
88
89 return result;
90 }
91
92 public override string GetUsage()
93 {
94 string val = "noise <delta> [ -rec=x1,y1,dx[,dy] | -ell=x0,y0,rx[,ry] ] [-taper=<delta2>]"
95 + "\nAdds noise to all points within the specified range.";
96 return val;
97 }
98
99 public override double operate(double[,] map, TerrainModifierData data, int x, int y)
100 {
101 double factor = this.computeBevel(data, x, y);
102 double noise = TerrainUtil.PerlinNoise2D((double)x / map.GetLength(0), (double)y / map.GetLength(1), 8, 1.0);
103 return map[x, y] + (data.elevation - (data.elevation - data.bevelevation) * factor) * (noise - .5);
104 }
105
106 }
107
108}
diff --git a/OpenSim/Region/CoreModules/World/Terrain/Modifiers/RaiseModifier.cs b/OpenSim/Region/CoreModules/World/Terrain/Modifiers/RaiseModifier.cs
new file mode 100644
index 0000000..35fb9d6
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Terrain/Modifiers/RaiseModifier.cs
@@ -0,0 +1,92 @@
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 */
27using System;
28using OpenSim.Region.CoreModules.World.Terrain;
29using OpenSim.Region.Framework.Interfaces;
30
31namespace OpenSim.Region.CoreModules.World.Terrain.Modifiers
32{
33 public class RaiseModifier : TerrainModifier
34 {
35 public RaiseModifier(ITerrainModule module) : base(module)
36 {
37 }
38
39 public override string ModifyTerrain(ITerrainChannel map, string[] args)
40 {
41 string result;
42 if (args.Length < 3)
43 {
44 result = "Usage: " + GetUsage();
45 }
46 else
47 {
48 TerrainModifierData data;
49 result = this.parseParameters(args, out data);
50
51 // Context-specific validation
52 if (result == String.Empty)
53 {
54 if (data.shape == String.Empty)
55 {
56 data.shape = "rectangle";
57 data.x0 = 0;
58 data.y0 = 0;
59 data.dx = map.Width;
60 data.dy = map.Height;
61 }
62 }
63
64 // if it's all good, then do the work
65 if (result == String.Empty)
66 {
67 this.applyModification(map, data);
68 }
69 }
70
71 return result;
72 }
73
74 public override string GetUsage()
75 {
76 string val = "raise <delta> [ -rec=x1,y1,dx[,dy] | -ell=x0,y0,rx[,ry] ] [-taper=<delta2>]"
77 + "\nRaises all points within the specified range by the specified amount.";
78 return val;
79
80 }
81
82 public override double operate(double[,] map, TerrainModifierData data, int x, int y)
83 {
84 double factor = this.computeBevel(data, x, y);
85 double result = map[x, y] + (data.elevation - (data.elevation - data.bevelevation) * factor);
86 return result;
87 }
88
89 }
90
91}
92
diff --git a/OpenSim/Region/CoreModules/World/Terrain/Modifiers/SmoothModifier.cs b/OpenSim/Region/CoreModules/World/Terrain/Modifiers/SmoothModifier.cs
new file mode 100644
index 0000000..9f8d5b2
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Terrain/Modifiers/SmoothModifier.cs
@@ -0,0 +1,131 @@
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 */
27using System;
28using OpenSim.Region.CoreModules.World.Terrain;
29using OpenSim.Region.Framework.Interfaces;
30
31namespace OpenSim.Region.CoreModules.World.Terrain.Modifiers
32{
33 public class SmoothModifier : TerrainModifier
34 {
35 public SmoothModifier(ITerrainModule module) : base(module)
36 {
37 }
38
39 public override string ModifyTerrain(ITerrainChannel map, string[] args)
40 {
41 string result;
42 if (args.Length < 3)
43 {
44 result = "Usage: " + GetUsage();
45 }
46 else
47 {
48 TerrainModifierData data;
49 result = this.parseParameters(args, out data);
50
51 // Context-specific validation
52 if (result == String.Empty)
53 {
54 if (data.bevel == "taper")
55 {
56 if (data.bevelevation < 0.01 || data.bevelevation > 0.99)
57 {
58 result = String.Format("Taper must be 0.01 to 0.99: {0}", data.bevelevation);
59 }
60 }
61 else
62 {
63 data.bevelevation = 2.0f / 3.0f;
64 }
65
66 if (data.elevation < 0.0 || data.elevation > 1.0)
67 {
68 result = String.Format("Smoothing strength must be 0.0 to 1.0: {0}", data.elevation);
69 }
70
71 if (data.shape == String.Empty)
72 {
73 data.shape = "rectangle";
74 data.x0 = 0;
75 data.y0 = 0;
76 data.dx = map.Width;
77 data.dy = map.Height;
78 }
79 }
80
81 // if it's all good, then do the work
82 if (result == String.Empty)
83 {
84 this.applyModification(map, data);
85 }
86 }
87
88 return result;
89 }
90
91 public override string GetUsage()
92 {
93 string val = "smooth <strength> [ -rec=x1,y1,dx[,dy] | -ell=x0,y0,rx[,ry] ] [-taper=<fraction>]"
94 + "\nSmooths all points within the specified range using a simple averaging algorithm.";
95 return val;
96 }
97
98 public override double operate(double[,] map, TerrainModifierData data, int x, int y)
99 {
100 double[] scale = new double[3];
101 scale[0] = data.elevation;
102 scale[1] = ((1.0 - scale[0]) * data.bevelevation) / 8.0;
103 scale[2] = ((1.0 - scale[0]) * (1.0 - data.bevelevation)) / 16.0;
104 int xMax = map.GetLength(0);
105 int yMax = map.GetLength(1);
106 double result;
107 if ((x == 0) || (y == 0) || (x == (xMax - 1)) || (y == (yMax - 1)))
108 {
109 result = map[x, y];
110 }
111 else
112 {
113 result = 0.0;
114 for(int yPos = (y - 2); yPos < (y + 3); yPos++)
115 {
116 int yVal = (yPos <= 0) ? 0 : ((yPos < yMax) ? yPos : yMax - 1);
117 for(int xPos = (x - 2); xPos < (x + 3); xPos++)
118 {
119 int xVal = (xPos <= 0) ? 0 : ((xPos < xMax) ? xPos : xMax - 1);
120 int dist = Math.Max(Math.Abs(x - xVal), Math.Abs(y - yVal));
121 result += map[xVal, yVal] * scale[dist];
122 }
123 }
124 }
125 return result;
126 }
127
128 }
129
130}
131
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModifier.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModifier.cs
new file mode 100644
index 0000000..7ebd08e
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModifier.cs
@@ -0,0 +1,378 @@
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 */
27using System;
28using System.Reflection;
29using log4net;
30
31using OpenSim.Region.Framework.Interfaces;
32
33namespace OpenSim.Region.CoreModules.World.Terrain
34{
35 public abstract class TerrainModifier : ITerrainModifier
36 {
37 protected ITerrainModule m_module;
38 protected static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
39
40 protected TerrainModifier(ITerrainModule module)
41 {
42 m_module = module;
43 }
44
45 public abstract string ModifyTerrain(ITerrainChannel map, string[] args);
46
47 public abstract string GetUsage();
48
49 public abstract double operate(double[,] map, TerrainModifierData data, int x, int y);
50
51 protected String parseParameters(string[] args, out TerrainModifierData data)
52 {
53 string val;
54 string arg;
55 string result;
56 data = new TerrainModifierData();
57 data.shape = String.Empty;
58 data.bevel = String.Empty;
59 data.dx = 0;
60 data.dy = 0;
61 if (args.Length < 4)
62 {
63 result = "Usage: " + GetUsage();
64 }
65 else
66 {
67 result = this.parseFloat(args[3], out data.elevation);
68 }
69 if (result == String.Empty)
70 {
71 int index = 3;
72 while(++index < args.Length && result == String.Empty)
73 {
74 arg = args[index];
75 // check for shape
76 if (arg.StartsWith("-rec=") || arg.StartsWith("-ell="))
77 {
78 if (data.shape != String.Empty)
79 {
80 result = "Only 1 '-rec' or '-ell' parameter is permitted.";
81 }
82 else
83 {
84 data.shape = arg.StartsWith("-ell=") ? "ellipse" : "rectangle";
85 val = arg.Substring(arg.IndexOf("=") + 1);
86 string[] coords = val.Split(new char[] {','});
87 if ((coords.Length < 3) || (coords.Length > 4))
88 {
89 result = String.Format("Bad format for shape parameter {0}", arg);
90 }
91 else
92 {
93 result = this.parseInt(coords[0], out data.x0);
94 if (result == String.Empty)
95 {
96 result = this.parseInt(coords[1], out data.y0);
97 }
98 if (result == String.Empty)
99 {
100 result = this.parseInt(coords[2], out data.dx);
101 }
102 if (result == String.Empty)
103 {
104 if (coords.Length == 4)
105 {
106 result = this.parseInt(coords[3], out data.dy);
107 }
108 else
109 {
110 data.dy = data.dx;
111 }
112 }
113 if (result == String.Empty)
114 {
115 if ((data.dx <= 0) || (data.dy <= 0))
116 {
117 result = "Shape sizes must be positive integers";
118 }
119 }
120 else
121 {
122 result = String.Format("Bad value in shape parameters {0}", arg);
123 }
124 }
125 }
126 }
127 else if (arg.StartsWith("-taper="))
128 {
129 if (data.bevel != String.Empty)
130 {
131 result = "Only 1 '-taper' parameter is permitted.";
132 }
133 else
134 {
135 data.bevel = "taper";
136 val = arg.Substring(arg.IndexOf("=") + 1);
137 result = this.parseFloat(val, out data.bevelevation);
138 if (result != String.Empty)
139 {
140 result = String.Format("Bad format for taper parameter {0}", arg);
141 }
142 }
143 }
144 else
145 {
146 result = String.Format("Unrecognized parameter {0}", arg);
147 }
148 }
149 }
150 return result;
151 }
152
153 protected string parseFloat(String s, out float f)
154 {
155 string result;
156 double d;
157 if (Double.TryParse(s, out d))
158 {
159 try
160 {
161 f = (float)d;
162 result = String.Empty;
163 }
164 catch(InvalidCastException)
165 {
166 result = String.Format("{0} is invalid", s);
167 f = -1.0f;
168 }
169 }
170 else
171 {
172 f = -1.0f;
173 result = String.Format("{0} is invalid", s);
174 }
175 return result;
176 }
177
178 protected string parseInt(String s, out int i)
179 {
180 string result;
181 if (Int32.TryParse(s, out i))
182 {
183 result = String.Empty;
184 }
185 else
186 {
187 result = String.Format("{0} is invalid", s);
188 }
189 return result;
190 }
191
192 protected void applyModification(ITerrainChannel map, TerrainModifierData data)
193 {
194 bool[,] mask;
195 int xMax;
196 int yMax;
197 int xMid;
198 int yMid;
199 if (data.shape == "ellipse")
200 {
201 mask = this.ellipticalMask(data.dx, data.dy);
202 xMax = mask.GetLength(0);
203 yMax = mask.GetLength(1);
204 xMid = xMax / 2 + xMax % 2;
205 yMid = yMax / 2 + yMax % 2;
206 }
207 else
208 {
209 mask = this.rectangularMask(data.dx, data.dy);
210 xMax = mask.GetLength(0);
211 yMax = mask.GetLength(1);
212 xMid = 0;
213 yMid = 0;
214 }
215// m_log.DebugFormat("Apply {0} mask {1}x{2} @ {3},{4}", data.shape, xMax, yMax, xMid, yMid);
216 double[,] buffer = map.GetDoubles();
217 int yDim = yMax;
218 while(--yDim >= 0)
219 {
220 int yPos = data.y0 + yDim - yMid;
221 if ((yPos >= 0) && (yPos < map.Height))
222 {
223 int xDim = xMax;
224 while(--xDim >= 0)
225 {
226 int xPos = data.x0 + xDim - xMid;
227 if ((xPos >= 0) && (xPos < map.Width) && (mask[xDim, yDim]))
228 {
229 double endElevation = this.operate(buffer, data, xPos, yPos);
230 map[xPos, yPos] = endElevation;
231 }
232 }
233 }
234 }
235 }
236
237 protected double computeBevel(TerrainModifierData data, int x, int y)
238 {
239 int deltaX;
240 int deltaY;
241 int xMax;
242 int yMax;
243 double factor;
244 if (data.bevel == "taper")
245 {
246 if (data.shape == "ellipse")
247 {
248 deltaX = x - data.x0;
249 deltaY = y - data.y0;
250 xMax = data.dx;
251 yMax = data.dy;
252 factor = (double)((deltaX * deltaX) + (deltaY * deltaY));
253 factor /= ((xMax * xMax) + (yMax * yMax));
254 }
255 else
256 {
257 // pyramid
258 xMax = data.dx / 2 + data.dx % 2;
259 yMax = data.dy / 2 + data.dy % 2;
260 deltaX = Math.Abs(data.x0 + xMax - x);
261 deltaY = Math.Abs(data.y0 + yMax - y);
262 factor = Math.Max(((double)(deltaY) / yMax), ((double)(deltaX) / xMax));
263 }
264 }
265 else
266 {
267 factor = 0.0;
268 }
269 return factor;
270 }
271
272 private bool[,] rectangularMask(int xSize, int ySize)
273 {
274 bool[,] mask = new bool[xSize, ySize];
275 int yPos = ySize;
276 while(--yPos >= 0)
277 {
278 int xPos = xSize;
279 while(--xPos >= 0)
280 {
281 mask[xPos, yPos] = true;
282 }
283 }
284 return mask;
285 }
286
287 /*
288 * Fast ellipse-based derivative of Bresenham algorithm.
289 * https://web.archive.org/web/20120225095359/http://homepage.smc.edu/kennedy_john/belipse.pdf
290 */
291 private bool[,] ellipticalMask(int xRadius, int yRadius)
292 {
293 long twoASquared = 2L * xRadius * xRadius;
294 long twoBSquared = 2L * yRadius * yRadius;
295
296 bool[,] mask = new bool[2 * xRadius + 1, 2 * yRadius + 1];
297
298 long ellipseError = 0L;
299 long stoppingX = twoBSquared * xRadius;
300 long stoppingY = 0L;
301 long xChange = yRadius * yRadius * (1L - 2L * xRadius);
302 long yChange = xRadius * xRadius;
303
304 int xPos = xRadius;
305 int yPos = 0;
306
307 // first set of points
308 while(stoppingX >= stoppingY)
309 {
310 int yUpper = yRadius + yPos;
311 int yLower = yRadius - yPos;
312 // fill in the mask
313 int xNow = xPos;
314 while(xNow >= 0)
315 {
316 mask[xRadius + xNow, yUpper] = true;
317 mask[xRadius - xNow, yUpper] = true;
318 mask[xRadius + xNow, yLower] = true;
319 mask[xRadius - xNow, yLower] = true;
320 --xNow;
321 }
322 yPos++;
323 stoppingY += twoASquared;
324 ellipseError += yChange;
325 yChange += twoASquared;
326 if ((2L * ellipseError + xChange) > 0L)
327 {
328 xPos--;
329 stoppingX -= twoBSquared;
330 ellipseError += xChange;
331 xChange += twoBSquared;
332 }
333 }
334
335 // second set of points
336 xPos = 0;
337 yPos = yRadius;
338 xChange = yRadius * yRadius;
339 yChange = xRadius * xRadius * (1L - 2L * yRadius);
340
341 ellipseError = 0L;
342 stoppingX = 0L;
343 stoppingY = twoASquared * yRadius;
344
345 while(stoppingX <= stoppingY)
346 {
347 int xUpper = xRadius + xPos;
348 int xLower = xRadius - xPos;
349 // fill in the mask
350 int yNow = yPos;
351 while(yNow >= 0)
352 {
353 mask[xUpper, yRadius + yNow] = true;
354 mask[xUpper, yRadius - yNow] = true;
355 mask[xLower, yRadius + yNow] = true;
356 mask[xLower, yRadius - yNow] = true;
357 --yNow;
358 }
359 xPos++;
360 stoppingX += twoBSquared;
361 ellipseError += xChange;
362 xChange += twoBSquared;
363 if ((2L * ellipseError + yChange) > 0L)
364 {
365 yPos--;
366 stoppingY -= twoASquared;
367 ellipseError += yChange;
368 yChange += twoASquared;
369 }
370 }
371 return mask;
372 }
373
374
375 }
376
377}
378
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModifierData.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModifierData.cs
new file mode 100644
index 0000000..4e0f8d7
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModifierData.cs
@@ -0,0 +1,17 @@
1using System;
2
3namespace OpenSim.Region.CoreModules.World.Terrain
4{
5 public struct TerrainModifierData
6 {
7 public float elevation;
8 public string shape;
9 public int x0;
10 public int y0;
11 public int dx;
12 public int dy;
13 public string bevel;
14 public float bevelevation;
15 }
16}
17
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
index 7bae9ec..925de2a 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
@@ -24,19 +24,24 @@
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 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. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27
28using System; 27using System;
29using System.Collections.Generic; 28using System.Collections.Generic;
30using System.IO; 29using System.IO;
31using System.Reflection; 30using System.Reflection;
32using System.Net; 31using System.Net;
32
33using log4net; 33using log4net;
34using Nini.Config; 34using Nini.Config;
35
35using OpenMetaverse; 36using OpenMetaverse;
36using Mono.Addins; 37using Mono.Addins;
38
39using OpenSim.Data;
37using OpenSim.Framework; 40using OpenSim.Framework;
41using OpenSim.Framework.Console;
38using OpenSim.Region.CoreModules.Framework.InterfaceCommander; 42using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
39using OpenSim.Region.CoreModules.World.Terrain.FileLoaders; 43using OpenSim.Region.CoreModules.World.Terrain.FileLoaders;
44using OpenSim.Region.CoreModules.World.Terrain.Modifiers;
40using OpenSim.Region.CoreModules.World.Terrain.FloodBrushes; 45using OpenSim.Region.CoreModules.World.Terrain.FloodBrushes;
41using OpenSim.Region.CoreModules.World.Terrain.PaintBrushes; 46using OpenSim.Region.CoreModules.World.Terrain.PaintBrushes;
42using OpenSim.Region.Framework.Interfaces; 47using OpenSim.Region.Framework.Interfaces;
@@ -70,20 +75,36 @@ namespace OpenSim.Region.CoreModules.World.Terrain
70 #endregion 75 #endregion
71 76
72 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 77 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
78<<<<<<< HEAD
79=======
73 80
74#pragma warning disable 414 81#pragma warning disable 414
75 private static readonly string LogHeader = "[TERRAIN MODULE]"; 82 private static readonly string LogHeader = "[TERRAIN MODULE]";
76#pragma warning restore 414 83#pragma warning restore 414
77 84
78 private readonly Commander m_commander = new Commander("terrain"); 85 private readonly Commander m_commander = new Commander("terrain");
86>>>>>>> avn/ubitvar
87
88#pragma warning disable 414
89 private static readonly string LogHeader = "[TERRAIN MODULE]";
90#pragma warning restore 414
79 91
92 private readonly Commander m_commander = new Commander("terrain");
80 private readonly Dictionary<StandardTerrainEffects, ITerrainFloodEffect> m_floodeffects = 93 private readonly Dictionary<StandardTerrainEffects, ITerrainFloodEffect> m_floodeffects =
81 new Dictionary<StandardTerrainEffects, ITerrainFloodEffect>(); 94 new Dictionary<StandardTerrainEffects, ITerrainFloodEffect>();
82
83 private readonly Dictionary<string, ITerrainLoader> m_loaders = new Dictionary<string, ITerrainLoader>(); 95 private readonly Dictionary<string, ITerrainLoader> m_loaders = new Dictionary<string, ITerrainLoader>();
84
85 private readonly Dictionary<StandardTerrainEffects, ITerrainPaintableEffect> m_painteffects = 96 private readonly Dictionary<StandardTerrainEffects, ITerrainPaintableEffect> m_painteffects =
86 new Dictionary<StandardTerrainEffects, ITerrainPaintableEffect>(); 97 new Dictionary<StandardTerrainEffects, ITerrainPaintableEffect>();
98<<<<<<< HEAD
99 private Dictionary<string, ITerrainEffect> m_plugineffects;
100 private Dictionary<string, ITerrainModifier> m_modifyOperations =
101 new Dictionary<string, ITerrainModifier>();
102 private ITerrainChannel m_channel;
103 private ITerrainChannel m_revert;
104 private Scene m_scene;
105 private volatile bool m_tainted;
106 private readonly Stack<LandUndoState> m_undo = new Stack<LandUndoState>(5);
107=======
87 108
88 private Dictionary<string, ITerrainEffect> m_plugineffects; 109 private Dictionary<string, ITerrainEffect> m_plugineffects;
89 private ITerrainChannel m_channel; 110 private ITerrainChannel m_channel;
@@ -91,6 +112,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
91 private Scene m_scene; 112 private Scene m_scene;
92 private volatile bool m_tainted; 113 private volatile bool m_tainted;
93 114
115>>>>>>> avn/ubitvar
94 private String m_InitialTerrain = "pinhead-island"; 116 private String m_InitialTerrain = "pinhead-island";
95 117
96 // If true, send terrain patch updates to clients based on their view distance 118 // If true, send terrain patch updates to clients based on their view distance
@@ -104,11 +126,19 @@ namespace OpenSim.Region.CoreModules.World.Terrain
104 private bool[,] updated; // for each patch, whether it needs to be sent to this client 126 private bool[,] updated; // for each patch, whether it needs to be sent to this client
105 private int updateCount; // number of patches that need to be sent 127 private int updateCount; // number of patches that need to be sent
106 public ScenePresence Presence; // a reference to the client to send to 128 public ScenePresence Presence; // a reference to the client to send to
129<<<<<<< HEAD
130 public TerrainData Terrain; // reference to the underlying terrain
131=======
132>>>>>>> avn/ubitvar
107 public PatchUpdates(TerrainData terrData, ScenePresence pPresence) 133 public PatchUpdates(TerrainData terrData, ScenePresence pPresence)
108 { 134 {
109 updated = new bool[terrData.SizeX / Constants.TerrainPatchSize, terrData.SizeY / Constants.TerrainPatchSize]; 135 updated = new bool[terrData.SizeX / Constants.TerrainPatchSize, terrData.SizeY / Constants.TerrainPatchSize];
110 updateCount = 0; 136 updateCount = 0;
111 Presence = pPresence; 137 Presence = pPresence;
138<<<<<<< HEAD
139 Terrain = terrData;
140=======
141>>>>>>> avn/ubitvar
112 // Initially, send all patches to the client 142 // Initially, send all patches to the client
113 SetAll(true); 143 SetAll(true);
114 } 144 }
@@ -117,14 +147,26 @@ namespace OpenSim.Region.CoreModules.World.Terrain
117 { 147 {
118 return (updateCount > 0); 148 return (updateCount > 0);
119 } 149 }
150<<<<<<< HEAD
151
152=======
153>>>>>>> avn/ubitvar
120 public void SetByXY(int x, int y, bool state) 154 public void SetByXY(int x, int y, bool state)
121 { 155 {
122 this.SetByPatch(x / Constants.TerrainPatchSize, y / Constants.TerrainPatchSize, state); 156 this.SetByPatch(x / Constants.TerrainPatchSize, y / Constants.TerrainPatchSize, state);
123 } 157 }
158<<<<<<< HEAD
159
160=======
161>>>>>>> avn/ubitvar
124 public bool GetByPatch(int patchX, int patchY) 162 public bool GetByPatch(int patchX, int patchY)
125 { 163 {
126 return updated[patchX, patchY]; 164 return updated[patchX, patchY];
127 } 165 }
166<<<<<<< HEAD
167
168=======
169>>>>>>> avn/ubitvar
128 public void SetByPatch(int patchX, int patchY, bool state) 170 public void SetByPatch(int patchX, int patchY, bool state)
129 { 171 {
130 bool prevState = updated[patchX, patchY]; 172 bool prevState = updated[patchX, patchY];
@@ -134,11 +176,20 @@ namespace OpenSim.Region.CoreModules.World.Terrain
134 updateCount--; 176 updateCount--;
135 updated[patchX, patchY] = state; 177 updated[patchX, patchY] = state;
136 } 178 }
179<<<<<<< HEAD
180
181 public void SetAll(bool state)
182 {
183 updateCount = 0;
184 for(int xx = 0; xx < updated.GetLength(0); xx++)
185 for(int yy = 0; yy < updated.GetLength(1); yy++)
186=======
137 public void SetAll(bool state) 187 public void SetAll(bool state)
138 { 188 {
139 updateCount = 0; 189 updateCount = 0;
140 for (int xx = 0; xx < updated.GetLength(0); xx++) 190 for (int xx = 0; xx < updated.GetLength(0); xx++)
141 for (int yy = 0; yy < updated.GetLength(1); yy++) 191 for (int yy = 0; yy < updated.GetLength(1); yy++)
192>>>>>>> avn/ubitvar
142 updated[xx, yy] = state; 193 updated[xx, yy] = state;
143 if (state) 194 if (state)
144 updateCount = updated.GetLength(0) * updated.GetLength(1); 195 updateCount = updated.GetLength(0) * updated.GetLength(1);
@@ -155,9 +206,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain
155 terrData.SizeX / Constants.TerrainPatchSize, terrData.SizeY / Constants.TerrainPatchSize) 206 terrData.SizeX / Constants.TerrainPatchSize, terrData.SizeY / Constants.TerrainPatchSize)
156 ); 207 );
157 } 208 }
209<<<<<<< HEAD
210 for(int xx = 0; xx < terrData.SizeX; xx += Constants.TerrainPatchSize)
211 {
212 for(int yy = 0; yy < terrData.SizeY; yy += Constants.TerrainPatchSize)
213=======
158 for (int xx = 0; xx < terrData.SizeX; xx += Constants.TerrainPatchSize) 214 for (int xx = 0; xx < terrData.SizeX; xx += Constants.TerrainPatchSize)
159 { 215 {
160 for (int yy = 0; yy < terrData.SizeY; yy += Constants.TerrainPatchSize) 216 for (int yy = 0; yy < terrData.SizeY; yy += Constants.TerrainPatchSize)
217>>>>>>> avn/ubitvar
161 { 218 {
162 // Only set tainted. The patch bit may be set if the patch was to be sent later. 219 // Only set tainted. The patch bit may be set if the patch was to be sent later.
163 if (terrData.IsTaintedAt(xx, yy, false)) 220 if (terrData.IsTaintedAt(xx, yy, false))
@@ -182,8 +239,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
182 239
183 #region ICommandableModule Members 240 #region ICommandableModule Members
184 241
185 public ICommander CommandInterface 242 public ICommander CommandInterface {
186 {
187 get { return m_commander; } 243 get { return m_commander; }
188 } 244 }
189 245
@@ -211,7 +267,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
211 m_scene = scene; 267 m_scene = scene;
212 268
213 // Install terrain module in the simulator 269 // Install terrain module in the simulator
214 lock (m_scene) 270 lock(m_scene)
215 { 271 {
216 if (m_scene.Heightmap == null) 272 if (m_scene.Heightmap == null)
217 { 273 {
@@ -219,12 +275,20 @@ namespace OpenSim.Region.CoreModules.World.Terrain
219 (int)m_scene.RegionInfo.RegionSizeY, 275 (int)m_scene.RegionInfo.RegionSizeY,
220 (int)m_scene.RegionInfo.RegionSizeZ); 276 (int)m_scene.RegionInfo.RegionSizeZ);
221 m_scene.Heightmap = m_channel; 277 m_scene.Heightmap = m_channel;
278<<<<<<< HEAD
279 UpdateRevertMap();
280=======
222 UpdateBakedMap(); 281 UpdateBakedMap();
282>>>>>>> avn/ubitvar
223 } 283 }
224 else 284 else
225 { 285 {
226 m_channel = m_scene.Heightmap; 286 m_channel = m_scene.Heightmap;
287<<<<<<< HEAD
288 UpdateRevertMap();
289=======
227 UpdateBakedMap(); 290 UpdateBakedMap();
291>>>>>>> avn/ubitvar
228 } 292 }
229 293
230 m_scene.RegisterModuleInterface<ITerrainModule>(this); 294 m_scene.RegisterModuleInterface<ITerrainModule>(this);
@@ -232,7 +296,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain
232 m_scene.EventManager.OnClientClosed += EventManager_OnClientClosed; 296 m_scene.EventManager.OnClientClosed += EventManager_OnClientClosed;
233 m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; 297 m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
234 m_scene.EventManager.OnTerrainTick += EventManager_OnTerrainTick; 298 m_scene.EventManager.OnTerrainTick += EventManager_OnTerrainTick;
299<<<<<<< HEAD
300 m_scene.EventManager.OnFrame += EventManager_OnFrame;
301=======
235 m_scene.EventManager.OnTerrainCheckUpdates += EventManager_TerrainCheckUpdates; 302 m_scene.EventManager.OnTerrainCheckUpdates += EventManager_TerrainCheckUpdates;
303>>>>>>> avn/ubitvar
236 } 304 }
237 305
238 InstallDefaultEffects(); 306 InstallDefaultEffects();
@@ -243,7 +311,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
243 string supportedFilesSeparatorForTileSave = ""; 311 string supportedFilesSeparatorForTileSave = "";
244 312
245 m_supportFileExtensionsForTileSave = ""; 313 m_supportFileExtensionsForTileSave = "";
246 foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders) 314 foreach(KeyValuePair<string, ITerrainLoader> loader in m_loaders)
247 { 315 {
248 m_supportedFileExtensions += supportedFilesSeparator + loader.Key + " (" + loader.Value + ")"; 316 m_supportedFileExtensions += supportedFilesSeparator + loader.Key + " (" + loader.Value + ")";
249 supportedFilesSeparator = ", "; 317 supportedFilesSeparator = ", ";
@@ -266,12 +334,16 @@ namespace OpenSim.Region.CoreModules.World.Terrain
266 334
267 public void RemoveRegion(Scene scene) 335 public void RemoveRegion(Scene scene)
268 { 336 {
269 lock (m_scene) 337 lock(m_scene)
270 { 338 {
271 // remove the commands 339 // remove the commands
272 m_scene.UnregisterModuleCommander(m_commander.Name); 340 m_scene.UnregisterModuleCommander(m_commander.Name);
273 // remove the event-handlers 341 // remove the event-handlers
342<<<<<<< HEAD
343 m_scene.EventManager.OnFrame -= EventManager_OnFrame;
344=======
274 m_scene.EventManager.OnTerrainCheckUpdates -= EventManager_TerrainCheckUpdates; 345 m_scene.EventManager.OnTerrainCheckUpdates -= EventManager_TerrainCheckUpdates;
346>>>>>>> avn/ubitvar
275 m_scene.EventManager.OnTerrainTick -= EventManager_OnTerrainTick; 347 m_scene.EventManager.OnTerrainTick -= EventManager_OnTerrainTick;
276 m_scene.EventManager.OnPluginConsole -= EventManager_OnPluginConsole; 348 m_scene.EventManager.OnPluginConsole -= EventManager_OnPluginConsole;
277 m_scene.EventManager.OnClientClosed -= EventManager_OnClientClosed; 349 m_scene.EventManager.OnClientClosed -= EventManager_OnClientClosed;
@@ -285,13 +357,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain
285 { 357 {
286 } 358 }
287 359
288 public Type ReplaceableInterface 360 public Type ReplaceableInterface {
289 {
290 get { return null; } 361 get { return null; }
291 } 362 }
292 363
293 public string Name 364 public string Name {
294 {
295 get { return "TerrainModule"; } 365 get { return "TerrainModule"; }
296 } 366 }
297 367
@@ -310,11 +380,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain
310 /// <param name="filename">Filename to terrain file. Type is determined by extension.</param> 380 /// <param name="filename">Filename to terrain file. Type is determined by extension.</param>
311 public void LoadFromFile(string filename) 381 public void LoadFromFile(string filename)
312 { 382 {
313 foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders) 383 foreach(KeyValuePair<string, ITerrainLoader> loader in m_loaders)
314 { 384 {
315 if (filename.EndsWith(loader.Key)) 385 if (filename.EndsWith(loader.Key))
316 { 386 {
317 lock (m_scene) 387 lock(m_scene)
318 { 388 {
319 try 389 try
320 { 390 {
@@ -330,20 +400,20 @@ namespace OpenSim.Region.CoreModules.World.Terrain
330 m_channel = channel; 400 m_channel = channel;
331 UpdateBakedMap(); 401 UpdateBakedMap();
332 } 402 }
333 catch (NotImplementedException) 403 catch(NotImplementedException)
334 { 404 {
335 m_log.Error("[TERRAIN]: Unable to load heightmap, the " + loader.Value + 405 m_log.Error("[TERRAIN]: Unable to load heightmap, the " + loader.Value +
336 " parser does not support file loading. (May be save only)"); 406 " parser does not support file loading. (May be save only)");
337 throw new TerrainException(String.Format("unable to load heightmap: parser {0} does not support loading", loader.Value)); 407 throw new TerrainException(String.Format("unable to load heightmap: parser {0} does not support loading", loader.Value));
338 } 408 }
339 catch (FileNotFoundException) 409 catch(FileNotFoundException)
340 { 410 {
341 m_log.Error( 411 m_log.Error(
342 "[TERRAIN]: Unable to load heightmap, file not found. (A directory permissions error may also cause this)"); 412 "[TERRAIN]: Unable to load heightmap, file not found. (A directory permissions error may also cause this)");
343 throw new TerrainException( 413 throw new TerrainException(
344 String.Format("unable to load heightmap: file {0} not found (or permissions do not allow access", filename)); 414 String.Format("unable to load heightmap: file {0} not found (or permissions do not allow access", filename));
345 } 415 }
346 catch (ArgumentException e) 416 catch(ArgumentException e)
347 { 417 {
348 m_log.ErrorFormat("[TERRAIN]: Unable to load heightmap: {0}", e.Message); 418 m_log.ErrorFormat("[TERRAIN]: Unable to load heightmap: {0}", e.Message);
349 throw new TerrainException( 419 throw new TerrainException(
@@ -367,7 +437,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
367 { 437 {
368 try 438 try
369 { 439 {
370 foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders) 440 foreach(KeyValuePair<string, ITerrainLoader> loader in m_loaders)
371 { 441 {
372 if (filename.EndsWith(loader.Key)) 442 if (filename.EndsWith(loader.Key))
373 { 443 {
@@ -377,7 +447,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
377 } 447 }
378 } 448 }
379 } 449 }
380 catch (IOException ioe) 450 catch(IOException ioe)
381 { 451 {
382 m_log.Error(String.Format("[TERRAIN]: Unable to save to {0}, {1}", filename, ioe.Message)); 452 m_log.Error(String.Format("[TERRAIN]: Unable to save to {0}, {1}", filename, ioe.Message));
383 } 453 }
@@ -410,19 +480,23 @@ namespace OpenSim.Region.CoreModules.World.Terrain
410 public void LoadFromStream(string filename, Vector3 displacement, 480 public void LoadFromStream(string filename, Vector3 displacement,
411 float radianRotation, Vector2 rotationDisplacement, Stream stream) 481 float radianRotation, Vector2 rotationDisplacement, Stream stream)
412 { 482 {
413 foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders) 483 foreach(KeyValuePair<string, ITerrainLoader> loader in m_loaders)
414 { 484 {
415 if (filename.EndsWith(loader.Key)) 485 if (filename.EndsWith(loader.Key))
416 { 486 {
417 lock (m_scene) 487 lock(m_scene)
418 { 488 {
419 try 489 try
420 { 490 {
421 ITerrainChannel channel = loader.Value.LoadStream(stream); 491 ITerrainChannel channel = loader.Value.LoadStream(stream);
422 m_channel.Merge(channel, displacement, radianRotation, rotationDisplacement); 492 m_channel.Merge(channel, displacement, radianRotation, rotationDisplacement);
493<<<<<<< HEAD
494 UpdateRevertMap();
495=======
423 UpdateBakedMap(); 496 UpdateBakedMap();
497>>>>>>> avn/ubitvar
424 } 498 }
425 catch (NotImplementedException) 499 catch(NotImplementedException)
426 { 500 {
427 m_log.Error("[TERRAIN]: Unable to load heightmap, the " + loader.Value + 501 m_log.Error("[TERRAIN]: Unable to load heightmap, the " + loader.Value +
428 " parser does not support file loading. (May be save only)"); 502 " parser does not support file loading. (May be save only)");
@@ -482,7 +556,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
482 { 556 {
483 try 557 try
484 { 558 {
485 foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders) 559 foreach(KeyValuePair<string, ITerrainLoader> loader in m_loaders)
486 { 560 {
487 if (filename.EndsWith(loader.Key)) 561 if (filename.EndsWith(loader.Key))
488 { 562 {
@@ -491,7 +565,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
491 } 565 }
492 } 566 }
493 } 567 }
494 catch (NotImplementedException) 568 catch(NotImplementedException)
495 { 569 {
496 m_log.Error("Unable to save to " + filename + ", saving of this file format has not been implemented."); 570 m_log.Error("Unable to save to " + filename + ", saving of this file format has not been implemented.");
497 throw new TerrainException(String.Format("Unable to save heightmap: saving of this file format not implemented")); 571 throw new TerrainException(String.Format("Unable to save heightmap: saving of this file format not implemented"));
@@ -500,16 +574,27 @@ namespace OpenSim.Region.CoreModules.World.Terrain
500 574
501 // Someone diddled terrain outside the normal code paths. Set the taintedness for all clients. 575 // Someone diddled terrain outside the normal code paths. Set the taintedness for all clients.
502 // ITerrainModule.TaintTerrain() 576 // ITerrainModule.TaintTerrain()
577<<<<<<< HEAD
578 public void TaintTerrain()
579 {
580 lock(m_perClientPatchUpdates)
581 {
582 // Set the flags for all clients so the tainted patches will be sent out
583 foreach(PatchUpdates pups in m_perClientPatchUpdates.Values)
584=======
503 public void TaintTerrain () 585 public void TaintTerrain ()
504 { 586 {
505 lock (m_perClientPatchUpdates) 587 lock (m_perClientPatchUpdates)
506 { 588 {
507 // Set the flags for all clients so the tainted patches will be sent out 589 // Set the flags for all clients so the tainted patches will be sent out
508 foreach (PatchUpdates pups in m_perClientPatchUpdates.Values) 590 foreach (PatchUpdates pups in m_perClientPatchUpdates.Values)
591>>>>>>> avn/ubitvar
509 { 592 {
510 pups.SetAll(m_scene.Heightmap.GetTerrainData()); 593 pups.SetAll(m_scene.Heightmap.GetTerrainData());
511 } 594 }
512 } 595 }
596<<<<<<< HEAD
597=======
513 } 598 }
514 599
515 // ITerrainModule.PushTerrain() 600 // ITerrainModule.PushTerrain()
@@ -530,8 +615,38 @@ namespace OpenSim.Region.CoreModules.World.Terrain
530 pups.SetAll(true); 615 pups.SetAll(true);
531 } 616 }
532 } 617 }
618>>>>>>> avn/ubitvar
533 } 619 }
534 620
621 // ITerrainModule.PushTerrain()
622 public void PushTerrain(IClientAPI pClient)
623 {
624 // If view distance based, set the modified patch bits and the frame event will send the updates
625 if (m_sendTerrainUpdatesByViewDistance)
626 {
627 ScenePresence presence = m_scene.GetScenePresence(pClient.AgentId);
628 if (presence != null)
629 {
630 lock(m_perClientPatchUpdates)
631 {
632 PatchUpdates pups;
633 if (!m_perClientPatchUpdates.TryGetValue(pClient.AgentId, out pups))
634 {
635 // There is a ScenePresence without a send patch map. Create one.
636 pups = new PatchUpdates(m_scene.Heightmap.GetTerrainData(), presence);
637 m_perClientPatchUpdates.Add(presence.UUID, pups);
638 }
639 // By setting all to modified, the next update tick will send the patches
640 pups.SetAll(true);
641 }
642 }
643 }
644 else
645 {
646 // The traditional way is to call into the protocol stack to send them all.
647 pClient.SendLayerData(new float[10]);
648 }
649 }
535 #region Plugin Loading Methods 650 #region Plugin Loading Methods
536 651
537 private void LoadPlugins() 652 private void LoadPlugins()
@@ -539,13 +654,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain
539 m_plugineffects = new Dictionary<string, ITerrainEffect>(); 654 m_plugineffects = new Dictionary<string, ITerrainEffect>();
540 LoadPlugins(Assembly.GetCallingAssembly()); 655 LoadPlugins(Assembly.GetCallingAssembly());
541 string plugineffectsPath = "Terrain"; 656 string plugineffectsPath = "Terrain";
542 657
543 // Load the files in the Terrain/ dir 658 // Load the files in the Terrain/ dir
544 if (!Directory.Exists(plugineffectsPath)) 659 if (!Directory.Exists(plugineffectsPath))
545 return; 660 return;
546 661
547 string[] files = Directory.GetFiles(plugineffectsPath); 662 string[] files = Directory.GetFiles(plugineffectsPath);
548 foreach (string file in files) 663 foreach(string file in files)
549 { 664 {
550 m_log.Info("Loading effects in " + file); 665 m_log.Info("Loading effects in " + file);
551 try 666 try
@@ -553,7 +668,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
553 Assembly library = Assembly.LoadFrom(file); 668 Assembly library = Assembly.LoadFrom(file);
554 LoadPlugins(library); 669 LoadPlugins(library);
555 } 670 }
556 catch (BadImageFormatException) 671 catch(BadImageFormatException)
557 { 672 {
558 } 673 }
559 } 674 }
@@ -561,7 +676,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
561 676
562 private void LoadPlugins(Assembly library) 677 private void LoadPlugins(Assembly library)
563 { 678 {
564 foreach (Type pluginType in library.GetTypes()) 679 foreach(Type pluginType in library.GetTypes())
565 { 680 {
566 try 681 try
567 { 682 {
@@ -583,7 +698,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
583 m_log.Info("L ... " + typeName); 698 m_log.Info("L ... " + typeName);
584 } 699 }
585 } 700 }
586 catch (AmbiguousMatchException) 701 catch(AmbiguousMatchException)
587 { 702 {
588 } 703 }
589 } 704 }
@@ -591,7 +706,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
591 706
592 public void InstallPlugin(string pluginName, ITerrainEffect effect) 707 public void InstallPlugin(string pluginName, ITerrainEffect effect)
593 { 708 {
594 lock (m_plugineffects) 709 lock(m_plugineffects)
595 { 710 {
596 if (!m_plugineffects.ContainsKey(pluginName)) 711 if (!m_plugineffects.ContainsKey(pluginName))
597 { 712 {
@@ -634,6 +749,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain
634 m_floodeffects[StandardTerrainEffects.Flatten] = new FlattenArea(); 749 m_floodeffects[StandardTerrainEffects.Flatten] = new FlattenArea();
635 m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_baked); 750 m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_baked);
636 751
752 // Terrain Modifier operations
753 m_modifyOperations["min"] = new MinModifier(this);
754 m_modifyOperations["max"] = new MaxModifier(this);
755 m_modifyOperations["raise"] = new RaiseModifier(this);
756 m_modifyOperations["lower"] = new LowerModifier(this);
757 m_modifyOperations["fill"] = new FillModifier(this);
758 m_modifyOperations["smooth"] = new SmoothModifier(this);
759 m_modifyOperations["noise"] = new NoiseModifier(this);
760
637 // Filesystem load/save loaders 761 // Filesystem load/save loaders
638 m_loaders[".r32"] = new RAW32(); 762 m_loaders[".r32"] = new RAW32();
639 m_loaders[".f32"] = m_loaders[".r32"]; 763 m_loaders[".f32"] = m_loaders[".r32"];
@@ -654,9 +778,24 @@ namespace OpenSim.Region.CoreModules.World.Terrain
654 /// </summary> 778 /// </summary>
655 public void UpdateBakedMap() 779 public void UpdateBakedMap()
656 { 780 {
781<<<<<<< HEAD
782 /*
783 int x;
784 for (x = 0; x < m_channel.Width; x++)
785 {
786 int y;
787 for (y = 0; y < m_channel.Height; y++)
788 {
789 m_revert[x, y] = m_channel[x, y];
790 }
791 }
792 */
793 m_revert = m_channel.MakeCopy();
794=======
657 m_baked = m_channel.MakeCopy(); 795 m_baked = m_channel.MakeCopy();
658 m_painteffects[StandardTerrainEffects.Revert] = new RevertSphere(m_baked); 796 m_painteffects[StandardTerrainEffects.Revert] = new RevertSphere(m_baked);
659 m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_baked); 797 m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_baked);
798>>>>>>> avn/ubitvar
660 } 799 }
661 800
662 /// <summary> 801 /// <summary>
@@ -669,22 +808,27 @@ namespace OpenSim.Region.CoreModules.World.Terrain
669 /// <param name="fileStartY">Where to begin our slice</param> 808 /// <param name="fileStartY">Where to begin our slice</param>
670 public void LoadFromFile(string filename, int fileWidth, int fileHeight, int fileStartX, int fileStartY) 809 public void LoadFromFile(string filename, int fileWidth, int fileHeight, int fileStartX, int fileStartY)
671 { 810 {
672 int offsetX = (int) m_scene.RegionInfo.RegionLocX - fileStartX; 811 int offsetX = (int)m_scene.RegionInfo.RegionLocX - fileStartX;
673 int offsetY = (int) m_scene.RegionInfo.RegionLocY - fileStartY; 812 int offsetY = (int)m_scene.RegionInfo.RegionLocY - fileStartY;
674 813
675 if (offsetX >= 0 && offsetX < fileWidth && offsetY >= 0 && offsetY < fileHeight) 814 if (offsetX >= 0 && offsetX < fileWidth && offsetY >= 0 && offsetY < fileHeight)
676 { 815 {
677 // this region is included in the tile request 816 // this region is included in the tile request
678 foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders) 817 foreach(KeyValuePair<string, ITerrainLoader> loader in m_loaders)
679 { 818 {
680 if (filename.EndsWith(loader.Key)) 819 if (filename.EndsWith(loader.Key))
681 { 820 {
682 lock (m_scene) 821 lock(m_scene)
683 { 822 {
684 ITerrainChannel channel = loader.Value.LoadFile(filename, offsetX, offsetY, 823 ITerrainChannel channel = loader.Value.LoadFile(filename, offsetX, offsetY,
685 fileWidth, fileHeight, 824 fileWidth, fileHeight,
825<<<<<<< HEAD
826 (int)m_scene.RegionInfo.RegionSizeX,
827 (int)m_scene.RegionInfo.RegionSizeY);
828=======
686 (int) m_scene.RegionInfo.RegionSizeX, 829 (int) m_scene.RegionInfo.RegionSizeX,
687 (int) m_scene.RegionInfo.RegionSizeY); 830 (int) m_scene.RegionInfo.RegionSizeY);
831>>>>>>> avn/ubitvar
688 m_scene.Heightmap = channel; 832 m_scene.Heightmap = channel;
689 m_channel = channel; 833 m_channel = channel;
690 UpdateBakedMap(); 834 UpdateBakedMap();
@@ -723,11 +867,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain
723 } 867 }
724 868
725 // this region is included in the tile request 869 // this region is included in the tile request
726 foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders) 870 foreach(KeyValuePair<string, ITerrainLoader> loader in m_loaders)
727 { 871 {
728 if (filename.EndsWith(loader.Key) && loader.Value.SupportsTileSave()) 872 if (filename.EndsWith(loader.Key) && loader.Value.SupportsTileSave())
729 { 873 {
730 lock (m_scene) 874 lock(m_scene)
731 { 875 {
732 loader.Value.SaveFile(m_channel, filename, offsetX, offsetY, 876 loader.Value.SaveFile(m_channel, filename, offsetX, offsetY,
733 fileWidth, fileHeight, 877 fileWidth, fileHeight,
@@ -739,7 +883,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
739 fileStartX, fileStartY, fileStartX + fileWidth - 1, fileStartY + fileHeight - 1, 883 fileStartX, fileStartY, fileStartX + fileWidth - 1, fileStartY + fileHeight - 1,
740 m_scene.RegionInfo.RegionName, filename); 884 m_scene.RegionInfo.RegionName, filename);
741 } 885 }
742 886
743 return; 887 return;
744 } 888 }
745 } 889 }
@@ -750,11 +894,27 @@ namespace OpenSim.Region.CoreModules.World.Terrain
750 } 894 }
751 895
752 /// <summary> 896 /// <summary>
897<<<<<<< HEAD
898 /// Called before processing of every simulation frame.
899=======
900>>>>>>> avn/ubitvar
753 /// This is used to check to see of any of the terrain is tainted and, if so, schedule 901 /// This is used to check to see of any of the terrain is tainted and, if so, schedule
754 /// updates for all the presences. 902 /// updates for all the presences.
755 /// This also checks to see if there are updates that need to be sent for each presence. 903 /// This also checks to see if there are updates that need to be sent for each presence.
756 /// This is where the logic is to send terrain updates to clients. 904 /// This is where the logic is to send terrain updates to clients.
757 /// </summary> 905 /// </summary>
906<<<<<<< HEAD
907 private void EventManager_OnFrame()
908 {
909 TerrainData terrData = m_channel.GetTerrainData();
910
911 bool shouldTaint = false;
912 for(int x = 0; x < terrData.SizeX; x += Constants.TerrainPatchSize)
913 {
914 for(int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize)
915 {
916 if (terrData.IsTaintedAt(x, y))
917=======
758 private void EventManager_TerrainCheckUpdates() 918 private void EventManager_TerrainCheckUpdates()
759 { 919 {
760 // this needs fixing 920 // this needs fixing
@@ -766,6 +926,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
766 for (int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize) 926 for (int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize)
767 { 927 {
768 if (terrData.IsTaintedAt(x, y,true)) 928 if (terrData.IsTaintedAt(x, y,true))
929>>>>>>> avn/ubitvar
769 { 930 {
770 // Found a patch that was modified. Push this flag into the clients. 931 // Found a patch that was modified. Push this flag into the clients.
771 SendToClients(terrData, x, y); 932 SendToClients(terrData, x, y);
@@ -783,7 +944,10 @@ namespace OpenSim.Region.CoreModules.World.Terrain
783 m_scene.EventManager.TriggerTerrainTainted(); 944 m_scene.EventManager.TriggerTerrainTainted();
784 m_tainted = true; 945 m_tainted = true;
785 } 946 }
947<<<<<<< HEAD
948=======
786 949
950>>>>>>> avn/ubitvar
787 } 951 }
788 952
789 /// <summary> 953 /// <summary>
@@ -819,7 +983,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
819 983
820 string[] tmpArgs = new string[args.Length - 2]; 984 string[] tmpArgs = new string[args.Length - 2];
821 int i; 985 int i;
822 for (i = 2; i < args.Length; i++) 986 for(i = 2; i < args.Length; i++)
823 tmpArgs[i - 2] = args[i]; 987 tmpArgs[i - 2] = args[i];
824 988
825 m_commander.ProcessConsoleCommand(args[1], tmpArgs); 989 m_commander.ProcessConsoleCommand(args[1], tmpArgs);
@@ -837,7 +1001,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
837 client.OnLandUndo += client_OnLandUndo; 1001 client.OnLandUndo += client_OnLandUndo;
838 client.OnUnackedTerrain += client_OnUnackedTerrain; 1002 client.OnUnackedTerrain += client_OnUnackedTerrain;
839 } 1003 }
840 1004
841 /// <summary> 1005 /// <summary>
842 /// Installs terrain brush hook to IClientAPI 1006 /// Installs terrain brush hook to IClientAPI
843 /// </summary> 1007 /// </summary>
@@ -852,6 +1016,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain
852 presence.ControllingClient.OnLandUndo -= client_OnLandUndo; 1016 presence.ControllingClient.OnLandUndo -= client_OnLandUndo;
853 presence.ControllingClient.OnUnackedTerrain -= client_OnUnackedTerrain; 1017 presence.ControllingClient.OnUnackedTerrain -= client_OnUnackedTerrain;
854 } 1018 }
1019<<<<<<< HEAD
1020
1021 lock(m_perClientPatchUpdates)
1022 m_perClientPatchUpdates.Remove(client);
1023 }
1024=======
1025>>>>>>> avn/ubitvar
855 1026
856 lock (m_perClientPatchUpdates) 1027 lock (m_perClientPatchUpdates)
857 m_perClientPatchUpdates.Remove(client); 1028 m_perClientPatchUpdates.Remove(client);
@@ -867,12 +1038,21 @@ namespace OpenSim.Region.CoreModules.World.Terrain
867 TerrainData terrData = m_channel.GetTerrainData(); 1038 TerrainData terrData = m_channel.GetTerrainData();
868 1039
869 bool wasLimited = false; 1040 bool wasLimited = false;
1041<<<<<<< HEAD
1042 for(int x = 0; x < terrData.SizeX; x += Constants.TerrainPatchSize)
1043 {
1044 for(int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize)
1045 {
1046 if (terrData.IsTaintedAt(x, y, false /* clearOnTest */))
1047 {
1048=======
870 for (int x = 0; x < terrData.SizeX; x += Constants.TerrainPatchSize) 1049 for (int x = 0; x < terrData.SizeX; x += Constants.TerrainPatchSize)
871 { 1050 {
872 for (int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize) 1051 for (int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize)
873 { 1052 {
874 if (terrData.IsTaintedAt(x, y, false /* clearOnTest */)) 1053 if (terrData.IsTaintedAt(x, y, false /* clearOnTest */))
875 { 1054 {
1055>>>>>>> avn/ubitvar
876 // If we should respect the estate settings then 1056 // If we should respect the estate settings then
877 // fixup and height deltas that don't respect them. 1057 // fixup and height deltas that don't respect them.
878 // Note that LimitChannelChanges() modifies the TerrainChannel with the limited height values. 1058 // Note that LimitChannelChanges() modifies the TerrainChannel with the limited height values.
@@ -895,13 +1075,22 @@ namespace OpenSim.Region.CoreModules.World.Terrain
895 float maxDelta = (float)m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit; 1075 float maxDelta = (float)m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit;
896 1076
897 // loop through the height map for this patch and compare it against 1077 // loop through the height map for this patch and compare it against
1078<<<<<<< HEAD
1079 // the revert map
1080 for(int x = xStart; x < xStart + Constants.TerrainPatchSize; x++)
1081=======
898 // the baked map 1082 // the baked map
899 for (int x = xStart; x < xStart + Constants.TerrainPatchSize; x++) 1083 for (int x = xStart; x < xStart + Constants.TerrainPatchSize; x++)
1084>>>>>>> avn/ubitvar
900 { 1085 {
901 for (int y = yStart; y < yStart + Constants.TerrainPatchSize; y++) 1086 for(int y = yStart; y < yStart + Constants.TerrainPatchSize; y++)
902 { 1087 {
903 float requestedHeight = terrData[x, y]; 1088 float requestedHeight = terrData[x, y];
1089<<<<<<< HEAD
1090 float bakedHeight = (float)m_revert[x, y];
1091=======
904 float bakedHeight = (float)m_baked[x, y]; 1092 float bakedHeight = (float)m_baked[x, y];
1093>>>>>>> avn/ubitvar
905 float requestedDelta = requestedHeight - bakedHeight; 1094 float requestedDelta = requestedHeight - bakedHeight;
906 1095
907 if (requestedDelta > maxDelta) 1096 if (requestedDelta > maxDelta)
@@ -922,7 +1111,19 @@ namespace OpenSim.Region.CoreModules.World.Terrain
922 1111
923 private void client_OnLandUndo(IClientAPI client) 1112 private void client_OnLandUndo(IClientAPI client)
924 { 1113 {
1114<<<<<<< HEAD
1115 lock(m_undo)
1116 {
1117 if (m_undo.Count > 0)
1118 {
1119 LandUndoState goback = m_undo.Pop();
1120 if (goback != null)
1121 goback.PlaybackState();
1122 }
1123 }
1124=======
925 1125
1126>>>>>>> avn/ubitvar
926 } 1127 }
927 1128
928 /// <summary> 1129 /// <summary>
@@ -932,6 +1133,175 @@ namespace OpenSim.Region.CoreModules.World.Terrain
932 /// <param name="x">The patch corner to send</param> 1133 /// <param name="x">The patch corner to send</param>
933 /// <param name="y">The patch corner to send</param> 1134 /// <param name="y">The patch corner to send</param>
934 private void SendToClients(TerrainData terrData, int x, int y) 1135 private void SendToClients(TerrainData terrData, int x, int y)
1136<<<<<<< HEAD
1137 {
1138 if (m_sendTerrainUpdatesByViewDistance)
1139 {
1140 // Add that this patch needs to be sent to the accounting for each client.
1141 lock(m_perClientPatchUpdates)
1142 {
1143 m_scene.ForEachScenePresence(presence =>
1144 {
1145 PatchUpdates thisClientUpdates;
1146 if (!m_perClientPatchUpdates.TryGetValue(presence.UUID, out thisClientUpdates))
1147 {
1148 // There is a ScenePresence without a send patch map. Create one.
1149 thisClientUpdates = new PatchUpdates(terrData, presence);
1150 m_perClientPatchUpdates.Add(presence.UUID, thisClientUpdates);
1151 }
1152 thisClientUpdates.SetByXY(x, y, true);
1153 }
1154 );
1155 }
1156 }
1157 else
1158 {
1159 // Legacy update sending where the update is sent out as soon as noticed
1160 // We know the actual terrain data that is passed is ignored so this passes a dummy heightmap.
1161 //float[] heightMap = terrData.GetFloatsSerialized();
1162 float[] heightMap = new float[10];
1163 m_scene.ForEachClient(
1164 delegate(IClientAPI controller)
1165 {
1166 controller.SendLayerData(x / Constants.TerrainPatchSize,
1167 y / Constants.TerrainPatchSize,
1168 heightMap);
1169 }
1170 );
1171 }
1172 }
1173
1174 private class PatchesToSend : IComparable<PatchesToSend>
1175 {
1176 public int PatchX;
1177 public int PatchY;
1178 public float Dist;
1179
1180 public PatchesToSend(int pX, int pY, float pDist)
1181 {
1182 PatchX = pX;
1183 PatchY = pY;
1184 Dist = pDist;
1185 }
1186
1187 public int CompareTo(PatchesToSend other)
1188 {
1189 return Dist.CompareTo(other.Dist);
1190 }
1191 }
1192
1193 // Called each frame time to see if there are any patches to send to any of the
1194 // ScenePresences.
1195 // We know this is only called if we are doing view distance patch sending so some
1196 // tests are not made.
1197 // Loop through all the per-client info and send any patches necessary.
1198 private void CheckSendingPatchesToClients()
1199 {
1200 lock(m_perClientPatchUpdates)
1201 {
1202 foreach(PatchUpdates pups in m_perClientPatchUpdates.Values)
1203 {
1204 if (pups.HasUpdates())
1205 {
1206 // There is something that could be sent to this client.
1207 List<PatchesToSend> toSend = GetModifiedPatchesInViewDistance(pups);
1208 if (toSend.Count > 0)
1209 {
1210 // m_log.DebugFormat("{0} CheckSendingPatchesToClient: sending {1} patches to {2} in region {3}",
1211 // LogHeader, toSend.Count, pups.Presence.Name, m_scene.RegionInfo.RegionName);
1212 // Sort the patches to send by the distance from the presence
1213 toSend.Sort();
1214 /* old way that sent individual patches
1215 foreach (PatchesToSend pts in toSend)
1216 {
1217 pups.Presence.ControllingClient.SendLayerData(pts.PatchX, pts.PatchY, null);
1218 // presence.ControllingClient.SendLayerData(xs.ToArray(), ys.ToArray(), null, TerrainPatch.LayerType.Land);
1219 }
1220 */
1221
1222 // new way that sends all patches to the protocol so they can be sent in one block
1223 int[] xPieces = new int[toSend.Count];
1224 int[] yPieces = new int[toSend.Count];
1225 float[] patchPieces = new float[toSend.Count * 2];
1226 int pieceIndex = 0;
1227 foreach(PatchesToSend pts in toSend)
1228 {
1229 patchPieces[pieceIndex++] = pts.PatchX;
1230 patchPieces[pieceIndex++] = pts.PatchY;
1231 }
1232 pups.Presence.ControllingClient.SendLayerData(-toSend.Count, 0, patchPieces);
1233 }
1234 }
1235 }
1236 }
1237 }
1238
1239 // Compute a list of modified patches that are within our view distance.
1240 private List<PatchesToSend> GetModifiedPatchesInViewDistance(PatchUpdates pups)
1241 {
1242 List<PatchesToSend> ret = new List<PatchesToSend>();
1243
1244 ScenePresence presence = pups.Presence;
1245 if (presence == null)
1246 return ret;
1247
1248 Vector3 presencePos = presence.AbsolutePosition;
1249
1250 // Before this distance check, the whole region just showed up. Adding the distance
1251 // check causes different things to happen for the current and adjacent regions.
1252 // So, to keep legacy views, if the region is legacy sized, don't do distance check.
1253 bool isLegacySizedRegion = pups.Terrain.SizeX == Constants.RegionSize && pups.Terrain.SizeY == Constants.RegionSize;
1254 bool shouldCheckViewDistance = m_sendTerrainUpdatesByViewDistance && !isLegacySizedRegion;
1255
1256 int startX = 0;
1257 int endX = (int)m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize;
1258 int startY = 0;
1259 int endY = (int)m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize;
1260
1261 // The following only reduces the size of area scanned for updates. Only significant for very large varregions.
1262 if (shouldCheckViewDistance)
1263 {
1264 // Compute the area of patches within our draw distance
1265 startX = (((int)(presencePos.X - presence.DrawDistance)) / Constants.TerrainPatchSize) - 2;
1266 startX = Math.Max(startX, 0);
1267 startX = Math.Min(startX, (int)m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize);
1268 startY = (((int)(presencePos.Y - presence.DrawDistance)) / Constants.TerrainPatchSize) - 2;
1269 startY = Math.Max(startY, 0);
1270 startY = Math.Min(startY, (int)m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize);
1271 endX = (((int)(presencePos.X + presence.DrawDistance)) / Constants.TerrainPatchSize) + 2;
1272 endX = Math.Max(endX, 0);
1273 endX = Math.Min(endX, (int)m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize);
1274 endY = (((int)(presencePos.Y + presence.DrawDistance)) / Constants.TerrainPatchSize) + 2;
1275 endY = Math.Max(endY, 0);
1276 endY = Math.Min(endY, (int)m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize);
1277 }
1278
1279 // m_log.DebugFormat("{0} GetModifiedPatchesInViewDistance. rName={1}, ddist={2}, apos={3}, cpos={4}, isChild={5}, start=<{6},{7}>, end=<{8},{9}>",
1280 // LogHeader, m_scene.RegionInfo.RegionName,
1281 // presence.DrawDistance, presencePos, presence.CameraPosition,
1282 // isLegacySizeChildRegion,
1283 // startX, startY, endX, endY);
1284 for(int x = startX; x < endX; x++)
1285 {
1286 for(int y = startY; y < endY; y++)
1287 {
1288 //Need to make sure we don't send the same ones over and over
1289 Vector3 patchPos = new Vector3(x * Constants.TerrainPatchSize, y * Constants.TerrainPatchSize, presencePos.Z);
1290 if (pups.GetByPatch(x, y))
1291 {
1292 //Check which has less distance, camera or avatar position, both have to be done.
1293 //Its not a radius, its a diameter and we add 50 so that it doesn't look like it cuts off
1294 if (!shouldCheckViewDistance
1295 || Util.DistanceLessThan(presencePos, patchPos, presence.DrawDistance + 50)
1296 || Util.DistanceLessThan(presence.CameraPosition, patchPos, presence.DrawDistance + 50))
1297 {
1298 //They can see it, send it to them
1299 pups.SetByPatch(x, y, false);
1300 float dist = Vector3.DistanceSquared(presencePos, patchPos);
1301 ret.Add(new PatchesToSend(x, y, dist));
1302 }
1303 }
1304=======
935 { 1305 {
936 // Add that this patch needs to be sent to the accounting for each client. 1306 // Add that this patch needs to be sent to the accounting for each client.
937 lock (m_perClientPatchUpdates) 1307 lock (m_perClientPatchUpdates)
@@ -1105,6 +1475,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1105 } 1475 }
1106 } 1476 }
1107 } 1477 }
1478>>>>>>> avn/ubitvar
1108 } 1479 }
1109 } 1480 }
1110 return ret; 1481 return ret;
@@ -1117,17 +1488,34 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1117 bool allowed = false; 1488 bool allowed = false;
1118 if (north == south && east == west) 1489 if (north == south && east == west)
1119 { 1490 {
1120 if (m_painteffects.ContainsKey((StandardTerrainEffects) action)) 1491 if (m_painteffects.ContainsKey((StandardTerrainEffects)action))
1121 { 1492 {
1122 bool[,] allowMask = new bool[m_channel.Width,m_channel.Height]; 1493 bool[,] allowMask = new bool[m_channel.Width, m_channel.Height];
1123 allowMask.Initialize(); 1494 allowMask.Initialize();
1124 int n = size + 1; 1495 int n = size + 1;
1125 if (n > 2) 1496 if (n > 2)
1126 n = 4; 1497 n = 4;
1127 1498
1128 int zx = (int) (west + 0.5); 1499 int zx = (int)(west + 0.5);
1129 int zy = (int) (north + 0.5); 1500 int zy = (int)(north + 0.5);
1130 1501
1502<<<<<<< HEAD
1503 int dx;
1504 for(dx=-n; dx<=n; dx++)
1505 {
1506 int dy;
1507 for(dy=-n; dy<=n; dy++)
1508 {
1509 int x = zx + dx;
1510 int y = zy + dy;
1511 if (x >= 0 && y >= 0 && x < m_channel.Width && y < m_channel.Height)
1512 {
1513 if (m_scene.Permissions.CanTerraformLand(agentId, new Vector3(x, y, 0)))
1514 {
1515 allowMask[x, y] = true;
1516 allowed = true;
1517 }
1518=======
1131 1519
1132 int startX = zx - n; 1520 int startX = zx - n;
1133 if (startX < 0) 1521 if (startX < 0)
@@ -1154,17 +1542,25 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1154 { 1542 {
1155 allowMask[x, y] = true; 1543 allowMask[x, y] = true;
1156 allowed = true; 1544 allowed = true;
1545>>>>>>> avn/ubitvar
1157 } 1546 }
1158 } 1547 }
1159 } 1548 }
1160 if (allowed) 1549 if (allowed)
1161 { 1550 {
1162 StoreUndoState(); 1551 StoreUndoState();
1552<<<<<<< HEAD
1553 m_painteffects[(StandardTerrainEffects)action].PaintEffect(
1554 m_channel, allowMask, west, south, height, size, seconds);
1555
1556 //revert changes outside estate limits
1557=======
1163 m_painteffects[(StandardTerrainEffects) action].PaintEffect( 1558 m_painteffects[(StandardTerrainEffects) action].PaintEffect(
1164 m_channel, allowMask, west, south, height, size, seconds, 1559 m_channel, allowMask, west, south, height, size, seconds,
1165 startX, endX, startY, endY); 1560 startX, endX, startY, endY);
1166 1561
1167 //block changes outside estate limits 1562 //block changes outside estate limits
1563>>>>>>> avn/ubitvar
1168 if (!god) 1564 if (!god)
1169 EnforceEstateLimits(); 1565 EnforceEstateLimits();
1170 } 1566 }
@@ -1176,22 +1572,22 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1176 } 1572 }
1177 else 1573 else
1178 { 1574 {
1179 if (m_floodeffects.ContainsKey((StandardTerrainEffects) action)) 1575 if (m_floodeffects.ContainsKey((StandardTerrainEffects)action))
1180 { 1576 {
1181 bool[,] fillArea = new bool[m_channel.Width,m_channel.Height]; 1577 bool[,] fillArea = new bool[m_channel.Width, m_channel.Height];
1182 fillArea.Initialize(); 1578 fillArea.Initialize();
1183 1579
1184 int x; 1580 int x;
1185 for (x = 0; x < m_channel.Width; x++) 1581 for(x = 0; x < m_channel.Width; x++)
1186 { 1582 {
1187 int y; 1583 int y;
1188 for (y = 0; y < m_channel.Height; y++) 1584 for(y = 0; y < m_channel.Height; y++)
1189 { 1585 {
1190 if (x < east && x > west) 1586 if (x < east && x > west)
1191 { 1587 {
1192 if (y < north && y > south) 1588 if (y < north && y > south)
1193 { 1589 {
1194 if (m_scene.Permissions.CanTerraformLand(agentId, new Vector3(x,y,0))) 1590 if (m_scene.Permissions.CanTerraformLand(agentId, new Vector3(x, y, 0)))
1195 { 1591 {
1196 fillArea[x, y] = true; 1592 fillArea[x, y] = true;
1197 allowed = true; 1593 allowed = true;
@@ -1204,9 +1600,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1204 if (allowed) 1600 if (allowed)
1205 { 1601 {
1206 StoreUndoState(); 1602 StoreUndoState();
1603<<<<<<< HEAD
1604 m_floodeffects[(StandardTerrainEffects)action].FloodEffect(m_channel, fillArea, size);
1605
1606 //revert changes outside estate limits
1607=======
1207 m_floodeffects[(StandardTerrainEffects) action].FloodEffect(m_channel, fillArea, size); 1608 m_floodeffects[(StandardTerrainEffects) action].FloodEffect(m_channel, fillArea, size);
1208 1609
1209 //block changes outside estate limits 1610 //block changes outside estate limits
1611>>>>>>> avn/ubitvar
1210 if (!god) 1612 if (!god)
1211 EnforceEstateLimits(); 1613 EnforceEstateLimits();
1212 } 1614 }
@@ -1228,7 +1630,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1228 InterfaceBakeTerrain(null); //bake terrain does not use the passed in parameter 1630 InterfaceBakeTerrain(null); //bake terrain does not use the passed in parameter
1229 } 1631 }
1230 } 1632 }
1231 1633
1232 protected void client_OnUnackedTerrain(IClientAPI client, int patchX, int patchY) 1634 protected void client_OnUnackedTerrain(IClientAPI client, int patchX, int patchY)
1233 { 1635 {
1234 //m_log.Debug("Terrain packet unacked, resending patch: " + patchX + " , " + patchY); 1636 //m_log.Debug("Terrain packet unacked, resending patch: " + patchX + " , " + patchY);
@@ -1239,27 +1641,57 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1239 1641
1240 private void StoreUndoState() 1642 private void StoreUndoState()
1241 { 1643 {
1644<<<<<<< HEAD
1645 lock(m_undo)
1646 {
1647 if (m_undo.Count > 0)
1648 {
1649 LandUndoState last = m_undo.Peek();
1650 if (last != null)
1651 {
1652 if (last.Compare(m_channel))
1653 return;
1654 }
1655 }
1656
1657 LandUndoState nUndo = new LandUndoState(this, m_channel);
1658 m_undo.Push(nUndo);
1659 }
1660=======
1661>>>>>>> avn/ubitvar
1242 } 1662 }
1243 1663
1244 #region Console Commands 1664 #region Console Commands
1245 1665
1246 private void InterfaceLoadFile(Object[] args) 1666 private void InterfaceLoadFile(Object[] args)
1247 { 1667 {
1668<<<<<<< HEAD
1669 LoadFromFile((string)args[0]);
1670=======
1248 LoadFromFile((string) args[0]); 1671 LoadFromFile((string) args[0]);
1672>>>>>>> avn/ubitvar
1249 } 1673 }
1250 1674
1251 private void InterfaceLoadTileFile(Object[] args) 1675 private void InterfaceLoadTileFile(Object[] args)
1252 { 1676 {
1677<<<<<<< HEAD
1678 LoadFromFile((string)args[0],
1679 (int)args[1],
1680 (int)args[2],
1681 (int)args[3],
1682 (int)args[4]);
1683=======
1253 LoadFromFile((string) args[0], 1684 LoadFromFile((string) args[0],
1254 (int) args[1], 1685 (int) args[1],
1255 (int) args[2], 1686 (int) args[2],
1256 (int) args[3], 1687 (int) args[3],
1257 (int) args[4]); 1688 (int) args[4]);
1689>>>>>>> avn/ubitvar
1258 } 1690 }
1259 1691
1260 private void InterfaceSaveFile(Object[] args) 1692 private void InterfaceSaveFile(Object[] args)
1261 { 1693 {
1262 SaveToFile((string) args[0]); 1694 SaveToFile((string)args[0]);
1263 } 1695 }
1264 1696
1265 private void InterfaceSaveTileFile(Object[] args) 1697 private void InterfaceSaveTileFile(Object[] args)
@@ -1279,9 +1711,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1279 private void InterfaceRevertTerrain(Object[] args) 1711 private void InterfaceRevertTerrain(Object[] args)
1280 { 1712 {
1281 int x, y; 1713 int x, y;
1714<<<<<<< HEAD
1715 for(x = 0; x < m_channel.Width; x++)
1716 for(y = 0; y < m_channel.Height; y++)
1717 m_channel[x, y] = m_revert[x, y];
1718=======
1282 for (x = 0; x < m_channel.Width; x++) 1719 for (x = 0; x < m_channel.Width; x++)
1283 for (y = 0; y < m_channel.Height; y++) 1720 for (y = 0; y < m_channel.Height; y++)
1284 m_channel[x, y] = m_baked[x, y]; 1721 m_channel[x, y] = m_baked[x, y];
1722>>>>>>> avn/ubitvar
1285 1723
1286 } 1724 }
1287 1725
@@ -1291,9 +1729,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1291 1729
1292 if (direction.ToLower().StartsWith("y")) 1730 if (direction.ToLower().StartsWith("y"))
1293 { 1731 {
1732<<<<<<< HEAD
1733 for(int x = 0; x < m_channel.Width; x++)
1734 {
1735 for(int y = 0; y < m_channel.Height / 2; y++)
1736=======
1294 for (int x = 0; x < m_channel.Width; x++) 1737 for (int x = 0; x < m_channel.Width; x++)
1295 { 1738 {
1296 for (int y = 0; y < m_channel.Height / 2; y++) 1739 for (int y = 0; y < m_channel.Height / 2; y++)
1740>>>>>>> avn/ubitvar
1297 { 1741 {
1298 double height = m_channel[x, y]; 1742 double height = m_channel[x, y];
1299 double flippedHeight = m_channel[x, (int)m_channel.Height - 1 - y]; 1743 double flippedHeight = m_channel[x, (int)m_channel.Height - 1 - y];
@@ -1305,9 +1749,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1305 } 1749 }
1306 else if (direction.ToLower().StartsWith("x")) 1750 else if (direction.ToLower().StartsWith("x"))
1307 { 1751 {
1752<<<<<<< HEAD
1753 for(int y = 0; y < m_channel.Height; y++)
1754 {
1755 for(int x = 0; x < m_channel.Width / 2; x++)
1756=======
1308 for (int y = 0; y < m_channel.Height; y++) 1757 for (int y = 0; y < m_channel.Height; y++)
1309 { 1758 {
1310 for (int x = 0; x < m_channel.Width / 2; x++) 1759 for (int x = 0; x < m_channel.Width / 2; x++)
1760>>>>>>> avn/ubitvar
1311 { 1761 {
1312 double height = m_channel[x, y]; 1762 double height = m_channel[x, y];
1313 double flippedHeight = m_channel[(int)m_channel.Width - 1 - x, y]; 1763 double flippedHeight = m_channel[(int)m_channel.Width - 1 - x, y];
@@ -1319,7 +1769,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1319 } 1769 }
1320 else 1770 else
1321 { 1771 {
1322 m_log.Error("Unrecognised direction - need x or y"); 1772 MainConsole.Instance.OutputFormat("ERROR: Unrecognised direction {0} - need x or y", direction);
1323 } 1773 }
1324 } 1774 }
1325 1775
@@ -1346,9 +1796,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1346 int width = m_channel.Width; 1796 int width = m_channel.Width;
1347 int height = m_channel.Height; 1797 int height = m_channel.Height;
1348 1798
1349 for (int x = 0; x < width; x++) 1799 for(int x = 0; x < width; x++)
1350 { 1800 {
1351 for (int y = 0; y < height; y++) 1801 for(int y = 0; y < height; y++)
1352 { 1802 {
1353 double currHeight = m_channel[x, y]; 1803 double currHeight = m_channel[x, y];
1354 if (currHeight < currMin) 1804 if (currHeight < currMin)
@@ -1369,12 +1819,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1369 //m_log.InfoFormat("Scale = {0}", scale); 1819 //m_log.InfoFormat("Scale = {0}", scale);
1370 1820
1371 // scale the heightmap accordingly 1821 // scale the heightmap accordingly
1372 for (int x = 0; x < width; x++) 1822 for(int x = 0; x < width; x++)
1373 { 1823 {
1374 for (int y = 0; y < height; y++) 1824 for(int y = 0; y < height; y++)
1375 { 1825 {
1376 double currHeight = m_channel[x, y] - currMin; 1826 double currHeight = m_channel[x, y] - currMin;
1377 m_channel[x, y] = desiredMin + (currHeight * scale); 1827 m_channel[x, y] = desiredMin + (currHeight * scale);
1378 } 1828 }
1379 } 1829 }
1380 1830
@@ -1387,29 +1837,47 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1387 double val = (double)args[0]; 1837 double val = (double)args[0];
1388 1838
1389 int x, y; 1839 int x, y;
1840<<<<<<< HEAD
1841 for(x = 0; x < m_channel.Width; x++)
1842 for(y = 0; y < m_channel.Height; y++)
1843 m_channel[x, y] += (double)args[0];
1844=======
1390 for (x = 0; x < m_channel.Width; x++) 1845 for (x = 0; x < m_channel.Width; x++)
1391 for (y = 0; y < m_channel.Height; y++) 1846 for (y = 0; y < m_channel.Height; y++)
1392 m_channel[x, y] += val; 1847 m_channel[x, y] += val;
1848>>>>>>> avn/ubitvar
1393 } 1849 }
1394 1850
1395 private void InterfaceMultiplyTerrain(Object[] args) 1851 private void InterfaceMultiplyTerrain(Object[] args)
1396 { 1852 {
1397 int x, y; 1853 int x, y;
1854<<<<<<< HEAD
1855 for(x = 0; x < m_channel.Width; x++)
1856 for(y = 0; y < m_channel.Height; y++)
1857 m_channel[x, y] *= (double)args[0];
1858=======
1398 double val = (double)args[0]; 1859 double val = (double)args[0];
1399 1860
1400 for (x = 0; x < m_channel.Width; x++) 1861 for (x = 0; x < m_channel.Width; x++)
1401 for (y = 0; y < m_channel.Height; y++) 1862 for (y = 0; y < m_channel.Height; y++)
1402 m_channel[x, y] *= val; 1863 m_channel[x, y] *= val;
1864>>>>>>> avn/ubitvar
1403 } 1865 }
1404 1866
1405 private void InterfaceLowerTerrain(Object[] args) 1867 private void InterfaceLowerTerrain(Object[] args)
1406 { 1868 {
1407 int x, y; 1869 int x, y;
1870<<<<<<< HEAD
1871 for(x = 0; x < m_channel.Width; x++)
1872 for(y = 0; y < m_channel.Height; y++)
1873 m_channel[x, y] -= (double)args[0];
1874=======
1408 double val = (double)args[0]; 1875 double val = (double)args[0];
1409 1876
1410 for (x = 0; x < m_channel.Width; x++) 1877 for (x = 0; x < m_channel.Width; x++)
1411 for (y = 0; y < m_channel.Height; y++) 1878 for (y = 0; y < m_channel.Height; y++)
1412 m_channel[x, y] -= val; 1879 m_channel[x, y] -= val;
1880>>>>>>> avn/ubitvar
1413 } 1881 }
1414 1882
1415 public void InterfaceFillTerrain(Object[] args) 1883 public void InterfaceFillTerrain(Object[] args)
@@ -1417,18 +1885,28 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1417 int x, y; 1885 int x, y;
1418 double val = (double)args[0]; 1886 double val = (double)args[0];
1419 1887
1888<<<<<<< HEAD
1889 for(x = 0; x < m_channel.Width; x++)
1890 for(y = 0; y < m_channel.Height; y++)
1891 m_channel[x, y] = (double)args[0];
1892=======
1420 for (x = 0; x < m_channel.Width; x++) 1893 for (x = 0; x < m_channel.Width; x++)
1421 for (y = 0; y < m_channel.Height; y++) 1894 for (y = 0; y < m_channel.Height; y++)
1422 m_channel[x, y] = val; 1895 m_channel[x, y] = val;
1896>>>>>>> avn/ubitvar
1423 } 1897 }
1424 1898
1425 private void InterfaceMinTerrain(Object[] args) 1899 private void InterfaceMinTerrain(Object[] args)
1426 { 1900 {
1427 int x, y; 1901 int x, y;
1902<<<<<<< HEAD
1903 for(x = 0; x < m_channel.Width; x++)
1904=======
1428 double val = (double)args[0]; 1905 double val = (double)args[0];
1429 for (x = 0; x < m_channel.Width; x++) 1906 for (x = 0; x < m_channel.Width; x++)
1907>>>>>>> avn/ubitvar
1430 { 1908 {
1431 for (y = 0; y < m_channel.Height; y++) 1909 for(y = 0; y < m_channel.Height; y++)
1432 { 1910 {
1433 m_channel[x, y] = Math.Max(val, m_channel[x, y]); 1911 m_channel[x, y] = Math.Max(val, m_channel[x, y]);
1434 } 1912 }
@@ -1438,14 +1916,36 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1438 private void InterfaceMaxTerrain(Object[] args) 1916 private void InterfaceMaxTerrain(Object[] args)
1439 { 1917 {
1440 int x, y; 1918 int x, y;
1919<<<<<<< HEAD
1920 for(x = 0; x < m_channel.Width; x++)
1921=======
1441 double val = (double)args[0]; 1922 double val = (double)args[0];
1442 for (x = 0; x < m_channel.Width; x++) 1923 for (x = 0; x < m_channel.Width; x++)
1924>>>>>>> avn/ubitvar
1443 { 1925 {
1444 for (y = 0; y < m_channel.Height; y++) 1926 for(y = 0; y < m_channel.Height; y++)
1445 { 1927 {
1446 m_channel[x, y] = Math.Min(val, m_channel[x, y]); 1928 m_channel[x, y] = Math.Min(val, m_channel[x, y]);
1447 } 1929 }
1448 } 1930 }
1931<<<<<<< HEAD
1932 }
1933
1934 private void InterfaceShow(Object[] args)
1935 {
1936 Vector2 point;
1937
1938 if (!ConsoleUtil.TryParseConsole2DVector((string)args[0], null, out point))
1939 {
1940 Console.WriteLine("ERROR: {0} is not a valid vector", args[0]);
1941 return;
1942 }
1943
1944 double height = m_channel[(int)point.X, (int)point.Y];
1945
1946 Console.WriteLine("Terrain height at {0} is {1}", point, height);
1947=======
1948>>>>>>> avn/ubitvar
1449 } 1949 }
1450 1950
1451 private void InterfaceShowDebugStats(Object[] args) 1951 private void InterfaceShowDebugStats(Object[] args)
@@ -1455,10 +1955,10 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1455 double sum = 0; 1955 double sum = 0;
1456 1956
1457 int x; 1957 int x;
1458 for (x = 0; x < m_channel.Width; x++) 1958 for(x = 0; x < m_channel.Width; x++)
1459 { 1959 {
1460 int y; 1960 int y;
1461 for (y = 0; y < m_channel.Height; y++) 1961 for(y = 0; y < m_channel.Height; y++)
1462 { 1962 {
1463 sum += m_channel[x, y]; 1963 sum += m_channel[x, y];
1464 if (max < m_channel[x, y]) 1964 if (max < m_channel[x, y])
@@ -1470,13 +1970,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1470 1970
1471 double avg = sum / (m_channel.Height * m_channel.Width); 1971 double avg = sum / (m_channel.Height * m_channel.Width);
1472 1972
1473 m_log.Info("Channel " + m_channel.Width + "x" + m_channel.Height); 1973 MainConsole.Instance.OutputFormat("Channel {0}x{1}", m_channel.Width, m_channel.Height);
1474 m_log.Info("max/min/avg/sum: " + max + "/" + min + "/" + avg + "/" + sum); 1974 MainConsole.Instance.OutputFormat("max/min/avg/sum: {0}/{1}/{2}/{3}", max, min, avg, sum);
1475 } 1975 }
1476 1976
1477 private void InterfaceEnableExperimentalBrushes(Object[] args) 1977 private void InterfaceEnableExperimentalBrushes(Object[] args)
1478 { 1978 {
1479 if ((bool) args[0]) 1979 if ((bool)args[0])
1480 { 1980 {
1481 m_painteffects[StandardTerrainEffects.Revert] = new WeatherSphere(); 1981 m_painteffects[StandardTerrainEffects.Revert] = new WeatherSphere();
1482 m_painteffects[StandardTerrainEffects.Flatten] = new OlsenSphere(); 1982 m_painteffects[StandardTerrainEffects.Flatten] = new OlsenSphere();
@@ -1491,27 +1991,30 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1491 private void InterfaceRunPluginEffect(Object[] args) 1991 private void InterfaceRunPluginEffect(Object[] args)
1492 { 1992 {
1493 string firstArg = (string)args[0]; 1993 string firstArg = (string)args[0];
1994
1494 if (firstArg == "list") 1995 if (firstArg == "list")
1495 { 1996 {
1496 m_log.Info("List of loaded plugins"); 1997 MainConsole.Instance.Output("List of loaded plugins");
1497 foreach (KeyValuePair<string, ITerrainEffect> kvp in m_plugineffects) 1998 foreach(KeyValuePair<string, ITerrainEffect> kvp in m_plugineffects)
1498 { 1999 {
1499 m_log.Info(kvp.Key); 2000 MainConsole.Instance.Output(kvp.Key);
1500 } 2001 }
1501 return; 2002 return;
1502 } 2003 }
2004
1503 if (firstArg == "reload") 2005 if (firstArg == "reload")
1504 { 2006 {
1505 LoadPlugins(); 2007 LoadPlugins();
1506 return; 2008 return;
1507 } 2009 }
2010
1508 if (m_plugineffects.ContainsKey(firstArg)) 2011 if (m_plugineffects.ContainsKey(firstArg))
1509 { 2012 {
1510 m_plugineffects[firstArg].RunEffect(m_channel); 2013 m_plugineffects[firstArg].RunEffect(m_channel);
1511 } 2014 }
1512 else 2015 else
1513 { 2016 {
1514 m_log.Warn("No such plugin effect loaded."); 2017 MainConsole.Instance.Output("WARNING: No such plugin effect {0} loaded.", firstArg);
1515 } 2018 }
1516 } 2019 }
1517 2020
@@ -1600,12 +2103,17 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1600 new Command("stats", CommandIntentions.COMMAND_STATISTICAL, InterfaceShowDebugStats, 2103 new Command("stats", CommandIntentions.COMMAND_STATISTICAL, InterfaceShowDebugStats,
1601 "Shows some information about the regions heightmap for debugging purposes."); 2104 "Shows some information about the regions heightmap for debugging purposes.");
1602 2105
2106 Command showCommand =
2107 new Command("show", CommandIntentions.COMMAND_NON_HAZARDOUS, InterfaceShow,
2108 "Shows terrain height at a given co-ordinate.");
2109 showCommand.AddArgument("point", "point in <x>,<y> format with no spaces (e.g. 45,45)", "String");
2110
1603 Command experimentalBrushesCommand = 2111 Command experimentalBrushesCommand =
1604 new Command("newbrushes", CommandIntentions.COMMAND_HAZARDOUS, InterfaceEnableExperimentalBrushes, 2112 new Command("newbrushes", CommandIntentions.COMMAND_HAZARDOUS, InterfaceEnableExperimentalBrushes,
1605 "Enables experimental brushes which replace the standard terrain brushes. WARNING: This is a debug setting and may be removed at any time."); 2113 "Enables experimental brushes which replace the standard terrain brushes. WARNING: This is a debug setting and may be removed at any time.");
1606 experimentalBrushesCommand.AddArgument("Enabled?", "true / false - Enable new brushes", "Boolean"); 2114 experimentalBrushesCommand.AddArgument("Enabled?", "true / false - Enable new brushes", "Boolean");
1607 2115
1608 //Plugins 2116 // Plugins
1609 Command pluginRunCommand = 2117 Command pluginRunCommand =
1610 new Command("effect", CommandIntentions.COMMAND_HAZARDOUS, InterfaceRunPluginEffect, "Runs a specified plugin effect"); 2118 new Command("effect", CommandIntentions.COMMAND_HAZARDOUS, InterfaceRunPluginEffect, "Runs a specified plugin effect");
1611 pluginRunCommand.AddArgument("name", "The plugin effect you wish to run, or 'list' to see all plugins", "String"); 2119 pluginRunCommand.AddArgument("name", "The plugin effect you wish to run, or 'list' to see all plugins", "String");
@@ -1621,6 +2129,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1621 m_commander.RegisterCommand("bake", bakeRegionCommand); 2129 m_commander.RegisterCommand("bake", bakeRegionCommand);
1622 m_commander.RegisterCommand("revert", revertRegionCommand); 2130 m_commander.RegisterCommand("revert", revertRegionCommand);
1623 m_commander.RegisterCommand("newbrushes", experimentalBrushesCommand); 2131 m_commander.RegisterCommand("newbrushes", experimentalBrushesCommand);
2132 m_commander.RegisterCommand("show", showCommand);
1624 m_commander.RegisterCommand("stats", showDebugStatsCommand); 2133 m_commander.RegisterCommand("stats", showDebugStatsCommand);
1625 m_commander.RegisterCommand("effect", pluginRunCommand); 2134 m_commander.RegisterCommand("effect", pluginRunCommand);
1626 m_commander.RegisterCommand("flip", flipCommand); 2135 m_commander.RegisterCommand("flip", flipCommand);
@@ -1630,10 +2139,66 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1630 2139
1631 // Add this to our scene so scripts can call these functions 2140 // Add this to our scene so scripts can call these functions
1632 m_scene.RegisterModuleCommander(m_commander); 2141 m_scene.RegisterModuleCommander(m_commander);
2142
2143 // Add Modify command to Scene, since Command object requires fixed-length arglists
2144 m_scene.AddCommand("Terrain", this, "terrain modify",
2145 "terrain modify <operation> <value> [<area>] [<taper>]",
2146 "Modifies the terrain as instructed." +
2147 "\nEach operation can be limited to an area of effect:" +
2148 "\n * -ell=x,y,rx[,ry] constrains the operation to an ellipse centred at x,y" +
2149 "\n * -rec=x,y,dx[,dy] constrains the operation to a rectangle based at x,y" +
2150 "\nEach operation can have its effect tapered based on distance from centre:" +
2151 "\n * elliptical operations taper as cones" +
2152 "\n * rectangular operations taper as pyramids"
2153 ,
2154 ModifyCommand);
2155
1633 } 2156 }
1634 2157
2158 public void ModifyCommand(string module, string[] cmd)
2159 {
2160 string result;
2161 Scene scene = SceneManager.Instance.CurrentScene;
2162 if ((scene != null) && (scene != m_scene))
2163 {
2164 result = String.Empty;
2165 }
2166 else if (cmd.Length > 2)
2167 {
2168 string operationType = cmd[2];
1635 2169
1636 #endregion 2170
2171 ITerrainModifier operation;
2172 if (!m_modifyOperations.TryGetValue(operationType, out operation))
2173 {
2174 result = String.Format("Terrain Modify \"{0}\" not found.", operationType);
2175 }
2176 else if ((cmd.Length > 3) && (cmd[3] == "usage"))
2177 {
2178 result = "Usage: " + operation.GetUsage();
2179 }
2180 else
2181 {
2182 result = operation.ModifyTerrain(m_channel, cmd);
2183 }
2184
2185 if (result == String.Empty)
2186 {
2187 result = "Modified terrain";
2188 m_log.DebugFormat("Performed terrain operation {0}", operationType);
2189 }
2190 }
2191 else
2192 {
2193 result = "Usage: <operation-name> <arg1> <arg2>...";
2194 }
2195 if (result != String.Empty)
2196 {
2197 MainConsole.Instance.Output(result);
2198 }
2199 }
2200
2201#endregion
1637 2202
1638 } 2203 }
1639} 2204}
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainModuleTests.cs
index e2178e5..0563ad0 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/MockScene.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainModuleTests.cs
@@ -25,55 +25,51 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System.Net; 28using System;
29using OpenMetaverse; 29using NUnit.Framework;
30using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenSim.Region.CoreModules.World.Terrain;
31using OpenSim.Region.Framework.Scenes; 32using OpenSim.Region.Framework.Scenes;
32using GridRegion = OpenSim.Services.Interfaces.GridRegion; 33using OpenSim.Tests.Common;
33 34
34namespace OpenSim.Region.ClientStack.LindenUDP.Tests 35namespace OpenSim.Region.CoreModules.Terrain.Tests
35{ 36{
36 /// <summary> 37 public class TerrainModuleTests : OpenSimTestCase
37 /// Mock scene for unit tests
38 /// </summary>
39 public class MockScene : SceneBase
40 { 38 {
41 public int ObjectNameCallsReceived 39 [Test]
40 public void TestTerrainFill()
42 { 41 {
43 get { return m_objectNameCallsReceived; } 42 TestHelpers.InMethod();
44 } 43// TestHelpers.EnableLogging();
45 protected int m_objectNameCallsReceived;
46
47 public MockScene() : base(new RegionInfo(1000, 1000, null, null))
48 {
49 m_regStatus = RegionStatus.Up;
50 }
51
52 public override void Update(int frames) {}
53 public override void LoadWorldMap() {}
54
55 public override ISceneAgent AddNewAgent(IClientAPI client, PresenceType type)
56 {
57 client.OnObjectName += RecordObjectNameCall;
58 44
59 // FIXME 45 //UUID userId = TestHelpers.ParseTail(0x1);
60 return null;
61 }
62 46
63 public override bool CloseAgent(UUID agentID, bool force) { return true; } 47 TerrainModule tm = new TerrainModule();
48 Scene scene = new SceneHelpers().SetupScene();
49 SceneHelpers.SetupSceneModules(scene, tm);
64 50
65 public override bool CheckClient(UUID clientId, IPEndPoint endPoint) { return true; } 51 // Fillheight of 30
52 {
53 double fillHeight = 30;
66 54
67 public override void OtherRegionUp(GridRegion otherRegion) { } 55 tm.InterfaceFillTerrain(new object[] { fillHeight });
68 56
69 public override bool TryGetScenePresence(UUID uuid, out ScenePresence sp) { sp = null; return false; } 57 double height = scene.Heightmap[128, 128];
70 58
71 /// <summary> 59 Assert.AreEqual(fillHeight, height);
72 /// Doesn't really matter what the call is - we're using this to test that a packet has actually been received 60 }
73 /// </summary> 61
74 protected void RecordObjectNameCall(IClientAPI remoteClient, uint localID, string message) 62 // Max fillheight of 30
75 { 63 // According to http://wiki.secondlife.com/wiki/Tips_for_Creating_Heightfields_and_Details_on_Terrain_RAW_Files#Notes_for_Creating_Height_Field_Maps_for_Second_Life
76 m_objectNameCallsReceived++; 64 {
65 double fillHeight = 508;
66
67 tm.InterfaceFillTerrain(new object[] { fillHeight });
68
69 double height = scene.Heightmap[128, 128];
70
71 Assert.AreEqual(fillHeight, height);
72 }
77 } 73 }
78 } 74 }
79} 75} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs
index 2329c1f..40db370 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs
@@ -60,8 +60,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests
60 TerrainChannel map = new TerrainChannel((int)Constants.RegionSize, (int)Constants.RegionSize); 60 TerrainChannel map = new TerrainChannel((int)Constants.RegionSize, (int)Constants.RegionSize);
61 ITerrainPaintableEffect effect = new RaiseSphere(); 61 ITerrainPaintableEffect effect = new RaiseSphere();
62 62
63<<<<<<< HEAD
64 effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0);
65=======
63 effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0, 66 effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0,
64 0, midRegion - 1,0, (int)Constants.RegionSize -1); 67 0, midRegion - 1,0, (int)Constants.RegionSize -1);
68>>>>>>> avn/ubitvar
65 Assert.That(map[127, midRegion] > 0.0, "Raise brush should raising value at this point (127,128)."); 69 Assert.That(map[127, midRegion] > 0.0, "Raise brush should raising value at this point (127,128).");
66 Assert.That(map[125, midRegion] > 0.0, "Raise brush should raising value at this point (124,128)."); 70 Assert.That(map[125, midRegion] > 0.0, "Raise brush should raising value at this point (124,128).");
67 Assert.That(map[120, midRegion] == 0.0, "Raise brush should not change value at this point (120,128)."); 71 Assert.That(map[120, midRegion] == 0.0, "Raise brush should not change value at this point (120,128).");
@@ -80,8 +84,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests
80 } 84 }
81 effect = new LowerSphere(); 85 effect = new LowerSphere();
82 86
87<<<<<<< HEAD
88 effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0);
89=======
83 effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0, 90 effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0,
84 0, (int)Constants.RegionSize -1,0, (int)Constants.RegionSize -1); 91 0, (int)Constants.RegionSize -1,0, (int)Constants.RegionSize -1);
92>>>>>>> avn/ubitvar
85 Assert.That(map[127, midRegion] >= 0.0, "Lower should not lowering value below 0.0 at this point (127,128)."); 93 Assert.That(map[127, midRegion] >= 0.0, "Lower should not lowering value below 0.0 at this point (127,128).");
86 Assert.That(map[127, midRegion] == 0.0, "Lower brush should lowering value to 0.0 at this point (127,128)."); 94 Assert.That(map[127, midRegion] == 0.0, "Lower brush should lowering value to 0.0 at this point (127,128).");
87 Assert.That(map[125, midRegion] < 1.0, "Lower brush should lowering value at this point (124,128)."); 95 Assert.That(map[125, midRegion] < 1.0, "Lower brush should lowering value at this point (124,128).");
@@ -104,10 +112,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests
104 x[0, 0] -= 1.0; 112 x[0, 0] -= 1.0;
105 Assert.That(x[0, 0] == 4.0, "Terrain addition/subtraction error."); 113 Assert.That(x[0, 0] == 4.0, "Terrain addition/subtraction error.");
106 114
107 x[0, 0] = Math.PI;
108 double[,] doublesExport = x.GetDoubles();
109 Assert.That(doublesExport[0, 0] == Math.PI, "Export to double[,] array not working correctly.");
110
111 x[0, 0] = 1.0; 115 x[0, 0] = 1.0;
112 float[] floatsExport = x.GetFloatsSerialised(); 116 float[] floatsExport = x.GetFloatsSerialised();
113 Assert.That(floatsExport[0] == 1.0f, "Export to float[] not working correctly."); 117 Assert.That(floatsExport[0] == 1.0f, "Export to float[] not working correctly.");
diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs
index 91ca7e2..77c10b8 100644
--- a/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs
+++ b/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -73,133 +73,131 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
73 /// Builds a composited terrain texture given the region texture 73 /// Builds a composited terrain texture given the region texture
74 /// and heightmap settings 74 /// and heightmap settings
75 /// </summary> 75 /// </summary>
76 /// <param name="heightmap">Terrain heightmap</param> 76 /// <param name="terrain">Terrain heightmap</param>
77 /// <param name="regionInfo">Region information including terrain texture parameters</param> 77 /// <param name="regionInfo">Region information including terrain texture parameters</param>
78 /// <returns>A composited 256x256 RGB texture ready for rendering</returns> 78 /// <returns>A 256x256 square RGB texture ready for rendering</returns>
79 /// <remarks>Based on the algorithm described at http://opensimulator.org/wiki/Terrain_Splatting 79 /// <remarks>Based on the algorithm described at http://opensimulator.org/wiki/Terrain_Splatting
80 /// Note we create a 256x256 dimension texture even if the actual terrain is larger.
80 /// </remarks> 81 /// </remarks>
82<<<<<<< HEAD
83 public static Bitmap Splat(ITerrainChannel terrain,
84 UUID[] textureIDs, float[] startHeights, float[] heightRanges,
85 Vector3d regionPosition, IAssetService assetService, bool textureTerrain)
86=======
81 public static Bitmap Splat(ITerrainChannel terrain, UUID[] textureIDs, float[] startHeights, float[] heightRanges, Vector3d regionPosition, IAssetService assetService, bool textureTerrain) 87 public static Bitmap Splat(ITerrainChannel terrain, UUID[] textureIDs, float[] startHeights, float[] heightRanges, Vector3d regionPosition, IAssetService assetService, bool textureTerrain)
88>>>>>>> avn/ubitvar
82 { 89 {
83 Debug.Assert(textureIDs.Length == 4); 90 Debug.Assert(textureIDs.Length == 4);
84 Debug.Assert(startHeights.Length == 4); 91 Debug.Assert(startHeights.Length == 4);
85 Debug.Assert(heightRanges.Length == 4); 92 Debug.Assert(heightRanges.Length == 4);
86 93
87 Bitmap[] detailTexture = new Bitmap[4]; 94 Bitmap[] detailTexture = new Bitmap[4];
88 Bitmap output = null;
89 BitmapData outputData = null;
90 95
91 try 96 if (textureTerrain)
92 { 97 {
93 if (textureTerrain) 98 // Swap empty terrain textureIDs with default IDs
99 for (int i = 0; i < textureIDs.Length; i++)
94 { 100 {
95 // Swap empty terrain textureIDs with default IDs 101 if (textureIDs[i] == UUID.Zero)
96 for (int i = 0; i < textureIDs.Length; i++) 102 textureIDs[i] = DEFAULT_TERRAIN_DETAIL[i];
97 { 103 }
98 if (textureIDs[i] == UUID.Zero) 104
99 textureIDs[i] = DEFAULT_TERRAIN_DETAIL[i]; 105 #region Texture Fetching
100 } 106
101 107 if (assetService != null)
102 #region Texture Fetching 108 {
103 109 for (int i = 0; i < 4; i++)
104 if (assetService != null)
105 { 110 {
106 for (int i = 0; i < 4; i++) 111 AssetBase asset;
112 UUID cacheID = UUID.Combine(TERRAIN_CACHE_MAGIC, textureIDs[i]);
113
114 // Try to fetch a cached copy of the decoded/resized version of this texture
115 asset = assetService.GetCached(cacheID.ToString());
116 if (asset != null)
107 { 117 {
108 AssetBase asset; 118 try
109 UUID cacheID = UUID.Combine(TERRAIN_CACHE_MAGIC, textureIDs[i]); 119 {
110 120 using (System.IO.MemoryStream stream = new System.IO.MemoryStream(asset.Data))
111 // Try to fetch a cached copy of the decoded/resized version of this texture 121 detailTexture[i] = (Bitmap)Image.FromStream(stream);
112 asset = assetService.GetCached(cacheID.ToString()); 122 }
123 catch (Exception ex)
124 {
125 m_log.Warn("Failed to decode cached terrain texture " + cacheID +
126 " (textureID: " + textureIDs[i] + "): " + ex.Message);
127 }
128 }
129
130 if (detailTexture[i] == null)
131 {
132 // Try to fetch the original JPEG2000 texture, resize if needed, and cache as PNG
133 asset = assetService.Get(textureIDs[i].ToString());
113 if (asset != null) 134 if (asset != null)
114 { 135 {
115// m_log.DebugFormat( 136// m_log.DebugFormat(
116// "[TERRAIN SPLAT]: Got asset service cached terrain texture {0} {1}", i, asset.ID); 137// "[TERRAIN SPLAT]: Got cached original JPEG2000 terrain texture {0} {1}", i, asset.ID);
117 138
118 try 139 try { detailTexture[i] = (Bitmap)CSJ2K.J2kImage.FromBytes(asset.Data); }
119 {
120 using (System.IO.MemoryStream stream = new System.IO.MemoryStream(asset.Data))
121 detailTexture[i] = (Bitmap)Image.FromStream(stream);
122 }
123 catch (Exception ex) 140 catch (Exception ex)
124 { 141 {
125 m_log.Warn("Failed to decode cached terrain texture " + cacheID + 142 m_log.Warn("Failed to decode terrain texture " + asset.ID + ": " + ex.Message);
126 " (textureID: " + textureIDs[i] + "): " + ex.Message);
127 } 143 }
128 } 144 }
129
130 if (detailTexture[i] == null)
131 {
132 // Try to fetch the original JPEG2000 texture, resize if needed, and cache as PNG
133 asset = assetService.Get(textureIDs[i].ToString());
134 if (asset != null)
135 {
136// m_log.DebugFormat(
137// "[TERRAIN SPLAT]: Got cached original JPEG2000 terrain texture {0} {1}", i, asset.ID);
138 145
139 try { detailTexture[i] = (Bitmap)CSJ2K.J2kImage.FromBytes(asset.Data); } 146 if (detailTexture[i] != null)
140 catch (Exception ex) 147 {
148 // Make sure this texture is the correct size, otherwise resize
149 if (detailTexture[i].Width != 256 || detailTexture[i].Height != 256)
150 {
151 using (Bitmap origBitmap = detailTexture[i])
141 { 152 {
142 m_log.Warn("Failed to decode terrain texture " + asset.ID + ": " + ex.Message); 153 detailTexture[i] = ImageUtils.ResizeImage(origBitmap, 256, 256);
143 } 154 }
144 } 155 }
145 156
146 if (detailTexture[i] != null) 157 // Save the decoded and resized texture to the cache
147 { 158 byte[] data;
148 // Make sure this texture is the correct size, otherwise resize 159 using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
149 if (detailTexture[i].Width != 256 || detailTexture[i].Height != 256) 160 {
150 { 161 detailTexture[i].Save(stream, ImageFormat.Png);
151 using (Bitmap origBitmap = detailTexture[i]) 162 data = stream.ToArray();
152 {
153 detailTexture[i] = ImageUtils.ResizeImage(origBitmap, 256, 256);
154 }
155 }
156
157 // Save the decoded and resized texture to the cache
158 byte[] data;
159 using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
160 {
161 detailTexture[i].Save(stream, ImageFormat.Png);
162 data = stream.ToArray();
163 }
164
165 // Cache a PNG copy of this terrain texture
166 AssetBase newAsset = new AssetBase
167 {
168 Data = data,
169 Description = "PNG",
170 Flags = AssetFlags.Collectable,
171 FullID = cacheID,
172 ID = cacheID.ToString(),
173 Local = true,
174 Name = String.Empty,
175 Temporary = true,
176 Type = (sbyte)AssetType.Unknown
177 };
178 newAsset.Metadata.ContentType = "image/png";
179 assetService.Store(newAsset);
180 } 163 }
164
165 // Cache a PNG copy of this terrain texture
166 AssetBase newAsset = new AssetBase
167 {
168 Data = data,
169 Description = "PNG",
170 Flags = AssetFlags.Collectable,
171 FullID = cacheID,
172 ID = cacheID.ToString(),
173 Local = true,
174 Name = String.Empty,
175 Temporary = true,
176 Type = (sbyte)AssetType.Unknown
177 };
178 newAsset.Metadata.ContentType = "image/png";
179 assetService.Store(newAsset);
181 } 180 }
182 } 181 }
183 } 182 }
184
185 #endregion Texture Fetching
186 } 183 }
187 184
188 // Fill in any missing textures with a solid color 185 #endregion Texture Fetching
189 for (int i = 0; i < 4; i++) 186 }
187
188 // Fill in any missing textures with a solid color
189 for (int i = 0; i < 4; i++)
190 {
191 if (detailTexture[i] == null)
190 { 192 {
191 if (detailTexture[i] == null) 193 m_log.DebugFormat("{0} Missing terrain texture for layer {1}. Filling with solid default color",
194 LogHeader, i);
195 // Create a solid color texture for this layer
196 detailTexture[i] = new Bitmap(256, 256, PixelFormat.Format24bppRgb);
197 using (Graphics gfx = Graphics.FromImage(detailTexture[i]))
192 { 198 {
193// m_log.DebugFormat( 199 using (SolidBrush brush = new SolidBrush(DEFAULT_TERRAIN_COLOR[i]))
194// "[TERRAIN SPLAT]: Generating solid colour for missing texture {0}", i); 200 gfx.FillRectangle(brush, 0, 0, 256, 256);
195
196 // Create a solid color texture for this layer
197 detailTexture[i] = new Bitmap(256, 256, PixelFormat.Format24bppRgb);
198 using (Graphics gfx = Graphics.FromImage(detailTexture[i]))
199 {
200 using (SolidBrush brush = new SolidBrush(DEFAULT_TERRAIN_COLOR[i]))
201 gfx.FillRectangle(brush, 0, 0, 256, 256);
202 }
203 } 201 }
204 else 202 else
205 { 203 {
@@ -209,6 +207,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
209 } 207 }
210 } 208 }
211 } 209 }
210<<<<<<< HEAD
211 else
212=======
212 213
213 #region Layer Map 214 #region Layer Map
214 215
@@ -218,9 +219,13 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
218 int yFactor = terrain.Height / 256; 219 int yFactor = terrain.Height / 256;
219 220
220 for (int y = 0; y < 256; y++) 221 for (int y = 0; y < 256; y++)
222>>>>>>> avn/ubitvar
221 { 223 {
222 for (int x = 0; x < 256; x++) 224 if (detailTexture[i].Width != 256 || detailTexture[i].Height != 256)
223 { 225 {
226<<<<<<< HEAD
227 detailTexture[i] = ResizeBitmap(detailTexture[i], 256, 256);
228=======
224 float height = (float)terrain[x * xFactor, y * yFactor]; 229 float height = (float)terrain[x * xFactor, y * yFactor];
225 230
226 float pctX = (float)x / 255f; 231 float pctX = (float)x / 255f;
@@ -261,18 +266,69 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
261 float layer = ((height + noise - startHeight) / heightRange) * 4f; 266 float layer = ((height + noise - startHeight) / heightRange) * 4f;
262 if (Single.IsNaN(layer)) layer = 0f; 267 if (Single.IsNaN(layer)) layer = 0f;
263 layermap[x,y] = Utils.Clamp(layer, 0f, 3f); 268 layermap[x,y] = Utils.Clamp(layer, 0f, 3f);
269>>>>>>> avn/ubitvar
264 } 270 }
265 } 271 }
266 272 }
267 #endregion Layer Map 273
268 274 #region Layer Map
269 #region Texture Compositing 275
270 276 float[,] layermap = new float[256, 256];
271 output = new Bitmap(256, 256, PixelFormat.Format24bppRgb); 277
272 outputData = output.LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.WriteOnly, PixelFormat.Format24bppRgb); 278 // Scale difference between actual region size and the 256 texture being created
273 279 int xFactor = terrain.Width / 256;
274 unsafe 280 int yFactor = terrain.Height / 256;
281
282 // Create 'layermap' where each value is the fractional layer number to place
283 // at that point. For instance, a value of 1.345 gives the blending of
284 // layer 1 and layer 2 for that point.
285 for (int y = 0; y < 256; y++)
286 {
287 for (int x = 0; x < 256; x++)
275 { 288 {
289<<<<<<< HEAD
290 float height = (float)terrain[x * xFactor, y * yFactor];
291
292 float pctX = (float)x / 255f;
293 float pctY = (float)y / 255f;
294
295 // Use bilinear interpolation between the four corners of start height and
296 // height range to select the current values at this position
297 float startHeight = ImageUtils.Bilinear(
298 startHeights[0],
299 startHeights[2],
300 startHeights[1],
301 startHeights[3],
302 pctX, pctY);
303 startHeight = Utils.Clamp(startHeight, 0f, 255f);
304
305 float heightRange = ImageUtils.Bilinear(
306 heightRanges[0],
307 heightRanges[2],
308 heightRanges[1],
309 heightRanges[3],
310 pctX, pctY);
311 heightRange = Utils.Clamp(heightRange, 0f, 255f);
312
313 // Generate two frequencies of perlin noise based on our global position
314 // The magic values were taken from http://opensimulator.org/wiki/Terrain_Splatting
315 Vector3 vec = new Vector3
316 (
317 ((float)regionPosition.X + (x * xFactor)) * 0.20319f,
318 ((float)regionPosition.Y + (y * yFactor)) * 0.20319f,
319 height * 0.25f
320 );
321
322 float lowFreq = Perlin.noise2(vec.X * 0.222222f, vec.Y * 0.222222f) * 6.5f;
323 float highFreq = Perlin.turbulence2(vec.X, vec.Y, 2f) * 2.25f;
324 float noise = (lowFreq + highFreq) * 2f;
325
326 // Combine the current height, generated noise, start height, and height range parameters, then scale all of it
327 float layer = ((height + noise - startHeight) / heightRange) * 4f;
328 if (Single.IsNaN(layer))
329 layer = 0f;
330 layermap[x, y] = Utils.Clamp(layer, 0f, 3f);
331=======
276 // Get handles to all of the texture data arrays 332 // Get handles to all of the texture data arrays
277 BitmapData[] datas = new BitmapData[] 333 BitmapData[] datas = new BitmapData[]
278 { 334 {
@@ -323,15 +379,78 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
323 379
324 for (int i = 0; i < 4; i++) 380 for (int i = 0; i < 4; i++)
325 detailTexture[i].UnlockBits(datas[i]); 381 detailTexture[i].UnlockBits(datas[i]);
382>>>>>>> avn/ubitvar
326 } 383 }
327 } 384 }
328 finally 385
386 #endregion Layer Map
387
388 #region Texture Compositing
389
390 Bitmap output = new Bitmap(256, 256, PixelFormat.Format24bppRgb);
391 BitmapData outputData = output.LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.WriteOnly, PixelFormat.Format24bppRgb);
392
393 // Unsafe work as we lock down the source textures for quicker access and access the
394 // pixel data directly
395 unsafe
329 { 396 {
330 for (int i = 0; i < 4; i++) 397 // Get handles to all of the texture data arrays
331 if (detailTexture[i] != null) 398 BitmapData[] datas = new BitmapData[]
332 detailTexture[i].Dispose(); 399 {
400 detailTexture[0].LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.ReadOnly, detailTexture[0].PixelFormat),
401 detailTexture[1].LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.ReadOnly, detailTexture[1].PixelFormat),
402 detailTexture[2].LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.ReadOnly, detailTexture[2].PixelFormat),
403 detailTexture[3].LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.ReadOnly, detailTexture[3].PixelFormat)
404 };
405
406 // Compute size of each pixel data (used to address into the pixel data array)
407 int[] comps = new int[]
408 {
409 (datas[0].PixelFormat == PixelFormat.Format32bppArgb) ? 4 : 3,
410 (datas[1].PixelFormat == PixelFormat.Format32bppArgb) ? 4 : 3,
411 (datas[2].PixelFormat == PixelFormat.Format32bppArgb) ? 4 : 3,
412 (datas[3].PixelFormat == PixelFormat.Format32bppArgb) ? 4 : 3
413 };
414
415 for (int y = 0; y < 256; y++)
416 {
417 for (int x = 0; x < 256; x++)
418 {
419 float layer = layermap[x, y];
420
421 // Select two textures
422 int l0 = (int)Math.Floor(layer);
423 int l1 = Math.Min(l0 + 1, 3);
424
425 byte* ptrA = (byte*)datas[l0].Scan0 + y * datas[l0].Stride + x * comps[l0];
426 byte* ptrB = (byte*)datas[l1].Scan0 + y * datas[l1].Stride + x * comps[l1];
427 byte* ptrO = (byte*)outputData.Scan0 + y * outputData.Stride + x * 3;
428
429 float aB = *(ptrA + 0);
430 float aG = *(ptrA + 1);
431 float aR = *(ptrA + 2);
432
433 float bB = *(ptrB + 0);
434 float bG = *(ptrB + 1);
435 float bR = *(ptrB + 2);
436
437 float layerDiff = layer - l0;
438
439 // Interpolate between the two selected textures
440 *(ptrO + 0) = (byte)Math.Floor(aB + layerDiff * (bB - aB));
441 *(ptrO + 1) = (byte)Math.Floor(aG + layerDiff * (bG - aG));
442 *(ptrO + 2) = (byte)Math.Floor(aR + layerDiff * (bR - aR));
443 }
444 }
445
446 for (int i = 0; i < detailTexture.Length; i++)
447 detailTexture[i].UnlockBits(datas[i]);
333 } 448 }
334 449
450 for (int i = 0; i < detailTexture.Length; i++)
451 if (detailTexture[i] != null)
452 detailTexture[i].Dispose();
453
335 output.UnlockBits(outputData); 454 output.UnlockBits(outputData);
336 455
337 // We generated the texture upside down, so flip it 456 // We generated the texture upside down, so flip it
@@ -352,6 +471,10 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
352 b.Dispose(); 471 b.Dispose();
353 return result; 472 return result;
354 } 473 }
474<<<<<<< HEAD
475
476=======
477>>>>>>> avn/ubitvar
355 public static Bitmap SplatSimple(float[] heightmap) 478 public static Bitmap SplatSimple(float[] heightmap)
356 { 479 {
357 const float BASE_HSV_H = 93f / 360f; 480 const float BASE_HSV_H = 93f / 360f;
diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs
index f538c9e..d8420d9 100644
--- a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs
@@ -31,21 +31,25 @@ using System.Drawing;
31using System.Drawing.Imaging; 31using System.Drawing.Imaging;
32using System.IO; 32using System.IO;
33using System.Reflection; 33using System.Reflection;
34
34using CSJ2K; 35using CSJ2K;
35using Nini.Config; 36using Nini.Config;
36using log4net; 37using log4net;
37using Rednettle.Warp3D; 38using Rednettle.Warp3D;
38using Mono.Addins; 39using Mono.Addins;
39using OpenMetaverse; 40
40using OpenMetaverse.Imaging;
41using OpenMetaverse.Rendering;
42using OpenMetaverse.StructuredData;
43using OpenSim.Framework; 41using OpenSim.Framework;
44using OpenSim.Region.Framework.Interfaces; 42using OpenSim.Region.Framework.Interfaces;
45using OpenSim.Region.Framework.Scenes; 43using OpenSim.Region.Framework.Scenes;
46using OpenSim.Region.Physics.Manager; 44using OpenSim.Region.Physics.Manager;
47using OpenSim.Services.Interfaces; 45using OpenSim.Services.Interfaces;
48 46
47using OpenMetaverse;
48using OpenMetaverse.Assets;
49using OpenMetaverse.Imaging;
50using OpenMetaverse.Rendering;
51using OpenMetaverse.StructuredData;
52
49using WarpRenderer = global::Warp3D.Warp3D; 53using WarpRenderer = global::Warp3D.Warp3D;
50 54
51namespace OpenSim.Region.CoreModules.World.Warp3DMap 55namespace OpenSim.Region.CoreModules.World.Warp3DMap
@@ -58,11 +62,22 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
58 62
59 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 63 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
60 64
65#pragma warning disable 414
66 private static string LogHeader = "[WARP 3D IMAGE MODULE]";
67#pragma warning restore 414
68
61 private Scene m_scene; 69 private Scene m_scene;
62 private IRendering m_primMesher; 70 private IRendering m_primMesher;
63 private IConfigSource m_config;
64 private Dictionary<UUID, Color4> m_colors = new Dictionary<UUID, Color4>(); 71 private Dictionary<UUID, Color4> m_colors = new Dictionary<UUID, Color4>();
65 private bool m_useAntiAliasing = false; // TODO: Make this a config option 72
73 private IConfigSource m_config;
74 private bool m_drawPrimVolume = true; // true if should render the prims on the tile
75 private bool m_textureTerrain = true; // true if to create terrain splatting texture
76 private bool m_texturePrims = true; // true if should texture the rendered prims
77 private float m_texturePrimSize = 48f; // size of prim before we consider texturing it
78 private bool m_renderMeshes = false; // true if to render meshes rather than just bounding boxes
79 private bool m_useAntiAliasing = false; // true if to anti-alias the rendered image
80
66 private bool m_Enabled = false; 81 private bool m_Enabled = false;
67 82
68 private Bitmap lastImage = null; 83 private Bitmap lastImage = null;
@@ -74,11 +89,27 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
74 { 89 {
75 m_config = source; 90 m_config = source;
76 91
92 string[] configSections = new string[] { "Map", "Startup" };
93
77 if (Util.GetConfigVarFromSections<string>( 94 if (Util.GetConfigVarFromSections<string>(
78 m_config, "MapImageModule", new string[] { "Startup", "Map" }, "MapImageModule") != "Warp3DImageModule") 95 m_config, "MapImageModule", configSections, "MapImageModule") != "Warp3DImageModule")
79 return; 96 return;
80 97
81 m_Enabled = true; 98 m_Enabled = true;
99
100 m_drawPrimVolume
101 = Util.GetConfigVarFromSections<bool>(m_config, "DrawPrimOnMapTile", configSections, m_drawPrimVolume);
102 m_textureTerrain
103 = Util.GetConfigVarFromSections<bool>(m_config, "TextureOnMapTile", configSections, m_textureTerrain);
104 m_texturePrims
105 = Util.GetConfigVarFromSections<bool>(m_config, "TexturePrims", configSections, m_texturePrims);
106 m_texturePrimSize
107 = Util.GetConfigVarFromSections<float>(m_config, "TexturePrimSize", configSections, m_texturePrimSize);
108 m_renderMeshes
109 = Util.GetConfigVarFromSections<bool>(m_config, "RenderMeshes", configSections, m_renderMeshes);
110 m_useAntiAliasing
111 = Util.GetConfigVarFromSections<bool>(m_config, "UseAntiAliasing", configSections, m_useAntiAliasing);
112
82 } 113 }
83 114
84 public void AddRegion(Scene scene) 115 public void AddRegion(Scene scene)
@@ -125,6 +156,13 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
125 156
126 public Bitmap CreateMapTile() 157 public Bitmap CreateMapTile()
127 { 158 {
159<<<<<<< HEAD
160 // Vector3 camPos = new Vector3(127.5f, 127.5f, 221.7025033688163f);
161 // Camera above the middle of the region
162 Vector3 camPos = new Vector3(
163 m_scene.RegionInfo.RegionSizeX/2 - 0.5f,
164 m_scene.RegionInfo.RegionSizeY/2 - 0.5f,
165=======
128 /* this must be on all map, not just its image 166 /* this must be on all map, not just its image
129 if ((DateTime.Now - lastImageTime).TotalSeconds < 3600) 167 if ((DateTime.Now - lastImageTime).TotalSeconds < 3600)
130 { 168 {
@@ -141,10 +179,16 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
141 Vector3 camPos = new Vector3( 179 Vector3 camPos = new Vector3(
142 m_scene.RegionInfo.RegionSizeX / 2 - 0.5f, 180 m_scene.RegionInfo.RegionSizeX / 2 - 0.5f,
143 m_scene.RegionInfo.RegionSizeY / 2 - 0.5f, 181 m_scene.RegionInfo.RegionSizeY / 2 - 0.5f,
182>>>>>>> avn/ubitvar
144 221.7025033688163f); 183 221.7025033688163f);
145 // Viewport viewing down onto the region 184 // Viewport viewing down onto the region
146 Viewport viewport = new Viewport(camPos, -Vector3.UnitZ, 1024f, 0.1f, 185 Viewport viewport = new Viewport(camPos, -Vector3.UnitZ, 1024f, 0.1f,
147 (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY, 186 (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY,
187<<<<<<< HEAD
188 (float)m_scene.RegionInfo.RegionSizeX, (float)m_scene.RegionInfo.RegionSizeY );
189 // Fill the viewport and return the image
190 return CreateMapTile(viewport, false);
191=======
148 (float)m_scene.RegionInfo.RegionSizeX, (float)m_scene.RegionInfo.RegionSizeY); 192 (float)m_scene.RegionInfo.RegionSizeX, (float)m_scene.RegionInfo.RegionSizeY);
149 193
150 Bitmap tile = CreateMapTile(viewport, false); 194 Bitmap tile = CreateMapTile(viewport, false);
@@ -155,26 +199,17 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
155 lastImageTime = DateTime.Now; 199 lastImageTime = DateTime.Now;
156 return (Bitmap)lastImage.Clone(); 200 return (Bitmap)lastImage.Clone();
157 */ 201 */
202>>>>>>> avn/ubitvar
158 } 203 }
159 204
160 public Bitmap CreateViewImage(Vector3 camPos, Vector3 camDir, float fov, int width, int height, bool useTextures) 205 public Bitmap CreateViewImage(Vector3 camPos, Vector3 camDir, float fov, int width, int height, bool useTextures)
161 { 206 {
162 Viewport viewport = new Viewport(camPos, camDir, fov, (float)Constants.RegionSize, 0.1f, width, height); 207 Viewport viewport = new Viewport(camPos, camDir, fov, Constants.RegionSize, 0.1f, width, height);
163 return CreateMapTile(viewport, useTextures); 208 return CreateMapTile(viewport, useTextures);
164 } 209 }
165 210
166 public Bitmap CreateMapTile(Viewport viewport, bool useTextures) 211 public Bitmap CreateMapTile(Viewport viewport, bool useTextures)
167 { 212 {
168 bool drawPrimVolume = true;
169 bool textureTerrain = true;
170
171 string[] configSections = new string[] { "Map", "Startup" };
172
173 drawPrimVolume
174 = Util.GetConfigVarFromSections<bool>(m_config, "DrawPrimOnMapTile", configSections, drawPrimVolume);
175 textureTerrain
176 = Util.GetConfigVarFromSections<bool>(m_config, "TextureOnMapTile", configSections, textureTerrain);
177
178 m_colors.Clear(); 213 m_colors.Clear();
179 214
180 int width = viewport.Width; 215 int width = viewport.Width;
@@ -187,6 +222,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
187 } 222 }
188 223
189 WarpRenderer renderer = new WarpRenderer(); 224 WarpRenderer renderer = new WarpRenderer();
225
190 renderer.CreateScene(width, height); 226 renderer.CreateScene(width, height);
191 renderer.Scene.autoCalcNormals = false; 227 renderer.Scene.autoCalcNormals = false;
192 228
@@ -218,8 +254,8 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
218 renderer.Scene.addLight("Light2", new warp_Light(new warp_Vector(-1f, -1f, 1f), 0xffffff, 0, 100, 40)); 254 renderer.Scene.addLight("Light2", new warp_Light(new warp_Vector(-1f, -1f, 1f), 0xffffff, 0, 100, 40));
219 255
220 CreateWater(renderer); 256 CreateWater(renderer);
221 CreateTerrain(renderer, textureTerrain); 257 CreateTerrain(renderer, m_textureTerrain);
222 if (drawPrimVolume) 258 if (m_drawPrimVolume)
223 CreateAllPrims(renderer, useTextures); 259 CreateAllPrims(renderer, useTextures);
224 260
225 renderer.Render(); 261 renderer.Render();
@@ -235,6 +271,18 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
235 // afterwards. It's generally regarded as a bad idea to manually GC. If Warp3D is using lots of memory 271 // afterwards. It's generally regarded as a bad idea to manually GC. If Warp3D is using lots of memory
236 // then this may be some issue with the Warp3D code itself, though it's also quite possible that generating 272 // then this may be some issue with the Warp3D code itself, though it's also quite possible that generating
237 // this map tile simply takes a lot of memory. 273 // this map tile simply takes a lot of memory.
274 foreach (var o in renderer.Scene.objectData.Values)
275 {
276 warp_Object obj = (warp_Object)o;
277 obj.vertexData = null;
278 obj.triangleData = null;
279 }
280
281 renderer.Scene.removeAllObjects();
282 renderer = null;
283 viewport = null;
284
285 m_colors.Clear();
238 GC.Collect(); 286 GC.Collect();
239 m_log.Debug("[WARP 3D IMAGE MODULE]: GC.Collect()"); 287 m_log.Debug("[WARP 3D IMAGE MODULE]: GC.Collect()");
240 288
@@ -261,21 +309,32 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
261 309
262 #region Rendering Methods 310 #region Rendering Methods
263 311
312 // Add a water plane to the renderer.
264 private void CreateWater(WarpRenderer renderer) 313 private void CreateWater(WarpRenderer renderer)
265 { 314 {
266 float waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; 315 float waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight;
267 316
268 renderer.AddPlane("Water", m_scene.RegionInfo.RegionSizeX * 0.5f); 317 renderer.AddPlane("Water", m_scene.RegionInfo.RegionSizeX * 0.5f);
318<<<<<<< HEAD
319 renderer.Scene.sceneobject("Water").setPos(m_scene.RegionInfo.RegionSizeX/2 - 0.5f,
320 waterHeight,
321 m_scene.RegionInfo.RegionSizeY/2 - 0.5f );
322=======
269 renderer.Scene.sceneobject("Water").setPos(m_scene.RegionInfo.RegionSizeX / 2 - 0.5f, 323 renderer.Scene.sceneobject("Water").setPos(m_scene.RegionInfo.RegionSizeX / 2 - 0.5f,
270 waterHeight, 324 waterHeight,
271 m_scene.RegionInfo.RegionSizeY / 2 - 0.5f); 325 m_scene.RegionInfo.RegionSizeY / 2 - 0.5f);
326>>>>>>> avn/ubitvar
272 327
273 renderer.AddMaterial("WaterColor", ConvertColor(WATER_COLOR)); 328 warp_Material waterColorMaterial = new warp_Material(ConvertColor(WATER_COLOR));
274 renderer.Scene.material("WaterColor").setReflectivity(0); // match water color with standard map module thanks lkalif 329 waterColorMaterial.setReflectivity(0); // match water color with standard map module thanks lkalif
275 renderer.Scene.material("WaterColor").setTransparency((byte)((1f - WATER_COLOR.A) * 255f)); 330 waterColorMaterial.setTransparency((byte)((1f - WATER_COLOR.A) * 255f));
331 renderer.Scene.addMaterial("WaterColor", waterColorMaterial);
276 renderer.SetObjectMaterial("Water", "WaterColor"); 332 renderer.SetObjectMaterial("Water", "WaterColor");
277 } 333 }
278 334
335 // Add a terrain to the renderer.
336 // Note that we create a 'low resolution' 256x256 vertex terrain rather than trying for
337 // full resolution. This saves a lot of memory especially for very large regions.
279 private void CreateTerrain(WarpRenderer renderer, bool textureTerrain) 338 private void CreateTerrain(WarpRenderer renderer, bool textureTerrain)
280 { 339 {
281 ITerrainChannel terrain = m_scene.Heightmap; 340 ITerrainChannel terrain = m_scene.Heightmap;
@@ -293,7 +352,11 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
293 warp_Vector pos = ConvertVector(x, y, (float)terrain[(int)x, (int)y]); 352 warp_Vector pos = ConvertVector(x, y, (float)terrain[(int)x, (int)y]);
294 obj.addVertex(new warp_Vertex(pos, 353 obj.addVertex(new warp_Vertex(pos,
295 x / (float)m_scene.RegionInfo.RegionSizeX, 354 x / (float)m_scene.RegionInfo.RegionSizeX,
355<<<<<<< HEAD
356 (((float)m_scene.RegionInfo.RegionSizeY) - y) / m_scene.RegionInfo.RegionSizeY) );
357=======
296 (((float)m_scene.RegionInfo.RegionSizeY) - y) / m_scene.RegionInfo.RegionSizeY)); 358 (((float)m_scene.RegionInfo.RegionSizeY) - y) / m_scene.RegionInfo.RegionSizeY));
359>>>>>>> avn/ubitvar
297 } 360 }
298 } 361 }
299 362
@@ -338,7 +401,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
338 float[] startHeights = new float[4]; 401 float[] startHeights = new float[4];
339 float[] heightRanges = new float[4]; 402 float[] heightRanges = new float[4];
340 403
341 RegionSettings regionInfo = m_scene.RegionInfo.RegionSettings; 404 OpenSim.Framework.RegionSettings regionInfo = m_scene.RegionInfo.RegionSettings;
342 405
343 textureIDs[0] = regionInfo.TerrainTexture1; 406 textureIDs[0] = regionInfo.TerrainTexture1;
344 textureIDs[1] = regionInfo.TerrainTexture2; 407 textureIDs[1] = regionInfo.TerrainTexture2;
@@ -359,11 +422,14 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
359 Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out globalX, out globalY); 422 Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out globalX, out globalY);
360 423
361 warp_Texture texture; 424 warp_Texture texture;
362
363 using ( 425 using (
364 Bitmap image 426 Bitmap image
427<<<<<<< HEAD
428 = TerrainSplat.Splat(terrain, textureIDs, startHeights, heightRanges,
429=======
365 = TerrainSplat.Splat( 430 = TerrainSplat.Splat(
366 terrain, textureIDs, startHeights, heightRanges, 431 terrain, textureIDs, startHeights, heightRanges,
432>>>>>>> avn/ubitvar
367 new Vector3d(globalX, globalY, 0.0), m_scene.AssetService, textureTerrain)) 433 new Vector3d(globalX, globalY, 0.0), m_scene.AssetService, textureTerrain))
368 { 434 {
369 texture = new warp_Texture(image); 435 texture = new warp_Texture(image);
@@ -384,7 +450,6 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
384 m_scene.ForEachSOG( 450 m_scene.ForEachSOG(
385 delegate(SceneObjectGroup group) 451 delegate(SceneObjectGroup group)
386 { 452 {
387 CreatePrim(renderer, group.RootPart, useTextures);
388 foreach (SceneObjectPart child in group.Parts) 453 foreach (SceneObjectPart child in group.Parts)
389 CreatePrim(renderer, child, useTextures); 454 CreatePrim(renderer, child, useTextures);
390 } 455 }
@@ -401,8 +466,48 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
401 if (prim.Scale.LengthSquared() < MIN_SIZE * MIN_SIZE) 466 if (prim.Scale.LengthSquared() < MIN_SIZE * MIN_SIZE)
402 return; 467 return;
403 468
469 FacetedMesh renderMesh = null;
404 Primitive omvPrim = prim.Shape.ToOmvPrimitive(prim.OffsetPosition, prim.RotationOffset); 470 Primitive omvPrim = prim.Shape.ToOmvPrimitive(prim.OffsetPosition, prim.RotationOffset);
405 FacetedMesh renderMesh = m_primMesher.GenerateFacetedMesh(omvPrim, DetailLevel.Medium); 471
472 if (m_renderMeshes)
473 {
474 if (omvPrim.Sculpt != null && omvPrim.Sculpt.SculptTexture != UUID.Zero)
475 {
476 // Try fetchinng the asset
477 byte[] sculptAsset = m_scene.AssetService.GetData(omvPrim.Sculpt.SculptTexture.ToString());
478 if (sculptAsset != null)
479 {
480 // Is it a mesh?
481 if (omvPrim.Sculpt.Type == SculptType.Mesh)
482 {
483 AssetMesh meshAsset = new AssetMesh(omvPrim.Sculpt.SculptTexture, sculptAsset);
484 FacetedMesh.TryDecodeFromAsset(omvPrim, meshAsset, DetailLevel.Highest, out renderMesh);
485 meshAsset = null;
486 }
487 else // It's sculptie
488 {
489 IJ2KDecoder imgDecoder = m_scene.RequestModuleInterface<IJ2KDecoder>();
490 if (imgDecoder != null)
491 {
492 Image sculpt = imgDecoder.DecodeToImage(sculptAsset);
493 if (sculpt != null)
494 {
495 renderMesh = m_primMesher.GenerateFacetedSculptMesh(omvPrim, (Bitmap)sculpt,
496 DetailLevel.Medium);
497 sculpt.Dispose();
498 }
499 }
500 }
501 }
502 }
503 }
504
505 // If not a mesh or sculptie, try the regular mesher
506 if (renderMesh == null)
507 {
508 renderMesh = m_primMesher.GenerateFacetedMesh(omvPrim, DetailLevel.Medium);
509 }
510
406 if (renderMesh == null) 511 if (renderMesh == null)
407 return; 512 return;
408 513
@@ -461,7 +566,11 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
461 566
462 Primitive.TextureEntryFace teFace = prim.Shape.Textures.GetFace((uint)i); 567 Primitive.TextureEntryFace teFace = prim.Shape.Textures.GetFace((uint)i);
463 Color4 faceColor = GetFaceColor(teFace); 568 Color4 faceColor = GetFaceColor(teFace);
464 string materialName = GetOrCreateMaterial(renderer, faceColor); 569 string materialName = String.Empty;
570 if (m_texturePrims && prim.Scale.LengthSquared() > m_texturePrimSize*m_texturePrimSize)
571 materialName = GetOrCreateMaterial(renderer, faceColor, teFace.TextureID);
572 else
573 materialName = GetOrCreateMaterial(renderer, faceColor);
465 574
466 faceObj.transform(m); 575 faceObj.transform(m);
467 faceObj.setPos(primPos); 576 faceObj.setPos(primPos);
@@ -550,6 +659,49 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
550 return name; 659 return name;
551 } 660 }
552 661
662 public string GetOrCreateMaterial(WarpRenderer renderer, Color4 faceColor, UUID textureID)
663 {
664 string materialName = "Color-" + faceColor.ToString() + "-Texture-" + textureID.ToString();
665
666 if (renderer.Scene.material(materialName) == null)
667 {
668 renderer.AddMaterial(materialName, ConvertColor(faceColor));
669 if (faceColor.A < 1f)
670 {
671 renderer.Scene.material(materialName).setTransparency((byte) ((1f - faceColor.A)*255f));
672 }
673 warp_Texture texture = GetTexture(textureID);
674 if (texture != null)
675 renderer.Scene.material(materialName).setTexture(texture);
676 }
677
678 return materialName;
679 }
680
681 private warp_Texture GetTexture(UUID id)
682 {
683 warp_Texture ret = null;
684
685 byte[] asset = m_scene.AssetService.GetData(id.ToString());
686
687 if (asset != null)
688 {
689 IJ2KDecoder imgDecoder = m_scene.RequestModuleInterface<IJ2KDecoder>();
690
691 try
692 {
693 using (Bitmap img = (Bitmap)imgDecoder.DecodeToImage(asset))
694 ret = new warp_Texture(img);
695 }
696 catch (Exception e)
697 {
698 m_log.Warn(string.Format("[WARP 3D IMAGE MODULE]: Failed to decode asset {0}, exception ", id), e);
699 }
700 }
701
702 return ret;
703 }
704
553 #endregion Rendering Methods 705 #endregion Rendering Methods
554 706
555 #region Static Helpers 707 #region Static Helpers
@@ -559,6 +711,12 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
559 return new warp_Vector(x, z, y); 711 return new warp_Vector(x, z, y);
560 } 712 }
561 713
714 // Note: axis change.
715 private static warp_Vector ConvertVector(float x, float y, float z)
716 {
717 return new warp_Vector(x, z, y);
718 }
719
562 private static warp_Vector ConvertVector(Vector3 vector) 720 private static warp_Vector ConvertVector(Vector3 vector)
563 { 721 {
564 return new warp_Vector(vector.X, vector.Z, vector.Y); 722 return new warp_Vector(vector.X, vector.Z, vector.Y);
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
index 1e5af1b..553d057 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
@@ -76,6 +76,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
76 m_scenes.Add(scene); 76 m_scenes.Add(scene);
77 scene.EventManager.OnNewClient += OnNewClient; 77 scene.EventManager.OnNewClient += OnNewClient;
78 m_Clients = new List<UUID>(); 78 m_Clients = new List<UUID>();
79
79 } 80 }
80 81
81 public void RemoveRegion(Scene scene) 82 public void RemoveRegion(Scene scene)
@@ -140,7 +141,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
140 141
141 private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags) 142 private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags)
142 { 143 {
144<<<<<<< HEAD
145 List<MapBlockData> blocks = new List<MapBlockData>();
146 if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4))
147=======
143 Util.FireAndForget(x => 148 Util.FireAndForget(x =>
149>>>>>>> avn/ubitvar
144 { 150 {
145 List<MapBlockData> blocks = new List<MapBlockData>(); 151 List<MapBlockData> blocks = new List<MapBlockData>();
146 if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4)) 152 if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4))
@@ -226,6 +232,74 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
226 // they have different values depending on different viewers, apparently 232 // they have different values depending on different viewers, apparently
227 remoteClient.SendMapBlock(blocks, flags); 233 remoteClient.SendMapBlock(blocks, flags);
228 234
235<<<<<<< HEAD
236 List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20);
237
238 string mapNameOrig = mapName;
239 if (regionInfos.Count == 0)
240 {
241 // Hack to get around the fact that ll V3 now drops the port from the
242 // map name. See https://jira.secondlife.com/browse/VWR-28570
243 //
244 // Caller, use this magic form instead:
245 // secondlife://http|!!mygrid.com|8002|Region+Name/128/128
246 // or url encode if possible.
247 // the hacks we do with this viewer...
248 //
249 if (mapName.Contains("|"))
250 mapName = mapName.Replace('|', ':');
251 if (mapName.Contains("+"))
252 mapName = mapName.Replace('+', ' ');
253 if (mapName.Contains("!"))
254 mapName = mapName.Replace('!', '/');
255
256 if (mapName != mapNameOrig)
257 regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20);
258 }
259
260 m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions. Flags={2}", mapName, regionInfos.Count, flags);
261
262 if (regionInfos.Count > 0)
263 {
264 foreach (GridRegion info in regionInfos)
265 {
266 if ((flags & 2) == 2) // V2 sends this
267 {
268 List<MapBlockData> datas = WorldMap.Map2BlockFromGridRegion(info, flags);
269 // ugh! V2-3 is very sensitive about the result being
270 // exactly the same as the requested name
271 if (regionInfos.Count == 1 && (mapName != mapNameOrig))
272 datas.ForEach(d => d.Name = mapNameOrig);
273
274 blocks.AddRange(datas);
275 }
276 else
277 {
278 MapBlockData data = WorldMap.MapBlockFromGridRegion(info, flags);
279 blocks.Add(data);
280 }
281 }
282 }
283
284 // final block, closing the search result
285 AddFinalBlock(blocks);
286
287 // flags are agent flags sent from the viewer.
288 // they have different values depending on different viewers, apparently
289 remoteClient.SendMapBlock(blocks, flags);
290
291 // send extra user messages for V3
292 // because the UI is very confusing
293 // while we don't fix the hard-coded urls
294 if (flags == 2)
295 {
296 if (regionInfos.Count == 0)
297 remoteClient.SendAlertMessage("No regions found with that name.");
298 // this seems unnecessary because found regions will show up in the search results
299 //else if (regionInfos.Count == 1)
300 // remoteClient.SendAlertMessage("Region found!");
301 }
302=======
229 // send extra user messages for V3 303 // send extra user messages for V3
230 // because the UI is very confusing 304 // because the UI is very confusing
231 // while we don't fix the hard-coded urls 305 // while we don't fix the hard-coded urls
@@ -237,6 +311,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
237// remoteClient.SendAgentAlertMessage("Region found!", false); 311// remoteClient.SendAgentAlertMessage("Region found!", false);
238 } 312 }
239 }); 313 });
314>>>>>>> avn/ubitvar
240 } 315 }
241 316
242 private void AddFinalBlock(List<MapBlockData> blocks) 317 private void AddFinalBlock(List<MapBlockData> blocks)
@@ -244,7 +319,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
244 // final block, closing the search result 319 // final block, closing the search result
245 MapBlockData data = new MapBlockData(); 320 MapBlockData data = new MapBlockData();
246 data.Agents = 0; 321 data.Agents = 0;
247 data.Access = 255; 322 data.Access = (byte)SimAccess.NonExistent;
248 data.MapImageId = UUID.Zero; 323 data.MapImageId = UUID.Zero;
249 data.Name = ""; 324 data.Name = "";
250 data.RegionFlags = 0; 325 data.RegionFlags = 0;
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index 1f8f6b0..2fbd017 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -59,13 +59,21 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
59 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WorldMapModule")] 59 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WorldMapModule")]
60 public class WorldMapModule : INonSharedRegionModule, IWorldMapModule 60 public class WorldMapModule : INonSharedRegionModule, IWorldMapModule
61 { 61 {
62 private static readonly ILog m_log = 62 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
63 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 63#pragma warning disable 414
64 private static string LogHeader = "[WORLD MAP]";
65#pragma warning restore 414
64 66
65 private static readonly string DEFAULT_WORLD_MAP_EXPORT_PATH = "exportmap.jpg"; 67 private static readonly string DEFAULT_WORLD_MAP_EXPORT_PATH = "exportmap.jpg";
66 private static readonly UUID STOP_UUID = UUID.Random(); 68 private static readonly UUID STOP_UUID = UUID.Random();
67 private static readonly string m_mapLayerPath = "0001/"; 69 private static readonly string m_mapLayerPath = "0001/";
68 70
71<<<<<<< HEAD
72 private IMapImageGenerator m_mapImageGenerator;
73 private IMapImageUploadModule m_mapImageServiceModule;
74
75 private OpenSim.Framework.BlockingQueue<MapRequestState> requests = new OpenSim.Framework.BlockingQueue<MapRequestState>();
76=======
69 private ManualResetEvent queueEvent = new ManualResetEvent(false); 77 private ManualResetEvent queueEvent = new ManualResetEvent(false);
70 private Queue<MapRequestState> requests = new Queue<MapRequestState>(); 78 private Queue<MapRequestState> requests = new Queue<MapRequestState>();
71 79
@@ -74,6 +82,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
74 82
75 private IMapImageGenerator m_mapImageGenerator; 83 private IMapImageGenerator m_mapImageGenerator;
76 private IMapImageUploadModule m_mapImageServiceModule; 84 private IMapImageUploadModule m_mapImageServiceModule;
85>>>>>>> avn/ubitvar
77 86
78 protected Scene m_scene; 87 protected Scene m_scene;
79 private List<MapBlockData> cachedMapBlocks = new List<MapBlockData>(); 88 private List<MapBlockData> cachedMapBlocks = new List<MapBlockData>();
@@ -102,7 +111,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
102 = Util.GetConfigVarFromSections<int>(config, "BlacklistTimeout", configSections, 10 * 60) * 1000; 111 = Util.GetConfigVarFromSections<int>(config, "BlacklistTimeout", configSections, 10 * 60) * 1000;
103 } 112 }
104 113
105 public virtual void AddRegion (Scene scene) 114 public virtual void AddRegion(Scene scene)
106 { 115 {
107 if (!m_Enabled) 116 if (!m_Enabled)
108 return; 117 return;
@@ -145,10 +154,17 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
145 if (!m_Enabled) 154 if (!m_Enabled)
146 return; 155 return;
147 156
157<<<<<<< HEAD
158 m_ServiceThrottle = scene.RequestModuleInterface<IServiceThrottleModule>();
159=======
148 m_mapImageGenerator = m_scene.RequestModuleInterface<IMapImageGenerator>(); 160 m_mapImageGenerator = m_scene.RequestModuleInterface<IMapImageGenerator>();
149 m_mapImageServiceModule = m_scene.RequestModuleInterface<IMapImageUploadModule>(); 161 m_mapImageServiceModule = m_scene.RequestModuleInterface<IMapImageUploadModule>();
150 } 162 }
163>>>>>>> avn/ubitvar
151 164
165 m_mapImageGenerator = m_scene.RequestModuleInterface<IMapImageGenerator>();
166 m_mapImageServiceModule = m_scene.RequestModuleInterface<IMapImageUploadModule>();
167 }
152 168
153 public virtual void Close() 169 public virtual void Close()
154 { 170 {
@@ -259,6 +275,56 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
259 // 6/8/2011 -- I'm adding an explicit 2048 check, so that we never forget that there is 275 // 6/8/2011 -- I'm adding an explicit 2048 check, so that we never forget that there is
260 // a hack here, and so that regions below 4096 don't get spammed with unnecessary map blocks. 276 // a hack here, and so that regions below 4096 don't get spammed with unnecessary map blocks.
261 277
278<<<<<<< HEAD
279 if (m_scene.RegionInfo.RegionLocX >= 2048 || m_scene.RegionInfo.RegionLocY >= 2048)
280 {
281 ScenePresence avatarPresence = null;
282
283 m_scene.TryGetScenePresence(agentID, out avatarPresence);
284
285 if (avatarPresence != null)
286 {
287 bool lookup = false;
288
289 lock (cachedMapBlocks)
290 {
291 if (cachedMapBlocks.Count > 0 && ((cachedTime + 1800) > Util.UnixTimeSinceEpoch()))
292 {
293 List<MapBlockData> mapBlocks;
294
295 mapBlocks = cachedMapBlocks;
296 avatarPresence.ControllingClient.SendMapBlock(mapBlocks, 0);
297 }
298 else
299 {
300 lookup = true;
301 }
302 }
303 if (lookup)
304 {
305 List<MapBlockData> mapBlocks = new List<MapBlockData>(); ;
306
307 // Get regions that are within 8 regions of here
308 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
309 (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocX - 8),
310 (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocX + 8),
311 (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocY - 8),
312 (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocY + 8) );
313 foreach (GridRegion r in regions)
314 {
315 MapBlockData block = MapBlockFromGridRegion(r, 0);
316 mapBlocks.Add(block);
317 }
318 avatarPresence.ControllingClient.SendMapBlock(mapBlocks, 0);
319
320 lock (cachedMapBlocks)
321 cachedMapBlocks = mapBlocks;
322
323 cachedTime = Util.UnixTimeSinceEpoch();
324 }
325 }
326 }
327=======
262 //if (m_scene.RegionInfo.RegionLocX >= 2048 || m_scene.RegionInfo.RegionLocY >= 2048) 328 //if (m_scene.RegionInfo.RegionLocX >= 2048 || m_scene.RegionInfo.RegionLocY >= 2048)
263 //{ 329 //{
264 // ScenePresence avatarPresence = null; 330 // ScenePresence avatarPresence = null;
@@ -307,6 +373,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
307 // } 373 // }
308 // } 374 // }
309 //} 375 //}
376>>>>>>> avn/ubitvar
310 377
311 LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); 378 LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse();
312 mapResponse.LayerData.Array.Add(GetOSDMapLayerResponse()); 379 mapResponse.LayerData.Array.Add(GetOSDMapLayerResponse());
@@ -386,7 +453,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
386 453
387// m_log.Debug("[WORLD MAP]: Starting remote MapItem request thread"); 454// m_log.Debug("[WORLD MAP]: Starting remote MapItem request thread");
388 455
389 Watchdog.StartThread( 456 WorkManager.StartThread(
390 process, 457 process,
391 string.Format("MapItemRequestThread ({0})", m_scene.RegionInfo.RegionName), 458 string.Format("MapItemRequestThread ({0})", m_scene.RegionInfo.RegionName),
392 ThreadPriority.BelowNormal, 459 ThreadPriority.BelowNormal,
@@ -449,17 +516,29 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
449 uint xstart = 0; 516 uint xstart = 0;
450 uint ystart = 0; 517 uint ystart = 0;
451 Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out xstart, out ystart); 518 Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out xstart, out ystart);
519<<<<<<< HEAD
520 if (itemtype == (int)GridItemType.AgentLocations)
521=======
452 522
453 if (itemtype == 6) // Service 6 right now (MAP_ITEM_AGENTS_LOCATION; green dots) 523 if (itemtype == 6) // Service 6 right now (MAP_ITEM_AGENTS_LOCATION; green dots)
524>>>>>>> avn/ubitvar
454 { 525 {
455 if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle) 526 if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle)
456 { 527 {
457 // Local Map Item Request 528 // Just requesting map info about the current, local region
458 int tc = Environment.TickCount; 529 int tc = Environment.TickCount;
459 List<mapItemReply> mapitems = new List<mapItemReply>(); 530 List<mapItemReply> mapitems = new List<mapItemReply>();
460 mapItemReply mapitem = new mapItemReply(); 531 mapItemReply mapitem = new mapItemReply();
461 if (m_scene.GetRootAgentCount() <= 1) 532 if (m_scene.GetRootAgentCount() <= 1)
462 { 533 {
534<<<<<<< HEAD
535 mapitem = new mapItemReply(
536 xstart + 1,
537 ystart + 1,
538 UUID.Zero,
539 Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()),
540 0, 0);
541=======
463 mapitem = new mapItemReply(); 542 mapitem = new mapItemReply();
464 mapitem.x = xstart + 1; 543 mapitem.x = xstart + 1;
465 mapitem.y = ystart + 1; 544 mapitem.y = ystart + 1;
@@ -467,6 +546,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
467 mapitem.name = Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()); 546 mapitem.name = Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString());
468 mapitem.Extra = 0; 547 mapitem.Extra = 0;
469 mapitem.Extra2 = 0; 548 mapitem.Extra2 = 0;
549>>>>>>> avn/ubitvar
470 mapitems.Add(mapitem); 550 mapitems.Add(mapitem);
471 } 551 }
472 else 552 else
@@ -476,6 +556,14 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
476 // Don't send a green dot for yourself 556 // Don't send a green dot for yourself
477 if (sp.UUID != remoteClient.AgentId) 557 if (sp.UUID != remoteClient.AgentId)
478 { 558 {
559<<<<<<< HEAD
560 mapitem = new mapItemReply(
561 xstart + (uint)sp.AbsolutePosition.X,
562 ystart + (uint)sp.AbsolutePosition.Y,
563 UUID.Zero,
564 Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()),
565 1, 0);
566=======
479 mapitem = new mapItemReply(); 567 mapitem = new mapItemReply();
480 mapitem.x = xstart + (uint)sp.AbsolutePosition.X; 568 mapitem.x = xstart + (uint)sp.AbsolutePosition.X;
481 mapitem.y = ystart + (uint)sp.AbsolutePosition.Y; 569 mapitem.y = ystart + (uint)sp.AbsolutePosition.Y;
@@ -483,6 +571,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
483 mapitem.name = Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()); 571 mapitem.name = Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString());
484 mapitem.Extra = 1; 572 mapitem.Extra = 1;
485 mapitem.Extra2 = 0; 573 mapitem.Extra2 = 0;
574>>>>>>> avn/ubitvar
486 mapitems.Add(mapitem); 575 mapitems.Add(mapitem);
487 } 576 }
488 }); 577 });
@@ -497,7 +586,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
497 RequestMapItems("",remoteClient.AgentId,flags,EstateID,godlike,itemtype,regionhandle); 586 RequestMapItems("",remoteClient.AgentId,flags,EstateID,godlike,itemtype,regionhandle);
498 } 587 }
499 } 588 }
500 else if (itemtype == 7) // Service 7 (MAP_ITEM_LAND_FOR_SALE) 589 else if (itemtype == (int)GridItemType.LandForSale) // Service 7 (MAP_ITEM_LAND_FOR_SALE)
501 { 590 {
502 if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle) 591 if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle)
503 { 592 {
@@ -527,6 +616,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
527 float x = (min.X+max.X)/2; 616 float x = (min.X+max.X)/2;
528 float y = (min.Y+max.Y)/2; 617 float y = (min.Y+max.Y)/2;
529 618
619<<<<<<< HEAD
620 mapitem = new mapItemReply(
621 xstart + (uint)x,
622 ystart + (uint)y,
623 parcel.GlobalID,
624 parcel.Name,
625 parcel.Area,
626 parcel.SalePrice
627 );
628=======
530 mapitem = new mapItemReply(); 629 mapitem = new mapItemReply();
531 mapitem.x = xstart + (uint)x; 630 mapitem.x = xstart + (uint)x;
532 mapitem.y = ystart +(uint)y; 631 mapitem.y = ystart +(uint)y;
@@ -535,6 +634,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
535 mapitem.name = parcel.Name; 634 mapitem.name = parcel.Name;
536 mapitem.Extra = parcel.Area; 635 mapitem.Extra = parcel.Area;
537 mapitem.Extra2 = parcel.SalePrice; 636 mapitem.Extra2 = parcel.SalePrice;
637>>>>>>> avn/ubitvar
538 mapitems.Add(mapitem); 638 mapitems.Add(mapitem);
539 } 639 }
540 } 640 }
@@ -549,7 +649,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
549 RequestMapItems("",remoteClient.AgentId,flags,EstateID,godlike,itemtype,regionhandle); 649 RequestMapItems("",remoteClient.AgentId,flags,EstateID,godlike,itemtype,regionhandle);
550 } 650 }
551 } 651 }
552 else if (itemtype == 1) // Service 1 (MAP_ITEM_TELEHUB) 652 else if (itemtype == (int)GridItemType.Telehub) // Service 1 (MAP_ITEM_TELEHUB)
553 { 653 {
554 if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle) 654 if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle)
555 { 655 {
@@ -559,6 +659,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
559 SceneObjectGroup sog = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject); 659 SceneObjectGroup sog = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject);
560 if (sog != null) 660 if (sog != null)
561 { 661 {
662<<<<<<< HEAD
663 mapitem = new mapItemReply(
664 xstart + (uint)sog.AbsolutePosition.X,
665 ystart + (uint)sog.AbsolutePosition.Y,
666 UUID.Zero,
667 sog.Name,
668 0, // color (not used)
669 0 // 0 = telehub / 1 = infohub
670 );
671=======
562 mapitem = new mapItemReply(); 672 mapitem = new mapItemReply();
563 mapitem.x = xstart + (uint)sog.AbsolutePosition.X; 673 mapitem.x = xstart + (uint)sog.AbsolutePosition.X;
564 mapitem.y = ystart + (uint)sog.AbsolutePosition.Y; 674 mapitem.y = ystart + (uint)sog.AbsolutePosition.Y;
@@ -566,6 +676,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
566 mapitem.name = sog.Name; 676 mapitem.name = sog.Name;
567 mapitem.Extra = 0; // color (not used) 677 mapitem.Extra = 0; // color (not used)
568 mapitem.Extra2 = 0; // 0 = telehub / 1 = infohub 678 mapitem.Extra2 = 0; // 0 = telehub / 1 = infohub
679>>>>>>> avn/ubitvar
569 mapitems.Add(mapitem); 680 mapitems.Add(mapitem);
570 681
571 remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags); 682 remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags);
@@ -652,8 +763,126 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
652 { 763 {
653 lock (requests) 764 lock (requests)
654 { 765 {
766<<<<<<< HEAD
767 if (st.agentID != UUID.Zero)
768 {
769 bool dorequest = true;
770 lock (m_rootAgents)
771 {
772 if (!m_rootAgents.Contains(st.agentID))
773 dorequest = false;
774 }
775
776 if (dorequest && !m_blacklistedregions.ContainsKey(st.regionhandle))
777 {
778 if (nAsyncRequests >= MAX_ASYNC_REQUESTS) // hit the break
779 {
780 // AH!!! Recursive !
781 // Put this request back in the queue and return
782 EnqueueMapItemRequest(st);
783 return;
784 }
785
786 RequestMapItemsDelegate d = RequestMapItemsAsync;
787 d.BeginInvoke(st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle, RequestMapItemsCompleted, null);
788 //OSDMap response = RequestMapItemsAsync(st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle);
789 //RequestMapItemsCompleted(response);
790 Interlocked.Increment(ref nAsyncRequests);
791 }
792 }
793 });
794 }
795
796 /// <summary>
797 /// Sends the mapitem response to the IClientAPI
798 /// </summary>
799 /// <param name="response">The OSDMap Response for the mapitem</param>
800 private void RequestMapItemsCompleted(IAsyncResult iar)
801 {
802 AsyncResult result = (AsyncResult)iar;
803 RequestMapItemsDelegate icon = (RequestMapItemsDelegate)result.AsyncDelegate;
804
805 OSDMap response = (OSDMap)icon.EndInvoke(iar);
806
807 Interlocked.Decrement(ref nAsyncRequests);
808
809 if (!response.ContainsKey("requestID"))
810 return;
811
812 UUID requestID = response["requestID"].AsUUID();
813
814 if (requestID != UUID.Zero)
815 {
816 MapRequestState mrs = new MapRequestState();
817 mrs.agentID = UUID.Zero;
818 lock (m_openRequests)
819 {
820 if (m_openRequests.ContainsKey(requestID))
821 {
822 mrs = m_openRequests[requestID];
823 m_openRequests.Remove(requestID);
824 }
825 }
826
827 if (mrs.agentID != UUID.Zero)
828 {
829 ScenePresence av = null;
830 m_scene.TryGetScenePresence(mrs.agentID, out av);
831 if (av != null)
832 {
833 if (response.ContainsKey(mrs.itemtype.ToString()))
834 {
835 List<mapItemReply> returnitems = new List<mapItemReply>();
836 OSDArray itemarray = (OSDArray)response[mrs.itemtype.ToString()];
837 for (int i = 0; i < itemarray.Count; i++)
838 {
839 OSDMap mapitem = (OSDMap)itemarray[i];
840 mapItemReply mi = new mapItemReply();
841 mi.FromOSD(mapitem);
842 returnitems.Add(mi);
843 }
844 av.ControllingClient.SendMapItemReply(returnitems.ToArray(), mrs.itemtype, mrs.flags);
845 }
846
847 // Service 7 (MAP_ITEM_LAND_FOR_SALE)
848 uint itemtype = (uint)GridItemType.LandForSale;
849
850 if (response.ContainsKey(itemtype.ToString()))
851 {
852 List<mapItemReply> returnitems = new List<mapItemReply>();
853 OSDArray itemarray = (OSDArray)response[itemtype.ToString()];
854 for (int i = 0; i < itemarray.Count; i++)
855 {
856 OSDMap mapitem = (OSDMap)itemarray[i];
857 mapItemReply mi = new mapItemReply();
858 mi.FromOSD(mapitem);
859 returnitems.Add(mi);
860 }
861 av.ControllingClient.SendMapItemReply(returnitems.ToArray(), itemtype, mrs.flags);
862 }
863
864 // Service 1 (MAP_ITEM_TELEHUB)
865 itemtype = (uint)GridItemType.Telehub;
866
867 if (response.ContainsKey(itemtype.ToString()))
868 {
869 List<mapItemReply> returnitems = new List<mapItemReply>();
870 OSDArray itemarray = (OSDArray)response[itemtype.ToString()];
871 for (int i = 0; i < itemarray.Count; i++)
872 {
873 OSDMap mapitem = (OSDMap)itemarray[i];
874 mapItemReply mi = new mapItemReply();
875 mi.FromOSD(mapitem);
876 returnitems.Add(mi);
877 }
878 av.ControllingClient.SendMapItemReply(returnitems.ToArray(), itemtype, mrs.flags);
879 }
880 }
881 }
882=======
655 queueEvent.Set(); 883 queueEvent.Set();
656 requests.Enqueue(state); 884 requests.Enqueue(state);
885>>>>>>> avn/ubitvar
657 } 886 }
658 } 887 }
659 888
@@ -833,7 +1062,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
833 finally 1062 finally
834 { 1063 {
835 if (os != null) 1064 if (os != null)
836 os.Close(); 1065 os.Dispose();
837 } 1066 }
838 1067
839 string response_mapItems_reply = null; 1068 string response_mapItems_reply = null;
@@ -999,8 +1228,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
999 /// <param name="maxY"></param> 1228 /// <param name="maxY"></param>
1000 public void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) 1229 public void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag)
1001 { 1230 {
1231<<<<<<< HEAD
1232=======
1002 m_log.DebugFormat("[WoldMapModule] RequestMapBlocks {0}={1}={2}={3} {4}", minX, minY, maxX, maxY, flag); 1233 m_log.DebugFormat("[WoldMapModule] RequestMapBlocks {0}={1}={2}={3} {4}", minX, minY, maxX, maxY, flag);
1003/* this flag does not seem to mean what his says 1234/* this flag does not seem to mean what his says
1235>>>>>>> avn/ubitvar
1004 if ((flag & 0x10000) != 0) // user clicked on qthe map a tile that isn't visible 1236 if ((flag & 0x10000) != 0) // user clicked on qthe map a tile that isn't visible
1005 { 1237 {
1006 List<MapBlockData> response = new List<MapBlockData>(); 1238 List<MapBlockData> response = new List<MapBlockData>();
@@ -1009,15 +1241,34 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1009 // on an unloaded square. 1241 // on an unloaded square.
1010 // But make sure: Look whether the one we requested is in there 1242 // But make sure: Look whether the one we requested is in there
1011 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, 1243 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
1244<<<<<<< HEAD
1245 (int)Util.RegionToWorldLoc((uint)minX), (int)Util.RegionToWorldLoc((uint)maxX),
1246 (int)Util.RegionToWorldLoc((uint)minY), (int)Util.RegionToWorldLoc((uint)maxY) );
1247
1248 m_log.DebugFormat("[WORLD MAP MODULE] RequestMapBlocks min=<{0},{1}>, max=<{2},{3}>, flag={4}, cntFound={5}",
1249 minX, minY, maxX, maxY, flag.ToString("X"), regions.Count);
1250=======
1012 (int)Util.RegionToWorldLoc((uint)minX), 1251 (int)Util.RegionToWorldLoc((uint)minX),
1013 (int)Util.RegionToWorldLoc((uint)maxX), 1252 (int)Util.RegionToWorldLoc((uint)maxX),
1014 (int)Util.RegionToWorldLoc((uint)minY), 1253 (int)Util.RegionToWorldLoc((uint)minY),
1015 (int)Util.RegionToWorldLoc((uint)maxY) ); 1254 (int)Util.RegionToWorldLoc((uint)maxY) );
1016 1255
1256>>>>>>> avn/ubitvar
1017 if (regions != null) 1257 if (regions != null)
1018 { 1258 {
1019 foreach (GridRegion r in regions) 1259 foreach (GridRegion r in regions)
1020 { 1260 {
1261<<<<<<< HEAD
1262 if (r.RegionLocX == Util.RegionToWorldLoc((uint)minX)
1263 && r.RegionLocY == Util.RegionToWorldLoc((uint)minY) )
1264 {
1265 // found it => add it to response
1266 // Version 2 viewers can handle the larger regions
1267 if ((flag & 2) == 2)
1268 response.AddRange(Map2BlockFromGridRegion(r, flag));
1269 else
1270 response.Add(MapBlockFromGridRegion(r, flag));
1271=======
1021 if (r.RegionLocX == Util.RegionToWorldLoc((uint)minX) && 1272 if (r.RegionLocX == Util.RegionToWorldLoc((uint)minX) &&
1022 r.RegionLocY == Util.RegionToWorldLoc((uint)minY)) 1273 r.RegionLocY == Util.RegionToWorldLoc((uint)minY))
1023 { 1274 {
@@ -1030,6 +1281,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1030 MapBlockFromGridRegion(block, r, flag); 1281 MapBlockFromGridRegion(block, r, flag);
1031 response.Add(block); 1282 response.Add(block);
1032 } 1283 }
1284>>>>>>> avn/ubitvar
1033 break; 1285 break;
1034 } 1286 }
1035 } 1287 }
@@ -1042,6 +1294,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1042 block.X = (ushort)minX; 1294 block.X = (ushort)minX;
1043 block.Y = (ushort)minY; 1295 block.Y = (ushort)minY;
1044 block.Access = (byte)SimAccess.Down; // means 'simulator is offline' 1296 block.Access = (byte)SimAccess.Down; // means 'simulator is offline'
1297<<<<<<< HEAD
1298 // block.Access = (byte)SimAccess.NonExistent;
1299=======
1300>>>>>>> avn/ubitvar
1045 response.Add(block); 1301 response.Add(block);
1046 } 1302 }
1047 // The lower 16 bits are an unsigned int16 1303 // The lower 16 bits are an unsigned int16
@@ -1117,6 +1373,19 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1117 List<MapBlockData> allBlocks = new List<MapBlockData>(); 1373 List<MapBlockData> allBlocks = new List<MapBlockData>();
1118 List<MapBlockData> mapBlocks = new List<MapBlockData>(); 1374 List<MapBlockData> mapBlocks = new List<MapBlockData>();
1119 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, 1375 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
1376<<<<<<< HEAD
1377 (int)Util.RegionToWorldLoc((uint)(minX - 4)), (int)Util.RegionToWorldLoc((uint)(maxX + 4)),
1378 (int)Util.RegionToWorldLoc((uint)(minY - 4)), (int)Util.RegionToWorldLoc((uint)(maxY + 4)) );
1379 //m_log.DebugFormat("{0} GetAndSendBlocks. min=<{1},{2}>, max=<{3},{4}>, cntFound={5}",
1380 // LogHeader, minX, minY, maxX, maxY, regions.Count);
1381 foreach (GridRegion r in regions)
1382 {
1383 // Version 2 viewers can handle the larger regions
1384 if ((flag & 2) == 2)
1385 mapBlocks.AddRange(Map2BlockFromGridRegion(r, flag));
1386 else
1387 mapBlocks.Add(MapBlockFromGridRegion(r, flag));
1388=======
1120 minX * (int)Constants.RegionSize, 1389 minX * (int)Constants.RegionSize,
1121 maxX * (int)Constants.RegionSize, 1390 maxX * (int)Constants.RegionSize,
1122 minY * (int)Constants.RegionSize, 1391 minY * (int)Constants.RegionSize,
@@ -1138,6 +1407,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1138 mapBlocks.Add(block); 1407 mapBlocks.Add(block);
1139 remoteClient.SendMapBlock(mapBlocks, flag & 0xffff); 1408 remoteClient.SendMapBlock(mapBlocks, flag & 0xffff);
1140 return allBlocks; 1409 return allBlocks;
1410>>>>>>> avn/ubitvar
1141 } 1411 }
1142 1412
1143 foreach (GridRegion r in regions) 1413 foreach (GridRegion r in regions)
@@ -1168,22 +1438,37 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1168 return allBlocks; 1438 return allBlocks;
1169 } 1439 }
1170 1440
1441<<<<<<< HEAD
1442 // Fill a passed MapBlockData from a GridRegion
1443 public MapBlockData MapBlockFromGridRegion(GridRegion r, uint flag)
1444=======
1171 public void MapBlockFromGridRegion(MapBlockData block, GridRegion r, uint flag) 1445 public void MapBlockFromGridRegion(MapBlockData block, GridRegion r, uint flag)
1446>>>>>>> avn/ubitvar
1172 { 1447 {
1448 MapBlockData block = new MapBlockData();
1449
1173 block.Access = r.Access; 1450 block.Access = r.Access;
1174 switch (flag & 0xffff) 1451 switch (flag & 0xffff)
1175 { 1452 {
1176 case 0: 1453 case 0:
1177 block.MapImageId = r.TerrainImage; 1454 block.MapImageId = r.TerrainImage;
1178 break; 1455 break;
1179 case 2: 1456 case 2:
1180 block.MapImageId = r.ParcelImage; 1457 block.MapImageId = r.ParcelImage;
1181 break; 1458 break;
1182 default: 1459 default:
1183 block.MapImageId = UUID.Zero; 1460 block.MapImageId = UUID.Zero;
1184 break; 1461 break;
1185 } 1462 }
1186 block.Name = r.RegionName; 1463 block.Name = r.RegionName;
1464<<<<<<< HEAD
1465 block.X = (ushort)Util.WorldToRegionLoc((uint)r.RegionLocX);
1466 block.Y = (ushort)Util.WorldToRegionLoc((uint)r.RegionLocY);
1467 block.SizeX = (ushort) r.RegionSizeX;
1468 block.SizeY = (ushort) r.RegionSizeY;
1469
1470 return block;
1471=======
1187 block.X = (ushort)(r.RegionLocX / Constants.RegionSize); 1472 block.X = (ushort)(r.RegionLocX / Constants.RegionSize);
1188 block.Y = (ushort)(r.RegionLocY / Constants.RegionSize); 1473 block.Y = (ushort)(r.RegionLocY / Constants.RegionSize);
1189 block.SizeX = (ushort)r.RegionSizeX; 1474 block.SizeX = (ushort)r.RegionSizeX;
@@ -1223,8 +1508,45 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1223 blocks.Add(block); 1508 blocks.Add(block);
1224 } 1509 }
1225 return blocks; 1510 return blocks;
1511>>>>>>> avn/ubitvar
1226 } 1512 }
1227 1513
1514 public List<MapBlockData> Map2BlockFromGridRegion(GridRegion r, uint flag)
1515 {
1516 List<MapBlockData> blocks = new List<MapBlockData>();
1517 MapBlockData block = new MapBlockData();
1518 if (r == null)
1519 {
1520 block.Access = (byte)SimAccess.Down;
1521 block.MapImageId = UUID.Zero;
1522 blocks.Add(block);
1523 }
1524 else
1525 {
1526 block.Access = r.Access;
1527 switch (flag & 0xffff)
1528 {
1529 case 0:
1530 block.MapImageId = r.TerrainImage;
1531 break;
1532 case 2:
1533 block.MapImageId = r.ParcelImage;
1534 break;
1535 default:
1536 block.MapImageId = UUID.Zero;
1537 break;
1538 }
1539 block.Name = r.RegionName;
1540 block.X = (ushort)(r.RegionLocX / Constants.RegionSize);
1541 block.Y = (ushort)(r.RegionLocY / Constants.RegionSize);
1542 block.SizeX = (ushort)r.RegionSizeX;
1543 block.SizeY = (ushort)r.RegionSizeY;
1544 blocks.Add(block);
1545 }
1546 return blocks;
1547 }
1548
1549
1228 public Hashtable OnHTTPThrottled(Hashtable keysvals) 1550 public Hashtable OnHTTPThrottled(Hashtable keysvals)
1229 { 1551 {
1230 Hashtable reply = new Hashtable(); 1552 Hashtable reply = new Hashtable();
@@ -1291,10 +1613,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1291 image.Dispose(); 1613 image.Dispose();
1292 1614
1293 if (imgstream != null) 1615 if (imgstream != null)
1294 {
1295 imgstream.Close();
1296 imgstream.Dispose(); 1616 imgstream.Dispose();
1297 }
1298 } 1617 }
1299 } 1618 }
1300 else 1619 else
@@ -1353,17 +1672,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1353 1672
1354 List<MapBlockData> mapBlocks = new List<MapBlockData>(); 1673 List<MapBlockData> mapBlocks = new List<MapBlockData>();
1355 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, 1674 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
1356 (int)(m_scene.RegionInfo.RegionLocX - 9) * (int)Constants.RegionSize, 1675 (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocX - 9),
1357 (int)(m_scene.RegionInfo.RegionLocX + 9) * (int)Constants.RegionSize, 1676 (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocX + 9),
1358 (int)(m_scene.RegionInfo.RegionLocY - 9) * (int)Constants.RegionSize, 1677 (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocY - 9),
1359 (int)(m_scene.RegionInfo.RegionLocY + 9) * (int)Constants.RegionSize); 1678 (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocY + 9));
1360 List<AssetBase> textures = new List<AssetBase>(); 1679 List<AssetBase> textures = new List<AssetBase>();
1361 List<Image> bitImages = new List<Image>(); 1680 List<Image> bitImages = new List<Image>();
1362 1681
1363 foreach (GridRegion r in regions) 1682 foreach (GridRegion r in regions)
1364 { 1683 {
1365 MapBlockData mapBlock = new MapBlockData(); 1684 MapBlockData mapBlock = MapBlockFromGridRegion(r, 0);
1366 MapBlockFromGridRegion(mapBlock, r, 0);
1367 AssetBase texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString()); 1685 AssetBase texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString());
1368 1686
1369 if (texAsset != null) 1687 if (texAsset != null)
@@ -1434,7 +1752,13 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1434 uint xstart = 0; 1752 uint xstart = 0;
1435 uint ystart = 0; 1753 uint ystart = 0;
1436 1754
1755<<<<<<< HEAD
1756 Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle,out xstart,out ystart);
1757 // m_log.DebugFormat("{0} HandleRemoteMapItemRequest. loc=<{1},{2}>",
1758 // LogHeader, Util.WorldToRegionLoc(xstart), Util.WorldToRegionLoc(ystart));
1759=======
1437 Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out xstart, out ystart); 1760 Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out xstart, out ystart);
1761>>>>>>> avn/ubitvar
1438 1762
1439 // Service 6 (MAP_ITEM_AGENTS_LOCATION; green dots) 1763 // Service 6 (MAP_ITEM_AGENTS_LOCATION; green dots)
1440 1764
@@ -1554,6 +1878,23 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1554 return; 1878 return;
1555 1879
1556 m_log.DebugFormat("[WORLD MAP]: Generating map image for {0}", m_scene.Name); 1880 m_log.DebugFormat("[WORLD MAP]: Generating map image for {0}", m_scene.Name);
1881<<<<<<< HEAD
1882
1883 using (Bitmap mapbmp = m_mapImageGenerator.CreateMapTile())
1884 {
1885 // V1 (This Module)
1886 GenerateMaptile(mapbmp);
1887
1888 // v2/3 (MapImageServiceModule)
1889 m_mapImageServiceModule.UploadMapTile(m_scene, mapbmp);
1890 }
1891 }
1892
1893 private void GenerateMaptile(Bitmap mapbmp)
1894 {
1895 byte[] data;
1896
1897=======
1557 1898
1558 using (Bitmap mapbmp = m_mapImageGenerator.CreateMapTile()) 1899 using (Bitmap mapbmp = m_mapImageGenerator.CreateMapTile())
1559 { 1900 {
@@ -1569,6 +1910,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1569 { 1910 {
1570 byte[] data; 1911 byte[] data;
1571 1912
1913>>>>>>> avn/ubitvar
1572 try 1914 try
1573 { 1915 {
1574 data = OpenJPEG.EncodeFromImage(mapbmp, true); 1916 data = OpenJPEG.EncodeFromImage(mapbmp, true);
@@ -1685,7 +2027,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1685 int regionSizeX = (int)m_scene.RegionInfo.RegionSizeX; 2027 int regionSizeX = (int)m_scene.RegionInfo.RegionSizeX;
1686 int regionSizeY = (int)m_scene.RegionInfo.RegionSizeY; 2028 int regionSizeY = (int)m_scene.RegionInfo.RegionSizeY;
1687 2029
2030<<<<<<< HEAD
2031 int landTileSize = LandManagementModule.LandUnit;
2032=======
1688 int landTileSize = LandManagementModule.landUnit; 2033 int landTileSize = LandManagementModule.landUnit;
2034>>>>>>> avn/ubitvar
1689 int regionLandTilesX = regionSizeX / landTileSize; 2035 int regionLandTilesX = regionSizeX / landTileSize;
1690 int regionLandTilesY = regionSizeY / landTileSize; 2036 int regionLandTilesY = regionSizeY / landTileSize;
1691 2037
@@ -1708,7 +2054,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1708 { 2054 {
1709 using (SolidBrush transparent = new SolidBrush(background)) 2055 using (SolidBrush transparent = new SolidBrush(background))
1710 g.FillRectangle(transparent, 0, 0, regionSizeX, regionSizeY); 2056 g.FillRectangle(transparent, 0, 0, regionSizeX, regionSizeY);
2057<<<<<<< HEAD
2058=======
1711 2059
2060>>>>>>> avn/ubitvar
1712 2061
1713 foreach (ILandObject land in parcels) 2062 foreach (ILandObject land in parcels)
1714 { 2063 {
@@ -1731,6 +2080,17 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1731 2080
1732 using (SolidBrush yellow = new SolidBrush(Color.FromArgb(255, 249, 223, 9))) 2081 using (SolidBrush yellow = new SolidBrush(Color.FromArgb(255, 249, 223, 9)))
1733 { 2082 {
2083<<<<<<< HEAD
2084 for (int x = 0 ; x < regionLandTilesX ; x++)
2085 {
2086 for (int y = 0 ; y < regionLandTilesY ; y++)
2087 {
2088 if (saleBitmap[x, y])
2089 g.FillRectangle(
2090 yellow, x * landTileSize,
2091 regionSizeX - landTileSize - (y * landTileSize),
2092 landTileSize,
2093=======
1734 for (int x = 0; x < regionLandTilesX ; x++) 2094 for (int x = 0; x < regionLandTilesX ; x++)
1735 { 2095 {
1736 for (int y = 0; y < regionLandTilesY ; y++) 2096 for (int y = 0; y < regionLandTilesY ; y++)
@@ -1741,6 +2101,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1741 x * landTileSize, 2101 x * landTileSize,
1742 regionSizeX - landTileSize - (y * landTileSize), 2102 regionSizeX - landTileSize - (y * landTileSize),
1743 landTileSize, 2103 landTileSize,
2104>>>>>>> avn/ubitvar
1744 landTileSize); 2105 landTileSize);
1745 } 2106 }
1746 } 2107 }
diff --git a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs
index 78c050a..7472050 100644
--- a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs
+++ b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs
@@ -29,8 +29,10 @@
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.IO; 31using System.IO;
32using System.Linq;
32using System.Net; 33using System.Net;
33using System.Reflection; 34using System.Reflection;
35using System.Text;
34using System.Xml; 36using System.Xml;
35using log4net; 37using log4net;
36using Nini.Config; 38using Nini.Config;
@@ -42,8 +44,8 @@ using OpenSim.Region.DataSnapshot.Interfaces;
42using OpenSim.Region.Framework.Interfaces; 44using OpenSim.Region.Framework.Interfaces;
43using OpenSim.Region.Framework.Scenes; 45using OpenSim.Region.Framework.Scenes;
44 46
45[assembly: Addin("DataSnapshot", "0.1")] 47[assembly: Addin("DataSnapshot", OpenSim.VersionInfo.VersionNumber)]
46[assembly: AddinDependency("OpenSim", "0.5")] 48[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)]
47 49
48namespace OpenSim.Region.DataSnapshot 50namespace OpenSim.Region.DataSnapshot
49{ 51{
@@ -131,9 +133,12 @@ namespace OpenSim.Region.DataSnapshot
131 m_period = config.Configs["DataSnapshot"].GetInt("default_snapshot_period", m_period); 133 m_period = config.Configs["DataSnapshot"].GetInt("default_snapshot_period", m_period);
132 m_maxStales = config.Configs["DataSnapshot"].GetInt("max_changes_before_update", m_maxStales); 134 m_maxStales = config.Configs["DataSnapshot"].GetInt("max_changes_before_update", m_maxStales);
133 m_snapsDir = config.Configs["DataSnapshot"].GetString("snapshot_cache_directory", m_snapsDir); 135 m_snapsDir = config.Configs["DataSnapshot"].GetString("snapshot_cache_directory", m_snapsDir);
134 m_dataServices = config.Configs["DataSnapshot"].GetString("data_services", m_dataServices);
135 m_listener_port = config.Configs["Network"].GetString("http_listener_port", m_listener_port); 136 m_listener_port = config.Configs["Network"].GetString("http_listener_port", m_listener_port);
136 137
138 m_dataServices = config.Configs["DataSnapshot"].GetString("data_services", m_dataServices);
139 // New way of spec'ing data services, one per line
140 AddDataServicesVars(config.Configs["DataSnapshot"]);
141
137 String[] annoying_string_array = config.Configs["DataSnapshot"].GetString("disable_modules", "").Split(".".ToCharArray()); 142 String[] annoying_string_array = config.Configs["DataSnapshot"].GetString("disable_modules", "").Split(".".ToCharArray());
138 foreach (String bloody_wanker in annoying_string_array) 143 foreach (String bloody_wanker in annoying_string_array)
139 { 144 {
@@ -289,6 +294,28 @@ namespace OpenSim.Region.DataSnapshot
289 return null; 294 return null;
290 } 295 }
291 296
297 private void AddDataServicesVars(IConfig config)
298 {
299 // Make sure the services given this way aren't in m_dataServices already
300 List<string> servs = new List<string>(m_dataServices.Split(new char[] { ';' }));
301
302 StringBuilder sb = new StringBuilder();
303 string[] keys = config.GetKeys();
304
305 if (keys.Length > 0)
306 {
307 IEnumerable<string> serviceKeys = keys.Where(value => value.StartsWith("DATA_SRV_"));
308 foreach (string serviceKey in serviceKeys)
309 {
310 string keyValue = config.GetString(serviceKey, string.Empty).Trim();
311 if (!servs.Contains(keyValue))
312 sb.Append(keyValue).Append(";");
313 }
314 }
315
316 m_dataServices = (m_dataServices == "noservices") ? sb.ToString() : sb.Append(m_dataServices).ToString();
317 }
318
292 #endregion 319 #endregion
293 320
294 #region [Public] Snapshot storage functions 321 #region [Public] Snapshot storage functions
@@ -368,27 +395,48 @@ namespace OpenSim.Region.DataSnapshot
368 string delimStr = ";"; 395 string delimStr = ";";
369 char [] delimiter = delimStr.ToCharArray(); 396 char [] delimiter = delimStr.ToCharArray();
370 397
371 string[] services = servicesStr.Split(delimiter); 398 string[] services = servicesStr.Split(delimiter, StringSplitOptions.RemoveEmptyEntries);
372 399
373 for (int i = 0; i < services.Length; i++) 400 for (int i = 0; i < services.Length; i++)
374 { 401 {
375 string url = services[i].Trim(); 402 string url = services[i].Trim();
376 RestClient cli = new RestClient(url); 403 using (RestClient cli = new RestClient(url))
377 cli.AddQueryParameter("service", serviceName);
378 cli.AddQueryParameter("host", m_hostname);
379 cli.AddQueryParameter("port", m_listener_port);
380 cli.AddQueryParameter("secret", m_Secret.ToString());
381 cli.RequestMethod = "GET";
382 try
383 {
384 reply = cli.Request();
385 }
386 catch (WebException)
387 { 404 {
388 m_log.Warn("[DATASNAPSHOT]: Unable to notify " + url); 405<<<<<<< HEAD
406 cli.AddQueryParameter("service", serviceName);
407 cli.AddQueryParameter("host", m_hostname);
408 cli.AddQueryParameter("port", m_listener_port);
409 cli.AddQueryParameter("secret", m_Secret.ToString());
410 cli.RequestMethod = "GET";
411 try
412 {
413 reply = cli.Request(null);
414 }
415 catch (WebException)
416 {
417 m_log.Warn("[DATASNAPSHOT]: Unable to notify " + url);
418 }
419 catch (Exception e)
420 {
421 m_log.Warn("[DATASNAPSHOT]: Ignoring unknown exception " + e.ToString());
422 }
423
424 byte[] response = new byte[1024];
425 // int n = 0;
426 try
427 {
428 // n = reply.Read(response, 0, 1024);
429 reply.Read(response, 0, 1024);
430 }
431 catch (Exception e)
432 {
433 m_log.WarnFormat("[DATASNAPSHOT]: Unable to decode reply from data service. Ignoring. {0}", e.StackTrace);
434 }
435 // This is not quite working, so...
436 // string responseStr = Util.UTF8.GetString(response);
437 m_log.Info("[DATASNAPSHOT]: data service " + url + " notified. Secret: " + m_Secret);
389 } 438 }
390 catch (Exception e) 439=======
391 {
392 m_log.Warn("[DATASNAPSHOT]: Ignoring unknown exception " + e.ToString()); 440 m_log.Warn("[DATASNAPSHOT]: Ignoring unknown exception " + e.ToString());
393 } 441 }
394 442
@@ -409,6 +457,7 @@ namespace OpenSim.Region.DataSnapshot
409 457
410 if(reply != null) 458 if(reply != null)
411 reply.Close(); 459 reply.Close();
460>>>>>>> avn/ubitvar
412 } 461 }
413 462
414 } 463 }
diff --git a/OpenSim/Region/DataSnapshot/Properties/AssemblyInfo.cs b/OpenSim/Region/DataSnapshot/Properties/AssemblyInfo.cs
index 3d74597..e60d3ae 100644
--- a/OpenSim/Region/DataSnapshot/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/DataSnapshot/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.8.0.*")] 32[assembly: AssemblyVersion("0.8.2.*")]
33 33
diff --git a/OpenSim/Region/Framework/Interfaces/IAgentStatefulModule.cs b/OpenSim/Region/Framework/Interfaces/IAgentStatefulModule.cs
new file mode 100644
index 0000000..ccb2a03
--- /dev/null
+++ b/OpenSim/Region/Framework/Interfaces/IAgentStatefulModule.cs
@@ -0,0 +1,61 @@
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
28using System;
29using System.Collections.Generic;
30using OpenMetaverse;
31
32namespace OpenSim.Region.Framework.Interfaces
33{
34 public interface IAgentStatefulModule
35 {
36 /// <summary>
37 /// Returns a list of all the formats (by UUID) that this module
38 /// can render agent state in.
39 /// </summary>
40 List<UUID> GetRenderStateFormats();
41
42 /// <summary>
43 /// Returns a list (by UUID) of all formats this module can decode
44 /// to populate it's internal agent-related state.
45 /// </summary>
46 List<UUID> GetAcceptStateFormats();
47
48 /// <summary>
49 /// Render all internally held state for the given agent in the
50 /// requested format.
51 /// </summary>
52 string RenderState(UUID agentID, UUID format);
53
54 /// <summary>
55 /// Populate the internal state for the given agent from the
56 /// data argument, which is in the specified format. All prior
57 /// state relating to this agent is removed by this operation.
58 /// </summary>
59 bool ReceiveState(UUID agentID, UUID format, string data);
60 }
61}
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
index 84cdc15..50448b4 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
@@ -93,14 +93,21 @@ namespace OpenSim.Region.Framework.Interfaces
93 93
94 void EnableChildAgent(ScenePresence agent, GridRegion region); 94 void EnableChildAgent(ScenePresence agent, GridRegion region);
95 95
96<<<<<<< HEAD
97 GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out string version,
98 out Vector3 newpos, out string reason);
99
100=======
96 GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out string version, out Vector3 newpos); 101 GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out string version, out Vector3 newpos);
97 GridRegion GetObjectDestination(SceneObjectGroup grp, Vector3 targetPosition, out Vector3 newpos); 102 GridRegion GetObjectDestination(SceneObjectGroup grp, Vector3 targetPosition, out Vector3 newpos);
98 bool checkAgentAccessToRegion(ScenePresence agent, GridRegion destiny, Vector3 position, out string version, out string reason); 103 bool checkAgentAccessToRegion(ScenePresence agent, GridRegion destiny, Vector3 position, out string version, out string reason);
104>>>>>>> avn/ubitvar
99 void Cross(SceneObjectGroup sog, Vector3 position, bool silent); 105 void Cross(SceneObjectGroup sog, Vector3 position, bool silent);
100 bool CrossPrimGroupIntoNewRegion(GridRegion destination, Vector3 newPosition, SceneObjectGroup grp, bool silent); 106 bool CrossPrimGroupIntoNewRegion(GridRegion destination, Vector3 newPosition, SceneObjectGroup grp, bool silent);
101 107
102 ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, string version); 108 ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, string version);
103 109
110 bool HandleIncomingSceneObject(SceneObjectGroup so, Vector3 newPosition);
104 } 111 }
105 112
106 public interface IUserAgentVerificationModule 113 public interface IUserAgentVerificationModule
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs
deleted file mode 100644
index 35cc220..0000000
--- a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs
+++ /dev/null
@@ -1,115 +0,0 @@
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
28using System;
29using System.Collections.Generic;
30using OpenSim.Framework;
31using OpenMetaverse;
32
33namespace OpenSim.Region.Framework.Interfaces
34{
35 public interface IEstateDataService
36 {
37 /// <summary>
38 /// Load estate settings for a region.
39 /// </summary>
40 /// <param name="regionID"></param>
41 /// <param name="create">If true, then an estate is created if one is not found.</param>
42 /// <returns></returns>
43 EstateSettings LoadEstateSettings(UUID regionID, bool create);
44
45 /// <summary>
46 /// Load estate settings for an estate ID.
47 /// </summary>
48 /// <param name="estateID"></param>
49 /// <returns></returns>
50 EstateSettings LoadEstateSettings(int estateID);
51
52 /// <summary>
53 /// Create a new estate.
54 /// </summary>
55 /// <returns>
56 /// A <see cref="EstateSettings"/>
57 /// </returns>
58 EstateSettings CreateNewEstate();
59
60 /// <summary>
61 /// Load/Get all estate settings.
62 /// </summary>
63 /// <returns>An empty list if no estates were found.</returns>
64 List<EstateSettings> LoadEstateSettingsAll();
65
66 /// <summary>
67 /// Store estate settings.
68 /// </summary>
69 /// <remarks>
70 /// This is also called by EstateSettings.Save()</remarks>
71 /// <param name="es"></param>
72 void StoreEstateSettings(EstateSettings es);
73
74 /// <summary>
75 /// Get estate IDs.
76 /// </summary>
77 /// <param name="search">Name of estate to search for. This is the exact name, no parttern matching is done.</param>
78 /// <returns></returns>
79 List<int> GetEstates(string search);
80
81 /// <summary>
82 /// Get the IDs of all estates owned by the given user.
83 /// </summary>
84 /// <returns>An empty list if no estates were found.</returns>
85 List<int> GetEstatesByOwner(UUID ownerID);
86
87 /// <summary>
88 /// Get the IDs of all estates.
89 /// </summary>
90 /// <returns>An empty list if no estates were found.</returns>
91 List<int> GetEstatesAll();
92
93 /// <summary>
94 /// Link a region to an estate.
95 /// </summary>
96 /// <param name="regionID"></param>
97 /// <param name="estateID"></param>
98 /// <returns>true if the link succeeded, false otherwise</returns>
99 bool LinkRegion(UUID regionID, int estateID);
100
101 /// <summary>
102 /// Get the UUIDs of all the regions in an estate.
103 /// </summary>
104 /// <param name="estateID"></param>
105 /// <returns></returns>
106 List<UUID> GetRegions(int estateID);
107
108 /// <summary>
109 /// Delete an estate
110 /// </summary>
111 /// <param name="estateID"></param>
112 /// <returns>true if the delete succeeded, false otherwise</returns>
113 bool DeleteEstate(int estateID);
114 }
115} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs
deleted file mode 100644
index 8febb13..0000000
--- a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs
+++ /dev/null
@@ -1,120 +0,0 @@
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
28using System.Collections.Generic;
29using OpenMetaverse;
30using OpenSim.Framework;
31
32namespace OpenSim.Region.Framework.Interfaces
33{
34 public interface IEstateDataStore
35 {
36 /// <summary>
37 /// Initialise the data store.
38 /// </summary>
39 /// <param name="connectstring"></param>
40 void Initialise(string connectstring);
41
42 /// <summary>
43 /// Load estate settings for a region.
44 /// </summary>
45 /// <param name="regionID"></param>
46 /// <param name="create">If true, then an estate is created if one is not found.</param>
47 /// <returns></returns>
48 EstateSettings LoadEstateSettings(UUID regionID, bool create);
49
50 /// <summary>
51 /// Load estate settings for an estate ID.
52 /// </summary>
53 /// <param name="estateID"></param>
54 /// <returns></returns>
55 EstateSettings LoadEstateSettings(int estateID);
56
57 /// <summary>
58 /// Create a new estate.
59 /// </summary>
60 /// <returns>
61 /// A <see cref="EstateSettings"/>
62 /// </returns>
63 EstateSettings CreateNewEstate();
64
65 /// <summary>
66 /// Load/Get all estate settings.
67 /// </summary>
68 /// <returns>An empty list if no estates were found.</returns>
69 List<EstateSettings> LoadEstateSettingsAll();
70
71 /// <summary>
72 /// Store estate settings.
73 /// </summary>
74 /// <remarks>
75 /// This is also called by EstateSettings.Save()</remarks>
76 /// <param name="es"></param>
77 void StoreEstateSettings(EstateSettings es);
78
79 /// <summary>
80 /// Get estate IDs.
81 /// </summary>
82 /// <param name="search">Name of estate to search for. This is the exact name, no parttern matching is done.</param>
83 /// <returns></returns>
84 List<int> GetEstates(string search);
85
86 /// <summary>
87 /// Get the IDs of all estates owned by the given user.
88 /// </summary>
89 /// <returns>An empty list if no estates were found.</returns>
90 List<int> GetEstatesByOwner(UUID ownerID);
91
92 /// <summary>
93 /// Get the IDs of all estates.
94 /// </summary>
95 /// <returns>An empty list if no estates were found.</returns>
96 List<int> GetEstatesAll();
97
98 /// <summary>
99 /// Link a region to an estate.
100 /// </summary>
101 /// <param name="regionID"></param>
102 /// <param name="estateID"></param>
103 /// <returns>true if the link succeeded, false otherwise</returns>
104 bool LinkRegion(UUID regionID, int estateID);
105
106 /// <summary>
107 /// Get the UUIDs of all the regions in an estate.
108 /// </summary>
109 /// <param name="estateID"></param>
110 /// <returns></returns>
111 List<UUID> GetRegions(int estateID);
112
113 /// <summary>
114 /// Delete an estate
115 /// </summary>
116 /// <param name="estateID"></param>
117 /// <returns>true if the delete succeeded, false otherwise</returns>
118 bool DeleteEstate(int estateID);
119 }
120} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs
index 944c66b..461c880 100644
--- a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs
@@ -26,6 +26,8 @@
26 */ 26 */
27 27
28using OpenMetaverse; 28using OpenMetaverse;
29using OpenSim.Framework;
30using OpenSim.Services.Interfaces;
29 31
30namespace OpenSim.Region.Framework.Interfaces 32namespace OpenSim.Region.Framework.Interfaces
31{ 33{
@@ -41,6 +43,11 @@ namespace OpenSim.Region.Framework.Interfaces
41 uint GetRegionFlags(); 43 uint GetRegionFlags();
42 bool IsManager(UUID avatarID); 44 bool IsManager(UUID avatarID);
43 45
46 string SetEstateOwner(int estateID, UserAccount account);
47 string SetEstateName(int estateID, string newName);
48 string SetRegionEstate(RegionInfo regionInfo, int estateID);
49 string CreateEstate(string estateName, UUID ownerID);
50
44 /// <summary> 51 /// <summary>
45 /// Tell all clients about the current state of the region (terrain textures, water height, etc.). 52 /// Tell all clients about the current state of the region (terrain textures, water height, etc.).
46 /// </summary> 53 /// </summary>
diff --git a/OpenSim/Region/Framework/Interfaces/IGroupsMessagingModule.cs b/OpenSim/Region/Framework/Interfaces/IGroupsMessagingModule.cs
index f158236..7dc1552 100644
--- a/OpenSim/Region/Framework/Interfaces/IGroupsMessagingModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IGroupsMessagingModule.cs
@@ -25,6 +25,7 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
28using OpenMetaverse; 29using OpenMetaverse;
29using OpenSim.Framework; 30using OpenSim.Framework;
30 31
@@ -57,7 +58,7 @@ namespace OpenSim.Region.Framework.Interfaces
57 bool StartGroupChatSession(UUID agentID, UUID groupID); 58 bool StartGroupChatSession(UUID agentID, UUID groupID);
58 59
59 /// <summary> 60 /// <summary>
60 /// Send a message to an entire group. 61 /// Send a message to each member of a group whose chat session is active.
61 /// </summary> 62 /// </summary>
62 /// <param name="im"> 63 /// <param name="im">
63 /// The message itself. The fields that must be populated are 64 /// The message itself. The fields that must be populated are
@@ -69,5 +70,28 @@ namespace OpenSim.Region.Framework.Interfaces
69 /// </param> 70 /// </param>
70 /// <param name="groupID"></param> 71 /// <param name="groupID"></param>
71 void SendMessageToGroup(GridInstantMessage im, UUID groupID); 72 void SendMessageToGroup(GridInstantMessage im, UUID groupID);
73
74 /// <summary>
75 /// Send a message to all the members of a group that fulfill a condition.
76 /// </summary>
77 /// <param name="im">
78 /// The message itself. The fields that must be populated are
79 ///
80 /// imSessionID - Populate this with the group ID (session ID and group ID are currently identical)
81 /// fromAgentName - Populate this with whatever arbitrary name you want to show up in the chat dialog
82 /// message - The message itself
83 /// dialog - This must be (byte)InstantMessageDialog.SessionSend
84 /// </param>
85 /// <param name="groupID"></param>
86 /// <param name="sendingAgentForGroupCalls">
87 /// The requesting agent to use when querying the groups service. Sometimes this is different from
88 /// im.fromAgentID, with group notices, for example.
89 /// </param>
90 /// <param name="sendCondition">
91 /// The condition that must be met by a member for the message to be sent. If null then the message is sent
92 /// if the chat session is active.
93 /// </param>
94 void SendMessageToGroup(
95 GridInstantMessage im, UUID groupID, UUID sendingAgentForGroupCalls, Func<GroupMembersData, bool> sendCondition);
72 } 96 }
73} \ No newline at end of file 97} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Interfaces/IHttpRequests.cs b/OpenSim/Region/Framework/Interfaces/IHttpRequests.cs
index eb6c5ac..2f9b222 100644
--- a/OpenSim/Region/Framework/Interfaces/IHttpRequests.cs
+++ b/OpenSim/Region/Framework/Interfaces/IHttpRequests.cs
@@ -25,6 +25,7 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
28using System.Collections.Generic; 29using System.Collections.Generic;
29using OpenMetaverse; 30using OpenMetaverse;
30 31
@@ -41,11 +42,56 @@ namespace OpenSim.Region.Framework.Interfaces
41 HTTP_PRAGMA_NO_CACHE = 6 42 HTTP_PRAGMA_NO_CACHE = 6
42 } 43 }
43 44
45 /// <summary>
46 /// The initial status of the request before it is placed on the wire.
47 /// </summary>
48 /// <remarks>
49 /// The request may still fail later on, in which case the normal HTTP status is set.
50 /// </remarks>
51 [Flags]
52 public enum HttpInitialRequestStatus
53 {
54 OK = 1,
55 DISALLOWED_BY_FILTER = 2
56 }
57
44 public interface IHttpRequestModule 58 public interface IHttpRequestModule
45 { 59 {
46 UUID MakeHttpRequest(string url, string parameters, string body); 60 UUID MakeHttpRequest(string url, string parameters, string body);
61<<<<<<< HEAD
62
63 /// <summary>
64 /// Starts the http request.
65 /// </summary>
66 /// <remarks>
67 /// This is carried out asynchronously unless it fails initial checks. Results are fetched by the script engine
68 /// HTTP requests module to be distributed back to scripts via a script event.
69 /// </remarks>
70 /// <returns>The ID of the request. If the requested could not be performed then this is UUID.Zero</returns>
71 /// <param name="localID">Local ID of the object containing the script making the request.</param>
72 /// <param name="itemID">Item ID of the script making the request.</param>
73 /// <param name="url">Url to request.</param>
74 /// <param name="parameters">LSL parameters for the request.</param>
75 /// <param name="headers">Extra headers for the request.</param>
76 /// <param name="body">Body of the request.</param>
77 /// <param name="status">
78 /// Initial status of the request. If OK then the request is actually made to the URL. Subsequent status is
79 /// then returned via IServiceRequest when the response is asynchronously fetched.
80 /// </param>
81 UUID StartHttpRequest(
82 uint localID, UUID itemID, string url, List<string> parameters, Dictionary<string, string> headers, string body,
83 out HttpInitialRequestStatus status);
84
85 /// <summary>
86 /// Stop and remove all http requests for the given script.
87 /// </summary>
88 /// <param name='id'></param>
89 void StopHttpRequestsForScript(UUID id);
90
91=======
47 UUID StartHttpRequest(uint localID, UUID itemID, string url, List<string> parameters, Dictionary<string, string> headers, string body); 92 UUID StartHttpRequest(uint localID, UUID itemID, string url, List<string> parameters, Dictionary<string, string> headers, string body);
48 void StopHttpRequest(uint m_localID, UUID m_itemID); 93 void StopHttpRequest(uint m_localID, UUID m_itemID);
94>>>>>>> avn/ubitvar
49 IServiceRequest GetNextCompletedRequest(); 95 IServiceRequest GetNextCompletedRequest();
50 void RemoveCompletedRequest(UUID id); 96 void RemoveCompletedRequest(UUID id);
51 } 97 }
diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs
index 3576e35..6bad018 100644
--- a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs
@@ -38,7 +38,9 @@ namespace OpenSim.Region.Framework.Interfaces
38 public interface IInventoryAccessModule 38 public interface IInventoryAccessModule
39 { 39 {
40 UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data); 40 UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data);
41 41
42 bool UpdateInventoryItemAsset(UUID ownerID, InventoryItemBase item, AssetBase asset);
43
42 /// <summary> 44 /// <summary>
43 /// Copy objects to a user's inventory. 45 /// Copy objects to a user's inventory.
44 /// </summary> 46 /// </summary>
diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs
index ddf7565..37e20c3 100644
--- a/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs
@@ -29,6 +29,7 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using OpenSim.Services.Interfaces; 31using OpenSim.Services.Interfaces;
32using OpenMetaverse;
32 33
33namespace OpenSim.Region.Framework.Interfaces 34namespace OpenSim.Region.Framework.Interfaces
34{ 35{
@@ -41,8 +42,24 @@ namespace OpenSim.Region.Framework.Interfaces
41 /// <param name="invPath">The inventory path saved</param> 42 /// <param name="invPath">The inventory path saved</param>
42 /// <param name="savePath">The stream to which the archive was saved</param> 43 /// <param name="savePath">The stream to which the archive was saved</param>
43 /// <param name="reportedException">Contains the exception generated if the save did not succeed</param> 44 /// <param name="reportedException">Contains the exception generated if the save did not succeed</param>
45 /// <param name="saveCount">Number of inventory items saved to archive</param>
46 /// <param name="filterCount">Number of inventory items skipped due to perm filter option</param>
44 public delegate void InventoryArchiveSaved( 47 public delegate void InventoryArchiveSaved(
45 Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, Exception reportedException); 48 UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, Exception reportedException, int saveCount, int filterCount);
49
50 /// <summary>
51 /// Used for the OnInventoryArchiveLoaded event.
52 /// </summary>
53 /// <param name="id">Request id</param>
54 /// <param name="succeeded">true if the load succeeded, false otherwise</param>
55 /// <param name="userInfo">The user for whom the load was conducted</param>
56 /// <param name="invPath">The inventory path loaded</param>
57 /// <param name="savePath">The stream from which the archive was loaded</param>
58 /// <param name="reportedException">Contains the exception generated if the load did not succeed</param>
59 /// <param name="loadCount">Number of inventory items loaded from archive</param>
60 public delegate void InventoryArchiveLoaded(
61 UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream loadStream, Exception reportedException, int loadCount);
62
46 63
47 public interface IInventoryArchiverModule 64 public interface IInventoryArchiverModule
48 { 65 {
@@ -52,6 +69,11 @@ namespace OpenSim.Region.Framework.Interfaces
52 event InventoryArchiveSaved OnInventoryArchiveSaved; 69 event InventoryArchiveSaved OnInventoryArchiveSaved;
53 70
54 /// <summary> 71 /// <summary>
72 /// Fired when an archive inventory load has been completed.
73 /// </summary>
74 event InventoryArchiveLoaded OnInventoryArchiveLoaded;
75
76 /// <summary>
55 /// Dearchive a user's inventory folder from the given stream 77 /// Dearchive a user's inventory folder from the given stream
56 /// </summary> 78 /// </summary>
57 /// <param name="firstName"></param> 79 /// <param name="firstName"></param>
@@ -59,7 +81,7 @@ namespace OpenSim.Region.Framework.Interfaces
59 /// <param name="invPath">The inventory path in which to place the loaded folders and items</param> 81 /// <param name="invPath">The inventory path in which to place the loaded folders and items</param>
60 /// <param name="loadStream">The stream from which the inventory archive will be loaded</param> 82 /// <param name="loadStream">The stream from which the inventory archive will be loaded</param>
61 /// <returns>true if the first stage of the operation succeeded, false otherwise</returns> 83 /// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
62 bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream); 84 bool DearchiveInventory(UUID id, string firstName, string lastName, string invPath, string pass, Stream loadStream);
63 85
64 /// <summary> 86 /// <summary>
65 /// Dearchive a user's inventory folder from the given stream 87 /// Dearchive a user's inventory folder from the given stream
@@ -72,7 +94,7 @@ namespace OpenSim.Region.Framework.Interfaces
72 /// the loaded IAR with existing folders where possible.</param> 94 /// the loaded IAR with existing folders where possible.</param>
73 /// <returns>true if the first stage of the operation succeeded, false otherwise</returns> 95 /// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
74 bool DearchiveInventory( 96 bool DearchiveInventory(
75 string firstName, string lastName, string invPath, string pass, Stream loadStream, 97 UUID id, string firstName, string lastName, string invPath, string pass, Stream loadStream,
76 Dictionary<string, object> options); 98 Dictionary<string, object> options);
77 99
78 /// <summary> 100 /// <summary>
@@ -84,7 +106,7 @@ namespace OpenSim.Region.Framework.Interfaces
84 /// <param name="invPath">The inventory path from which the inventory should be saved.</param> 106 /// <param name="invPath">The inventory path from which the inventory should be saved.</param>
85 /// <param name="saveStream">The stream to which the inventory archive will be saved</param> 107 /// <param name="saveStream">The stream to which the inventory archive will be saved</param>
86 /// <returns>true if the first stage of the operation succeeded, false otherwise</returns> 108 /// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
87 bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream); 109 bool ArchiveInventory(UUID id, string firstName, string lastName, string invPath, string pass, Stream saveStream);
88 110
89 /// <summary> 111 /// <summary>
90 /// Archive a user's inventory folder to the given stream 112 /// Archive a user's inventory folder to the given stream
@@ -97,7 +119,7 @@ namespace OpenSim.Region.Framework.Interfaces
97 /// <param name="options">Archiving options. Currently, there are none.</param> 119 /// <param name="options">Archiving options. Currently, there are none.</param>
98 /// <returns>true if the first stage of the operation succeeded, false otherwise</returns> 120 /// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
99 bool ArchiveInventory( 121 bool ArchiveInventory(
100 Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream, 122 UUID id, string firstName, string lastName, string invPath, string pass, Stream saveStream,
101 Dictionary<string, object> options); 123 Dictionary<string, object> options);
102 } 124 }
103} 125}
diff --git a/OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs b/OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs
index 46d03b3..1cbd045 100644
--- a/OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs
+++ b/OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -25,6 +25,7 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System.Drawing;
28using OpenMetaverse; 29using OpenMetaverse;
29using OpenMetaverse.Imaging; 30using OpenMetaverse.Imaging;
30 31
@@ -53,5 +54,12 @@ namespace OpenSim.Region.Framework.Interfaces
53 /// <param name="components">number of components</param> 54 /// <param name="components">number of components</param>
54 /// <returns>true if decode was successful. false otherwise.</returns> 55 /// <returns>true if decode was successful. false otherwise.</returns>
55 bool Decode(UUID assetID, byte[] j2kData, out OpenJPEG.J2KLayerInfo[] layers, out int components); 56 bool Decode(UUID assetID, byte[] j2kData, out OpenJPEG.J2KLayerInfo[] layers, out int components);
57
58 /// <summary>
59 /// Provides a synchronous decode direct to an image object
60 /// </summary>
61 /// <param name="j2kData"></param>
62 /// <returns>decoded image or 'null' of unsuccessful</returns>
63 Image DecodeToImage(byte[] j2kData);
56 } 64 }
57} 65}
diff --git a/OpenSim/Region/Framework/Interfaces/IMapImageUploadModule.cs b/OpenSim/Region/Framework/Interfaces/IMapImageUploadModule.cs
index 5151567..eb79711 100644
--- a/OpenSim/Region/Framework/Interfaces/IMapImageUploadModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IMapImageUploadModule.cs
@@ -25,14 +25,24 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28<<<<<<< HEAD
29using System.Drawing;
30using OpenSim.Framework;
31=======
28using OpenMetaverse; 32using OpenMetaverse;
29using OpenSim.Framework; 33using OpenSim.Framework;
30using System.Drawing; 34using System.Drawing;
35>>>>>>> avn/ubitvar
31 36
32namespace OpenSim.Region.Framework.Interfaces 37namespace OpenSim.Region.Framework.Interfaces
33{ 38{
34 public interface IMapImageUploadModule 39 public interface IMapImageUploadModule
35 { 40 {
41<<<<<<< HEAD
42 void UploadMapTile(IScene scene, Bitmap mapTile);
43 }
44}
45=======
36 /// <summary> 46 /// <summary>
37 /// Upload a new maptile 47 /// Upload a new maptile
38 /// </summary> 48 /// </summary>
@@ -40,3 +50,4 @@ namespace OpenSim.Region.Framework.Interfaces
40 void UploadMapTile(IScene scene, Bitmap mapTile); 50 void UploadMapTile(IScene scene, Bitmap mapTile);
41 } 51 }
42} 52}
53>>>>>>> avn/ubitvar
diff --git a/OpenSim/Region/Framework/Interfaces/IMessageTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IMessageTransferModule.cs
index b0b47a7..290b826 100644
--- a/OpenSim/Region/Framework/Interfaces/IMessageTransferModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IMessageTransferModule.cs
@@ -36,6 +36,26 @@ namespace OpenSim.Region.Framework.Interfaces
36 { 36 {
37 event UndeliveredMessage OnUndeliveredMessage; 37 event UndeliveredMessage OnUndeliveredMessage;
38 38
39 /// <summary>
40 /// Attempt to send an instant message to a given destination.
41 /// </summary>
42 /// <remarks>
43 /// If the message cannot be delivered for any reason, this will be signalled on the OnUndeliveredMessage
44 /// event. result(false) will also be called if the message cannot be delievered unless the type is
45 /// InstantMessageDialog.MessageFromAgent. For successful message delivery, result(true) is called.
46 /// </remarks>
47 /// <param name="im"></param>
48 /// <param name="result"></param>
39 void SendInstantMessage(GridInstantMessage im, MessageResultNotification result); 49 void SendInstantMessage(GridInstantMessage im, MessageResultNotification result);
50
51 /// <summary>
52 /// Appropriately handle a known undeliverable message without attempting a send.
53 /// </summary>
54 /// <remarks>
55 /// Essentially, this invokes the OnUndeliveredMessage event.
56 /// </remarks>
57 /// <param name="im"></param>
58 /// <param name="result"></param>
59 void HandleUndeliverableMessage(GridInstantMessage im, MessageResultNotification result);
40 } 60 }
41} 61}
diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
index 9817cf7..478833e 100644
--- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
@@ -72,6 +72,32 @@ namespace OpenSim.Region.Framework.Interfaces
72 AvatarAppearance appearance); 72 AvatarAppearance appearance);
73 73
74 /// <summary> 74 /// <summary>
75 /// Create an NPC with a user-supplied agentID
76 /// </summary>
77 /// <param name="firstname"></param>
78 /// <param name="lastname"></param>
79 /// <param name="position"></param>
80 /// <param name="agentID"></param>
81 /// The desired agent ID
82 /// <param name="owner"></param>
83 /// <param name="senseAsAgent">
84 /// Make the NPC show up as an agent on LSL sensors. The default is
85 /// that they show up as the NPC type instead, but this is currently
86 /// an OpenSim-only extension.
87 /// </param>
88 /// <param name="scene"></param>
89 /// <param name="appearance">
90 /// The avatar appearance to use for the new NPC.
91 /// </param>
92 /// <returns>
93 /// The UUID of the ScenePresence created. UUID.Zero if there was a
94 /// failure.
95 /// </returns>
96 UUID CreateNPC(string firstname, string lastname,
97 Vector3 position, UUID agentID, UUID owner, bool senseAsAgent, Scene scene,
98 AvatarAppearance appearance);
99
100 /// <summary>
75 /// Check if the agent is an NPC. 101 /// Check if the agent is an NPC.
76 /// </summary> 102 /// </summary>
77 /// <param name="agentID"></param> 103 /// <param name="agentID"></param>
@@ -96,6 +122,17 @@ namespace OpenSim.Region.Framework.Interfaces
96 /// <summary> 122 /// <summary>
97 /// Check if the caller has permission to manipulate the given NPC. 123 /// Check if the caller has permission to manipulate the given NPC.
98 /// </summary> 124 /// </summary>
125 /// <remarks>
126 /// A caller has permission if
127 /// * An NPC exists with the given npcID.
128 /// * The caller UUID given is UUID.Zero.
129 /// * The avatar is unowned (owner is UUID.Zero).
130 /// * The avatar is owned and the owner and callerID match.
131 /// * The avatar is owned and the callerID matches its agentID.
132 /// </remarks>
133 /// <param name="av"></param>
134 /// <param name="callerID"></param>
135 /// <returns>true if they do, false if they don't.</returns>
99 /// <param name="npcID"></param> 136 /// <param name="npcID"></param>
100 /// <param name="callerID"></param> 137 /// <param name="callerID"></param>
101 /// <returns> 138 /// <returns>
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs
index ed93916..445342d 100644
--- a/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs
@@ -127,7 +127,12 @@ namespace OpenSim.Region.Framework.Interfaces
127 /// <param name="requestId">If supplied, this request Id is later returned in the saved event</param> 127 /// <param name="requestId">If supplied, this request Id is later returned in the saved event</param>
128 /// <param name="options"> 128 /// <param name="options">
129 /// Dictionary of options. 129 /// Dictionary of options.
130<<<<<<< HEAD
131 /// </param>
132 void DearchiveRegion(Stream loadStream, Guid requestId, Dictionary<string,object> options);
133=======
130 /// </param> 134 /// </param>
131 void DearchiveRegion(Stream loadStream, Guid requestId, Dictionary<string, object> options); 135 void DearchiveRegion(Stream loadStream, Guid requestId, Dictionary<string, object> options);
136>>>>>>> avn/ubitvar
132 } 137 }
133} 138}
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionModuleBase.cs b/OpenSim/Region/Framework/Interfaces/IRegionModuleBase.cs
index 9b1e4ca..2089bce 100644
--- a/OpenSim/Region/Framework/Interfaces/IRegionModuleBase.cs
+++ b/OpenSim/Region/Framework/Interfaces/IRegionModuleBase.cs
@@ -32,6 +32,7 @@ using OpenSim.Region.Framework.Scenes;
32 32
33namespace OpenSim.Region.Framework.Interfaces 33namespace OpenSim.Region.Framework.Interfaces
34{ 34{
35 [TypeExtensionPoint(Path = "/OpenSim/RegionModules", NodeName="RegionModule")]
35 public interface IRegionModuleBase 36 public interface IRegionModuleBase
36 { 37 {
37 /// <value> 38 /// <value>
diff --git a/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs b/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs
index 595e031..ff18519 100644
--- a/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs
@@ -24,10 +24,15 @@
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 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. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27using System.IO;
27 28
29using OpenSim.Framework;
28 30
31<<<<<<< HEAD
32=======
29using System.IO; 33using System.IO;
30using OpenSim.Framework; 34using OpenSim.Framework;
35>>>>>>> avn/ubitvar
31using OpenMetaverse; 36using OpenMetaverse;
32 37
33namespace OpenSim.Region.Framework.Interfaces 38namespace OpenSim.Region.Framework.Interfaces
@@ -51,6 +56,12 @@ namespace OpenSim.Region.Framework.Interfaces
51 void PushTerrain(IClientAPI pClient); 56 void PushTerrain(IClientAPI pClient);
52 57
53 /// <summary> 58 /// <summary>
59 /// When a client initially connects, all the terrain must be pushed to the viewer.
60 /// This call causes all the terrain patches to be sent to the client.
61 /// </summary>
62 void PushTerrain(IClientAPI pClient);
63
64 /// <summary>
54 /// Load a terrain from a stream. 65 /// Load a terrain from a stream.
55 /// </summary> 66 /// </summary>
56 /// <param name="filename"> 67 /// <param name="filename">
@@ -58,6 +69,7 @@ namespace OpenSim.Region.Framework.Interfaces
58 /// </param> 69 /// </param>
59 /// <param name="stream"></param> 70 /// <param name="stream"></param>
60 void LoadFromStream(string filename, Stream stream); 71 void LoadFromStream(string filename, Stream stream);
72 void LoadFromStream(string filename, Vector3 displacement, float radianRotation, Vector2 rotationDisplacement, Stream stream);
61 void LoadFromStream(string filename, System.Uri pathToTerrainHeightmap); 73 void LoadFromStream(string filename, System.Uri pathToTerrainHeightmap);
62 void LoadFromStream(string filename, Vector3 displacement, 74 void LoadFromStream(string filename, Vector3 displacement,
63 float radianRotation, Vector2 rotationDisplacement, Stream stream); 75 float radianRotation, Vector2 rotationDisplacement, Stream stream);
diff --git a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
deleted file mode 100644
index f8088c3..0000000
--- a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
+++ /dev/null
@@ -1,96 +0,0 @@
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
28using System;
29using System.Collections.Generic;
30
31using OpenMetaverse;
32
33namespace OpenSim.Region.Framework.Interfaces
34{
35 /// <summary>
36 /// This maintains the relationship between a UUID and a user name.
37 /// </summary>
38 public interface IUserManagement
39 {
40 string GetUserName(UUID uuid);
41 string GetUserHomeURL(UUID uuid);
42 string GetUserUUI(UUID uuid);
43 string GetUserServerURL(UUID uuid, string serverType);
44
45 /// <summary>
46 /// Get user ID by the given name.
47 /// </summary>
48 /// <param name="name"></param>
49 /// <returns>UUID.Zero if no user with that name is found or if the name is "Unknown User"</returns>
50 UUID GetUserIdByName(string name);
51
52 /// <summary>
53 /// Get user ID by the given name.
54 /// </summary>
55 /// <param name="firstName"></param>
56 /// <param name="lastName"></param>
57 /// <returns>UUID.Zero if no user with that name is found or if the name is "Unknown User"</returns>
58 UUID GetUserIdByName(string firstName, string lastName);
59
60 /// <summary>
61 /// Add a user.
62 /// </summary>
63 /// <remarks>
64 /// If an account is found for the UUID, then the names in this will be used rather than any information
65 /// extracted from creatorData.
66 /// </remarks>
67 /// <param name="uuid"></param>
68 /// <param name="creatorData">The creator data for this user.</param>
69 void AddUser(UUID uuid, string creatorData);
70
71 /// <summary>
72 /// Add a user.
73 /// </summary>
74 /// <remarks>
75 /// The UUID is related to the name without any other checks being performed, such as user account presence.
76 /// </remarks>
77 /// <param name="uuid"></param>
78 /// <param name="firstName"></param>
79 /// <param name="lastName"></param>
80 void AddUser(UUID uuid, string firstName, string lastName);
81
82 /// <summary>
83 /// Add a user.
84 /// </summary>
85 /// <remarks>
86 /// The arguments apart from uuid are formed into a creatorData string and processing proceeds as for the
87 /// AddUser(UUID uuid, string creatorData) method.
88 /// </remarks>
89 /// <param name="uuid"></param>
90 /// <param name="firstName"></param>
91 /// <param name="profileURL"></param>
92 void AddUser(UUID uuid, string firstName, string lastName, string homeURL);
93
94 bool IsLocalGridUser(UUID uuid);
95 }
96}
diff --git a/OpenSim/Region/Framework/Interfaces/IWindModelPlugin.cs b/OpenSim/Region/Framework/Interfaces/IWindModelPlugin.cs
index b087c8b..16b6024 100644
--- a/OpenSim/Region/Framework/Interfaces/IWindModelPlugin.cs
+++ b/OpenSim/Region/Framework/Interfaces/IWindModelPlugin.cs
@@ -33,8 +33,11 @@ using OpenSim.Framework;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
35 35
36using Mono.Addins;
37
36namespace OpenSim.Region.Framework.Interfaces 38namespace OpenSim.Region.Framework.Interfaces
37{ 39{
40 [TypeExtensionPoint(Path = "/OpenSim/WindModule", NodeName = "WindModel")]
38 public interface IWindModelPlugin : IPlugin 41 public interface IWindModelPlugin : IPlugin
39 { 42 {
40 /// <summary> 43 /// <summary>
diff --git a/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs b/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs
index e9cf4ad..08dc3e3 100644
--- a/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs
@@ -37,6 +37,10 @@ namespace OpenSim.Region.Framework.Interfaces
37 /// </summary> 37 /// </summary>
38 void GenerateMaptile(); 38 void GenerateMaptile();
39 List<MapBlockData> Map2BlockFromGridRegion(GridRegion r, uint flag); 39 List<MapBlockData> Map2BlockFromGridRegion(GridRegion r, uint flag);
40<<<<<<< HEAD
41 MapBlockData MapBlockFromGridRegion(GridRegion r, uint flag);
42=======
40 void MapBlockFromGridRegion(MapBlockData block, GridRegion r, uint flag); 43 void MapBlockFromGridRegion(MapBlockData block, GridRegion r, uint flag);
44>>>>>>> avn/ubitvar
41 } 45 }
42} 46}
diff --git a/OpenSim/Region/Framework/Properties/AssemblyInfo.cs b/OpenSim/Region/Framework/Properties/AssemblyInfo.cs
index a2a99d4..97dea1f 100644
--- a/OpenSim/Region/Framework/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/Framework/Properties/AssemblyInfo.cs
@@ -1,6 +1,7 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.CompilerServices; 2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices; 3using System.Runtime.InteropServices;
4using Mono.Addins;
4 5
5// General Information about an assembly is controlled through the following 6// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information 7// set of attributes. Change these attribute values to modify the information
@@ -22,6 +23,7 @@ using System.Runtime.InteropServices;
22// The following GUID is for the ID of the typelib if this project is exposed to COM 23// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("d25e7aed-7f55-4bb8-9970-0d7d978ea8a5")] 24[assembly: Guid("d25e7aed-7f55-4bb8-9970-0d7d978ea8a5")]
24 25
26
25// Version information for an assembly consists of the following four values: 27// Version information for an assembly consists of the following four values:
26// 28//
27// Major Version 29// Major Version
@@ -29,5 +31,6 @@ using System.Runtime.InteropServices;
29// Build Number 31// Build Number
30// Revision 32// Revision
31// 33//
32[assembly: AssemblyVersion("0.8.0.*")] 34[assembly: AssemblyVersion("0.8.2.*")]
35[assembly: AddinRoot("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)]
33 36
diff --git a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs
index b7400ea..eb1a970 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs
@@ -306,6 +306,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation
306 return base.Equals(obj); 306 return base.Equals(obj);
307 } 307 }
308 308
309 public override int GetHashCode()
310 {
311 return base.GetHashCode();
312 }
313
309 public override string ToString() 314 public override string ToString()
310 { 315 {
311 StringBuilder buff = new StringBuilder(); 316 StringBuilder buff = new StringBuilder();
diff --git a/OpenSim/Region/Framework/Scenes/Animation/BinBVHAnimation.cs b/OpenSim/Region/Framework/Scenes/Animation/BinBVHAnimation.cs
index 3afc87f..b3b38b2 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/BinBVHAnimation.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/BinBVHAnimation.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -113,31 +113,34 @@ namespace OpenSim.Region.Framework.Scenes.Animation
113 113
114 public byte[] ToBytes() 114 public byte[] ToBytes()
115 { 115 {
116 byte[] outputbytes = new byte[0]; 116 byte[] outputbytes;
117 117
118 BinaryWriter iostream = new BinaryWriter(new MemoryStream()); 118 using (MemoryStream ms = new MemoryStream())
119 iostream.Write(BinBVHUtil.ES(Utils.UInt16ToBytes(unknown0))); 119 using (BinaryWriter iostream = new BinaryWriter(ms))
120 iostream.Write(BinBVHUtil.ES(Utils.UInt16ToBytes(unknown1)));
121 iostream.Write(BinBVHUtil.ES(Utils.IntToBytes(Priority)));
122 iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(Length)));
123 iostream.Write(BinBVHUtil.WriteNullTerminatedString(ExpressionName));
124 iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(InPoint)));
125 iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(OutPoint)));
126 iostream.Write(BinBVHUtil.ES(Utils.IntToBytes(Loop ? 1 : 0)));
127 iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(EaseInTime)));
128 iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(EaseOutTime)));
129 iostream.Write(BinBVHUtil.ES(Utils.UIntToBytes(HandPose)));
130 iostream.Write(BinBVHUtil.ES(Utils.UIntToBytes((uint)(Joints.Length))));
131
132 for (int i = 0; i < Joints.Length; i++)
133 { 120 {
134 Joints[i].WriteBytesToStream(iostream, InPoint, OutPoint); 121 iostream.Write(BinBVHUtil.ES(Utils.UInt16ToBytes(unknown0)));
122 iostream.Write(BinBVHUtil.ES(Utils.UInt16ToBytes(unknown1)));
123 iostream.Write(BinBVHUtil.ES(Utils.IntToBytes(Priority)));
124 iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(Length)));
125 iostream.Write(BinBVHUtil.WriteNullTerminatedString(ExpressionName));
126 iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(InPoint)));
127 iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(OutPoint)));
128 iostream.Write(BinBVHUtil.ES(Utils.IntToBytes(Loop ? 1 : 0)));
129 iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(EaseInTime)));
130 iostream.Write(BinBVHUtil.ES(Utils.FloatToBytes(EaseOutTime)));
131 iostream.Write(BinBVHUtil.ES(Utils.UIntToBytes(HandPose)));
132 iostream.Write(BinBVHUtil.ES(Utils.UIntToBytes((uint)(Joints.Length))));
133
134 for (int i = 0; i < Joints.Length; i++)
135 {
136 Joints[i].WriteBytesToStream(iostream, InPoint, OutPoint);
137 }
138 iostream.Write(BinBVHUtil.ES(Utils.IntToBytes(0)));
139
140 using (MemoryStream ms2 = (MemoryStream)iostream.BaseStream)
141 outputbytes = ms2.ToArray();
135 } 142 }
136 iostream.Write(BinBVHUtil.ES(Utils.IntToBytes(0))); 143
137 MemoryStream ms = (MemoryStream)iostream.BaseStream;
138 outputbytes = ms.ToArray();
139 ms.Close();
140 iostream.Close();
141 return outputbytes; 144 return outputbytes;
142 } 145 }
143 146
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 24fbef9..22b8e4d 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -433,6 +433,9 @@ namespace OpenSim.Region.Framework.Scenes
433 public delegate void IncomingInstantMessage(GridInstantMessage message); 433 public delegate void IncomingInstantMessage(GridInstantMessage message);
434 public event IncomingInstantMessage OnIncomingInstantMessage; 434 public event IncomingInstantMessage OnIncomingInstantMessage;
435 435
436 public delegate void CrossAgentToNewRegion(ScenePresence sp, bool isFlying, GridRegion newRegion);
437 public event CrossAgentToNewRegion OnCrossAgentToNewRegion;
438
436 public event IncomingInstantMessage OnUnhandledInstantMessage; 439 public event IncomingInstantMessage OnUnhandledInstantMessage;
437 440
438 public delegate void ClientClosed(UUID clientID, Scene scene); 441 public delegate void ClientClosed(UUID clientID, Scene scene);
@@ -786,8 +789,30 @@ namespace OpenSim.Region.Framework.Scenes
786 /// <see cref="Scene.doObjectDuplicateOnRay"/> 789 /// <see cref="Scene.doObjectDuplicateOnRay"/>
787 /// </remarks> 790 /// </remarks>
788 public event Action<SceneObjectGroup> OnObjectAddedToScene; 791 public event Action<SceneObjectGroup> OnObjectAddedToScene;
792
793 /// <summary>
794 /// When a client sends a derez request for an object inworld
795 /// but before the object is deleted
796 /// </summary>
797 public event DeRezRequested OnDeRezRequested;
798 /// <summary>
799 /// Triggered when a client sends a derez request for an object inworld
800 /// </summary>
801 /// <param name="remoteClient">The client question (it can be null)</param>
802 /// <param name="obj">The object in question</param>
803 /// <param name="action">The exact derez action</param>
804 /// <returns>Flag indicating whether the object should be deleted from the scene or not</returns>
805 public delegate bool DeRezRequested(IClientAPI remoteClient, List<SceneObjectGroup> objs, DeRezAction action);
789 806
790 /// <summary> 807 /// <summary>
808 /// Triggered when an object is removed from the scene.
809 /// </summary>
810 /// <remarks>
811 /// Triggered by <see cref="TriggerObjectBeingRemovedFromScene"/>
812 /// in <see cref="Scene.DeleteSceneObject"/>
813 /// </remarks>
814 public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene;
815 /// <summary>
791 /// Delegate for <see cref="OnObjectBeingRemovedFromScene"/> 816 /// Delegate for <see cref="OnObjectBeingRemovedFromScene"/>
792 /// </summary> 817 /// </summary>
793 /// <param name="obj">The object being removed from the scene</param> 818 /// <param name="obj">The object being removed from the scene</param>
@@ -806,15 +831,6 @@ namespace OpenSim.Region.Framework.Scenes
806 /// </remarks> 831 /// </remarks>
807 public event Action<SceneObjectPart> OnObjectRemovedFromPhysicalScene; 832 public event Action<SceneObjectPart> OnObjectRemovedFromPhysicalScene;
808 833
809 /// <summary>
810 /// Triggered when an object is removed from the scene.
811 /// </summary>
812 /// <remarks>
813 /// Triggered by <see cref="TriggerObjectBeingRemovedFromScene"/>
814 /// in <see cref="Scene.DeleteSceneObject"/>
815 /// </remarks>
816 public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene;
817
818 public delegate void NoticeNoLandDataFromStorage(); 834 public delegate void NoticeNoLandDataFromStorage();
819 public event NoticeNoLandDataFromStorage OnNoticeNoLandDataFromStorage; 835 public event NoticeNoLandDataFromStorage OnNoticeNoLandDataFromStorage;
820 836
@@ -1568,8 +1584,33 @@ namespace OpenSim.Region.Framework.Scenes
1568 } 1584 }
1569 } 1585 }
1570 } 1586 }
1571 } 1587 }
1572 1588
1589 public bool TriggerDeRezRequested(IClientAPI client, List<SceneObjectGroup> objs, DeRezAction action)
1590 {
1591 bool canDeRez = true;
1592
1593 DeRezRequested handlerDeRezRequested = OnDeRezRequested;
1594 if (handlerDeRezRequested != null)
1595 {
1596 foreach (DeRezRequested d in handlerDeRezRequested.GetInvocationList())
1597 {
1598 try
1599 {
1600 canDeRez &= d(client, objs, action);
1601 }
1602 catch (Exception e)
1603 {
1604 m_log.ErrorFormat(
1605 "[EVENT MANAGER]: Delegate for TriggerDeRezRequested failed - continuing. {0} {1}",
1606 e.Message, e.StackTrace);
1607 }
1608 }
1609 }
1610
1611 return canDeRez;
1612 }
1613
1573 public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj) 1614 public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj)
1574 { 1615 {
1575 ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene; 1616 ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene;
@@ -2011,6 +2052,27 @@ namespace OpenSim.Region.Framework.Scenes
2011 } 2052 }
2012 } 2053 }
2013 2054
2055 public void TriggerCrossAgentToNewRegion(ScenePresence agent, bool isFlying, GridRegion newRegion)
2056 {
2057 CrossAgentToNewRegion handlerCrossAgentToNewRegion = OnCrossAgentToNewRegion;
2058 if (handlerCrossAgentToNewRegion != null)
2059 {
2060 foreach (CrossAgentToNewRegion d in handlerCrossAgentToNewRegion.GetInvocationList())
2061 {
2062 try
2063 {
2064 d(agent, isFlying, newRegion);
2065 }
2066 catch (Exception e)
2067 {
2068 m_log.ErrorFormat(
2069 "[EVENT MANAGER]: Delegate for TriggerCrossAgentToNewRegion failed - continuing. {0} {1}",
2070 e.Message, e.StackTrace);
2071 }
2072 }
2073 }
2074 }
2075
2014 public void TriggerIncomingInstantMessage(GridInstantMessage message) 2076 public void TriggerIncomingInstantMessage(GridInstantMessage message)
2015 { 2077 {
2016 IncomingInstantMessage handlerIncomingInstantMessage = OnIncomingInstantMessage; 2078 IncomingInstantMessage handlerIncomingInstantMessage = OnIncomingInstantMessage;
diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
index e3f979f..2b95a4c 100644
--- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
+++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
@@ -47,7 +47,7 @@ namespace OpenSim.Region.Framework.Scenes
47{ 47{
48 public class KeyframeTimer 48 public class KeyframeTimer
49 { 49 {
50 private static Dictionary<Scene, KeyframeTimer>m_timers = 50 private static Dictionary<Scene, KeyframeTimer> m_timers =
51 new Dictionary<Scene, KeyframeTimer>(); 51 new Dictionary<Scene, KeyframeTimer>();
52 52
53 private Timer m_timer; 53 private Timer m_timer;
@@ -67,8 +67,15 @@ namespace OpenSim.Region.Framework.Scenes
67 m_timer.Interval = TickDuration; 67 m_timer.Interval = TickDuration;
68 m_timer.AutoReset = true; 68 m_timer.AutoReset = true;
69 m_timer.Elapsed += OnTimer; 69 m_timer.Elapsed += OnTimer;
70 }
70 71
71 m_timer.Start(); 72 public void Start()
73 {
74 lock (m_timer)
75 {
76 if (!m_timer.Enabled)
77 m_timer.Start();
78 }
72 } 79 }
73 80
74 private void OnTimer(object sender, ElapsedEventArgs ea) 81 private void OnTimer(object sender, ElapsedEventArgs ea)
@@ -120,6 +127,25 @@ namespace OpenSim.Region.Framework.Scenes
120 { 127 {
121 timer = new KeyframeTimer(motion.Scene); 128 timer = new KeyframeTimer(motion.Scene);
122 m_timers[motion.Scene] = timer; 129 m_timers[motion.Scene] = timer;
130
131 if (!SceneManager.Instance.AllRegionsReady)
132 {
133 // Start the timers only once all the regions are ready. This is required
134 // when using megaregions, because the megaregion is correctly configured
135 // only after all the regions have been loaded. (If we don't do this then
136 // when the prim moves it might think that it crossed into a region.)
137 SceneManager.Instance.OnRegionsReadyStatusChange += delegate(SceneManager sm)
138 {
139 if (sm.AllRegionsReady)
140 timer.Start();
141 };
142 }
143
144 // Check again, in case the regions were started while we were adding the event handler
145 if (SceneManager.Instance.AllRegionsReady)
146 {
147 timer.Start();
148 }
123 } 149 }
124 } 150 }
125 151
@@ -154,7 +180,7 @@ namespace OpenSim.Region.Framework.Scenes
154 [Serializable] 180 [Serializable]
155 public class KeyframeMotion 181 public class KeyframeMotion
156 { 182 {
157// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 183 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
158 184
159 public enum PlayMode : int 185 public enum PlayMode : int
160 { 186 {
@@ -180,6 +206,7 @@ namespace OpenSim.Region.Framework.Scenes
180 public int TimeMS; 206 public int TimeMS;
181 public int TimeTotal; 207 public int TimeTotal;
182 public Vector3 AngularVelocity; 208 public Vector3 AngularVelocity;
209 public Vector3 StartPosition;
183 }; 210 };
184 211
185 private Vector3 m_serializedPosition; 212 private Vector3 m_serializedPosition;
@@ -284,10 +311,11 @@ namespace OpenSim.Region.Framework.Scenes
284 311
285 try 312 try
286 { 313 {
287 MemoryStream ms = new MemoryStream(data); 314 using (MemoryStream ms = new MemoryStream(data))
288 BinaryFormatter fmt = new BinaryFormatter(); 315 {
289 316 BinaryFormatter fmt = new BinaryFormatter();
290 newMotion = (KeyframeMotion)fmt.Deserialize(ms); 317 newMotion = (KeyframeMotion)fmt.Deserialize(ms);
318 }
291 319
292 newMotion.m_group = grp; 320 newMotion.m_group = grp;
293 321
@@ -323,6 +351,26 @@ namespace OpenSim.Region.Framework.Scenes
323 m_group = grp; 351 m_group = grp;
324 m_scene = grp.Scene; 352 m_scene = grp.Scene;
325 353
354<<<<<<< HEAD
355 Vector3 grppos = grp.AbsolutePosition;
356 Vector3 offset = grppos - m_serializedPosition;
357 // avoid doing it more than once
358 // current this will happen dragging a prim to other region
359 m_serializedPosition = grppos;
360
361 m_basePosition += offset;
362 m_nextPosition += offset;
363
364 m_currentFrame.StartPosition += offset;
365 m_currentFrame.Position += offset;
366
367 for (int i = 0; i < m_frames.Count; i++)
368 {
369 Keyframe k = m_frames[i];
370 k.StartPosition += offset;
371 k.Position += offset;
372 m_frames[i]=k;
373=======
326 lock (m_frames) 374 lock (m_frames)
327 { 375 {
328 Vector3 grppos = grp.AbsolutePosition; 376 Vector3 grppos = grp.AbsolutePosition;
@@ -342,6 +390,7 @@ namespace OpenSim.Region.Framework.Scenes
342 k.Position += offset; 390 k.Position += offset;
343 m_frames[i] = k; 391 m_frames[i] = k;
344 } 392 }
393>>>>>>> avn/ubitvar
345 } 394 }
346 395
347 if (m_running) 396 if (m_running)
@@ -433,6 +482,7 @@ namespace OpenSim.Region.Framework.Scenes
433 { 482 {
434 StartTimer(); 483 StartTimer();
435 m_running = true; 484 m_running = true;
485 m_group.Scene.EventManager.TriggerMovingStartEvent(m_group.RootPart.LocalId);
436 } 486 }
437 else 487 else
438 { 488 {
@@ -515,6 +565,7 @@ namespace OpenSim.Region.Framework.Scenes
515 { 565 {
516 Keyframe k = m_keyframes[i]; 566 Keyframe k = m_keyframes[i];
517 567
568 k.StartPosition = pos;
518 if (k.Position.HasValue) 569 if (k.Position.HasValue)
519 { 570 {
520 k.Position = (k.Position * direction); 571 k.Position = (k.Position * direction);
@@ -657,6 +708,29 @@ namespace OpenSim.Region.Framework.Scenes
657 708
658 if (m_frames.Count == 0) 709 if (m_frames.Count == 0)
659 { 710 {
711<<<<<<< HEAD
712 if (!m_running) return;
713
714 GetNextList();
715
716 if (m_frames.Count == 0)
717 {
718 Stop();
719// Scene scene = m_group.Scene;
720//
721// IScriptModule[] scriptModules = scene.RequestModuleInterfaces<IScriptModule>();
722// foreach (IScriptModule m in scriptModules)
723// {
724// if (m == null)
725// continue;
726// m.PostObjectEvent(m_group.RootPart.UUID, "moving_end", new object[0]);
727// }
728
729 m_group.Scene.EventManager.TriggerMovingEndEvent(m_group.RootPart.LocalId);
730
731 return;
732 }
733=======
660 lock (m_frames) 734 lock (m_frames)
661 { 735 {
662 GetNextList(); 736 GetNextList();
@@ -673,6 +747,7 @@ namespace OpenSim.Region.Framework.Scenes
673 continue; 747 continue;
674 m.PostObjectEvent(m_group.RootPart.UUID, "moving_end", new object[0]); 748 m.PostObjectEvent(m_group.RootPart.UUID, "moving_end", new object[0]);
675 } 749 }
750>>>>>>> avn/ubitvar
676 751
677 return; 752 return;
678 } 753 }
@@ -688,9 +763,9 @@ namespace OpenSim.Region.Framework.Scenes
688 m_currentFrame.TimeMS -= (int)tickDuration; 763 m_currentFrame.TimeMS -= (int)tickDuration;
689 764
690 // Do the frame processing 765 // Do the frame processing
691 double steps = (double)m_currentFrame.TimeMS / tickDuration; 766 double remainingSteps = (double)m_currentFrame.TimeMS / tickDuration;
692 767
693 if (steps <= 0.0) 768 if (remainingSteps <= 0.0)
694 { 769 {
695 m_group.RootPart.Velocity = Vector3.Zero; 770 m_group.RootPart.Velocity = Vector3.Zero;
696 m_group.RootPart.AngularVelocity = Vector3.Zero; 771 m_group.RootPart.AngularVelocity = Vector3.Zero;
@@ -714,23 +789,75 @@ namespace OpenSim.Region.Framework.Scenes
714 } 789 }
715 else 790 else
716 { 791 {
717 float complete = ((float)m_currentFrame.TimeTotal - (float)m_currentFrame.TimeMS) / (float)m_currentFrame.TimeTotal; 792 float completed = ((float)m_currentFrame.TimeTotal - (float)m_currentFrame.TimeMS) / (float)m_currentFrame.TimeTotal;
793 bool lastStep = m_currentFrame.TimeMS <= tickDuration;
794
795 Vector3 positionThisStep = m_currentFrame.StartPosition + (m_currentFrame.Position.Value - m_currentFrame.StartPosition) * completed;
796 Vector3 motionThisStep = positionThisStep - m_group.AbsolutePosition;
718 797
719 Vector3 v = (Vector3)m_currentFrame.Position - m_group.AbsolutePosition; 798<<<<<<< HEAD
720 Vector3 motionThisFrame = v / (float)steps; 799 float mag = Vector3.Mag(motionThisStep);
721 v = v * 1000 / m_currentFrame.TimeMS;
722 800
801 if ((mag >= 0.02f) || lastStep)
802 {
803 m_nextPosition = m_group.AbsolutePosition + motionThisStep;
804 m_group.AbsolutePosition = m_nextPosition;
805=======
723 m_nextPosition = m_group.AbsolutePosition + motionThisFrame; 806 m_nextPosition = m_group.AbsolutePosition + motionThisFrame;
724 807
725 if (Vector3.Mag(motionThisFrame) >= 0.05f) 808 if (Vector3.Mag(motionThisFrame) >= 0.05f)
809>>>>>>> avn/ubitvar
726 update = true; 810 update = true;
727 811
812 //int totalSteps = m_currentFrame.TimeTotal / (int)tickDuration;
813 //m_log.DebugFormat("KeyframeMotion.OnTimer: step {0}/{1}, curPosition={2}, finalPosition={3}, motionThisStep={4} (scene {5})",
814 // totalSteps - remainingSteps + 1, totalSteps, m_group.AbsolutePosition, m_currentFrame.Position, motionThisStep, m_scene.RegionInfo.RegionName);
815
728 if ((Quaternion)m_currentFrame.Rotation != m_group.GroupRotation) 816 if ((Quaternion)m_currentFrame.Rotation != m_group.GroupRotation)
729 { 817 {
730 Quaternion current = m_group.GroupRotation; 818 Quaternion current = m_group.GroupRotation;
731 819
732 Quaternion step = Quaternion.Slerp(m_currentFrame.StartRotation, (Quaternion)m_currentFrame.Rotation, complete); 820 Quaternion step = Quaternion.Slerp(m_currentFrame.StartRotation, (Quaternion)m_currentFrame.Rotation, completed);
733 step.Normalize(); 821 step.Normalize();
822<<<<<<< HEAD
823/* use simpler change detection
824* float angle = 0;
825
826 float aa = current.X * current.X + current.Y * current.Y + current.Z * current.Z + current.W * current.W;
827 float bb = step.X * step.X + step.Y * step.Y + step.Z * step.Z + step.W * step.W;
828 float aa_bb = aa * bb;
829
830 if (aa_bb == 0)
831 {
832 angle = 0;
833 }
834 else
835 {
836 float ab = current.X * step.X +
837 current.Y * step.Y +
838 current.Z * step.Z +
839 current.W * step.W;
840 float q = (ab * ab) / aa_bb;
841
842 if (q > 1.0f)
843 {
844 angle = 0;
845 }
846 else
847 {
848 angle = (float)Math.Acos(2 * q - 1);
849 }
850 }
851
852 if (angle > 0.01f)
853*/
854 if(Math.Abs(step.X - current.X) > 0.001f
855 || Math.Abs(step.Y - current.Y) > 0.001f
856 || Math.Abs(step.Z - current.Z) > 0.001f
857 || lastStep)
858 // assuming w is a dependente var
859
860=======
734 /* use simpler change detection 861 /* use simpler change detection
735 * float angle = 0; 862 * float angle = 0;
736 863
@@ -766,6 +893,7 @@ namespace OpenSim.Region.Framework.Scenes
766 || Math.Abs(step.Y - current.Y) > 0.001f 893 || Math.Abs(step.Y - current.Y) > 0.001f
767 || Math.Abs(step.Z - current.Z) > 0.001f) 894 || Math.Abs(step.Z - current.Z) > 0.001f)
768 // assuming w is a dependente var 895 // assuming w is a dependente var
896>>>>>>> avn/ubitvar
769 { 897 {
770 // m_group.UpdateGroupRotationR(step); 898 // m_group.UpdateGroupRotationR(step);
771 m_group.RootPart.RotationOffset = step; 899 m_group.RootPart.RotationOffset = step;
@@ -791,19 +919,29 @@ namespace OpenSim.Region.Framework.Scenes
791 timerWasStopped = m_timerStopped; 919 timerWasStopped = m_timerStopped;
792 } 920 }
793 StopTimer(); 921 StopTimer();
794 MemoryStream ms = new MemoryStream();
795 922
796 BinaryFormatter fmt = new BinaryFormatter();
797 SceneObjectGroup tmp = m_group; 923 SceneObjectGroup tmp = m_group;
798 m_group = null; 924 m_group = null;
799 if (!m_selected && tmp != null) 925 if (!m_selected && tmp != null)
800 m_serializedPosition = tmp.AbsolutePosition; 926 m_serializedPosition = tmp.AbsolutePosition;
927<<<<<<< HEAD
928=======
801 fmt.Serialize(ms, this); 929 fmt.Serialize(ms, this);
802 m_group = tmp; 930 m_group = tmp;
803 if (!timerWasStopped && m_running && !m_waitingCrossing) 931 if (!timerWasStopped && m_running && !m_waitingCrossing)
804 StartTimer(); 932 StartTimer();
933>>>>>>> avn/ubitvar
805 934
806 return ms.ToArray(); 935 using (MemoryStream ms = new MemoryStream())
936 {
937 BinaryFormatter fmt = new BinaryFormatter();
938 fmt.Serialize(ms, this);
939 m_group = tmp;
940 if (m_running && !m_waitingCrossing)
941 StartTimer();
942
943 return ms.ToArray();
944 }
807 } 945 }
808 946
809 public void StartCrossingCheck() 947 public void StartCrossingCheck()
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 4ab5a4a..e289666 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -30,24 +30,27 @@ using System.Collections.Generic;
30using System.Collections; 30using System.Collections;
31using System.Reflection; 31using System.Reflection;
32using System.Text; 32using System.Text;
33using System.Threading;
33using System.Timers; 34using System.Timers;
34using System.Xml; 35using System.Xml;
35using OpenMetaverse; 36using OpenMetaverse;
36using OpenMetaverse.Packets; 37using OpenMetaverse.Packets;
37using log4net; 38using log4net;
38using OpenSim.Framework; 39using OpenSim.Framework;
40using OpenSim.Framework.Serialization.External;
39using OpenSim.Region.Framework; 41using OpenSim.Region.Framework;
40using OpenSim.Framework.Client; 42using OpenSim.Framework.Client;
41using OpenSim.Region.Framework.Interfaces; 43using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.Framework.Scenes.Serialization; 44using OpenSim.Region.Framework.Scenes.Serialization;
45using OpenSim.Services.Interfaces;
43using PermissionMask = OpenSim.Framework.PermissionMask; 46using PermissionMask = OpenSim.Framework.PermissionMask;
44 47
45namespace OpenSim.Region.Framework.Scenes 48namespace OpenSim.Region.Framework.Scenes
46{ 49{
47 public partial class Scene 50 public partial class Scene
48 { 51 {
49 private static readonly ILog m_log 52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 53 //private static readonly string LogHeader = "[SCENE INVENTORY]";
51 54
52 /// <summary> 55 /// <summary>
53 /// Allows asynchronous derezzing of objects from the scene into a client's inventory. 56 /// Allows asynchronous derezzing of objects from the scene into a client's inventory.
@@ -127,11 +130,16 @@ namespace OpenSim.Region.Framework.Scenes
127 } 130 }
128 } 131 }
129 132
133 public bool AddInventoryItem(InventoryItemBase item)
134 {
135 return AddInventoryItem(item, true);
136 }
137
130 /// <summary> 138 /// <summary>
131 /// Add the given inventory item to a user's inventory. 139 /// Add the given inventory item to a user's inventory.
132 /// </summary> 140 /// </summary>
133 /// <param name="item"></param> 141 /// <param name="item"></param>
134 public bool AddInventoryItem(InventoryItemBase item) 142 public bool AddInventoryItem(InventoryItemBase item, bool trigger)
135 { 143 {
136 if (item.Folder != UUID.Zero && InventoryService.AddItem(item)) 144 if (item.Folder != UUID.Zero && InventoryService.AddItem(item))
137 { 145 {
@@ -140,14 +148,17 @@ namespace OpenSim.Region.Framework.Scenes
140 { 148 {
141 userlevel = 1; 149 userlevel = 1;
142 } 150 }
143 EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, (AssetType)item.AssetType, item.AssetID, item.Name, userlevel); 151 if (trigger)
152 EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, (AssetType)item.AssetType, item.AssetID, item.Name, userlevel);
144 153
145 return true; 154 return true;
146 } 155 }
147 156
148 // OK so either the viewer didn't send a folderID or AddItem failed 157 // OK so either the viewer didn't send a folderID or AddItem failed
149 UUID originalFolder = item.Folder; 158 UUID originalFolder = item.Folder;
150 InventoryFolderBase f = InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType); 159 InventoryFolderBase f = null;
160 if (Enum.IsDefined(typeof(FolderType), (sbyte)item.AssetType))
161 f = InventoryService.GetFolderForType(item.Owner, (FolderType)item.AssetType);
151 if (f != null) 162 if (f != null)
152 { 163 {
153 m_log.DebugFormat( 164 m_log.DebugFormat(
@@ -179,7 +190,8 @@ namespace OpenSim.Region.Framework.Scenes
179 { 190 {
180 userlevel = 1; 191 userlevel = 1;
181 } 192 }
182 EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, (AssetType)item.AssetType, item.AssetID, item.Name, userlevel); 193 if (trigger)
194 EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, (AssetType)item.AssetType, item.AssetID, item.Name, userlevel);
183 195
184 if (originalFolder != UUID.Zero) 196 if (originalFolder != UUID.Zero)
185 { 197 {
@@ -529,9 +541,9 @@ namespace OpenSim.Region.Framework.Scenes
529 /// <param name="recipientClient"></param> 541 /// <param name="recipientClient"></param>
530 /// <param name="senderId">ID of the sender of the item</param> 542 /// <param name="senderId">ID of the sender of the item</param>
531 /// <param name="itemId"></param> 543 /// <param name="itemId"></param>
532 public virtual void GiveInventoryItem(IClientAPI recipientClient, UUID senderId, UUID itemId) 544 public virtual void GiveInventoryItem(IClientAPI recipientClient, UUID senderId, UUID itemId, out string message)
533 { 545 {
534 InventoryItemBase itemCopy = GiveInventoryItem(recipientClient.AgentId, senderId, itemId); 546 InventoryItemBase itemCopy = GiveInventoryItem(recipientClient.AgentId, senderId, itemId, out message);
535 547
536 if (itemCopy != null) 548 if (itemCopy != null)
537 recipientClient.SendBulkUpdateInventory(itemCopy); 549 recipientClient.SendBulkUpdateInventory(itemCopy);
@@ -544,9 +556,9 @@ namespace OpenSim.Region.Framework.Scenes
544 /// <param name="senderId">ID of the sender of the item</param> 556 /// <param name="senderId">ID of the sender of the item</param>
545 /// <param name="itemId"></param> 557 /// <param name="itemId"></param>
546 /// <returns>The inventory item copy given, null if the give was unsuccessful</returns> 558 /// <returns>The inventory item copy given, null if the give was unsuccessful</returns>
547 public virtual InventoryItemBase GiveInventoryItem(UUID recipient, UUID senderId, UUID itemId) 559 public virtual InventoryItemBase GiveInventoryItem(UUID recipient, UUID senderId, UUID itemId, out string message)
548 { 560 {
549 return GiveInventoryItem(recipient, senderId, itemId, UUID.Zero); 561 return GiveInventoryItem(recipient, senderId, itemId, UUID.Zero, out message);
550 } 562 }
551 563
552 /// <summary> 564 /// <summary>
@@ -563,12 +575,15 @@ namespace OpenSim.Region.Framework.Scenes
563 /// The inventory item copy given, null if the give was unsuccessful 575 /// The inventory item copy given, null if the give was unsuccessful
564 /// </returns> 576 /// </returns>
565 public virtual InventoryItemBase GiveInventoryItem( 577 public virtual InventoryItemBase GiveInventoryItem(
566 UUID recipient, UUID senderId, UUID itemId, UUID recipientFolderId) 578 UUID recipient, UUID senderId, UUID itemId, UUID recipientFolderId, out string message)
567 { 579 {
568 //Console.WriteLine("Scene.Inventory.cs: GiveInventoryItem"); 580 //Console.WriteLine("Scene.Inventory.cs: GiveInventoryItem");
569 581
570 if (!Permissions.CanTransferUserInventory(itemId, senderId, recipient)) 582 if (!Permissions.CanTransferUserInventory(itemId, senderId, recipient))
583 {
584 message = "Not allowed to transfer this item.";
571 return null; 585 return null;
586 }
572 587
573 InventoryItemBase item = new InventoryItemBase(itemId, senderId); 588 InventoryItemBase item = new InventoryItemBase(itemId, senderId);
574 item = InventoryService.GetItem(item); 589 item = InventoryService.GetItem(item);
@@ -577,6 +592,7 @@ namespace OpenSim.Region.Framework.Scenes
577 { 592 {
578 m_log.WarnFormat( 593 m_log.WarnFormat(
579 "[AGENT INVENTORY]: Failed to find item {0} sent by {1} to {2}", itemId, senderId, recipient); 594 "[AGENT INVENTORY]: Failed to find item {0} sent by {1} to {2}", itemId, senderId, recipient);
595 message = string.Format("Item not found: {0}.", itemId);
580 return null; 596 return null;
581 } 597 }
582 598
@@ -585,6 +601,7 @@ namespace OpenSim.Region.Framework.Scenes
585 m_log.WarnFormat( 601 m_log.WarnFormat(
586 "[AGENT INVENTORY]: Attempt to send item {0} {1} to {2} failed because sender {3} did not match item owner {4}", 602 "[AGENT INVENTORY]: Attempt to send item {0} {1} to {2} failed because sender {3} did not match item owner {4}",
587 item.Name, item.ID, recipient, senderId, item.Owner); 603 item.Name, item.ID, recipient, senderId, item.Owner);
604 message = "Sender did not match item owner.";
588 return null; 605 return null;
589 } 606 }
590 607
@@ -595,7 +612,10 @@ namespace OpenSim.Region.Framework.Scenes
595 if (!Permissions.BypassPermissions()) 612 if (!Permissions.BypassPermissions())
596 { 613 {
597 if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) 614 if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)
615 {
616 message = "Item doesn't have the Transfer permission.";
598 return null; 617 return null;
618 }
599 } 619 }
600 620
601 // Insert a copy of the item into the recipient 621 // Insert a copy of the item into the recipient
@@ -720,7 +740,9 @@ namespace OpenSim.Region.Framework.Scenes
720 740
721 if (itemCopy.Folder == UUID.Zero) 741 if (itemCopy.Folder == UUID.Zero)
722 { 742 {
723 InventoryFolderBase folder = InventoryService.GetFolderForType(recipient, (AssetType)itemCopy.AssetType); 743 InventoryFolderBase folder = null;
744 if (Enum.IsDefined(typeof(FolderType), (sbyte)item.AssetType))
745 folder = InventoryService.GetFolderForType(recipient, (FolderType)itemCopy.AssetType);
724 746
725 if (folder != null) 747 if (folder != null)
726 { 748 {
@@ -731,9 +753,14 @@ namespace OpenSim.Region.Framework.Scenes
731 InventoryFolderBase root = InventoryService.GetRootFolder(recipient); 753 InventoryFolderBase root = InventoryService.GetRootFolder(recipient);
732 754
733 if (root != null) 755 if (root != null)
756 {
734 itemCopy.Folder = root.ID; 757 itemCopy.Folder = root.ID;
758 }
735 else 759 else
736 return null; // No destination 760 {
761 message = "Can't find a folder to add the item to.";
762 return null;
763 }
737 } 764 }
738 } 765 }
739 766
@@ -746,7 +773,7 @@ namespace OpenSim.Region.Framework.Scenes
746 IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); 773 IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>();
747 if (invAccess != null) 774 if (invAccess != null)
748 invAccess.TransferInventoryAssets(itemCopy, senderId, recipient); 775 invAccess.TransferInventoryAssets(itemCopy, senderId, recipient);
749 AddInventoryItem(itemCopy); 776 AddInventoryItem(itemCopy, false);
750 777
751 if (!Permissions.BypassPermissions()) 778 if (!Permissions.BypassPermissions())
752 { 779 {
@@ -758,6 +785,7 @@ namespace OpenSim.Region.Framework.Scenes
758 } 785 }
759 } 786 }
760 787
788 message = null;
761 return itemCopy; 789 return itemCopy;
762 } 790 }
763 791
@@ -775,11 +803,11 @@ namespace OpenSim.Region.Framework.Scenes
775 /// <returns> 803 /// <returns>
776 /// The inventory folder copy given, null if the copy was unsuccessful 804 /// The inventory folder copy given, null if the copy was unsuccessful
777 /// </returns> 805 /// </returns>
778 public virtual InventoryFolderBase GiveInventoryFolder( 806 public virtual InventoryFolderBase GiveInventoryFolder(IClientAPI client,
779 UUID recipientId, UUID senderId, UUID folderId, UUID recipientParentFolderId) 807 UUID recipientId, UUID senderId, UUID folderId, UUID recipientParentFolderId)
780 { 808 {
781 //// Retrieve the folder from the sender 809 //// Retrieve the folder from the sender
782 InventoryFolderBase folder = InventoryService.GetFolder(new InventoryFolderBase(folderId)); 810 InventoryFolderBase folder = InventoryService.GetFolder(new InventoryFolderBase(folderId, senderId));
783 if (null == folder) 811 if (null == folder)
784 { 812 {
785 m_log.ErrorFormat( 813 m_log.ErrorFormat(
@@ -810,13 +838,18 @@ namespace OpenSim.Region.Framework.Scenes
810 InventoryCollection contents = InventoryService.GetFolderContent(senderId, folderId); 838 InventoryCollection contents = InventoryService.GetFolderContent(senderId, folderId);
811 foreach (InventoryFolderBase childFolder in contents.Folders) 839 foreach (InventoryFolderBase childFolder in contents.Folders)
812 { 840 {
813 GiveInventoryFolder(recipientId, senderId, childFolder.ID, newFolder.ID); 841 GiveInventoryFolder(client, recipientId, senderId, childFolder.ID, newFolder.ID);
814 } 842 }
815 843
816 // Give all the items 844 // Give all the items
817 foreach (InventoryItemBase item in contents.Items) 845 foreach (InventoryItemBase item in contents.Items)
818 { 846 {
819 GiveInventoryItem(recipientId, senderId, item.ID, newFolder.ID); 847 string message;
848 if (GiveInventoryItem(recipientId, senderId, item.ID, newFolder.ID, out message) == null)
849 {
850 if (client != null)
851 client.SendAgentAlertMessage(message, false);
852 }
820 } 853 }
821 854
822 return newFolder; 855 return newFolder;
@@ -848,53 +881,40 @@ namespace OpenSim.Region.Framework.Scenes
848 return; 881 return;
849 } 882 }
850 883
884<<<<<<< HEAD
885 if (newName == String.Empty)
886 newName = item.Name;
887=======
851 if (newName == null) newName = item.Name; 888 if (newName == null) newName = item.Name;
852 889
853 AssetBase asset = AssetService.Get(item.AssetID.ToString()); 890 AssetBase asset = AssetService.Get(item.AssetID.ToString());
891>>>>>>> avn/ubitvar
854 892
855 if (asset != null) 893 if (remoteClient.AgentId == oldAgentID
894 || (LibraryService != null
895 && LibraryService.LibraryRootFolder != null
896 && oldAgentID == LibraryService.LibraryRootFolder.Owner))
856 { 897 {
857 if (newName != String.Empty) 898 CreateNewInventoryItem(
858 { 899 remoteClient, item.CreatorId, item.CreatorData, newFolderID,
859 asset.Name = newName; 900 newName, item.Description, item.Flags, callbackID, item.AssetID, (sbyte)item.AssetType, (sbyte)item.InvType,
860 } 901 item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions,
861 else 902 item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch(), false);
862 { 903 }
863 newName = item.Name; 904 else
864 } 905 {
865 906 // If item is transfer or permissions are off or calling agent is allowed to copy item owner's inventory item.
866 if (remoteClient.AgentId == oldAgentID 907 if (((item.CurrentPermissions & (uint)PermissionMask.Transfer) != 0)
867 || (LibraryService != null 908 && (m_permissions.BypassPermissions()
868 && LibraryService.LibraryRootFolder != null 909 || m_permissions.CanCopyUserInventory(remoteClient.AgentId, oldItemID)))
869 && oldAgentID == LibraryService.LibraryRootFolder.Owner))
870 { 910 {
871 CreateNewInventoryItem( 911 CreateNewInventoryItem(
872 remoteClient, item.CreatorId, item.CreatorData, newFolderID, 912 remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Description, item.Flags, callbackID,
873 newName, item.Description, item.Flags, callbackID, asset, (sbyte)item.InvType, 913 item.AssetID, (sbyte)item.AssetType, (sbyte) item.InvType,
874 item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions, 914 item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions,
875 item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch()); 915 item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch(), false);
876 }
877 else
878 {
879 // If item is transfer or permissions are off or calling agent is allowed to copy item owner's inventory item.
880 if (((item.CurrentPermissions & (uint)PermissionMask.Transfer) != 0)
881 && (m_permissions.BypassPermissions()
882 || m_permissions.CanCopyUserInventory(remoteClient.AgentId, oldItemID)))
883 {
884 CreateNewInventoryItem(
885 remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Description, item.Flags, callbackID,
886 asset, (sbyte) item.InvType,
887 item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions,
888 item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch());
889 }
890 } 916 }
891 } 917 }
892 else
893 {
894 m_log.ErrorFormat(
895 "[AGENT INVENTORY]: Could not copy item {0} since asset {1} could not be found",
896 item.Name, item.AssetID);
897 }
898 } 918 }
899 919
900 /// <summary> 920 /// <summary>
@@ -962,6 +982,14 @@ namespace OpenSim.Region.Framework.Scenes
962 public void CreateNewInventoryItem( 982 public void CreateNewInventoryItem(
963 IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, 983 IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID,
964 string name, string description, uint flags, uint callbackID, 984 string name, string description, uint flags, uint callbackID,
985<<<<<<< HEAD
986 UUID assetID, sbyte assetType, sbyte invType, uint nextOwnerMask, int creationDate)
987 {
988 CreateNewInventoryItem(
989 remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, assetID, assetType, invType,
990 (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, 0, nextOwnerMask, 0,
991 creationDate, true);
992=======
965 AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate, UUID transationID) 993 AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate, UUID transationID)
966 { 994 {
967 CreateNewInventoryItem( 995 CreateNewInventoryItem(
@@ -978,6 +1006,7 @@ namespace OpenSim.Region.Framework.Scenes
978 CreateNewInventoryItem(remoteClient, creatorID, creatorData, folderID, 1006 CreateNewInventoryItem(remoteClient, creatorID, creatorData, folderID,
979 name, description, flags, callbackID, asset, invType, 1007 name, description, flags, callbackID, asset, invType,
980 baseMask, currentMask, everyoneMask, nextOwnerMask, groupMask, creationDate, UUID.Zero); 1008 baseMask, currentMask, everyoneMask, nextOwnerMask, groupMask, creationDate, UUID.Zero);
1009>>>>>>> avn/ubitvar
981 } 1010 }
982 1011
983 /// <summary> 1012 /// <summary>
@@ -1001,19 +1030,25 @@ namespace OpenSim.Region.Framework.Scenes
1001 /// <param name="creationDate">Unix timestamp at which this item was created.</param> 1030 /// <param name="creationDate">Unix timestamp at which this item was created.</param>
1002 private void CreateNewInventoryItem( 1031 private void CreateNewInventoryItem(
1003 IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, 1032 IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID,
1033<<<<<<< HEAD
1034 string name, string description, uint flags, uint callbackID, UUID assetID, sbyte assetType, sbyte invType,
1035 uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate,
1036 bool assetUpload)
1037=======
1004 string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType, 1038 string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType,
1005 uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate,UUID transationID) 1039 uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate,UUID transationID)
1040>>>>>>> avn/ubitvar
1006 { 1041 {
1007 InventoryItemBase item = new InventoryItemBase(); 1042 InventoryItemBase item = new InventoryItemBase();
1008 item.Owner = remoteClient.AgentId; 1043 item.Owner = remoteClient.AgentId;
1009 item.CreatorId = creatorID; 1044 item.CreatorId = creatorID;
1010 item.CreatorData = creatorData; 1045 item.CreatorData = creatorData;
1011 item.ID = UUID.Random(); 1046 item.ID = UUID.Random();
1012 item.AssetID = asset.FullID; 1047 item.AssetID = assetID;
1013 item.Name = name; 1048 item.Name = name;
1014 item.Description = description; 1049 item.Description = description;
1015 item.Flags = flags; 1050 item.Flags = flags;
1016 item.AssetType = asset.Type; 1051 item.AssetType = assetType;
1017 item.InvType = invType; 1052 item.InvType = invType;
1018 item.Folder = folderID; 1053 item.Folder = folderID;
1019 item.CurrentPermissions = currentMask; 1054 item.CurrentPermissions = currentMask;
@@ -1023,11 +1058,15 @@ namespace OpenSim.Region.Framework.Scenes
1023 item.BasePermissions = baseMask; 1058 item.BasePermissions = baseMask;
1024 item.CreationDate = creationDate; 1059 item.CreationDate = creationDate;
1025 1060
1061<<<<<<< HEAD
1062 if (AddInventoryItem(item, assetUpload))
1063=======
1026 // special AnimationSet case 1064 // special AnimationSet case
1027 if (item.InvType == (int)CustomInventoryType.AnimationSet) 1065 if (item.InvType == (int)CustomInventoryType.AnimationSet)
1028 AnimationSet.enforceItemPermitions(item,true); 1066 AnimationSet.enforceItemPermitions(item,true);
1029 1067
1030 if (AddInventoryItem(item)) 1068 if (AddInventoryItem(item))
1069>>>>>>> avn/ubitvar
1031 { 1070 {
1032 remoteClient.SendInventoryItemCreateUpdate(item, transationID, callbackID); 1071 remoteClient.SendInventoryItemCreateUpdate(item, transationID, callbackID);
1033 } 1072 }
@@ -1090,17 +1129,12 @@ namespace OpenSim.Region.Framework.Scenes
1090// return; 1129// return;
1091// } 1130// }
1092 1131
1093 AssetBase asset = new AssetBase();
1094 asset.FullID = olditemID;
1095 asset.Type = type;
1096 asset.Name = name;
1097 asset.Description = description;
1098
1099 CreateNewInventoryItem( 1132 CreateNewInventoryItem(
1100 remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, 1133 remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID,
1101 name, description, 0, callbackID, asset, invType, 1134 name, description, 0, callbackID, olditemID, type, invType,
1102 (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All, 1135 (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All,
1103 (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, Util.UnixTimeSinceEpoch()); 1136 (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, Util.UnixTimeSinceEpoch(),
1137 false);
1104 } 1138 }
1105 else 1139 else
1106 { 1140 {
@@ -1176,13 +1210,21 @@ namespace OpenSim.Region.Framework.Scenes
1176 if (item == null) 1210 if (item == null)
1177 return; 1211 return;
1178 1212
1179 InventoryFolderBase destFolder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.TrashFolder); 1213 InventoryFolderBase destFolder = InventoryService.GetFolderForType(remoteClient.AgentId, FolderType.Trash);
1180 1214
1181 // Move the item to trash. If this is a copiable item, only 1215 // Move the item to trash. If this is a copyable item, only
1182 // a copy will be moved and we will still need to delete 1216 // a copy will be moved and we will still need to delete
1183 // the item from the prim. If it was no copy, is will be 1217 // the item from the prim. If it was no copy, it will be
1184 // deleted by this method. 1218 // deleted by this method.
1185 MoveTaskInventoryItem(remoteClient, destFolder.ID, part, itemID); 1219 string message;
1220 InventoryItemBase item2 = MoveTaskInventoryItem(remoteClient, destFolder.ID, part, itemID, out message);
1221
1222 if (item2 == null)
1223 {
1224 m_log.WarnFormat("[SCENE INVENTORY]: RemoveTaskInventory of item {0} failed: {1}", itemID, message);
1225 remoteClient.SendAgentAlertMessage(message, false);
1226 return;
1227 }
1186 1228
1187 if (group.GetInventoryItem(localID, itemID) != null) 1229 if (group.GetInventoryItem(localID, itemID) != null)
1188 { 1230 {
@@ -1194,11 +1236,16 @@ namespace OpenSim.Region.Framework.Scenes
1194 1236
1195 group.RemoveInventoryItem(localID, itemID); 1237 group.RemoveInventoryItem(localID, itemID);
1196 } 1238 }
1239
1197 part.SendPropertiesToClient(remoteClient); 1240 part.SendPropertiesToClient(remoteClient);
1198 } 1241 }
1199 } 1242 }
1200 1243
1201 private InventoryItemBase CreateAgentInventoryItemFromTask(UUID destAgent, SceneObjectPart part, UUID itemId) 1244
1245 /// <summary>
1246 /// Creates (in memory only) a user inventory item that will contain a copy of a task inventory item.
1247 /// </summary>
1248 private InventoryItemBase CreateAgentInventoryItemFromTask(UUID destAgent, SceneObjectPart part, UUID itemId, out string message)
1202 { 1249 {
1203 TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(itemId); 1250 TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(itemId);
1204 1251
@@ -1209,12 +1256,13 @@ namespace OpenSim.Region.Framework.Scenes
1209 + " inventory item from a prim's inventory item " 1256 + " inventory item from a prim's inventory item "
1210 + " but the required item does not exist in the prim's inventory", 1257 + " but the required item does not exist in the prim's inventory",
1211 itemId, part.Name, part.UUID); 1258 itemId, part.Name, part.UUID);
1212 1259 message = "Item not found: " + itemId;
1213 return null; 1260 return null;
1214 } 1261 }
1215 1262
1216 if ((destAgent != taskItem.OwnerID) && ((taskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)) 1263 if ((destAgent != taskItem.OwnerID) && ((taskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0))
1217 { 1264 {
1265 message = "Item doesn't have the Transfer permission.";
1218 return null; 1266 return null;
1219 } 1267 }
1220 1268
@@ -1236,11 +1284,25 @@ namespace OpenSim.Region.Framework.Scenes
1236 agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); 1284 agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
1237 if (taskItem.InvType == (int)InventoryType.Object) 1285 if (taskItem.InvType == (int)InventoryType.Object)
1238 { 1286 {
1287<<<<<<< HEAD
1288 // Bake the new base permissions from folded permissions
1289 // The folded perms are in the lowest 3 bits of the current perms
1290 // We use base permissions here to avoid baking the "Locked" status
1291 // into the item as it is passed.
1292 uint perms = taskItem.BasePermissions & taskItem.NextPermissions;
1293 PermissionsUtil.ApplyFoldedPermissions(taskItem.CurrentPermissions, ref perms);
1294 // Avoid the "lock trap" - move must always be enabled but the above may remove it
1295 // Add it back here.
1296 agentItem.BasePermissions = perms | (uint)PermissionMask.Move;
1297 // Newly given items cannot be "locked" on rez. Make sure by
1298 // setting current equal to base.
1299=======
1239 uint perms = taskItem.BasePermissions & taskItem.NextPermissions; 1300 uint perms = taskItem.BasePermissions & taskItem.NextPermissions;
1240 PermissionsUtil.ApplyFoldedPermissions(taskItem.CurrentPermissions, ref perms); 1301 PermissionsUtil.ApplyFoldedPermissions(taskItem.CurrentPermissions, ref perms);
1241// agentItem.BasePermissions = perms | (uint)PermissionMask.Move; 1302// agentItem.BasePermissions = perms | (uint)PermissionMask.Move;
1242// agentItem.CurrentPermissions = agentItem.BasePermissions; 1303// agentItem.CurrentPermissions = agentItem.BasePermissions;
1243 agentItem.BasePermissions = perms | (uint)PermissionMask.Move; 1304 agentItem.BasePermissions = perms | (uint)PermissionMask.Move;
1305>>>>>>> avn/ubitvar
1244 } 1306 }
1245 1307
1246 agentItem.CurrentPermissions = agentItem.BasePermissions; 1308 agentItem.CurrentPermissions = agentItem.BasePermissions;
@@ -1259,11 +1321,24 @@ namespace OpenSim.Region.Framework.Scenes
1259 agentItem.GroupPermissions = taskItem.GroupPermissions; 1321 agentItem.GroupPermissions = taskItem.GroupPermissions;
1260 } 1322 }
1261 1323
1324 message = null;
1325 return agentItem;
1326 }
1327
1328 /// <summary>
1329 /// If the task item is not-copyable then remove it from the prim.
1330 /// </summary>
1331 private void RemoveNonCopyTaskItemFromPrim(SceneObjectPart part, UUID itemId)
1332 {
1333 TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(itemId);
1334 if (taskItem == null)
1335 return;
1336
1262 if (!Permissions.BypassPermissions()) 1337 if (!Permissions.BypassPermissions())
1263 { 1338 {
1264 if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) 1339 if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
1265 { 1340 {
1266 if (taskItem.Type == 10) 1341 if (taskItem.Type == (int)AssetType.LSLText)
1267 { 1342 {
1268 part.RemoveScriptEvents(itemId); 1343 part.RemoveScriptEvents(itemId);
1269 EventManager.TriggerRemoveScript(part.LocalId, itemId); 1344 EventManager.TriggerRemoveScript(part.LocalId, itemId);
@@ -1272,8 +1347,6 @@ namespace OpenSim.Region.Framework.Scenes
1272 part.Inventory.RemoveInventoryItem(itemId); 1347 part.Inventory.RemoveInventoryItem(itemId);
1273 } 1348 }
1274 } 1349 }
1275
1276 return agentItem;
1277 } 1350 }
1278 1351
1279 /// <summary> 1352 /// <summary>
@@ -1283,19 +1356,22 @@ namespace OpenSim.Region.Framework.Scenes
1283 /// <param name="folderID"></param> 1356 /// <param name="folderID"></param>
1284 /// <param name="part"></param> 1357 /// <param name="part"></param>
1285 /// <param name="itemID"></param> 1358 /// <param name="itemID"></param>
1286 public InventoryItemBase MoveTaskInventoryItem(IClientAPI remoteClient, UUID folderId, SceneObjectPart part, UUID itemId) 1359 public InventoryItemBase MoveTaskInventoryItem(IClientAPI remoteClient, UUID folderId, SceneObjectPart part, UUID itemId, out string message)
1287 { 1360 {
1288 m_log.DebugFormat( 1361 m_log.DebugFormat(
1289 "[PRIM INVENTORY]: Adding item {0} from {1} to folder {2} for {3}", 1362 "[PRIM INVENTORY]: Adding item {0} from {1} to folder {2} for {3}",
1290 itemId, part.Name, folderId, remoteClient.Name); 1363 itemId, part.Name, folderId, remoteClient.Name);
1291 1364
1292 InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(remoteClient.AgentId, part, itemId); 1365 InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(remoteClient.AgentId, part, itemId, out message);
1293
1294 if (agentItem == null) 1366 if (agentItem == null)
1295 return null; 1367 return null;
1296 1368
1297 agentItem.Folder = folderId; 1369 agentItem.Folder = folderId;
1298 AddInventoryItem(remoteClient, agentItem); 1370 AddInventoryItem(remoteClient, agentItem);
1371
1372 RemoveNonCopyTaskItemFromPrim(part, itemId);
1373
1374 message = null;
1299 return agentItem; 1375 return agentItem;
1300 } 1376 }
1301 1377
@@ -1350,7 +1426,11 @@ namespace OpenSim.Region.Framework.Scenes
1350 return; 1426 return;
1351 } 1427 }
1352 1428
1353 MoveTaskInventoryItem(remoteClient, folderId, part, itemId); 1429 string message;
1430 InventoryItemBase item = MoveTaskInventoryItem(remoteClient, folderId, part, itemId, out message);
1431
1432 if (item == null)
1433 remoteClient.SendAgentAlertMessage(message, false);
1354 } 1434 }
1355 1435
1356 /// <summary> 1436 /// <summary>
@@ -1364,17 +1444,17 @@ namespace OpenSim.Region.Framework.Scenes
1364 /// </param> 1444 /// </param>
1365 /// <param name="part"></param> 1445 /// <param name="part"></param>
1366 /// <param name="itemID"></param> 1446 /// <param name="itemID"></param>
1367 public InventoryItemBase MoveTaskInventoryItem(UUID avatarId, UUID folderId, SceneObjectPart part, UUID itemId) 1447 public InventoryItemBase MoveTaskInventoryItem(UUID avatarId, UUID folderId, SceneObjectPart part, UUID itemId, out string message)
1368 { 1448 {
1369 ScenePresence avatar; 1449 ScenePresence avatar;
1370 1450
1371 if (TryGetScenePresence(avatarId, out avatar)) 1451 if (TryGetScenePresence(avatarId, out avatar))
1372 { 1452 {
1373 return MoveTaskInventoryItem(avatar.ControllingClient, folderId, part, itemId); 1453 return MoveTaskInventoryItem(avatar.ControllingClient, folderId, part, itemId, out message);
1374 } 1454 }
1375 else 1455 else
1376 { 1456 {
1377 InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(avatarId, part, itemId); 1457 InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(avatarId, part, itemId, out message);
1378 1458
1379 if (agentItem == null) 1459 if (agentItem == null)
1380 return null; 1460 return null;
@@ -1383,6 +1463,8 @@ namespace OpenSim.Region.Framework.Scenes
1383 1463
1384 AddInventoryItem(agentItem); 1464 AddInventoryItem(agentItem);
1385 1465
1466 RemoveNonCopyTaskItemFromPrim(part, itemId);
1467
1386 return agentItem; 1468 return agentItem;
1387 } 1469 }
1388 } 1470 }
@@ -1495,6 +1577,12 @@ namespace OpenSim.Region.Framework.Scenes
1495 1577
1496 public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) 1578 public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items)
1497 { 1579 {
1580<<<<<<< HEAD
1581 ScenePresence avatar;
1582 IClientAPI remoteClient = null;
1583 if (TryGetScenePresence(destID, out avatar))
1584 remoteClient = avatar.ControllingClient;
1585=======
1498 SceneObjectPart destPart = GetSceneObjectPart(destID); 1586 SceneObjectPart destPart = GetSceneObjectPart(destID);
1499 if (destPart != null) // Move into a prim 1587 if (destPart != null) // Move into a prim
1500 { 1588 {
@@ -1502,6 +1590,7 @@ namespace OpenSim.Region.Framework.Scenes
1502 MoveTaskInventoryItem(destID, host, itemID); 1590 MoveTaskInventoryItem(destID, host, itemID);
1503 return destID; // Prim folder ID == prim ID 1591 return destID; // Prim folder ID == prim ID
1504 } 1592 }
1593>>>>>>> avn/ubitvar
1505 1594
1506 InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID); 1595 InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID);
1507 1596
@@ -1512,26 +1601,28 @@ namespace OpenSim.Region.Framework.Scenes
1512 1601
1513 foreach (UUID itemID in items) 1602 foreach (UUID itemID in items)
1514 { 1603 {
1515 InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(destID, host, itemID); 1604 string message;
1605 InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(destID, host, itemID, out message);
1516 1606
1517 if (agentItem != null) 1607 if (agentItem != null)
1518 { 1608 {
1519 agentItem.Folder = newFolderID; 1609 agentItem.Folder = newFolderID;
1520 1610
1521 AddInventoryItem(agentItem); 1611 AddInventoryItem(agentItem);
1612
1613 RemoveNonCopyTaskItemFromPrim(host, itemID);
1614 }
1615 else
1616 {
1617 if (remoteClient != null)
1618 remoteClient.SendAgentAlertMessage(message, false);
1522 } 1619 }
1523 } 1620 }
1524 1621
1525 ScenePresence avatar = null; 1622 if (remoteClient != null)
1526 if (TryGetScenePresence(destID, out avatar))
1527 { 1623 {
1528 //profile.SendInventoryDecendents(avatar.ControllingClient, 1624 SendInventoryUpdate(remoteClient, rootFolder, true, false);
1529 // profile.RootFolder.ID, true, false); 1625 SendInventoryUpdate(remoteClient, newFolder, false, true);
1530 //profile.SendInventoryDecendents(avatar.ControllingClient,
1531 // newFolderID, false, true);
1532
1533 SendInventoryUpdate(avatar.ControllingClient, rootFolder, true, false);
1534 SendInventoryUpdate(avatar.ControllingClient, newFolder, false, true);
1535 } 1626 }
1536 1627
1537 return newFolderID; 1628 return newFolderID;
@@ -1935,8 +2026,11 @@ namespace OpenSim.Region.Framework.Scenes
1935 /// Rez a script into a prim's inventory from another prim 2026 /// Rez a script into a prim's inventory from another prim
1936 /// </summary> 2027 /// </summary>
1937 /// <param name="remoteClient"></param> 2028 /// <param name="remoteClient"></param>
1938 /// <param name="itemID"> </param> 2029 /// <param name="srcPart"> </param>
1939 /// <param name="localID"></param> 2030 /// <param name="destId"> </param>
2031 /// <param name="pin"></param>
2032 /// <param name="running"></param>
2033 /// <param name="start_param"></param>
1940 public void RezScriptFromPrim(UUID srcId, SceneObjectPart srcPart, UUID destId, int pin, int running, int start_param) 2034 public void RezScriptFromPrim(UUID srcId, SceneObjectPart srcPart, UUID destId, int pin, int running, int start_param)
1941 { 2035 {
1942 TaskInventoryItem srcTaskItem = srcPart.Inventory.GetInventoryItem(srcId); 2036 TaskInventoryItem srcTaskItem = srcPart.Inventory.GetInventoryItem(srcId);
@@ -1956,12 +2050,11 @@ namespace OpenSim.Region.Framework.Scenes
1956 if (destPart == null) 2050 if (destPart == null)
1957 { 2051 {
1958 m_log.ErrorFormat( 2052 m_log.ErrorFormat(
1959 "[PRIM INVENTORY]: " + 2053 "[PRIM INVENTORY]: Could not find part {0} to insert script item {1} from {2} {3} in {4}",
1960 "Could not find script for ID {0}", 2054 destId, srcId, srcPart.Name, srcPart.UUID, Name);
1961 destId);
1962 return; 2055 return;
1963 } 2056 }
1964 2057
1965 // Must own the object, and have modify rights 2058 // Must own the object, and have modify rights
1966 if (srcPart.OwnerID != destPart.OwnerID) 2059 if (srcPart.OwnerID != destPart.OwnerID)
1967 { 2060 {
@@ -1969,7 +2062,9 @@ namespace OpenSim.Region.Framework.Scenes
1969 if ((destPart.GroupID == UUID.Zero) || (destPart.GroupID != srcPart.GroupID) || 2062 if ((destPart.GroupID == UUID.Zero) || (destPart.GroupID != srcPart.GroupID) ||
1970 ((destPart.GroupMask & (uint)PermissionMask.Modify) == 0)) 2063 ((destPart.GroupMask & (uint)PermissionMask.Modify) == 0))
1971 return; 2064 return;
1972 } else { 2065 }
2066 else
2067 {
1973 if ((destPart.OwnerMask & (uint)PermissionMask.Modify) == 0) 2068 if ((destPart.OwnerMask & (uint)PermissionMask.Modify) == 0)
1974 return; 2069 return;
1975 } 2070 }
@@ -2094,7 +2189,7 @@ namespace OpenSim.Region.Framework.Scenes
2094 SceneObjectGroup grp = part.ParentGroup; 2189 SceneObjectGroup grp = part.ParentGroup;
2095 2190
2096 // If child prims have invalid perms, fix them 2191 // If child prims have invalid perms, fix them
2097 grp.AdjustChildPrimPermissions(); 2192 grp.AdjustChildPrimPermissions(false);
2098 2193
2099 if (remoteClient == null) 2194 if (remoteClient == null)
2100 { 2195 {
@@ -2192,15 +2287,27 @@ namespace OpenSim.Region.Framework.Scenes
2192 } 2287 }
2193 } 2288 }
2194 2289
2290<<<<<<< HEAD
2291 // OK, we're done with permissions. Let's check if any part of the code prevents the objects from being deleted
2292 bool canDelete = EventManager.TriggerDeRezRequested(remoteClient, deleteGroups, action);
2293
2294 if (permissionToTake && (action != DeRezAction.Delete || this.m_useTrashOnDelete))
2295=======
2195 SendKillObject(deleteIDs); 2296 SendKillObject(deleteIDs);
2196 2297
2197 if (deleteGroups.Count > 0) 2298 if (deleteGroups.Count > 0)
2299>>>>>>> avn/ubitvar
2198 { 2300 {
2199 foreach (SceneObjectGroup g in deleteGroups) 2301 foreach (SceneObjectGroup g in deleteGroups)
2200 deleteIDs.Remove(g.LocalId); 2302 deleteIDs.Remove(g.LocalId);
2201 2303
2202 m_asyncSceneObjectDeleter.DeleteToInventory( 2304 m_asyncSceneObjectDeleter.DeleteToInventory(
2203 action, destinationID, deleteGroups, remoteClient, 2305 action, destinationID, deleteGroups, remoteClient,
2306<<<<<<< HEAD
2307 permissionToDelete && canDelete);
2308 }
2309 else if (permissionToDelete && canDelete)
2310=======
2204 true); 2311 true);
2205 } 2312 }
2206 if (takeGroups.Count > 0) 2313 if (takeGroups.Count > 0)
@@ -2210,6 +2317,7 @@ namespace OpenSim.Region.Framework.Scenes
2210 false); 2317 false);
2211 } 2318 }
2212 if (deleteIDs.Count > 0) 2319 if (deleteIDs.Count > 0)
2320>>>>>>> avn/ubitvar
2213 { 2321 {
2214 foreach (SceneObjectGroup g in deleteGroups) 2322 foreach (SceneObjectGroup g in deleteGroups)
2215 DeleteSceneObject(g, true); 2323 DeleteSceneObject(g, true);
@@ -2306,24 +2414,30 @@ namespace OpenSim.Region.Framework.Scenes
2306 /// Returns one object if the asset is a regular object, and multiple objects for a coalesced object. 2414 /// Returns one object if the asset is a regular object, and multiple objects for a coalesced object.
2307 /// </remarks> 2415 /// </remarks>
2308 /// <param name="assetData">Asset data</param> 2416 /// <param name="assetData">Asset data</param>
2309 /// <param name="attachment">Whether the item is an attachment</param> 2417 /// <param name="isAttachment">True if the object is an attachment.</param>
2310 /// <param name="objlist">The objects included in the asset</param> 2418 /// <param name="objlist">The objects included in the asset</param>
2311 /// <param name="veclist">Relative positions of the objects</param> 2419 /// <param name="veclist">Relative positions of the objects</param>
2312 /// <param name="bbox">Bounding box of all the objects</param> 2420 /// <param name="bbox">Bounding box of all the objects</param>
2313 /// <param name="offsetHeight">Offset in the Z axis from the centre of the bounding box 2421 /// <param name="offsetHeight">Offset in the Z axis from the centre of the bounding box
2314 /// to the centre of the root prim (relevant only when returning a single object)</param> 2422 /// to the centre of the root prim (relevant only when returning a single object)</param>
2315 /// <returns>true = returning a single object; false = multiple objects</returns> 2423 /// <returns>
2316 public bool GetObjectsToRez(byte[] assetData, bool attachment, out List<SceneObjectGroup> objlist, out List<Vector3> veclist, 2424 /// true if returning a single object or deserialization fails, false if returning the coalesced
2425 /// list of objects
2426 /// </returns>
2427 public bool GetObjectsToRez(
2428 byte[] assetData, bool isAttachment, out List<SceneObjectGroup> objlist, out List<Vector3> veclist,
2317 out Vector3 bbox, out float offsetHeight) 2429 out Vector3 bbox, out float offsetHeight)
2318 { 2430 {
2319 objlist = new List<SceneObjectGroup>(); 2431 objlist = new List<SceneObjectGroup>();
2320 veclist = new List<Vector3>(); 2432 veclist = new List<Vector3>();
2433 bbox = Vector3.Zero;
2434 offsetHeight = 0;
2321 2435
2322 XmlDocument doc = new XmlDocument(); 2436 string xmlData = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(assetData));
2323 string xmlData = Utils.BytesToString(assetData);
2324 doc.LoadXml(xmlData);
2325 XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject");
2326 2437
2438<<<<<<< HEAD
2439 try
2440=======
2327 if (e == null || attachment) // Single 2441 if (e == null || attachment) // Single
2328 { 2442 {
2329 SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); 2443 SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
@@ -2344,17 +2458,75 @@ namespace OpenSim.Region.Framework.Scenes
2344 return true; 2458 return true;
2345 } 2459 }
2346 else 2460 else
2461>>>>>>> avn/ubitvar
2347 { 2462 {
2348 XmlElement coll = (XmlElement)e; 2463 using (XmlTextReader wrappedReader = new XmlTextReader(xmlData, XmlNodeType.Element, null))
2349 float bx = Convert.ToSingle(coll.GetAttribute("x"));
2350 float by = Convert.ToSingle(coll.GetAttribute("y"));
2351 float bz = Convert.ToSingle(coll.GetAttribute("z"));
2352 bbox = new Vector3(bx, by, bz);
2353 offsetHeight = 0;
2354
2355 XmlNodeList groups = e.SelectNodes("SceneObjectGroup");
2356 foreach (XmlNode n in groups)
2357 { 2464 {
2465<<<<<<< HEAD
2466 using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment }))
2467 {
2468 reader.Read();
2469 bool isSingleObject = reader.Name != "CoalescedObject";
2470
2471 if (isSingleObject || isAttachment)
2472 {
2473 SceneObjectGroup g;
2474 try
2475 {
2476 g = SceneObjectSerializer.FromOriginalXmlFormat(reader);
2477 }
2478 catch (Exception e)
2479 {
2480 m_log.Error("[AGENT INVENTORY]: Deserialization of xml failed ", e);
2481 Util.LogFailedXML("[AGENT INVENTORY]:", xmlData);
2482 g = null;
2483 }
2484
2485 if (g != null)
2486 {
2487 objlist.Add(g);
2488 veclist.Add(Vector3.Zero);
2489 bbox = g.GetAxisAlignedBoundingBox(out offsetHeight);
2490 }
2491
2492 return true;
2493 }
2494 else
2495 {
2496 XmlDocument doc = new XmlDocument();
2497 doc.LoadXml(xmlData);
2498 XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject");
2499 XmlElement coll = (XmlElement)e;
2500 float bx = Convert.ToSingle(coll.GetAttribute("x"));
2501 float by = Convert.ToSingle(coll.GetAttribute("y"));
2502 float bz = Convert.ToSingle(coll.GetAttribute("z"));
2503 bbox = new Vector3(bx, by, bz);
2504 offsetHeight = 0;
2505
2506 XmlNodeList groups = e.SelectNodes("SceneObjectGroup");
2507 foreach (XmlNode n in groups)
2508 {
2509 SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml);
2510 if (g != null)
2511 {
2512 objlist.Add(g);
2513
2514 XmlElement el = (XmlElement)n;
2515 string rawX = el.GetAttribute("offsetx");
2516 string rawY = el.GetAttribute("offsety");
2517 string rawZ = el.GetAttribute("offsetz");
2518
2519 float x = Convert.ToSingle(rawX);
2520 float y = Convert.ToSingle(rawY);
2521 float z = Convert.ToSingle(rawZ);
2522 veclist.Add(new Vector3(x, y, z));
2523 }
2524 }
2525
2526 return false;
2527 }
2528 }
2529=======
2358 SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml); 2530 SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml);
2359/* 2531/*
2360 g.RootPart.AttachPoint = g.RootPart.Shape.State; 2532 g.RootPart.AttachPoint = g.RootPart.Shape.State;
@@ -2375,10 +2547,16 @@ namespace OpenSim.Region.Framework.Scenes
2375 float y = Convert.ToSingle(rawY); 2547 float y = Convert.ToSingle(rawY);
2376 float z = Convert.ToSingle(rawZ); 2548 float z = Convert.ToSingle(rawZ);
2377 veclist.Add(new Vector3(x, y, z)); 2549 veclist.Add(new Vector3(x, y, z));
2550>>>>>>> avn/ubitvar
2378 } 2551 }
2379 } 2552 }
2553 catch (Exception e)
2554 {
2555 m_log.Error("[AGENT INVENTORY]: Deserialization of xml failed when looking for CoalescedObject tag ", e);
2556 Util.LogFailedXML("[AGENT INVENTORY]:", xmlData);
2557 }
2380 2558
2381 return false; 2559 return true;
2382 } 2560 }
2383 2561
2384 /// <summary> 2562 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 931093a..3d9c028 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -133,6 +133,21 @@ namespace OpenSim.Region.Framework.Scenes
133 } 133 }
134 134
135 /// <summary> 135 /// <summary>
136 ///
137 /// </summary>
138 /// <param name="message"></param>
139 /// <param name="type"></param>
140 /// <param name="channel"></param>
141 /// <param name="fromPos"></param>
142 /// <param name="fromName"></param>
143 /// <param name="fromAgentID"></param>
144 /// <param name="targetID"></param>
145 public void SimChatToAgent(UUID targetID, byte[] message, int channel, Vector3 fromPos, string fromName, UUID fromID, bool fromAgent)
146 {
147 SimChat(message, ChatTypeEnum.Region, channel, fromPos, fromName, fromID, targetID, fromAgent, false);
148 }
149
150 /// <summary>
136 /// Invoked when the client requests a prim. 151 /// Invoked when the client requests a prim.
137 /// </summary> 152 /// </summary>
138 /// <param name="primLocalID"></param> 153 /// <param name="primLocalID"></param>
@@ -536,8 +551,21 @@ namespace OpenSim.Region.Framework.Scenes
536 551
537 void SendInventoryAsync(IClientAPI remoteClient, UUID folderID, UUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder) 552 void SendInventoryAsync(IClientAPI remoteClient, UUID folderID, UUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder)
538 { 553 {
554<<<<<<< HEAD
555 try
556 {
557 SendInventoryUpdate(remoteClient, new InventoryFolderBase(folderID), fetchFolders, fetchItems);
558 }
559 catch (Exception e)
560 {
561 m_log.Error(
562 string.Format(
563 "[AGENT INVENTORY]: Error in SendInventoryAsync() for {0} with folder ID {1}. Exception ", e));
564 }
565=======
539 Thread.Sleep(20); 566 Thread.Sleep(20);
540 SendInventoryUpdate(remoteClient, new InventoryFolderBase(folderID), fetchFolders, fetchItems); 567 SendInventoryUpdate(remoteClient, new InventoryFolderBase(folderID), fetchFolders, fetchItems);
568>>>>>>> avn/ubitvar
541 } 569 }
542 570
543 void SendInventoryComplete(IAsyncResult iar) 571 void SendInventoryComplete(IAsyncResult iar)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 61e31e4..deb8d39 100644..100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -48,7 +48,7 @@ using OpenSim.Region.Framework.Interfaces;
48using OpenSim.Region.Framework.Scenes.Scripting; 48using OpenSim.Region.Framework.Scenes.Scripting;
49using OpenSim.Region.Framework.Scenes.Serialization; 49using OpenSim.Region.Framework.Scenes.Serialization;
50using OpenSim.Region.Physics.Manager; 50using OpenSim.Region.Physics.Manager;
51using Timer=System.Timers.Timer; 51using Timer = System.Timers.Timer;
52using TPFlags = OpenSim.Framework.Constants.TeleportFlags; 52using TPFlags = OpenSim.Framework.Constants.TeleportFlags;
53using GridRegion = OpenSim.Services.Interfaces.GridRegion; 53using GridRegion = OpenSim.Services.Interfaces.GridRegion;
54using PermissionMask = OpenSim.Framework.PermissionMask; 54using PermissionMask = OpenSim.Framework.PermissionMask;
@@ -61,6 +61,8 @@ namespace OpenSim.Region.Framework.Scenes
61 { 61 {
62 private const long DEFAULT_MIN_TIME_FOR_PERSISTENCE = 60L; 62 private const long DEFAULT_MIN_TIME_FOR_PERSISTENCE = 60L;
63 private const long DEFAULT_MAX_TIME_FOR_PERSISTENCE = 600L; 63 private const long DEFAULT_MAX_TIME_FOR_PERSISTENCE = 600L;
64
65 public const int m_defaultNumberFramesStored = 10;
64 66
65 public delegate void SynchronizeSceneHandler(Scene scene); 67 public delegate void SynchronizeSceneHandler(Scene scene);
66 68
@@ -103,9 +105,15 @@ namespace OpenSim.Region.Framework.Scenes
103 /// <summary> 105 /// <summary>
104 /// If false then physical objects are disabled, though collisions will continue as normal. 106 /// If false then physical objects are disabled, though collisions will continue as normal.
105 /// </summary> 107 /// </summary>
108<<<<<<< HEAD
109 public bool PhysicsEnabled
110 {
111 get
112=======
106 public bool PhysicsEnabled 113 public bool PhysicsEnabled
107 { 114 {
108 get 115 get
116>>>>>>> avn/ubitvar
109 { 117 {
110 return m_physicsEnabled; 118 return m_physicsEnabled;
111 } 119 }
@@ -130,10 +138,10 @@ namespace OpenSim.Region.Framework.Scenes
130 /// <summary> 138 /// <summary>
131 /// If false then scripts are not enabled on the smiulator 139 /// If false then scripts are not enabled on the smiulator
132 /// </summary> 140 /// </summary>
133 public bool ScriptsEnabled 141 public bool ScriptsEnabled
134 { 142 {
135 get { return m_scripts_enabled; } 143 get { return m_scripts_enabled; }
136 set 144 set
137 { 145 {
138 if (m_scripts_enabled != value) 146 if (m_scripts_enabled != value)
139 { 147 {
@@ -151,7 +159,7 @@ namespace OpenSim.Region.Framework.Scenes
151 else 159 else
152 { 160 {
153 m_log.Info("Starting all Scripts in Scene"); 161 m_log.Info("Starting all Scripts in Scene");
154 162
155 EntityBase[] entities = Entities.GetEntities(); 163 EntityBase[] entities = Entities.GetEntities();
156 foreach (EntityBase ent in entities) 164 foreach (EntityBase ent in entities)
157 { 165 {
@@ -214,7 +222,7 @@ namespace OpenSim.Region.Framework.Scenes
214 /// <summary> 222 /// <summary>
215 /// Maximum value of the size of a physical prim in each axis 223 /// Maximum value of the size of a physical prim in each axis
216 /// </summary> 224 /// </summary>
217 public float m_maxPhys = 10; 225 public float m_maxPhys = 64;
218 226
219 /// <summary> 227 /// <summary>
220 /// Max prims an object will hold 228 /// Max prims an object will hold
@@ -226,10 +234,16 @@ namespace OpenSim.Region.Framework.Scenes
226 public bool m_allowScriptCrossings = true; 234 public bool m_allowScriptCrossings = true;
227 235
228 /// <summary> 236 /// <summary>
237<<<<<<< HEAD
238 /// Can avatars cross from and to this region?
239 /// </summary>
240 public bool AllowAvatarCrossing { get; set; }
241=======
229 /// Max prims an Physical object will hold 242 /// Max prims an Physical object will hold
230 /// </summary> 243 /// </summary>
231 /// 244 ///
232 public int m_linksetPhysCapacity = 0; 245 public int m_linksetPhysCapacity = 0;
246>>>>>>> avn/ubitvar
233 247
234 public bool m_useFlySlow; 248 public bool m_useFlySlow;
235 public bool m_useTrashOnDelete = true; 249 public bool m_useTrashOnDelete = true;
@@ -239,10 +253,45 @@ namespace OpenSim.Region.Framework.Scenes
239 /// </summary> 253 /// </summary>
240 public bool SendPeriodicAppearanceUpdates { get; set; } 254 public bool SendPeriodicAppearanceUpdates { get; set; }
241 255
256 /// <summary>
257 /// How much a root agent has to change position before updates are sent to viewers.
258 /// </summary>
259 public float RootPositionUpdateTolerance { get; set; }
260
261 /// <summary>
262 /// How much a root agent has to rotate before updates are sent to viewers.
263 /// </summary>
264 public float RootRotationUpdateTolerance { get; set; }
265
266 /// <summary>
267 /// How much a root agent has to change velocity before updates are sent to viewers.
268 /// </summary>
269 public float RootVelocityUpdateTolerance { get; set; }
270
271 /// <summary>
272 /// If greater than 1, we only send terse updates to other root agents on every n updates.
273 /// </summary>
274 public int RootTerseUpdatePeriod { get; set; }
275
276 /// <summary>
277 /// If greater than 1, we only send terse updates to child agents on every n updates.
278 /// </summary>
279 public int ChildTerseUpdatePeriod { get; set; }
280
242 protected float m_defaultDrawDistance = 255.0f; 281 protected float m_defaultDrawDistance = 255.0f;
243 public float DefaultDrawDistance 282 public float DefaultDrawDistance
244 { 283 {
245 get { return m_defaultDrawDistance; } 284 // get { return m_defaultDrawDistance; }
285 get
286 {
287 if (RegionInfo != null)
288 {
289 float largestDimension = Math.Max(RegionInfo.RegionSizeX, RegionInfo.RegionSizeY);
290 m_defaultDrawDistance = Math.Max(m_defaultDrawDistance, largestDimension);
291
292 }
293 return m_defaultDrawDistance;
294 }
246 } 295 }
247 296
248 protected float m_maxDrawDistance = 512.0f; 297 protected float m_maxDrawDistance = 512.0f;
@@ -254,7 +303,7 @@ namespace OpenSim.Region.Framework.Scenes
254 303
255 private List<string> m_AllowedViewers = new List<string>(); 304 private List<string> m_AllowedViewers = new List<string>();
256 private List<string> m_BannedViewers = new List<string>(); 305 private List<string> m_BannedViewers = new List<string>();
257 306
258 // TODO: need to figure out how allow client agents but deny 307 // TODO: need to figure out how allow client agents but deny
259 // root agents when ACL denies access to root agent 308 // root agents when ACL denies access to root agent
260 public bool m_strictAccessControl = true; 309 public bool m_strictAccessControl = true;
@@ -298,6 +347,7 @@ namespace OpenSim.Region.Framework.Scenes
298 protected IUserAccountService m_UserAccountService; 347 protected IUserAccountService m_UserAccountService;
299 protected IAvatarService m_AvatarService; 348 protected IAvatarService m_AvatarService;
300 protected IGridUserService m_GridUserService; 349 protected IGridUserService m_GridUserService;
350 protected IAgentPreferencesService m_AgentPreferencesService;
301 351
302 protected IXMLRPC m_xmlrpcModule; 352 protected IXMLRPC m_xmlrpcModule;
303 protected IWorldComm m_worldCommModule; 353 protected IWorldComm m_worldCommModule;
@@ -311,6 +361,17 @@ namespace OpenSim.Region.Framework.Scenes
311 private Dictionary<string, string> m_extraSettings; 361 private Dictionary<string, string> m_extraSettings;
312 362
313 /// <summary> 363 /// <summary>
364 /// If true then the next time the scene loop is activated, updates will be performed by firing of a timer
365 /// rather than on a single thread that sleeps.
366 /// </summary>
367 public bool UpdateOnTimer { get; set; }
368
369 /// <summary>
370 /// Only used if we are updating scene on a timer rather than sleeping a thread.
371 /// </summary>
372 private Timer m_sceneUpdateTimer;
373
374 /// <summary>
314 /// Current scene frame number 375 /// Current scene frame number
315 /// </summary> 376 /// </summary>
316 public uint Frame 377 public uint Frame
@@ -325,30 +386,57 @@ namespace OpenSim.Region.Framework.Scenes
325 public uint MaintenanceRun { get; private set; } 386 public uint MaintenanceRun { get; private set; }
326 387
327 /// <summary> 388 /// <summary>
328 /// The minimum length of time in seconds that will be taken for a scene frame. If the frame takes less time then we 389 /// The minimum length of time in milliseconds that will be taken for a scene frame. If the frame takes less time then we
329 /// will sleep for the remaining period. 390 /// will sleep for the remaining period.
330 /// </summary> 391 /// </summary>
331 /// <remarks> 392 /// <remarks>
332 /// One can tweak this number to experiment. One current effect of reducing it is to make avatar animations 393 /// One can tweak this number to experiment. One current effect of reducing it is to make avatar animations
333 /// occur too quickly (viewer 1) or with even more slide (viewer 2). 394 /// occur too quickly (viewer 1) or with even more slide (viewer 2).
334 /// </remarks> 395 /// </remarks>
335 public float MinFrameTime { get; private set; } 396 public int MinFrameTicks
397 {
398 get { return m_minFrameTicks; }
399 private set
400 {
401 m_minFrameTicks = value;
402 MinFrameSeconds = (float)m_minFrameTicks / 1000;
403 }
404 }
405 private int m_minFrameTicks;
406
407 /// <summary>
408 /// The minimum length of time in seconds that will be taken for a scene frame.
409 /// </summary>
410 /// <remarks>
411 /// Always derived from MinFrameTicks.
412 /// </remarks>
413 public float MinFrameSeconds { get; private set; }
336 414
337 /// <summary> 415 /// <summary>
338 /// The minimum length of time in seconds that will be taken for a maintenance run. 416 /// The minimum length of time in milliseconds that will be taken for a scene frame. If the frame takes less time then we
417 /// will sleep for the remaining period.
339 /// </summary> 418 /// </summary>
340 public float MinMaintenanceTime { get; private set; } 419 /// <remarks>
420 /// One can tweak this number to experiment. One current effect of reducing it is to make avatar animations
421 /// occur too quickly (viewer 1) or with even more slide (viewer 2).
422 /// </remarks>
423 public int MinMaintenanceTicks { get; set; }
341 424
342 private int m_update_physics = 1; 425 private int m_update_physics = 1;
343 private int m_update_entitymovement = 1; 426 private int m_update_entitymovement = 1;
344 private int m_update_objects = 1; 427 private int m_update_objects = 1;
345 private int m_update_temp_cleaning = 1000;
346 private int m_update_presences = 1; // Update scene presence movements 428 private int m_update_presences = 1; // Update scene presence movements
347 private int m_update_events = 1; 429 private int m_update_events = 1;
348 private int m_update_backup = 200; 430 private int m_update_backup = 200;
431<<<<<<< HEAD
432 private int m_update_terrain = 50;
433 // private int m_update_land = 1;
434=======
349 private int m_update_terrain = 1000; 435 private int m_update_terrain = 1000;
350 private int m_update_land = 10; 436 private int m_update_land = 10;
437>>>>>>> avn/ubitvar
351 private int m_update_coarse_locations = 50; 438 private int m_update_coarse_locations = 50;
439 private int m_update_temp_cleaning = 180;
352 440
353 private int agentMS; 441 private int agentMS;
354 private int frameMS; 442 private int frameMS;
@@ -361,6 +449,17 @@ namespace OpenSim.Region.Framework.Scenes
361 private int terrainMS; 449 private int terrainMS;
362 private int landMS; 450 private int landMS;
363 451
452 // A temporary configuration flag to enable using FireAndForget to process
453 // collisions from the physics engine. There is a problem with collisions
454 // stopping sometimes and MB's suspicion is some race condition passing
455 // collisions from the physics engine callback to the script engine.
456 // This causes the collision events to be passed with a FireAndForget
457 // call which should eliminate that linkage. Testers can turn this on
458 // and see if collisions stop. If they don't, the problem is somewhere else.
459 // This feature defaults to 'off' so, by default, the simulator operation
460 // is not changed.
461 public bool ShouldUseFireAndForgetForCollisions = false;
462
364 /// <summary> 463 /// <summary>
365 /// Tick at which the last frame was processed. 464 /// Tick at which the last frame was processed.
366 /// </summary> 465 /// </summary>
@@ -373,12 +472,25 @@ namespace OpenSim.Region.Framework.Scenes
373 private int m_lastMaintenanceTick; 472 private int m_lastMaintenanceTick;
374 473
375 /// <summary> 474 /// <summary>
475 /// Total script execution time (in Stopwatch Ticks) since the last frame
476 /// </summary>
477 private long m_scriptExecutionTime = 0;
478
479 /// <summary>
376 /// Signals whether temporary objects are currently being cleaned up. Needed because this is launched 480 /// Signals whether temporary objects are currently being cleaned up. Needed because this is launched
377 /// asynchronously from the update loop. 481 /// asynchronously from the update loop.
378 /// </summary> 482 /// </summary>
379 private bool m_cleaningTemps = false; 483 private bool m_cleaningTemps = false;
380 484
381// private Object m_heartbeatLock = new Object(); 485 /// <summary>
486 /// Used to control main scene thread looping time when not updating via timer.
487 /// </summary>
488 private ManualResetEvent m_updateWaitEvent = new ManualResetEvent(false);
489
490 /// <summary>
491 /// Used to control maintenance thread runs.
492 /// </summary>
493 private ManualResetEvent m_maintenanceWaitEvent = new ManualResetEvent(false);
382 494
383 // TODO: Possibly stop other classes being able to manipulate this directly. 495 // TODO: Possibly stop other classes being able to manipulate this directly.
384 private SceneGraph m_sceneGraph; 496 private SceneGraph m_sceneGraph;
@@ -389,6 +501,12 @@ namespace OpenSim.Region.Framework.Scenes
389 501
390 private string m_defaultScriptEngine; 502 private string m_defaultScriptEngine;
391 503
504 private int m_unixStartTime;
505 public int UnixStartTime
506 {
507 get { return m_unixStartTime; }
508 }
509
392 /// <summary> 510 /// <summary>
393 /// Tick at which the last login occurred. 511 /// Tick at which the last login occurred.
394 /// </summary> 512 /// </summary>
@@ -417,7 +535,8 @@ namespace OpenSim.Region.Framework.Scenes
417 /// Is the scene active? 535 /// Is the scene active?
418 /// </summary> 536 /// </summary>
419 /// <remarks> 537 /// <remarks>
420 /// If false, maintenance and update loops are not being run. Updates can still be triggered manually if 538 /// If false, maintenance and update loops are not being run, though after setting to false update may still
539 /// be active for a period (and IsRunning will still be true). Updates can still be triggered manually if
421 /// the scene is not active. 540 /// the scene is not active.
422 /// </remarks> 541 /// </remarks>
423 public bool Active 542 public bool Active
@@ -440,6 +559,13 @@ namespace OpenSim.Region.Framework.Scenes
440 } 559 }
441 private volatile bool m_active; 560 private volatile bool m_active;
442 561
562<<<<<<< HEAD
563 /// <summary>
564 /// If true then updates are running. This may be true for a short period after a scene is de-activated.
565 /// </summary>
566 public bool IsRunning { get { return m_isRunning; } }
567 private volatile bool m_isRunning;
568=======
443// private int m_lastUpdate; 569// private int m_lastUpdate;
444 private bool m_firstHeartbeat = true; 570 private bool m_firstHeartbeat = true;
445 571
@@ -448,6 +574,7 @@ namespace OpenSim.Region.Framework.Scenes
448 private double m_reprioritizationInterval = 5000.0; 574 private double m_reprioritizationInterval = 5000.0;
449 private double m_rootReprioritizationDistance = 10.0; 575 private double m_rootReprioritizationDistance = 10.0;
450 private double m_childReprioritizationDistance = 20.0; 576 private double m_childReprioritizationDistance = 20.0;
577>>>>>>> avn/ubitvar
451 578
452 private Timer m_mapGenerationTimer = new Timer(); 579 private Timer m_mapGenerationTimer = new Timer();
453 private bool m_generateMaptiles; 580 private bool m_generateMaptiles;
@@ -468,6 +595,13 @@ namespace OpenSim.Region.Framework.Scenes
468 get { return m_sceneGraph.PhysicsScene.TimeDilation; } 595 get { return m_sceneGraph.PhysicsScene.TimeDilation; }
469 } 596 }
470 597
598 public void setThreadCount(int inUseThreads)
599 {
600 // Just pass the thread count information on its way as the Scene
601 // does not require the value for anything at this time
602 StatsReporter.SetThreadCount(inUseThreads);
603 }
604
471 public SceneCommunicationService SceneGridService 605 public SceneCommunicationService SceneGridService
472 { 606 {
473 get { return m_sceneGridService; } 607 get { return m_sceneGridService; }
@@ -539,7 +673,7 @@ namespace OpenSim.Region.Framework.Scenes
539 return m_AssetService; 673 return m_AssetService;
540 } 674 }
541 } 675 }
542 676
543 public IAuthorizationService AuthorizationService 677 public IAuthorizationService AuthorizationService
544 { 678 {
545 get 679 get
@@ -667,6 +801,16 @@ namespace OpenSim.Region.Framework.Scenes
667 } 801 }
668 } 802 }
669 803
804 public IAgentPreferencesService AgentPreferencesService
805 {
806 get
807 {
808 if (m_AgentPreferencesService == null)
809 m_AgentPreferencesService = RequestModuleInterface<IAgentPreferencesService>();
810 return m_AgentPreferencesService;
811 }
812 }
813
670 public IAttachmentsModule AttachmentsModule { get; set; } 814 public IAttachmentsModule AttachmentsModule { get; set; }
671 public IEntityTransferModule EntityTransferModule { get; private set; } 815 public IEntityTransferModule EntityTransferModule { get; private set; }
672 public IAgentAssetTransactions AgentTransactionsModule { get; private set; } 816 public IAgentAssetTransactions AgentTransactionsModule { get; private set; }
@@ -676,7 +820,7 @@ namespace OpenSim.Region.Framework.Scenes
676 { 820 {
677 get { return m_AvatarFactory; } 821 get { return m_AvatarFactory; }
678 } 822 }
679 823
680 public ICapabilitiesModule CapsModule 824 public ICapabilitiesModule CapsModule
681 { 825 {
682 get { return m_capsModule; } 826 get { return m_capsModule; }
@@ -693,11 +837,11 @@ namespace OpenSim.Region.Framework.Scenes
693 public int MonitorLandTime { get { return landMS; } } 837 public int MonitorLandTime { get { return landMS; } }
694 public int MonitorLastFrameTick { get { return m_lastFrameTick; } } 838 public int MonitorLastFrameTick { get { return m_lastFrameTick; } }
695 839
696 public UpdatePrioritizationSchemes UpdatePrioritizationScheme { get { return m_priorityScheme; } } 840 public UpdatePrioritizationSchemes UpdatePrioritizationScheme { get; set; }
697 public bool IsReprioritizationEnabled { get { return m_reprioritizationEnabled; } } 841 public bool IsReprioritizationEnabled { get; set; }
698 public double ReprioritizationInterval { get { return m_reprioritizationInterval; } } 842 public double ReprioritizationInterval { get; set; }
699 public double RootReprioritizationDistance { get { return m_rootReprioritizationDistance; } } 843 public double RootReprioritizationDistance { get; set; }
700 public double ChildReprioritizationDistance { get { return m_childReprioritizationDistance; } } 844 public double ChildReprioritizationDistance { get; set; }
701 845
702 public AgentCircuitManager AuthenticateHandler 846 public AgentCircuitManager AuthenticateHandler
703 { 847 {
@@ -742,18 +886,20 @@ namespace OpenSim.Region.Framework.Scenes
742 get { return m_sceneGraph.Entities; } 886 get { return m_sceneGraph.Entities; }
743 } 887 }
744 888
745 889
746 // used in sequence see: SpawnPoint() 890 // used in sequence see: SpawnPoint()
747 private int m_SpawnPoint; 891 private int m_SpawnPoint;
748 // can be closest/random/sequence 892 // can be closest/random/sequence
749 public string SpawnPointRouting 893 public string SpawnPointRouting
750 { 894 {
751 get; private set; 895 get;
896 private set;
752 } 897 }
753 // allow landmarks to pass 898 // allow landmarks to pass
754 public bool TelehubAllowLandmarks 899 public bool TelehubAllowLandmarks
755 { 900 {
756 get; private set; 901 get;
902 private set;
757 } 903 }
758 904
759 #endregion Properties 905 #endregion Properties
@@ -764,11 +910,11 @@ namespace OpenSim.Region.Framework.Scenes
764 SceneCommunicationService sceneGridService, 910 SceneCommunicationService sceneGridService,
765 ISimulationDataService simDataService, IEstateDataService estateDataService, 911 ISimulationDataService simDataService, IEstateDataService estateDataService,
766 IConfigSource config, string simulatorVersion) 912 IConfigSource config, string simulatorVersion)
767 : this(regInfo) 913 : this(regInfo, physicsScene)
768 { 914 {
769 m_config = config; 915 m_config = config;
770 MinFrameTime = 0.089f; 916 MinFrameTicks = 89;
771 MinMaintenanceTime = 1; 917 MinMaintenanceTicks = 1000;
772 SeeIntoRegion = true; 918 SeeIntoRegion = true;
773 919
774 Random random = new Random(); 920 Random random = new Random();
@@ -778,9 +924,12 @@ namespace OpenSim.Region.Framework.Scenes
778 m_sceneGridService = sceneGridService; 924 m_sceneGridService = sceneGridService;
779 m_SimulationDataService = simDataService; 925 m_SimulationDataService = simDataService;
780 m_EstateDataService = estateDataService; 926 m_EstateDataService = estateDataService;
927<<<<<<< HEAD
928=======
781 m_regionHandle = RegionInfo.RegionHandle; 929 m_regionHandle = RegionInfo.RegionHandle;
782 m_lastIncoming = 0; 930 m_lastIncoming = 0;
783 m_lastOutgoing = 0; 931 m_lastOutgoing = 0;
932>>>>>>> avn/ubitvar
784 933
785 m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); 934 m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this);
786 m_asyncSceneObjectDeleter.Enabled = true; 935 m_asyncSceneObjectDeleter.Enabled = true;
@@ -839,6 +988,8 @@ namespace OpenSim.Region.Framework.Scenes
839 EventManager.OnLandObjectRemoved += 988 EventManager.OnLandObjectRemoved +=
840 new EventManager.LandObjectRemoved(simDataService.RemoveLandObject); 989 new EventManager.LandObjectRemoved(simDataService.RemoveLandObject);
841 990
991<<<<<<< HEAD
992=======
842 m_sceneGraph = new SceneGraph(this); 993 m_sceneGraph = new SceneGraph(this);
843 m_sceneGraph.PhysicsScene = physicsScene; 994 m_sceneGraph.PhysicsScene = physicsScene;
844 995
@@ -855,6 +1006,7 @@ namespace OpenSim.Region.Framework.Scenes
855 RestartNow(); 1006 RestartNow();
856 }; 1007 };
857 1008
1009>>>>>>> avn/ubitvar
858 RegisterDefaultSceneEvents(); 1010 RegisterDefaultSceneEvents();
859 1011
860 // XXX: Don't set the public property since we don't want to activate here. This needs to be handled 1012 // XXX: Don't set the public property since we don't want to activate here. This needs to be handled
@@ -880,7 +1032,7 @@ namespace OpenSim.Region.Framework.Scenes
880 UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); 1032 UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup);
881 if (!UseBackup) 1033 if (!UseBackup)
882 m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); 1034 m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName);
883 1035
884 //Animation states 1036 //Animation states
885 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); 1037 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
886 1038
@@ -940,10 +1092,10 @@ namespace OpenSim.Region.Framework.Scenes
940 m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); 1092 m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries);
941 m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); 1093 m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings);
942 m_dontPersistBefore = 1094 m_dontPersistBefore =
943 startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); 1095 startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE);
944 m_dontPersistBefore *= 10000000; 1096 m_dontPersistBefore *= 10000000;
945 m_persistAfter = 1097 m_persistAfter =
946 startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); 1098 startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE);
947 m_persistAfter *= 10000000; 1099 m_persistAfter *= 10000000;
948 1100
949 m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); 1101 m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine");
@@ -955,12 +1107,13 @@ namespace OpenSim.Region.Framework.Scenes
955 1107
956 string[] possibleMapConfigSections = new string[] { "Map", "Startup" }; 1108 string[] possibleMapConfigSections = new string[] { "Map", "Startup" };
957 1109
958 m_generateMaptiles 1110 m_generateMaptiles
959 = Util.GetConfigVarFromSections<bool>(config, "GenerateMaptiles", possibleMapConfigSections, true); 1111 = Util.GetConfigVarFromSections<bool>(config, "GenerateMaptiles", possibleMapConfigSections, true);
960 1112
961 if (m_generateMaptiles) 1113 if (m_generateMaptiles)
962 { 1114 {
963 int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); 1115 int maptileRefresh = Util.GetConfigVarFromSections<int>(config, "MaptileRefresh", possibleMapConfigSections, 0);
1116 m_log.InfoFormat("[SCENE]: Region {0}, WORLD MAP refresh time set to {1} seconds", RegionInfo.RegionName, maptileRefresh);
964 if (maptileRefresh != 0) 1117 if (maptileRefresh != 0)
965 { 1118 {
966 m_mapGenerationTimer.Interval = maptileRefresh * 1000; 1119 m_mapGenerationTimer.Interval = maptileRefresh * 1000;
@@ -971,7 +1124,7 @@ namespace OpenSim.Region.Framework.Scenes
971 } 1124 }
972 else 1125 else
973 { 1126 {
974 string tile 1127 string tile
975 = Util.GetConfigVarFromSections<string>( 1128 = Util.GetConfigVarFromSections<string>(
976 config, "MaptileStaticUUID", possibleMapConfigSections, UUID.Zero.ToString()); 1129 config, "MaptileStaticUUID", possibleMapConfigSections, UUID.Zero.ToString());
977 1130
@@ -990,7 +1143,7 @@ namespace OpenSim.Region.Framework.Scenes
990 1143
991 string[] possibleAccessControlConfigSections = new string[] { "AccessControl", "Startup" }; 1144 string[] possibleAccessControlConfigSections = new string[] { "AccessControl", "Startup" };
992 1145
993 string grant 1146 string grant
994 = Util.GetConfigVarFromSections<string>( 1147 = Util.GetConfigVarFromSections<string>(
995 config, "AllowedClients", possibleAccessControlConfigSections, ""); 1148 config, "AllowedClients", possibleAccessControlConfigSections, "");
996 1149
@@ -1002,7 +1155,7 @@ namespace OpenSim.Region.Framework.Scenes
1002 } 1155 }
1003 } 1156 }
1004 1157
1005 grant 1158 grant
1006 = Util.GetConfigVarFromSections<string>( 1159 = Util.GetConfigVarFromSections<string>(
1007 config, "BannedClients", possibleAccessControlConfigSections, ""); 1160 config, "BannedClients", possibleAccessControlConfigSections, "");
1008 1161
@@ -1014,21 +1167,29 @@ namespace OpenSim.Region.Framework.Scenes
1014 } 1167 }
1015 } 1168 }
1016 1169
1017 MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); 1170 if (startupConfig.Contains("MinFrameTime"))
1018 m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); 1171 MinFrameTicks = (int)(startupConfig.GetFloat("MinFrameTime") * 1000);
1019 m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); 1172
1020 m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement); 1173 m_update_backup = startupConfig.GetInt("UpdateStorageEveryNFrames", m_update_backup);
1021 m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events); 1174 m_update_coarse_locations = startupConfig.GetInt("UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations);
1022 m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects); 1175 m_update_entitymovement = startupConfig.GetInt("UpdateEntityMovementEveryNFrames", m_update_entitymovement);
1023 m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); 1176 m_update_events = startupConfig.GetInt("UpdateEventsEveryNFrames", m_update_events);
1024 m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); 1177 m_update_objects = startupConfig.GetInt("UpdateObjectsEveryNFrames", m_update_objects);
1025 m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); 1178 m_update_physics = startupConfig.GetInt("UpdatePhysicsEveryNFrames", m_update_physics);
1026 m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); 1179 m_update_presences = startupConfig.GetInt("UpdateAgentsEveryNFrames", m_update_presences);
1180 m_update_terrain = startupConfig.GetInt("UpdateTerrainEveryNFrames", m_update_terrain);
1181 m_update_temp_cleaning = startupConfig.GetInt("UpdateTempCleaningEveryNSeconds", m_update_temp_cleaning);
1182
1183 if (startupConfig.Contains("ShouldUseFireAndForgetForCollisions"))
1184 {
1185 ShouldUseFireAndForgetForCollisions = startupConfig.GetBoolean("ShouldUseFireAndForgetForCollisions", false);
1186 }
1027 } 1187 }
1028 1188
1189
1029 // FIXME: Ultimately this should be in a module. 1190 // FIXME: Ultimately this should be in a module.
1030 SendPeriodicAppearanceUpdates = true; 1191 SendPeriodicAppearanceUpdates = false;
1031 1192
1032 IConfig appearanceConfig = m_config.Configs["Appearance"]; 1193 IConfig appearanceConfig = m_config.Configs["Appearance"];
1033 if (appearanceConfig != null) 1194 if (appearanceConfig != null)
1034 { 1195 {
@@ -1038,6 +1199,12 @@ namespace OpenSim.Region.Framework.Scenes
1038 1199
1039 #endregion Region Config 1200 #endregion Region Config
1040 1201
1202 IConfig entityTransferConfig = m_config.Configs["EntityTransfer"];
1203 if (entityTransferConfig != null)
1204 {
1205 AllowAvatarCrossing = entityTransferConfig.GetBoolean("AllowAvatarCrossing", AllowAvatarCrossing);
1206 }
1207
1041 #region Interest Management 1208 #region Interest Management
1042 1209
1043 IConfig interestConfig = m_config.Configs["InterestManagement"]; 1210 IConfig interestConfig = m_config.Configs["InterestManagement"];
@@ -1047,41 +1214,119 @@ namespace OpenSim.Region.Framework.Scenes
1047 1214
1048 try 1215 try
1049 { 1216 {
1050 m_priorityScheme = (UpdatePrioritizationSchemes)Enum.Parse(typeof(UpdatePrioritizationSchemes), update_prioritization_scheme, true); 1217 UpdatePrioritizationScheme = (UpdatePrioritizationSchemes)Enum.Parse(typeof(UpdatePrioritizationSchemes), update_prioritization_scheme, true);
1051 } 1218 }
1052 catch (Exception) 1219 catch (Exception)
1053 { 1220 {
1054 m_log.Warn("[PRIORITIZER]: UpdatePrioritizationScheme was not recognized, setting to default prioritizer Time"); 1221 m_log.Warn("[PRIORITIZER]: UpdatePrioritizationScheme was not recognized, setting to default prioritizer Time");
1055 m_priorityScheme = UpdatePrioritizationSchemes.Time; 1222 UpdatePrioritizationScheme = UpdatePrioritizationSchemes.Time;
1056 } 1223 }
1057 1224
1058 m_reprioritizationEnabled = interestConfig.GetBoolean("ReprioritizationEnabled", true); 1225 IsReprioritizationEnabled
1059 m_reprioritizationInterval = interestConfig.GetDouble("ReprioritizationInterval", 5000.0); 1226 = interestConfig.GetBoolean("ReprioritizationEnabled", IsReprioritizationEnabled);
1060 m_rootReprioritizationDistance = interestConfig.GetDouble("RootReprioritizationDistance", 10.0); 1227 ReprioritizationInterval
1061 m_childReprioritizationDistance = interestConfig.GetDouble("ChildReprioritizationDistance", 20.0); 1228 = interestConfig.GetDouble("ReprioritizationInterval", ReprioritizationInterval);
1229 RootReprioritizationDistance
1230 = interestConfig.GetDouble("RootReprioritizationDistance", RootReprioritizationDistance);
1231 ChildReprioritizationDistance
1232 = interestConfig.GetDouble("ChildReprioritizationDistance", ChildReprioritizationDistance);
1233
1234 RootTerseUpdatePeriod = interestConfig.GetInt("RootTerseUpdatePeriod", RootTerseUpdatePeriod);
1235 ChildTerseUpdatePeriod = interestConfig.GetInt("ChildTerseUpdatePeriod", ChildTerseUpdatePeriod);
1236
1237 RootPositionUpdateTolerance
1238 = interestConfig.GetFloat("RootPositionUpdateTolerance", RootPositionUpdateTolerance);
1239 RootRotationUpdateTolerance
1240 = interestConfig.GetFloat("RootRotationUpdateTolerance", RootRotationUpdateTolerance);
1241 RootVelocityUpdateTolerance
1242 = interestConfig.GetFloat("RootVelocityUpdateTolerance", RootVelocityUpdateTolerance);
1062 } 1243 }
1063 1244
1064 m_log.DebugFormat("[SCENE]: Using the {0} prioritization scheme", m_priorityScheme); 1245 m_log.DebugFormat("[SCENE]: Using the {0} prioritization scheme", UpdatePrioritizationScheme);
1065 1246
1066 #endregion Interest Management 1247 #endregion Interest Management
1067 1248
1068 StatsReporter = new SimStatsReporter(this); 1249 // The timer used by the Stopwatch class depends on the system hardware and operating system; inform
1250 // if the timer is based on a high-resolution performance counter or based on the system timer;
1251 // the performance counter will provide a more precise time than the system timer
1252 if (Stopwatch.IsHighResolution)
1253 m_log.InfoFormat("[SCENE]: Using high-resolution performance counter for statistics.");
1254 else
1255 m_log.InfoFormat("[SCENE]: Using system timer for statistics.");
1256
1257 // Acquire the statistics section of the OpenSim.ini file located
1258 // in the bin directory
1259 IConfig statisticsConfig = m_config.Configs["Statistics"];
1260
1261 // Confirm that the statistics section existed in the configuration
1262 // file
1263 if (statisticsConfig != null)
1264 {
1265 // Create the StatsReporter using the number of frames to store
1266 // for the frame time statistics, or 10 frames if the config
1267 // file doesn't contain a value
1268 StatsReporter = new SimStatsReporter(this,
1269 statisticsConfig.GetInt("NumberOfFrames",
1270 m_defaultNumberFramesStored));
1271 }
1272 else
1273 {
1274 // Create a StatsReporter with the current scene and a default
1275 // 10 frames stored for the frame time statistics
1276 StatsReporter = new SimStatsReporter(this);
1277 }
1278
1069 StatsReporter.OnSendStatsResult += SendSimStatsPackets; 1279 StatsReporter.OnSendStatsResult += SendSimStatsPackets;
1070 StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; 1280 StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
1071 1281
1282<<<<<<< HEAD
1283=======
1072 MainConsole.Instance.Commands.AddCommand("scene", false, "gc collect", "gc collect", "gc collect", "Cause the garbage collector to make a single pass", HandleGcCollect); 1284 MainConsole.Instance.Commands.AddCommand("scene", false, "gc collect", "gc collect", "gc collect", "Cause the garbage collector to make a single pass", HandleGcCollect);
1285>>>>>>> avn/ubitvar
1073 } 1286 }
1074 1287
1075 public Scene(RegionInfo regInfo) : base(regInfo) 1288 public Scene(RegionInfo regInfo, PhysicsScene physicsScene)
1289 : base(regInfo)
1076 { 1290 {
1291 m_sceneGraph = new SceneGraph(this);
1292 m_sceneGraph.PhysicsScene = physicsScene;
1293
1294 // If the scene graph has an Unrecoverable error, restart this sim.
1295 // Currently the only thing that causes it to happen is two kinds of specific
1296 // Physics based crashes.
1297 //
1298 // Out of memory
1299 // Operating system has killed the plugin
1300 m_sceneGraph.UnRecoverableError
1301 += () =>
1302 {
1303 m_log.ErrorFormat("[SCENE]: Restarting region {0} due to unrecoverable physics crash", Name);
1304 RestartNow();
1305 };
1306
1077 PhysicalPrims = true; 1307 PhysicalPrims = true;
1078 CollidablePrims = true; 1308 CollidablePrims = true;
1079 // this is done above acording to config 1309 // this is done above acording to config
1080 // PhysicsEnabled = true; 1310 // PhysicsEnabled = true;
1081 1311
1312 AllowAvatarCrossing = true;
1313
1082 PeriodicBackup = true; 1314 PeriodicBackup = true;
1083 UseBackup = true; 1315 UseBackup = true;
1084 1316
1317<<<<<<< HEAD
1318 IsReprioritizationEnabled = true;
1319 UpdatePrioritizationScheme = UpdatePrioritizationSchemes.Time;
1320 ReprioritizationInterval = 5000;
1321
1322 RootRotationUpdateTolerance = 0.1f;
1323 RootVelocityUpdateTolerance = 0.001f;
1324 RootPositionUpdateTolerance = 0.05f;
1325 RootReprioritizationDistance = 10.0;
1326 ChildReprioritizationDistance = 20.0;
1327
1328=======
1329>>>>>>> avn/ubitvar
1085 m_eventManager = new EventManager(); 1330 m_eventManager = new EventManager();
1086 1331
1087 m_permissions = new ScenePermissions(this); 1332 m_permissions = new ScenePermissions(this);
@@ -1131,7 +1376,24 @@ namespace OpenSim.Region.Framework.Scenes
1131 { 1376 {
1132 if (RegionInfo.RegionHandle != otherRegion.RegionHandle) 1377 if (RegionInfo.RegionHandle != otherRegion.RegionHandle)
1133 { 1378 {
1379<<<<<<< HEAD
1380 //// If these are cast to INT because long + negative values + abs returns invalid data
1381 //int resultX = Math.Abs((int)xcell - (int)RegionInfo.RegionLocX);
1382 //int resultY = Math.Abs((int)ycell - (int)RegionInfo.RegionLocY);
1383 //if (resultX <= 1 && resultY <= 1)
1384 float dist = (float)Math.Max(DefaultDrawDistance,
1385 (float)Math.Max(RegionInfo.RegionSizeX, RegionInfo.RegionSizeY));
1386 uint newRegionX, newRegionY, thisRegionX, thisRegionY;
1387 Util.RegionHandleToRegionLoc(otherRegion.RegionHandle, out newRegionX, out newRegionY);
1388 Util.RegionHandleToRegionLoc(RegionInfo.RegionHandle, out thisRegionX, out thisRegionY);
1389
1390 //m_log.InfoFormat("[SCENE]: (on region {0}): Region {1} up in coords {2}-{3}",
1391 // RegionInfo.RegionName, otherRegion.RegionName, newRegionX, newRegionY);
1392
1393 if (!Util.IsOutsideView(dist, thisRegionX, newRegionX, thisRegionY, newRegionY))
1394=======
1134 if (isNeighborRegion(otherRegion)) 1395 if (isNeighborRegion(otherRegion))
1396>>>>>>> avn/ubitvar
1135 { 1397 {
1136 // Let the grid service module know, so this can be cached 1398 // Let the grid service module know, so this can be cached
1137 m_eventManager.TriggerOnRegionUp(otherRegion); 1399 m_eventManager.TriggerOnRegionUp(otherRegion);
@@ -1292,14 +1554,14 @@ namespace OpenSim.Region.Framework.Scenes
1292 1554
1293 // Kick all ROOT agents with the message, 'The simulator is going down' 1555 // Kick all ROOT agents with the message, 'The simulator is going down'
1294 ForEachScenePresence(delegate(ScenePresence avatar) 1556 ForEachScenePresence(delegate(ScenePresence avatar)
1295 { 1557 {
1296 avatar.RemoveNeighbourRegion(RegionInfo.RegionHandle); 1558 avatar.RemoveNeighbourRegion(RegionInfo.RegionHandle);
1297 1559
1298 if (!avatar.IsChildAgent) 1560 if (!avatar.IsChildAgent)
1299 avatar.ControllingClient.Kick("The simulator is going down."); 1561 avatar.ControllingClient.Kick("The simulator is going down.");
1300 1562
1301 avatar.ControllingClient.SendShutdownConnectionNotice(); 1563 avatar.ControllingClient.SendShutdownConnectionNotice();
1302 }); 1564 });
1303 1565
1304 // Stop updating the scene objects and agents. 1566 // Stop updating the scene objects and agents.
1305 m_shuttingDown = true; 1567 m_shuttingDown = true;
@@ -1352,13 +1614,14 @@ namespace OpenSim.Region.Framework.Scenes
1352 /// </param> 1614 /// </param>
1353 public void Start(bool startScripts) 1615 public void Start(bool startScripts)
1354 { 1616 {
1617 if (IsRunning)
1618 return;
1619
1620 m_isRunning = true;
1355 m_active = true; 1621 m_active = true;
1356 1622
1623 m_unixStartTime = Util.UnixTimeSinceEpoch();
1357// m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName); 1624// m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName);
1358
1359 //m_heartbeatTimer.Enabled = true;
1360 //m_heartbeatTimer.Interval = (int)(m_timespan * 1000);
1361 //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat);
1362 if (m_heartbeatThread != null) 1625 if (m_heartbeatThread != null)
1363 { 1626 {
1364 m_hbRestarts++; 1627 m_hbRestarts++;
@@ -1379,14 +1642,13 @@ namespace OpenSim.Region.Framework.Scenes
1379 Watchdog.AbortThread(m_heartbeatThread.ManagedThreadId); 1642 Watchdog.AbortThread(m_heartbeatThread.ManagedThreadId);
1380 m_heartbeatThread = null; 1643 m_heartbeatThread = null;
1381 } 1644 }
1382// m_lastUpdate = Util.EnvironmentTickCount();
1383 1645
1384// m_sceneGraph.PreparePhysicsSimulation(); 1646// m_sceneGraph.PreparePhysicsSimulation();
1385 1647
1386 1648
1387 m_heartbeatThread 1649 m_heartbeatThread
1388 = Watchdog.StartThread( 1650 = WorkManager.StartThread(
1389 Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); 1651 Heartbeat, string.Format("Heartbeat-({0})", RegionInfo.RegionName.Replace(" ", "_")), ThreadPriority.Normal, false, false);
1390 1652
1391 StartScripts(); 1653 StartScripts();
1392 } 1654 }
@@ -1419,15 +1681,6 @@ namespace OpenSim.Region.Framework.Scenes
1419 /// </summary> 1681 /// </summary>
1420 private void Heartbeat() 1682 private void Heartbeat()
1421 { 1683 {
1422// if (!Monitor.TryEnter(m_heartbeatLock))
1423// {
1424// Watchdog.RemoveThread();
1425// return;
1426// }
1427
1428// try
1429// {
1430
1431 m_eventManager.TriggerOnRegionStarted(this); 1684 m_eventManager.TriggerOnRegionStarted(this);
1432 1685
1433 // The first frame can take a very long time due to physics actors being added on startup. Therefore, 1686 // The first frame can take a very long time due to physics actors being added on startup. Therefore,
@@ -1435,22 +1688,49 @@ namespace OpenSim.Region.Framework.Scenes
1435 // alarms for scenes with many objects. 1688 // alarms for scenes with many objects.
1436 Update(1); 1689 Update(1);
1437 1690
1438 Watchdog.StartThread( 1691 WorkManager.StartThread(
1439 Maintenance, string.Format("Maintenance ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, true); 1692 Maintenance, string.Format("Maintenance ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, true);
1440 1693
1441 Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; 1694 Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true;
1442 Update(-1); 1695 m_lastFrameTick = Util.EnvironmentTickCount();
1443 1696
1444// m_lastUpdate = Util.EnvironmentTickCount(); 1697 if (UpdateOnTimer)
1445// m_firstHeartbeat = false; 1698 {
1446// } 1699 m_sceneUpdateTimer = new Timer(MinFrameTicks);
1447// finally 1700 m_sceneUpdateTimer.AutoReset = true;
1448// { 1701 m_sceneUpdateTimer.Elapsed += Update;
1449// Monitor.Pulse(m_heartbeatLock); 1702 m_sceneUpdateTimer.Start();
1450// Monitor.Exit(m_heartbeatLock); 1703 }
1451// } 1704 else
1705 {
1706 Thread.CurrentThread.Priority = ThreadPriority.Highest;
1707 Update(-1);
1708 Watchdog.RemoveThread();
1709 m_isRunning = false;
1710 }
1711 }
1452 1712
1453 Watchdog.RemoveThread(); 1713 private volatile bool m_isTimerUpdateRunning;
1714
1715 private void Update(object sender, ElapsedEventArgs e)
1716 {
1717 if (m_isTimerUpdateRunning)
1718 return;
1719
1720 m_isTimerUpdateRunning = true;
1721
1722 // If the last frame did not complete on time, then immediately start the next update on the same thread
1723 // and ignore further timed updates until we have a frame that had spare time.
1724 while (!Update(1) && Active) { }
1725
1726 if (!Active || m_shuttingDown)
1727 {
1728 m_sceneUpdateTimer.Stop();
1729 m_sceneUpdateTimer = null;
1730 m_isRunning = false;
1731 }
1732
1733 m_isTimerUpdateRunning = false;
1454 } 1734 }
1455 1735
1456 private void Maintenance() 1736 private void Maintenance()
@@ -1463,7 +1743,7 @@ namespace OpenSim.Region.Framework.Scenes
1463 public void DoMaintenance(int runs) 1743 public void DoMaintenance(int runs)
1464 { 1744 {
1465 long? endRun = null; 1745 long? endRun = null;
1466 int runtc; 1746 int runtc, tmpMS;
1467 int previousMaintenanceTick; 1747 int previousMaintenanceTick;
1468 1748
1469 if (runs >= 0) 1749 if (runs >= 0)
@@ -1477,6 +1757,8 @@ namespace OpenSim.Region.Framework.Scenes
1477 runtc = Util.EnvironmentTickCount(); 1757 runtc = Util.EnvironmentTickCount();
1478 ++MaintenanceRun; 1758 ++MaintenanceRun;
1479 1759
1760 // m_log.DebugFormat("[SCENE]: Maintenance run {0} in {1}", MaintenanceRun, Name);
1761
1480 // Coarse locations relate to positions of green dots on the mini-map (on a SecondLife client) 1762 // Coarse locations relate to positions of green dots on the mini-map (on a SecondLife client)
1481 if (MaintenanceRun % (m_update_coarse_locations / 10) == 0) 1763 if (MaintenanceRun % (m_update_coarse_locations / 10) == 0)
1482 { 1764 {
@@ -1490,7 +1772,7 @@ namespace OpenSim.Region.Framework.Scenes
1490 1772
1491 if (SendPeriodicAppearanceUpdates && MaintenanceRun % 60 == 0) 1773 if (SendPeriodicAppearanceUpdates && MaintenanceRun % 60 == 0)
1492 { 1774 {
1493// m_log.DebugFormat("[SCENE]: Sending periodic appearance updates"); 1775 // m_log.DebugFormat("[SCENE]: Sending periodic appearance updates");
1494 1776
1495 if (AvatarFactory != null) 1777 if (AvatarFactory != null)
1496 { 1778 {
@@ -1498,29 +1780,44 @@ namespace OpenSim.Region.Framework.Scenes
1498 } 1780 }
1499 } 1781 }
1500 1782
1783 // Delete temp-on-rez stuff
1784 if (MaintenanceRun % m_update_temp_cleaning == 0 && !m_cleaningTemps)
1785 {
1786 // m_log.DebugFormat("[SCENE]: Running temp-on-rez cleaning in {0}", Name);
1787 tmpMS = Util.EnvironmentTickCount();
1788 m_cleaningTemps = true;
1789
1790 WorkManager.RunInThread(
1791 delegate { CleanTempObjects(); m_cleaningTemps = false; },
1792 null,
1793 string.Format("CleanTempObjects ({0})", Name));
1794
1795 tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpMS);
1796 }
1797
1501 Watchdog.UpdateThread(); 1798 Watchdog.UpdateThread();
1502 1799
1503 previousMaintenanceTick = m_lastMaintenanceTick; 1800 previousMaintenanceTick = m_lastMaintenanceTick;
1504 m_lastMaintenanceTick = Util.EnvironmentTickCount(); 1801 m_lastMaintenanceTick = Util.EnvironmentTickCount();
1505 runtc = Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, runtc); 1802 runtc = Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, runtc);
1506 runtc = (int)(MinMaintenanceTime * 1000) - runtc; 1803 runtc = MinMaintenanceTicks - runtc;
1507 1804
1508 if (runtc > 0) 1805 if (runtc > 0)
1509 Thread.Sleep(runtc); 1806 m_maintenanceWaitEvent.WaitOne(runtc);
1510 1807
1511 // Optionally warn if a frame takes double the amount of time that it should. 1808 // Optionally warn if a frame takes double the amount of time that it should.
1512 if (DebugUpdates 1809 if (DebugUpdates
1513 && Util.EnvironmentTickCountSubtract( 1810 && Util.EnvironmentTickCountSubtract(
1514 m_lastMaintenanceTick, previousMaintenanceTick) > (int)(MinMaintenanceTime * 1000 * 2)) 1811 m_lastMaintenanceTick, previousMaintenanceTick) > MinMaintenanceTicks * 2)
1515 m_log.WarnFormat( 1812 m_log.WarnFormat(
1516 "[SCENE]: Maintenance took {0} ms (desired max {1} ms) in {2}", 1813 "[SCENE]: Maintenance took {0} ms (desired max {1} ms) in {2}",
1517 Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, previousMaintenanceTick), 1814 Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, previousMaintenanceTick),
1518 MinMaintenanceTime * 1000, 1815 MinMaintenanceTicks,
1519 RegionInfo.RegionName); 1816 RegionInfo.RegionName);
1520 } 1817 }
1521 } 1818 }
1522 1819
1523 public override void Update(int frames) 1820 public override bool Update(int frames)
1524 { 1821 {
1525 long? endFrame = null; 1822 long? endFrame = null;
1526 1823
@@ -1528,20 +1825,43 @@ namespace OpenSim.Region.Framework.Scenes
1528 endFrame = Frame + frames; 1825 endFrame = Frame + frames;
1529 1826
1530 float physicsFPS = 0f; 1827 float physicsFPS = 0f;
1828<<<<<<< HEAD
1829 int previousFrameTick, tmpMS;
1830
1831 // These variables will be used to save the precise frame time using the
1832 // Stopwatch class of Microsoft SDK; the times are recorded at the start
1833 // and end of a particular section of code, and then used to calculate
1834 // the frame times, which are the sums of the sections for each given name
1835 double preciseTotalFrameTime = 0.0;
1836 double preciseSimFrameTime = 0.0;
1837 double precisePhysicsFrameTime = 0.0;
1838 Stopwatch totalFrameStopwatch = new Stopwatch();
1839 Stopwatch simFrameStopwatch = new Stopwatch();
1840 Stopwatch physicsFrameStopwatch = new Stopwatch();
1841
1842 // Begin the stopwatch to keep track of the time that the frame
1843 // started running to determine how long the frame took to complete
1844 totalFrameStopwatch.Start();
1845=======
1531 int tmpMS; 1846 int tmpMS;
1532 int previousFrameTick; 1847 int previousFrameTick;
1533 int maintc; 1848 int maintc;
1534 int sleepMS; 1849 int sleepMS;
1535 int framestart; 1850 int framestart;
1851>>>>>>> avn/ubitvar
1536 1852
1537 while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) 1853 while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame))
1538 { 1854 {
1539 framestart = Util.EnvironmentTickCount(); 1855 framestart = Util.EnvironmentTickCount();
1540 ++Frame; 1856 ++Frame;
1541 1857
1542// m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); 1858 // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName);
1543 1859
1860<<<<<<< HEAD
1861 agentMS = eventMS = backupMS = terrainMS = landMS = spareMS = 0;
1862=======
1544 agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; 1863 agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0;
1864>>>>>>> avn/ubitvar
1545 1865
1546 try 1866 try
1547 { 1867 {
@@ -1557,52 +1877,112 @@ namespace OpenSim.Region.Framework.Scenes
1557 1877
1558 if (Frame % m_update_terrain == 0) 1878 if (Frame % m_update_terrain == 0)
1559 { 1879 {
1880<<<<<<< HEAD
1881 // At several points inside the code there was a need to
1882 // create a more precise measurement of time elapsed.
1883 // This led to the addition of variables that have a
1884 // similar function and thus remain tightly connected to
1885 // their original counterparts. However, the original
1886 // code is not receiving comments from our group because
1887 // we don't feel right modifying the code to that degree
1888 // at this point in time, the precise values all begin
1889 // with the keyword precise
1890 tmpMS = Util.EnvironmentTickCount();
1891 simFrameStopwatch.Start();
1892 UpdateTerrain();
1893
1894 // Get the simulation frame time that the avatar force
1895 // input took
1896 simFrameStopwatch.Stop();
1897 preciseSimFrameTime =
1898 simFrameStopwatch.Elapsed.TotalMilliseconds;
1899 terrainMS = Util.EnvironmentTickCountSubtract(tmpMS);
1900 }
1901
1902 // At several points inside the code there was a need to
1903 // create a more precise measurement of time elapsed. This
1904 // led to the addition of variables that have a similar
1905 // function and thus remain tightly connected to their
1906 // original counterparts. However, the original code is
1907 // not receiving comments from our group because we don't
1908 // feel right modifying the code to that degree at this
1909 // point in time, the precise values all begin with the
1910 // keyword precise
1911=======
1560 UpdateTerrain(); 1912 UpdateTerrain();
1561 } 1913 }
1562 1914
1563 terrainMS = Util.EnvironmentTickCountSubtract(tmpMS); 1915 terrainMS = Util.EnvironmentTickCountSubtract(tmpMS);
1916>>>>>>> avn/ubitvar
1564 1917
1565 tmpMS = Util.EnvironmentTickCount(); 1918 tmpMS = Util.EnvironmentTickCount();
1919
1920 // Begin the stopwatch to track the time to prepare physics
1921 physicsFrameStopwatch.Start();
1566 if (PhysicsEnabled && Frame % m_update_physics == 0) 1922 if (PhysicsEnabled && Frame % m_update_physics == 0)
1567 m_sceneGraph.UpdatePreparePhysics(); 1923 m_sceneGraph.UpdatePreparePhysics();
1924
1925 // Get the time it took to prepare the physics, this
1926 // would report the most precise time that physics was
1927 // running on the machine and should the physics not be
1928 // enabled will report the time it took to check if physics
1929 // was enabled
1930 physicsFrameStopwatch.Stop();
1931 precisePhysicsFrameTime = physicsFrameStopwatch.Elapsed.TotalMilliseconds;
1568 physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS); 1932 physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS);
1569 1933
1570 // Apply any pending avatar force input to the avatar's velocity 1934 // Apply any pending avatar force input to the avatar's velocity
1571 tmpMS = Util.EnvironmentTickCount(); 1935 tmpMS = Util.EnvironmentTickCount();
1936 simFrameStopwatch.Restart();
1572 if (Frame % m_update_entitymovement == 0) 1937 if (Frame % m_update_entitymovement == 0)
1573 m_sceneGraph.UpdateScenePresenceMovement(); 1938 m_sceneGraph.UpdateScenePresenceMovement();
1939
1940 // Get the simulation frame time that the avatar force input
1941 // took
1942 simFrameStopwatch.Stop();
1943 preciseSimFrameTime +=
1944 simFrameStopwatch.Elapsed.TotalMilliseconds;
1574 agentMS = Util.EnvironmentTickCountSubtract(tmpMS); 1945 agentMS = Util.EnvironmentTickCountSubtract(tmpMS);
1575 1946
1576 // Perform the main physics update. This will do the actual work of moving objects and avatars according to their 1947 // Perform the main physics update. This will do the actual work of moving objects and avatars according to their
1577 // velocity 1948 // velocity
1578 tmpMS = Util.EnvironmentTickCount(); 1949 tmpMS = Util.EnvironmentTickCount();
1950 physicsFrameStopwatch.Restart();
1579 if (Frame % m_update_physics == 0) 1951 if (Frame % m_update_physics == 0)
1580 { 1952 {
1581 if (PhysicsEnabled) 1953 if (PhysicsEnabled)
1582 physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime); 1954 physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameSeconds);
1583 1955
1584 if (SynchronizeScene != null) 1956 if (SynchronizeScene != null)
1585 SynchronizeScene(this); 1957 SynchronizeScene(this);
1586 } 1958 }
1959
1960 // Add the main physics update time to the prepare physics time
1961 physicsFrameStopwatch.Stop();
1962 precisePhysicsFrameTime += physicsFrameStopwatch.Elapsed.TotalMilliseconds;
1587 physicsMS = Util.EnvironmentTickCountSubtract(tmpMS); 1963 physicsMS = Util.EnvironmentTickCountSubtract(tmpMS);
1588 1964
1965 // Start the stopwatch for the remainder of the simulation
1966 simFrameStopwatch.Restart();
1589 tmpMS = Util.EnvironmentTickCount(); 1967 tmpMS = Util.EnvironmentTickCount();
1590 1968
1591 // Check if any objects have reached their targets 1969 // Check if any objects have reached their targets
1592 CheckAtTargets(); 1970 CheckAtTargets();
1593 1971
1594 // Update SceneObjectGroups that have scheduled themselves for updates 1972 // Update SceneObjectGroups that have scheduled themselves for updates
1595 // Objects queue their updates onto all scene presences 1973 // Objects queue their updates onto all scene presences
1596 if (Frame % m_update_objects == 0) 1974 if (Frame % m_update_objects == 0)
1597 m_sceneGraph.UpdateObjectGroups(); 1975 m_sceneGraph.UpdateObjectGroups();
1598 1976
1599 // Run through all ScenePresences looking for updates 1977 // Run through all ScenePresences looking for updates
1600 // Presence updates and queued object updates for each presence are sent to clients 1978 // Presence updates and queued object updates for each presence are sent to clients
1601 if (Frame % m_update_presences == 0) 1979 if (Frame % m_update_presences == 0)
1602 m_sceneGraph.UpdatePresences(); 1980 m_sceneGraph.UpdatePresences();
1603 1981
1604 agentMS += Util.EnvironmentTickCountSubtract(tmpMS); 1982 agentMS += Util.EnvironmentTickCountSubtract(tmpMS);
1605 1983
1984<<<<<<< HEAD
1985=======
1606 1986
1607 // Delete temp-on-rez stuff 1987 // Delete temp-on-rez stuff
1608 if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) 1988 if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps)
@@ -1613,31 +1993,32 @@ namespace OpenSim.Region.Framework.Scenes
1613 tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpMS); 1993 tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpMS);
1614 } 1994 }
1615 1995
1996>>>>>>> avn/ubitvar
1616 if (Frame % m_update_events == 0) 1997 if (Frame % m_update_events == 0)
1617 { 1998 {
1618 tmpMS = Util.EnvironmentTickCount(); 1999 tmpMS = Util.EnvironmentTickCount();
1619 UpdateEvents(); 2000 UpdateEvents();
1620 eventMS = Util.EnvironmentTickCountSubtract(tmpMS); 2001 eventMS = Util.EnvironmentTickCountSubtract(tmpMS);
1621 } 2002 }
1622 2003
1623 if (PeriodicBackup && Frame % m_update_backup == 0) 2004 if (PeriodicBackup && Frame % m_update_backup == 0)
1624 { 2005 {
1625 tmpMS = Util.EnvironmentTickCount(); 2006 tmpMS = Util.EnvironmentTickCount();
1626 UpdateStorageBackup(); 2007 UpdateStorageBackup();
1627 backupMS = Util.EnvironmentTickCountSubtract(tmpMS); 2008 backupMS = Util.EnvironmentTickCountSubtract(tmpMS);
1628 } 2009 }
1629 2010
1630 //if (Frame % m_update_land == 0) 2011 //if (Frame % m_update_land == 0)
1631 //{ 2012 //{
1632 // int ldMS = Util.EnvironmentTickCount(); 2013 // int ldMS = Util.EnvironmentTickCount();
1633 // UpdateLand(); 2014 // UpdateLand();
1634 // landMS = Util.EnvironmentTickCountSubtract(ldMS); 2015 // landMS = Util.EnvironmentTickCountSubtract(ldMS);
1635 //} 2016 //}
1636 2017
1637 if (!LoginsEnabled && Frame == 20) 2018 if (!LoginsEnabled && Frame == 20)
1638 { 2019 {
1639 // m_log.DebugFormat("{0} {1} {2}", LoginsDisabled, m_sceneGraph.GetActiveScriptsCount(), LoginLock); 2020 // m_log.DebugFormat("{0} {1} {2}", LoginsDisabled, m_sceneGraph.GetActiveScriptsCount(), LoginLock);
1640 2021
1641 // In 99.9% of cases it is a bad idea to manually force garbage collection. However, 2022 // In 99.9% of cases it is a bad idea to manually force garbage collection. However,
1642 // this is a rare case where we know we have just went through a long cycle of heap 2023 // this is a rare case where we know we have just went through a long cycle of heap
1643 // allocations, and there is no more work to be done until someone logs in 2024 // allocations, and there is no more work to be done until someone logs in
@@ -1652,7 +2033,7 @@ namespace OpenSim.Region.Framework.Scenes
1652 } 2033 }
1653 2034
1654 m_sceneGridService.InformNeighborsThatRegionisUp( 2035 m_sceneGridService.InformNeighborsThatRegionisUp(
1655 RequestModuleInterface<INeighbourService>(), RegionInfo); 2036 RequestModuleInterface<INeighbourService>(), RegionInfo);
1656 2037
1657 // Region ready should always be set 2038 // Region ready should always be set
1658 Ready = true; 2039 Ready = true;
@@ -1663,7 +2044,7 @@ namespace OpenSim.Region.Framework.Scenes
1663 if (m_sceneGraph.GetActiveScriptsCount() == 0) 2044 if (m_sceneGraph.GetActiveScriptsCount() == 0)
1664 { 2045 {
1665 // In this case, we leave it to the IRegionReadyModule to enable logins 2046 // In this case, we leave it to the IRegionReadyModule to enable logins
1666 2047
1667 // LoginLock can currently only be set by a region module implementation. 2048 // LoginLock can currently only be set by a region module implementation.
1668 // If somehow this hasn't been done then the quickest way to bugfix is to see the 2049 // If somehow this hasn't been done then the quickest way to bugfix is to see the
1669 // NullReferenceException 2050 // NullReferenceException
@@ -1679,11 +2060,44 @@ namespace OpenSim.Region.Framework.Scenes
1679 "[SCENE]: Failed on region {0} with exception {1}{2}", 2060 "[SCENE]: Failed on region {0} with exception {1}{2}",
1680 RegionInfo.RegionName, e.Message, e.StackTrace); 2061 RegionInfo.RegionName, e.Message, e.StackTrace);
1681 } 2062 }
1682 2063
1683 EventManager.TriggerRegionHeartbeatEnd(this); 2064 EventManager.TriggerRegionHeartbeatEnd(this);
2065 otherMS = eventMS + backupMS + terrainMS + landMS;
1684 2066
1685 Watchdog.UpdateThread(); 2067 // Get the elapsed time for the simulation frame
2068 simFrameStopwatch.Stop();
2069 preciseSimFrameTime +=
2070 simFrameStopwatch.Elapsed.TotalMilliseconds;
1686 2071
2072<<<<<<< HEAD
2073 if (!UpdateOnTimer)
2074 {
2075 Watchdog.UpdateThread();
2076
2077 spareMS = MinFrameTicks - Util.EnvironmentTickCountSubtract(m_lastFrameTick);
2078
2079 if (spareMS > 0)
2080 m_updateWaitEvent.WaitOne(spareMS);
2081 else
2082 spareMS = 0;
2083 }
2084 else
2085 {
2086 spareMS = Math.Max(0, MinFrameTicks - physicsMS2 - agentMS - physicsMS - otherMS);
2087 }
2088
2089 // Get the total frame time
2090 totalFrameStopwatch.Stop();
2091 preciseTotalFrameTime =
2092 totalFrameStopwatch.Elapsed.TotalMilliseconds;
2093
2094 // Restart the stopwatch for the total time of the next frame
2095 totalFrameStopwatch.Restart();
2096
2097 previousFrameTick = m_lastFrameTick;
2098 frameMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick);
2099 m_lastFrameTick = Util.EnvironmentTickCount();
2100=======
1687 otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; 2101 otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS;
1688 2102
1689 StatsReporter.AddPhysicsFPS(physicsFPS); 2103 StatsReporter.AddPhysicsFPS(physicsFPS);
@@ -1711,22 +2125,67 @@ namespace OpenSim.Region.Framework.Scenes
1711 frameMS = Util.EnvironmentTickCountSubtract(framestart); 2125 frameMS = Util.EnvironmentTickCountSubtract(framestart);
1712 StatsReporter.addSleepMS(sleepMS); 2126 StatsReporter.addSleepMS(sleepMS);
1713 StatsReporter.addFrameMS(frameMS); 2127 StatsReporter.addFrameMS(frameMS);
2128>>>>>>> avn/ubitvar
1714 2129
1715 // if (Frame%m_update_avatars == 0) 2130 // if (Frame%m_update_avatars == 0)
1716 // UpdateInWorldTime(); 2131 // UpdateInWorldTime();
1717 2132
2133<<<<<<< HEAD
2134 StatsReporter.addFrameMS(frameMS);
2135 StatsReporter.addAgentMS(agentMS);
2136 StatsReporter.addPhysicsMS(physicsMS + physicsMS2);
2137 StatsReporter.addOtherMS(otherMS);
2138 StatsReporter.AddSpareMS(spareMS);
2139 StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS());
2140 StatsReporter.AddScriptMS((int) GetAndResetScriptExecutionTime());
2141=======
2142>>>>>>> avn/ubitvar
2143
2144 // Send the correct time values to the stats reporter for the
2145 // frame times
2146 StatsReporter.addFrameTimeMilliseconds(preciseTotalFrameTime,
2147 preciseSimFrameTime, precisePhysicsFrameTime, 0.0);
1718 2148
1719 // Optionally warn if a frame takes double the amount of time that it should. 2149 // Send the correct number of frames that the physics library
2150 // has processed to the stats reporter
2151 StatsReporter.addPhysicsFrame(1);
2152
2153 // Optionally warn if a frame takes double the amount of time that it should.
1720 if (DebugUpdates 2154 if (DebugUpdates
1721 && Util.EnvironmentTickCountSubtract( 2155 && Util.EnvironmentTickCountSubtract(
1722 m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2)) 2156 m_lastFrameTick, previousFrameTick) > MinFrameTicks * 2)
1723 m_log.WarnFormat( 2157 m_log.WarnFormat(
1724 "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}", 2158 "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}",
1725 Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick), 2159 Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick),
1726 MinFrameTime * 1000, 2160 MinFrameTicks,
1727 RegionInfo.RegionName); 2161 RegionInfo.RegionName);
1728 } 2162 }
1729 } 2163
2164 // Finished updating scene frame, so stop the total frame's Stopwatch
2165 totalFrameStopwatch.Stop();
2166
2167 return spareMS >= 0;
2168 }
2169
2170 /// <summary>
2171 /// Adds the execution time of one script to the total scripts execution time for this region.
2172 /// </summary>
2173 /// <param name="ticks">Elapsed Stopwatch ticks</param>
2174 public void AddScriptExecutionTime(long ticks)
2175 {
2176 Interlocked.Add(ref m_scriptExecutionTime, ticks);
2177 }
2178
2179 /// <summary>
2180 /// Returns the total execution time of all the scripts in the region since the last frame
2181 /// (in milliseconds), and clears the value in preparation for the next frame.
2182 /// </summary>
2183 /// <returns>Time in milliseconds</returns>
2184 private long GetAndResetScriptExecutionTime()
2185 {
2186 long ticks = Interlocked.Exchange(ref m_scriptExecutionTime, 0);
2187 return (ticks * 1000) / Stopwatch.Frequency;
2188 }
1730 2189
1731 public void AddGroupTarget(SceneObjectGroup grp) 2190 public void AddGroupTarget(SceneObjectGroup grp)
1732 { 2191 {
@@ -1796,7 +2255,7 @@ namespace OpenSim.Region.Framework.Scenes
1796 if (!m_backingup) 2255 if (!m_backingup)
1797 { 2256 {
1798 m_backingup = true; 2257 m_backingup = true;
1799 Util.FireAndForget(BackupWaitCallback); 2258 WorkManager.RunInThread(o => Backup(false), null, string.Format("BackupWaitCallback ({0})", Name));
1800 } 2259 }
1801 } 2260 }
1802 2261
@@ -1809,16 +2268,12 @@ namespace OpenSim.Region.Framework.Scenes
1809 } 2268 }
1810 2269
1811 /// <summary> 2270 /// <summary>
1812 /// Wrapper for Backup() that can be called with Util.FireAndForget() 2271 /// Backup the scene.
1813 /// </summary>
1814 private void BackupWaitCallback(object o)
1815 {
1816 Backup(false);
1817 }
1818
1819 /// <summary>
1820 /// Backup the scene. This acts as the main method of the backup thread.
1821 /// </summary> 2272 /// </summary>
2273 /// <remarks>
2274 /// This acts as the main method of the backup thread. In a regression test whether the backup thread is not
2275 /// running independently this can be invoked directly.
2276 /// </remarks>
1822 /// <param name="forced"> 2277 /// <param name="forced">
1823 /// If true, then any changes that have not yet been persisted are persisted. If false, 2278 /// If true, then any changes that have not yet been persisted are persisted. If false,
1824 /// then the persistence decision is left to the backup code (in some situations, such as object persistence, 2279 /// then the persistence decision is left to the backup code (in some situations, such as object persistence,
@@ -1857,7 +2312,7 @@ namespace OpenSim.Region.Framework.Scenes
1857 2312
1858 IMessageTransferModule tr = RequestModuleInterface<IMessageTransferModule>(); 2313 IMessageTransferModule tr = RequestModuleInterface<IMessageTransferModule>();
1859 if (tr != null) 2314 if (tr != null)
1860 tr.SendInstantMessage(msg, delegate(bool success) {}); 2315 tr.SendInstantMessage(msg, delegate(bool success) { });
1861 } 2316 }
1862 m_returns.Clear(); 2317 m_returns.Clear();
1863 } 2318 }
@@ -1871,6 +2326,7 @@ namespace OpenSim.Region.Framework.Scenes
1871 { 2326 {
1872 if (group != null) 2327 if (group != null)
1873 { 2328 {
2329 group.HasGroupChanged = true;
1874 group.ProcessBackup(SimulationDataService, true); 2330 group.ProcessBackup(SimulationDataService, true);
1875 } 2331 }
1876 } 2332 }
@@ -1964,9 +2420,9 @@ namespace OpenSim.Region.Framework.Scenes
1964 m_log.WarnFormat( 2420 m_log.WarnFormat(
1965 "[TERRAIN]: Scene.cs: LoadWorldMap() - Regenerating as failed with exception {0}{1}", 2421 "[TERRAIN]: Scene.cs: LoadWorldMap() - Regenerating as failed with exception {0}{1}",
1966 e.Message, e.StackTrace); 2422 e.Message, e.StackTrace);
1967 2423
1968 // Non standard region size. If there's an old terrain in the database, it might read past the buffer 2424 // Non standard region size. If there's an old terrain in the database, it might read past the buffer
1969 #pragma warning disable 0162 2425#pragma warning disable 0162
1970 if ((int)Constants.RegionSize != 256) 2426 if ((int)Constants.RegionSize != 256)
1971 { 2427 {
1972 Heightmap = new TerrainChannel(); 2428 Heightmap = new TerrainChannel();
@@ -1994,15 +2450,16 @@ namespace OpenSim.Region.Framework.Scenes
1994 //// stored in the GridService, because that's what the world map module uses 2450 //// stored in the GridService, because that's what the world map module uses
1995 //// to send the map image UUIDs (of other regions) to the viewer... 2451 //// to send the map image UUIDs (of other regions) to the viewer...
1996 if (m_generateMaptiles) 2452 if (m_generateMaptiles)
1997 RegenerateMaptile(); 2453 RegenerateMaptile();
1998 2454
1999 GridRegion region = new GridRegion(RegionInfo); 2455 GridRegion region = new GridRegion(RegionInfo);
2000 string error = GridService.RegisterRegion(RegionInfo.ScopeID, region); 2456 string error = GridService.RegisterRegion(RegionInfo.ScopeID, region);
2001 m_log.DebugFormat("{0} RegisterRegionWithGrid. name={1},id={2},loc=<{3},{4}>,size=<{5},{6}>", 2457 // m_log.DebugFormat("[SCENE]: RegisterRegionWithGrid. name={0},id={1},loc=<{2},{3}>,size=<{4},{5}>",
2002 LogHeader, m_regionName, 2458 // m_regionName,
2003 RegionInfo.RegionID, 2459 // RegionInfo.RegionID,
2004 RegionInfo.RegionLocX, RegionInfo.RegionLocY, 2460 // RegionInfo.RegionLocX, RegionInfo.RegionLocY,
2005 RegionInfo.RegionSizeX, RegionInfo.RegionSizeY); 2461 // RegionInfo.RegionSizeX, RegionInfo.RegionSizeY);
2462
2006 if (error != String.Empty) 2463 if (error != String.Empty)
2007 throw new Exception(error); 2464 throw new Exception(error);
2008 } 2465 }
@@ -2063,7 +2520,7 @@ namespace OpenSim.Region.Framework.Scenes
2063 rootPart.TrimPermissions(); 2520 rootPart.TrimPermissions();
2064 2521
2065 // Don't do this here - it will get done later on when sculpt data is loaded. 2522 // Don't do this here - it will get done later on when sculpt data is loaded.
2066// group.CheckSculptAndLoad(); 2523 // group.CheckSculptAndLoad();
2067 } 2524 }
2068 2525
2069 LoadingPrims = false; 2526 LoadingPrims = false;
@@ -2081,7 +2538,7 @@ namespace OpenSim.Region.Framework.Scenes
2081 { 2538 {
2082 if (PhysicsScene == null) 2539 if (PhysicsScene == null)
2083 return null; 2540 return null;
2084 return PhysicsScene.RaycastWorld(position, direction, length, Count,filter); 2541 return PhysicsScene.RaycastWorld(position, direction, length, Count, filter);
2085 } 2542 }
2086 2543
2087 /// <summary> 2544 /// <summary>
@@ -2121,8 +2578,8 @@ namespace OpenSim.Region.Framework.Scenes
2121 SceneObjectPart target = GetSceneObjectPart(RayTargetID); 2578 SceneObjectPart target = GetSceneObjectPart(RayTargetID);
2122 2579
2123 Vector3 direction = Vector3.Normalize(RayEnd - RayStart); 2580 Vector3 direction = Vector3.Normalize(RayEnd - RayStart);
2124 Vector3 AXOrigin = new Vector3(RayStart.X, RayStart.Y, RayStart.Z); 2581 Vector3 AXOrigin = RayStart;
2125 Vector3 AXdirection = new Vector3(direction.X, direction.Y, direction.Z); 2582 Vector3 AXdirection = direction;
2126 2583
2127 if (target != null) 2584 if (target != null)
2128 { 2585 {
@@ -2144,13 +2601,13 @@ namespace OpenSim.Region.Framework.Scenes
2144 // If we hit something 2601 // If we hit something
2145 if (ei.HitTF) 2602 if (ei.HitTF)
2146 { 2603 {
2147 Vector3 scaleComponent = new Vector3(ei.AAfaceNormal.X, ei.AAfaceNormal.Y, ei.AAfaceNormal.Z); 2604 Vector3 scaleComponent = ei.AAfaceNormal;
2148 if (scaleComponent.X != 0) ScaleOffset = scale.X; 2605 if (scaleComponent.X != 0) ScaleOffset = scale.X;
2149 if (scaleComponent.Y != 0) ScaleOffset = scale.Y; 2606 if (scaleComponent.Y != 0) ScaleOffset = scale.Y;
2150 if (scaleComponent.Z != 0) ScaleOffset = scale.Z; 2607 if (scaleComponent.Z != 0) ScaleOffset = scale.Z;
2151 ScaleOffset = Math.Abs(ScaleOffset); 2608 ScaleOffset = Math.Abs(ScaleOffset);
2152 Vector3 intersectionpoint = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); 2609 Vector3 intersectionpoint = ei.ipoint;
2153 Vector3 normal = new Vector3(ei.normal.X, ei.normal.Y, ei.normal.Z); 2610 Vector3 normal = ei.normal;
2154 // Set the position to the intersection point 2611 // Set the position to the intersection point
2155 Vector3 offset = (normal * (ScaleOffset / 2f)); 2612 Vector3 offset = (normal * (ScaleOffset / 2f));
2156 pos = (intersectionpoint + offset); 2613 pos = (intersectionpoint + offset);
@@ -2159,7 +2616,7 @@ namespace OpenSim.Region.Framework.Scenes
2159 //And in cases when we weren't rezzing from inventory we were re-adding the 0.25 straight after calling this method 2616 //And in cases when we weren't rezzing from inventory we were re-adding the 0.25 straight after calling this method
2160 // Un-offset the prim (it gets offset later by the consumer method) 2617 // Un-offset the prim (it gets offset later by the consumer method)
2161 //pos.Z -= 0.25F; 2618 //pos.Z -= 0.25F;
2162 2619
2163 } 2620 }
2164 } 2621 }
2165 else 2622 else
@@ -2172,8 +2629,13 @@ namespace OpenSim.Region.Framework.Scenes
2172 2629
2173 if (ei.HitTF) 2630 if (ei.HitTF)
2174 { 2631 {
2632<<<<<<< HEAD
2633 pos = ei.ipoint;
2634 }
2635=======
2175 pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); 2636 pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z);
2176 } 2637 }
2638>>>>>>> avn/ubitvar
2177 else 2639 else
2178 { 2640 {
2179 // fall back to our stupid functionality 2641 // fall back to our stupid functionality
@@ -2238,7 +2700,7 @@ namespace OpenSim.Region.Framework.Scenes
2238 // "[SCENE]: Scene.AddNewPrim() pcode {0} called for {1} in {2}", shape.PCode, ownerID, RegionInfo.RegionName); 2700 // "[SCENE]: Scene.AddNewPrim() pcode {0} called for {1} in {2}", shape.PCode, ownerID, RegionInfo.RegionName);
2239 2701
2240 SceneObjectGroup sceneObject = null; 2702 SceneObjectGroup sceneObject = null;
2241 2703
2242 // If an entity creator has been registered for this prim type then use that 2704 // If an entity creator has been registered for this prim type then use that
2243 if (m_entityCreators.ContainsKey((PCode)shape.PCode)) 2705 if (m_entityCreators.ContainsKey((PCode)shape.PCode))
2244 { 2706 {
@@ -2259,7 +2721,7 @@ namespace OpenSim.Region.Framework.Scenes
2259 2721
2260 return sceneObject; 2722 return sceneObject;
2261 } 2723 }
2262 2724
2263 /// <summary> 2725 /// <summary>
2264 /// Add an object into the scene that has come from storage 2726 /// Add an object into the scene that has come from storage
2265 /// </summary> 2727 /// </summary>
@@ -2292,7 +2754,7 @@ namespace OpenSim.Region.Framework.Scenes
2292 2754
2293 return false; 2755 return false;
2294 } 2756 }
2295 2757
2296 /// <summary> 2758 /// <summary>
2297 /// Add an object into the scene that has come from storage 2759 /// Add an object into the scene that has come from storage
2298 /// </summary> 2760 /// </summary>
@@ -2328,7 +2790,7 @@ namespace OpenSim.Region.Framework.Scenes
2328 { 2790 {
2329 return AddNewSceneObject(sceneObject, attachToBackup, true); 2791 return AddNewSceneObject(sceneObject, attachToBackup, true);
2330 } 2792 }
2331 2793
2332 /// <summary> 2794 /// <summary>
2333 /// Add a newly created object to the scene 2795 /// Add a newly created object to the scene
2334 /// </summary> 2796 /// </summary>
@@ -2343,16 +2805,16 @@ namespace OpenSim.Region.Framework.Scenes
2343 /// </param> 2805 /// </param>
2344 /// <returns>true if the object was added. false if not</returns> 2806 /// <returns>true if the object was added. false if not</returns>
2345 public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) 2807 public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
2346 { 2808 {
2347 if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates)) 2809 if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates))
2348 { 2810 {
2349 EventManager.TriggerObjectAddedToScene(sceneObject); 2811 EventManager.TriggerObjectAddedToScene(sceneObject);
2350 return true; 2812 return true;
2351 } 2813 }
2352 2814
2353 return false; 2815 return false;
2354 } 2816 }
2355 2817
2356 /// <summary> 2818 /// <summary>
2357 /// Add a newly created object to the scene. 2819 /// Add a newly created object to the scene.
2358 /// </summary> 2820 /// </summary>
@@ -2369,7 +2831,7 @@ namespace OpenSim.Region.Framework.Scenes
2369 SceneObjectGroup sceneObject, bool attachToBackup, Vector3? pos, Quaternion? rot, Vector3 vel) 2831 SceneObjectGroup sceneObject, bool attachToBackup, Vector3? pos, Quaternion? rot, Vector3 vel)
2370 { 2832 {
2371 if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel)) 2833 if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel))
2372 { 2834 {
2373 EventManager.TriggerObjectAddedToScene(sceneObject); 2835 EventManager.TriggerObjectAddedToScene(sceneObject);
2374 return true; 2836 return true;
2375 } 2837 }
@@ -2439,8 +2901,8 @@ namespace OpenSim.Region.Framework.Scenes
2439 /// <param name="silent">Suppress broadcasting changes to other clients.</param> 2901 /// <param name="silent">Suppress broadcasting changes to other clients.</param>
2440 /// <param name="removeScripts">If true, then scripts are removed. If false, then they are only stopped.</para> 2902 /// <param name="removeScripts">If true, then scripts are removed. If false, then they are only stopped.</para>
2441 public void DeleteSceneObject(SceneObjectGroup group, bool silent, bool removeScripts) 2903 public void DeleteSceneObject(SceneObjectGroup group, bool silent, bool removeScripts)
2442 { 2904 {
2443// m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID); 2905 // m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID);
2444 2906
2445 if (removeScripts) 2907 if (removeScripts)
2446 group.RemoveScriptInstances(true); 2908 group.RemoveScriptInstances(true);
@@ -2485,7 +2947,7 @@ namespace OpenSim.Region.Framework.Scenes
2485 if (!silent) 2947 if (!silent)
2486 SendKillObject(new List<uint>() { group.LocalId }); 2948 SendKillObject(new List<uint>() { group.LocalId });
2487 2949
2488// m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); 2950 // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID);
2489 } 2951 }
2490 2952
2491 /// <summary> 2953 /// <summary>
@@ -2501,17 +2963,16 @@ namespace OpenSim.Region.Framework.Scenes
2501 { 2963 {
2502 if (!softDelete) 2964 if (!softDelete)
2503 { 2965 {
2504 // Force a database update so that the scene object group ID is accurate. It's possible that the 2966 // If the group contains prims whose SceneGroupID is incorrect then force a
2505 // group has recently been delinked from another group but that this change has not been persisted 2967 // database update, because RemoveObject() works by searching on the SceneGroupID.
2506 // to the DB.
2507 // This is an expensive thing to do so only do it if absolutely necessary. 2968 // This is an expensive thing to do so only do it if absolutely necessary.
2508 if (so.HasGroupChangedDueToDelink) 2969 if (so.GroupContainsForeignPrims)
2509 ForceSceneObjectBackup(so); 2970 ForceSceneObjectBackup(so);
2510 2971
2511 so.DetachFromBackup(); 2972 so.DetachFromBackup();
2512 SimulationDataService.RemoveObject(so.UUID, RegionInfo.RegionID); 2973 SimulationDataService.RemoveObject(so.UUID, RegionInfo.RegionID);
2513 } 2974 }
2514 2975
2515 // We need to keep track of this state in case this group is still queued for further backup. 2976 // We need to keep track of this state in case this group is still queued for further backup.
2516 so.IsDeleted = true; 2977 so.IsDeleted = true;
2517 2978
@@ -2552,6 +3013,8 @@ namespace OpenSim.Region.Framework.Scenes
2552 m_log.Warn("[SCENE]: exception when trying to remove the prim that crossed the border."); 3013 m_log.Warn("[SCENE]: exception when trying to remove the prim that crossed the border.");
2553 } 3014 }
2554 return; 3015 return;
3016<<<<<<< HEAD
3017=======
2555 } 3018 }
2556 3019
2557 if (grp.RootPart.RETURN_AT_EDGE) 3020 if (grp.RootPart.RETURN_AT_EDGE)
@@ -2593,6 +3056,49 @@ namespace OpenSim.Region.Framework.Scenes
2593 // Regular region. Just check for region size 3056 // Regular region. Just check for region size
2594 if (xx < RegionInfo.RegionSizeX && yy < RegionInfo.RegionSizeY ) 3057 if (xx < RegionInfo.RegionSizeX && yy < RegionInfo.RegionSizeY )
2595 ret = true; 3058 ret = true;
3059>>>>>>> avn/ubitvar
3060 }
3061
3062 if (grp.RootPart.RETURN_AT_EDGE)
3063 {
3064<<<<<<< HEAD
3065 // We remove the object here
3066 try
3067 {
3068 List<SceneObjectGroup> objects = new List<SceneObjectGroup>();
3069 objects.Add(grp);
3070 SceneObjectGroup[] objectsArray = objects.ToArray();
3071 returnObjects(objectsArray, UUID.Zero);
3072 }
3073 catch (Exception)
3074 {
3075 m_log.Warn("[SCENE]: exception when trying to return the prim that crossed the border.");
3076 }
3077 return;
3078 }
3079
3080 if (EntityTransferModule != null)
3081 EntityTransferModule.Cross(grp, attemptedPosition, silent);
3082 }
3083
3084 // Simple test to see if a position is in the current region.
3085 // This test is mostly used to see if a region crossing is necessary.
3086 // Assuming the position is relative to the region so anything outside its bounds.
3087 // Return 'true' if position inside region.
3088 public bool PositionIsInCurrentRegion(Vector3 pos)
3089 {
3090 bool ret = false;
3091 int xx = (int)Math.Floor(pos.X);
3092 int yy = (int)Math.Floor(pos.Y);
3093 if (xx < 0 || yy < 0)
3094 return false;
3095
3096 IRegionCombinerModule regionCombinerModule = RequestModuleInterface<IRegionCombinerModule>();
3097 if (regionCombinerModule == null)
3098 {
3099 // Regular region. Just check for region size
3100 if (xx < RegionInfo.RegionSizeX && yy < RegionInfo.RegionSizeY)
3101 ret = true;
2596 } 3102 }
2597 else 3103 else
2598 { 3104 {
@@ -2604,6 +3110,16 @@ namespace OpenSim.Region.Framework.Scenes
2604 3110
2605 } 3111 }
2606 3112
3113=======
3114 // We're in a mega-region so see if we are still in that larger region
3115 ret = regionCombinerModule.PositionIsInMegaregion(this.RegionInfo.RegionID, xx, yy);
3116 }
3117
3118 return ret;
3119
3120 }
3121
3122>>>>>>> avn/ubitvar
2607 /// <summary> 3123 /// <summary>
2608 /// Called when objects or attachments cross the border, or teleport, between regions. 3124 /// Called when objects or attachments cross the border, or teleport, between regions.
2609 /// </summary> 3125 /// </summary>
@@ -2625,6 +3141,10 @@ namespace OpenSim.Region.Framework.Scenes
2625 return false; 3141 return false;
2626 } 3142 }
2627 3143
3144<<<<<<< HEAD
3145 if (!EntityTransferModule.HandleIncomingSceneObject(newObject, newPosition))
3146 return false;
3147=======
2628 // If the user is banned, we won't let any of their objects 3148 // If the user is banned, we won't let any of their objects
2629 // enter. Period. 3149 // enter. Period.
2630 // 3150 //
@@ -2669,6 +3189,7 @@ namespace OpenSim.Region.Framework.Scenes
2669 //if (newObject.RootPart.KeyframeMotion != null) 3189 //if (newObject.RootPart.KeyframeMotion != null)
2670 // newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject); 3190 // newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject);
2671 } 3191 }
3192>>>>>>> avn/ubitvar
2672 3193
2673 // Do this as late as possible so that listeners have full access to the incoming object 3194 // Do this as late as possible so that listeners have full access to the incoming object
2674 EventManager.TriggerOnIncomingSceneObject(newObject); 3195 EventManager.TriggerOnIncomingSceneObject(newObject);
@@ -2712,7 +3233,7 @@ namespace OpenSim.Region.Framework.Scenes
2712 { 3233 {
2713 sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez); 3234 sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez);
2714 sceneObject.RootPart.AddFlag(PrimFlags.Phantom); 3235 sceneObject.RootPart.AddFlag(PrimFlags.Phantom);
2715 3236
2716 // Don't sent a full update here because this will cause full updates to be sent twice for 3237 // Don't sent a full update here because this will cause full updates to be sent twice for
2717 // attachments on region crossings, resulting in viewer glitches. 3238 // attachments on region crossings, resulting in viewer glitches.
2718 AddRestoredSceneObject(sceneObject, false, false, false); 3239 AddRestoredSceneObject(sceneObject, false, false, false);
@@ -2727,10 +3248,10 @@ namespace OpenSim.Region.Framework.Scenes
2727 { 3248 {
2728 SceneObjectGroup grp = sceneObject; 3249 SceneObjectGroup grp = sceneObject;
2729 3250
2730// m_log.DebugFormat( 3251 // m_log.DebugFormat(
2731// "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.FromItemID, grp.UUID); 3252 // "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.FromItemID, grp.UUID);
2732// m_log.DebugFormat( 3253 // m_log.DebugFormat(
2733// "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); 3254 // "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition);
2734 3255
2735 RootPrim.RemFlag(PrimFlags.TemporaryOnRez); 3256 RootPrim.RemFlag(PrimFlags.TemporaryOnRez);
2736 3257
@@ -2765,6 +3286,8 @@ namespace OpenSim.Region.Framework.Scenes
2765 return true; 3286 return true;
2766 } 3287 }
2767 3288
3289<<<<<<< HEAD
3290=======
2768 private int GetStateSource(SceneObjectGroup sog) 3291 private int GetStateSource(SceneObjectGroup sog)
2769 { 3292 {
2770 ScenePresence sp = GetScenePresence(sog.OwnerID); 3293 ScenePresence sp = GetScenePresence(sog.OwnerID);
@@ -2793,6 +3316,7 @@ namespace OpenSim.Region.Framework.Scenes
2793 return uac.UserFlags; 3316 return uac.UserFlags;
2794 //} 3317 //}
2795 } 3318 }
3319>>>>>>> avn/ubitvar
2796 #endregion 3320 #endregion
2797 3321
2798 #region Add/Remove Avatar Methods 3322 #region Add/Remove Avatar Methods
@@ -2803,6 +3327,9 @@ namespace OpenSim.Region.Framework.Scenes
2803 bool vialogin; 3327 bool vialogin;
2804 bool reallyNew = true; 3328 bool reallyNew = true;
2805 3329
3330 // Update the number of users attempting to login
3331 StatsReporter.UpdateUsersLoggingIn(true);
3332
2806 // Validation occurs in LLUDPServer 3333 // Validation occurs in LLUDPServer
2807 // 3334 //
2808 // XXX: A race condition exists here where two simultaneous calls to AddNewAgent can interfere with 3335 // XXX: A race condition exists here where two simultaneous calls to AddNewAgent can interfere with
@@ -2825,9 +3352,15 @@ namespace OpenSim.Region.Framework.Scenes
2825 vialogin 3352 vialogin
2826 = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 3353 = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0
2827 || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; 3354 || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0;
3355<<<<<<< HEAD
3356
3357 // CheckHeartbeat();
3358
3359=======
2828 3360
2829 CheckHeartbeat(); 3361 CheckHeartbeat();
2830 3362
3363>>>>>>> avn/ubitvar
2831 sp = GetScenePresence(client.AgentId); 3364 sp = GetScenePresence(client.AgentId);
2832 3365
2833 // XXX: Not sure how good it is to add a new client if a scene presence already exists. Possibly this 3366 // XXX: Not sure how good it is to add a new client if a scene presence already exists. Possibly this
@@ -2837,6 +3370,29 @@ namespace OpenSim.Region.Framework.Scenes
2837 if (sp == null) 3370 if (sp == null)
2838 { 3371 {
2839 m_log.DebugFormat( 3372 m_log.DebugFormat(
3373<<<<<<< HEAD
3374 "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}",
3375 client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos);
3376
3377 sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type);
3378
3379 // We must set this here so that TriggerOnNewClient and TriggerOnClientLogin can determine whether the
3380 // client is for a root or child agent.
3381 // We must also set this before adding the client to the client manager so that an exception later on
3382 // does not leave a client manager entry without the scene agent set, which will cause other code
3383 // to fail since any entry in the client manager should have a ScenePresence
3384 //
3385 // XXX: This may be better set for a new client before that client is added to the client manager.
3386 // But need to know what happens in the case where a ScenePresence is already present (and if this
3387 // actually occurs).
3388 client.SceneAgent = sp;
3389
3390 m_clientManager.Add(client);
3391 SubscribeToClientEvents(client);
3392 m_eventManager.TriggerOnNewPresence(sp);
3393
3394 sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags;
3395=======
2840 "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}, tpflags: {4}", 3396 "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}, tpflags: {4}",
2841 client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos, 3397 client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos,
2842 ((TPFlags)aCircuit.teleportFlags).ToString()); 3398 ((TPFlags)aCircuit.teleportFlags).ToString());
@@ -2859,34 +3415,40 @@ namespace OpenSim.Region.Framework.Scenes
2859 */ 3415 */
2860 m_eventManager.TriggerOnNewPresence(sp); 3416 m_eventManager.TriggerOnNewPresence(sp);
2861 3417
3418>>>>>>> avn/ubitvar
2862 } 3419 }
2863 else 3420 else
2864 { 3421 {
3422 // We must set this here so that TriggerOnNewClient and TriggerOnClientLogin can determine whether the
3423 // client is for a root or child agent.
3424 // XXX: This may be better set for a new client before that client is added to the client manager.
3425 // But need to know what happens in the case where a ScenePresence is already present (and if this
3426 // actually occurs).
3427 client.SceneAgent = sp;
3428
2865 m_log.WarnFormat( 3429 m_log.WarnFormat(
2866 "[SCENE]: Already found {0} scene presence for {1} in {2} when asked to add new scene presence", 3430 "[SCENE]: Already found {0} scene presence for {1} in {2} when asked to add new scene presence",
2867 sp.IsChildAgent ? "child" : "root", sp.Name, RegionInfo.RegionName); 3431 sp.IsChildAgent ? "child" : "root", sp.Name, RegionInfo.RegionName);
3432
2868 reallyNew = false; 3433 reallyNew = false;
2869 } 3434 }
2870
2871 // We must set this here so that TriggerOnNewClient and TriggerOnClientLogin can determine whether the
2872 // client is for a root or child agent.
2873 // XXX: This may be better set for a new client before that client is added to the client manager.
2874 // But need to know what happens in the case where a ScenePresence is already present (and if this
2875 // actually occurs).
2876 client.SceneAgent = sp;
2877 3435
2878 // This is currently also being done earlier in NewUserConnection for real users to see if this 3436 // This is currently also being done earlier in NewUserConnection for real users to see if this
2879 // resolves problems where HG agents are occasionally seen by others as "Unknown user" in chat and other 3437 // resolves problems where HG agents are occasionally seen by others as "Unknown user" in chat and other
2880 // places. However, we still need to do it here for NPCs. 3438 // places. However, we still need to do it here for NPCs.
2881 CacheUserName(sp, aCircuit); 3439 CacheUserName(sp, aCircuit);
2882 3440
2883 if (reallyNew) 3441 if (reallyNew)
2884 EventManager.TriggerOnNewClient(client); 3442 EventManager.TriggerOnNewClient(client);
2885 3443
2886 if (vialogin) 3444 if (vialogin)
2887 EventManager.TriggerOnClientLogin(client); 3445 EventManager.TriggerOnClientLogin(client);
2888 } 3446 }
2889 3447
3448 // User has logged into the scene so update the list of users logging
3449 // in
3450 StatsReporter.UpdateUsersLoggingIn(false);
3451
2890 m_LastLogin = Util.EnvironmentTickCount(); 3452 m_LastLogin = Util.EnvironmentTickCount();
2891 3453
2892 return sp; 3454 return sp;
@@ -2902,6 +3464,18 @@ namespace OpenSim.Region.Framework.Scenes
2902 } 3464 }
2903 3465
2904 /// <summary> 3466 /// <summary>
3467 /// Returns the Home URI of the agent, or null if unknown.
3468 /// </summary>
3469 public string GetAgentHomeURI(UUID agentID)
3470 {
3471 AgentCircuitData circuit = AuthenticateHandler.GetAgentCircuitData(agentID);
3472 if (circuit != null && circuit.ServiceURLs != null && circuit.ServiceURLs.ContainsKey("HomeURI"))
3473 return circuit.ServiceURLs["HomeURI"].ToString();
3474 else
3475 return null;
3476 }
3477
3478 /// <summary>
2905 /// Cache the user name for later use. 3479 /// Cache the user name for later use.
2906 /// </summary> 3480 /// </summary>
2907 /// <param name="sp"></param> 3481 /// <param name="sp"></param>
@@ -2941,7 +3515,7 @@ namespace OpenSim.Region.Framework.Scenes
2941 private bool VerifyClient(AgentCircuitData aCircuit, System.Net.IPEndPoint ep, out bool vialogin) 3515 private bool VerifyClient(AgentCircuitData aCircuit, System.Net.IPEndPoint ep, out bool vialogin)
2942 { 3516 {
2943 vialogin = false; 3517 vialogin = false;
2944 3518
2945 // Do the verification here 3519 // Do the verification here
2946 if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0) 3520 if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0)
2947 { 3521 {
@@ -3032,7 +3606,7 @@ namespace OpenSim.Region.Framework.Scenes
3032 { 3606 {
3033// client.OnRegionHandShakeReply += SendLayerData; 3607// client.OnRegionHandShakeReply += SendLayerData;
3034 } 3608 }
3035 3609
3036 public virtual void SubscribeToClientPrimEvents(IClientAPI client) 3610 public virtual void SubscribeToClientPrimEvents(IClientAPI client)
3037 { 3611 {
3038 client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; 3612 client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition;
@@ -3044,7 +3618,7 @@ namespace OpenSim.Region.Framework.Scenes
3044 client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; 3618 client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation;
3045 client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; 3619 client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation;
3046 client.OnUpdatePrimSingleRotationPosition += m_sceneGraph.UpdatePrimSingleRotationPosition; 3620 client.OnUpdatePrimSingleRotationPosition += m_sceneGraph.UpdatePrimSingleRotationPosition;
3047 3621
3048 client.OnUpdatePrimScale += m_sceneGraph.UpdatePrimScale; 3622 client.OnUpdatePrimScale += m_sceneGraph.UpdatePrimScale;
3049 client.OnUpdatePrimGroupScale += m_sceneGraph.UpdatePrimGroupScale; 3623 client.OnUpdatePrimGroupScale += m_sceneGraph.UpdatePrimGroupScale;
3050 client.OnUpdateExtraParams += m_sceneGraph.UpdateExtraParam; 3624 client.OnUpdateExtraParams += m_sceneGraph.UpdateExtraParam;
@@ -3057,7 +3631,7 @@ namespace OpenSim.Region.Framework.Scenes
3057 client.OnSpinStart += m_sceneGraph.SpinStart; 3631 client.OnSpinStart += m_sceneGraph.SpinStart;
3058 client.OnSpinUpdate += m_sceneGraph.SpinObject; 3632 client.OnSpinUpdate += m_sceneGraph.SpinObject;
3059 client.OnDeRezObject += DeRezObjects; 3633 client.OnDeRezObject += DeRezObjects;
3060 3634
3061 client.OnObjectName += m_sceneGraph.PrimName; 3635 client.OnObjectName += m_sceneGraph.PrimName;
3062 client.OnObjectClickAction += m_sceneGraph.PrimClickAction; 3636 client.OnObjectClickAction += m_sceneGraph.PrimClickAction;
3063 client.OnObjectMaterial += m_sceneGraph.PrimMaterial; 3637 client.OnObjectMaterial += m_sceneGraph.PrimMaterial;
@@ -3069,7 +3643,7 @@ namespace OpenSim.Region.Framework.Scenes
3069 client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; 3643 client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily;
3070 client.OnObjectPermissions += HandleObjectPermissionsUpdate; 3644 client.OnObjectPermissions += HandleObjectPermissionsUpdate;
3071 client.OnGrabObject += ProcessObjectGrab; 3645 client.OnGrabObject += ProcessObjectGrab;
3072 client.OnGrabUpdate += ProcessObjectGrabUpdate; 3646 client.OnGrabUpdate += ProcessObjectGrabUpdate;
3073 client.OnDeGrabObject += ProcessObjectDeGrab; 3647 client.OnDeGrabObject += ProcessObjectDeGrab;
3074 client.OnUndo += m_sceneGraph.HandleUndo; 3648 client.OnUndo += m_sceneGraph.HandleUndo;
3075 client.OnRedo += m_sceneGraph.HandleRedo; 3649 client.OnRedo += m_sceneGraph.HandleRedo;
@@ -3131,7 +3705,7 @@ namespace OpenSim.Region.Framework.Scenes
3131 //client.OnNameFromUUIDRequest += HandleUUIDNameRequest; 3705 //client.OnNameFromUUIDRequest += HandleUUIDNameRequest;
3132 client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; 3706 client.OnMoneyTransferRequest += ProcessMoneyTransferRequest;
3133 } 3707 }
3134 3708
3135 public virtual void SubscribeToClientNetworkEvents(IClientAPI client) 3709 public virtual void SubscribeToClientNetworkEvents(IClientAPI client)
3136 { 3710 {
3137 client.OnNetworkStatsUpdate += StatsReporter.AddPacketsStats; 3711 client.OnNetworkStatsUpdate += StatsReporter.AddPacketsStats;
@@ -3325,8 +3899,8 @@ namespace OpenSim.Region.Framework.Scenes
3325 if (target != null && target2 != null) 3899 if (target != null && target2 != null)
3326 { 3900 {
3327 Vector3 direction = Vector3.Normalize(RayEnd - RayStart); 3901 Vector3 direction = Vector3.Normalize(RayEnd - RayStart);
3328 Vector3 AXOrigin = new Vector3(RayStart.X, RayStart.Y, RayStart.Z); 3902 Vector3 AXOrigin = RayStart;
3329 Vector3 AXdirection = new Vector3(direction.X, direction.Y, direction.Z); 3903 Vector3 AXdirection = direction;
3330 3904
3331 pos = target2.AbsolutePosition; 3905 pos = target2.AbsolutePosition;
3332 //m_log.Info("[OBJECT_REZ]: TargetPos: " + pos.ToString() + ", RayStart: " + RayStart.ToString() + ", RayEnd: " + RayEnd.ToString() + ", Volume: " + Util.GetDistanceTo(RayStart,RayEnd).ToString() + ", mag1: " + Util.GetMagnitude(RayStart).ToString() + ", mag2: " + Util.GetMagnitude(RayEnd).ToString()); 3906 //m_log.Info("[OBJECT_REZ]: TargetPos: " + pos.ToString() + ", RayStart: " + RayStart.ToString() + ", RayEnd: " + RayEnd.ToString() + ", Volume: " + Util.GetDistanceTo(RayStart,RayEnd).ToString() + ", mag1: " + Util.GetMagnitude(RayStart).ToString() + ", mag2: " + Util.GetMagnitude(RayEnd).ToString());
@@ -3347,13 +3921,13 @@ namespace OpenSim.Region.Framework.Scenes
3347 if (ei.HitTF) 3921 if (ei.HitTF)
3348 { 3922 {
3349 Vector3 scale = target.Scale; 3923 Vector3 scale = target.Scale;
3350 Vector3 scaleComponent = new Vector3(ei.AAfaceNormal.X, ei.AAfaceNormal.Y, ei.AAfaceNormal.Z); 3924 Vector3 scaleComponent = ei.AAfaceNormal;
3351 if (scaleComponent.X != 0) ScaleOffset = scale.X; 3925 if (scaleComponent.X != 0) ScaleOffset = scale.X;
3352 if (scaleComponent.Y != 0) ScaleOffset = scale.Y; 3926 if (scaleComponent.Y != 0) ScaleOffset = scale.Y;
3353 if (scaleComponent.Z != 0) ScaleOffset = scale.Z; 3927 if (scaleComponent.Z != 0) ScaleOffset = scale.Z;
3354 ScaleOffset = Math.Abs(ScaleOffset); 3928 ScaleOffset = Math.Abs(ScaleOffset);
3355 Vector3 intersectionpoint = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); 3929 Vector3 intersectionpoint = ei.ipoint;
3356 Vector3 normal = new Vector3(ei.normal.X, ei.normal.Y, ei.normal.Z); 3930 Vector3 normal = ei.normal;
3357 Vector3 offset = normal * (ScaleOffset / 2f); 3931 Vector3 offset = normal * (ScaleOffset / 2f);
3358 pos = intersectionpoint + offset; 3932 pos = intersectionpoint + offset;
3359 3933
@@ -3373,6 +3947,7 @@ namespace OpenSim.Region.Framework.Scenes
3373 { 3947 {
3374 copy = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, Quaternion.Identity); 3948 copy = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, Quaternion.Identity);
3375 } 3949 }
3950
3376 if (copy != null) 3951 if (copy != null)
3377 EventManager.TriggerObjectAddedToScene(copy); 3952 EventManager.TriggerObjectAddedToScene(copy);
3378 } 3953 }
@@ -3380,7 +3955,7 @@ namespace OpenSim.Region.Framework.Scenes
3380 } 3955 }
3381 3956
3382 /// <summary> 3957 /// <summary>
3383 /// Get the avatar apperance for the given client. 3958 /// Get the avatar appearance for the given client.
3384 /// </summary> 3959 /// </summary>
3385 /// <param name="client"></param> 3960 /// <param name="client"></param>
3386 /// <param name="appearance"></param> 3961 /// <param name="appearance"></param>
@@ -3433,18 +4008,19 @@ namespace OpenSim.Region.Framework.Scenes
3433 4008
3434 return; 4009 return;
3435 } 4010 }
3436 else
3437 {
3438 m_authenticateHandler.RemoveCircuit(agentID);
3439 }
3440 4011
3441 // TODO: Can we now remove this lock? 4012 // TODO: Can we now remove this lock?
4013<<<<<<< HEAD
4014 lock (acd)
4015 {
4016=======
3442 lock (m_removeClientPrivLock) 4017 lock (m_removeClientPrivLock)
3443 { 4018 {
4019>>>>>>> avn/ubitvar
3444 bool isChildAgent = false; 4020 bool isChildAgent = false;
3445 4021
3446 ScenePresence avatar = GetScenePresence(agentID); 4022 ScenePresence avatar = GetScenePresence(agentID);
3447 4023
3448 // Shouldn't be necessary since RemoveClient() is currently only called by IClientAPI.Close() which 4024 // Shouldn't be necessary since RemoveClient() is currently only called by IClientAPI.Close() which
3449 // in turn is only called by Scene.IncomingCloseAgent() which checks whether the presence exists or not 4025 // in turn is only called by Scene.IncomingCloseAgent() which checks whether the presence exists or not
3450 // However, will keep for now just in case. 4026 // However, will keep for now just in case.
@@ -3452,7 +4028,8 @@ namespace OpenSim.Region.Framework.Scenes
3452 { 4028 {
3453 m_log.ErrorFormat( 4029 m_log.ErrorFormat(
3454 "[SCENE]: Called RemoveClient() with agent ID {0} but no such presence is in the scene.", agentID); 4030 "[SCENE]: Called RemoveClient() with agent ID {0} but no such presence is in the scene.", agentID);
3455 4031 m_authenticateHandler.RemoveCircuit(agentID);
4032
3456 return; 4033 return;
3457 } 4034 }
3458 4035
@@ -3463,7 +4040,7 @@ namespace OpenSim.Region.Framework.Scenes
3463 m_log.DebugFormat( 4040 m_log.DebugFormat(
3464 "[SCENE]: Removing {0} agent {1} {2} from {3}", 4041 "[SCENE]: Removing {0} agent {1} {2} from {3}",
3465 isChildAgent ? "child" : "root", avatar.Name, agentID, Name); 4042 isChildAgent ? "child" : "root", avatar.Name, agentID, Name);
3466 4043
3467 // Don't do this to root agents, it's not nice for the viewer 4044 // Don't do this to root agents, it's not nice for the viewer
3468 if (closeChildAgents && isChildAgent) 4045 if (closeChildAgents && isChildAgent)
3469 { 4046 {
@@ -3471,20 +4048,25 @@ namespace OpenSim.Region.Framework.Scenes
3471 // Let's do this via UDP 4048 // Let's do this via UDP
3472 avatar.ControllingClient.SendShutdownConnectionNotice(); 4049 avatar.ControllingClient.SendShutdownConnectionNotice();
3473 } 4050 }
3474 4051
3475 // Only applies to root agents. 4052 // Only applies to root agents.
3476 if (avatar.ParentID != 0) 4053 if (avatar.ParentID != 0)
3477 { 4054 {
3478 avatar.StandUp(); 4055 avatar.StandUp();
3479 } 4056 }
3480 4057
3481 m_sceneGraph.removeUserCount(!isChildAgent); 4058 m_sceneGraph.removeUserCount(!isChildAgent);
3482 4059
3483 // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop 4060 // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop
3484 // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI 4061 // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI
3485 if (closeChildAgents && CapsModule != null) 4062 if (closeChildAgents && CapsModule != null)
4063<<<<<<< HEAD
4064 CapsModule.RemoveCaps(agentID);
4065
4066=======
3486 CapsModule.RemoveCaps(agentID, avatar.ControllingClient.CircuitCode); 4067 CapsModule.RemoveCaps(agentID, avatar.ControllingClient.CircuitCode);
3487 4068
4069>>>>>>> avn/ubitvar
3488 if (closeChildAgents && !isChildAgent) 4070 if (closeChildAgents && !isChildAgent)
3489 { 4071 {
3490 List<ulong> regions = avatar.KnownRegionHandles; 4072 List<ulong> regions = avatar.KnownRegionHandles;
@@ -3493,12 +4075,16 @@ namespace OpenSim.Region.Framework.Scenes
3493 // This ends up being done asynchronously so that a logout isn't held up where there are many present but unresponsive neighbours. 4075 // This ends up being done asynchronously so that a logout isn't held up where there are many present but unresponsive neighbours.
3494 m_sceneGridService.SendCloseChildAgentConnections(agentID, acd.SessionID.ToString(), regions); 4076 m_sceneGridService.SendCloseChildAgentConnections(agentID, acd.SessionID.ToString(), regions);
3495 } 4077 }
3496 4078
3497 m_eventManager.TriggerClientClosed(agentID, this); 4079 m_eventManager.TriggerClientClosed(agentID, this);
3498// m_log.Debug("[Scene]TriggerClientClosed done"); 4080// m_log.Debug("[Scene]TriggerClientClosed done");
3499 m_eventManager.TriggerOnRemovePresence(agentID); 4081 m_eventManager.TriggerOnRemovePresence(agentID);
4082<<<<<<< HEAD
4083
4084=======
3500// m_log.Debug("[Scene]TriggerOnRemovePresence done"); 4085// m_log.Debug("[Scene]TriggerOnRemovePresence done");
3501 4086
4087>>>>>>> avn/ubitvar
3502 if (!isChildAgent) 4088 if (!isChildAgent)
3503 { 4089 {
3504 if (AttachmentsModule != null) 4090 if (AttachmentsModule != null)
@@ -3516,7 +4102,7 @@ namespace OpenSim.Region.Framework.Scenes
3516 catch (NullReferenceException) { } 4102 catch (NullReferenceException) { }
3517 }); 4103 });
3518 } 4104 }
3519 4105
3520 // It's possible for child agents to have transactions if changes are being made cross-border. 4106 // It's possible for child agents to have transactions if changes are being made cross-border.
3521 if (AgentTransactionsModule != null) 4107 if (AgentTransactionsModule != null)
3522 { 4108 {
@@ -3537,9 +4123,10 @@ namespace OpenSim.Region.Framework.Scenes
3537 // Always clean these structures up so that any failure above doesn't cause them to remain in the 4123 // Always clean these structures up so that any failure above doesn't cause them to remain in the
3538 // scene with possibly bad effects (e.g. continually timing out on unacked packets and triggering 4124 // scene with possibly bad effects (e.g. continually timing out on unacked packets and triggering
3539 // the same cleanup exception continually. 4125 // the same cleanup exception continually.
4126 m_authenticateHandler.RemoveCircuit(agentID);
3540 m_sceneGraph.RemoveScenePresence(agentID); 4127 m_sceneGraph.RemoveScenePresence(agentID);
3541 m_clientManager.Remove(agentID); 4128 m_clientManager.Remove(agentID);
3542 4129
3543 avatar.Close(); 4130 avatar.Close();
3544 } 4131 }
3545 catch (Exception e) 4132 catch (Exception e)
@@ -3609,12 +4196,13 @@ namespace OpenSim.Region.Framework.Scenes
3609 /// </summary> 4196 /// </summary>
3610 /// <param name="agent">CircuitData of the agent who is connecting</param> 4197 /// <param name="agent">CircuitData of the agent who is connecting</param>
3611 /// <param name="teleportFlags"></param> 4198 /// <param name="teleportFlags"></param>
4199 /// <param name="source">Source region (may be null)</param>
3612 /// <param name="reason">Outputs the reason for the false response on this string</param> 4200 /// <param name="reason">Outputs the reason for the false response on this string</param>
3613 /// <returns>True if the region accepts this agent. False if it does not. False will 4201 /// <returns>True if the region accepts this agent. False if it does not. False will
3614 /// also return a reason.</returns> 4202 /// also return a reason.</returns>
3615 public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason) 4203 public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, GridRegion source, out string reason)
3616 { 4204 {
3617 return NewUserConnection(agent, teleportFlags, out reason, true); 4205 return NewUserConnection(agent, teleportFlags, source, out reason, true);
3618 } 4206 }
3619 4207
3620 /// <summary> 4208 /// <summary>
@@ -3634,15 +4222,20 @@ namespace OpenSim.Region.Framework.Scenes
3634 /// the LLUDP stack). 4222 /// the LLUDP stack).
3635 /// </remarks> 4223 /// </remarks>
3636 /// <param name="acd">CircuitData of the agent who is connecting</param> 4224 /// <param name="acd">CircuitData of the agent who is connecting</param>
4225 /// <param name="source">Source region (may be null)</param>
3637 /// <param name="reason">Outputs the reason for the false response on this string</param> 4226 /// <param name="reason">Outputs the reason for the false response on this string</param>
3638 /// <param name="requirePresenceLookup">True for normal presence. False for NPC 4227 /// <param name="requirePresenceLookup">True for normal presence. False for NPC
3639 /// or other applications where a full grid/Hypergrid presence may not be required.</param> 4228 /// or other applications where a full grid/Hypergrid presence may not be required.</param>
3640 /// <returns>True if the region accepts this agent. False if it does not. False will 4229 /// <returns>True if the region accepts this agent. False if it does not. False will
3641 /// also return a reason.</returns> 4230 /// also return a reason.</returns>
4231<<<<<<< HEAD
4232 public bool NewUserConnection(AgentCircuitData acd, uint teleportFlags, GridRegion source, out string reason, bool requirePresenceLookup)
4233=======
3642 /// 4234 ///
3643 private object m_newUserConnLock = new object(); 4235 private object m_newUserConnLock = new object();
3644 4236
3645 public bool NewUserConnection(AgentCircuitData acd, uint teleportFlags, out string reason, bool requirePresenceLookup) 4237 public bool NewUserConnection(AgentCircuitData acd, uint teleportFlags, out string reason, bool requirePresenceLookup)
4238>>>>>>> avn/ubitvar
3646 { 4239 {
3647 bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 || 4240 bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 ||
3648 (teleportFlags & (uint)TPFlags.ViaHGLogin) != 0); 4241 (teleportFlags & (uint)TPFlags.ViaHGLogin) != 0);
@@ -3659,8 +4252,9 @@ namespace OpenSim.Region.Framework.Scenes
3659 // TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport 4252 // TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport
3660 4253
3661 // Don't disable this log message - it's too helpful 4254 // Don't disable this log message - it's too helpful
4255 string curViewer = Util.GetViewerName(acd);
3662 m_log.DebugFormat( 4256 m_log.DebugFormat(
3663 "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags ({8}), position {9})", 4257 "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags ({8}), position {9}. {10}",
3664 RegionInfo.RegionName, 4258 RegionInfo.RegionName,
3665 (acd.child ? "child" : "root"), 4259 (acd.child ? "child" : "root"),
3666 acd.firstname, 4260 acd.firstname,
@@ -3668,9 +4262,10 @@ namespace OpenSim.Region.Framework.Scenes
3668 acd.AgentID, 4262 acd.AgentID,
3669 acd.circuitcode, 4263 acd.circuitcode,
3670 acd.IPAddress, 4264 acd.IPAddress,
3671 acd.Viewer, 4265 curViewer,
3672 ((TPFlags)teleportFlags).ToString(), 4266 ((TPFlags)teleportFlags).ToString(),
3673 acd.startpos 4267 acd.startpos,
4268 (source == null) ? "" : string.Format("From region {0} ({1}){2}", source.RegionName, source.RegionID, (source.RawServerURI == null) ? "" : " @ " + source.ServerURI)
3674 ); 4269 );
3675 4270
3676// m_log.DebugFormat("NewUserConnection stack {0}", Environment.StackTrace); 4271// m_log.DebugFormat("NewUserConnection stack {0}", Environment.StackTrace);
@@ -3690,7 +4285,7 @@ namespace OpenSim.Region.Framework.Scenes
3690 { 4285 {
3691 foreach (string viewer in m_AllowedViewers) 4286 foreach (string viewer in m_AllowedViewers)
3692 { 4287 {
3693 if (viewer == acd.Viewer.Substring(0, viewer.Length).Trim().ToLower()) 4288 if (viewer == curViewer.Substring(0, Math.Min(viewer.Length, curViewer.Length)).Trim().ToLower())
3694 { 4289 {
3695 ViewerDenied = false; 4290 ViewerDenied = false;
3696 break; 4291 break;
@@ -3707,7 +4302,7 @@ namespace OpenSim.Region.Framework.Scenes
3707 { 4302 {
3708 foreach (string viewer in m_BannedViewers) 4303 foreach (string viewer in m_BannedViewers)
3709 { 4304 {
3710 if (viewer == acd.Viewer.Substring(0, viewer.Length).Trim().ToLower()) 4305 if (viewer == curViewer.Substring(0, Math.Min(viewer.Length, curViewer.Length)).Trim().ToLower())
3711 { 4306 {
3712 ViewerDenied = true; 4307 ViewerDenied = true;
3713 break; 4308 break;
@@ -3719,7 +4314,7 @@ namespace OpenSim.Region.Framework.Scenes
3719 { 4314 {
3720 m_log.DebugFormat( 4315 m_log.DebugFormat(
3721 "[SCENE]: Access denied for {0} {1} using {2}", 4316 "[SCENE]: Access denied for {0} {1} using {2}",
3722 acd.firstname, acd.lastname, acd.Viewer); 4317 acd.firstname, acd.lastname, curViewer);
3723 reason = "Access denied, your viewer is banned by the region owner"; 4318 reason = "Access denied, your viewer is banned by the region owner";
3724 return false; 4319 return false;
3725 } 4320 }
@@ -3733,12 +4328,12 @@ namespace OpenSim.Region.Framework.Scenes
3733 4328
3734 // We need to ensure that we are not already removing the scene presence before we ask it not to be 4329 // We need to ensure that we are not already removing the scene presence before we ask it not to be
3735 // closed. 4330 // closed.
3736 if (sp != null && sp.IsChildAgent 4331 if (sp != null && sp.IsChildAgent
3737 && (sp.LifecycleState == ScenePresenceState.Running 4332 && (sp.LifecycleState == ScenePresenceState.Running
3738 || sp.LifecycleState == ScenePresenceState.PreRemove)) 4333 || sp.LifecycleState == ScenePresenceState.PreRemove))
3739 { 4334 {
3740 m_log.DebugFormat( 4335 m_log.DebugFormat(
3741 "[SCENE]: Reusing existing child scene presence for {0}, state {1} in {2}", 4336 "[SCENE]: Reusing existing child scene presence for {0}, state {1} in {2}",
3742 sp.Name, sp.LifecycleState, Name); 4337 sp.Name, sp.LifecycleState, Name);
3743 4338
3744 // In the case where, for example, an A B C D region layout, an avatar may 4339 // In the case where, for example, an A B C D region layout, an avatar may
@@ -3838,7 +4433,7 @@ namespace OpenSim.Region.Framework.Scenes
3838 m_authenticateHandler.AddNewCircuit(acd.circuitcode, acd); 4433 m_authenticateHandler.AddNewCircuit(acd.circuitcode, acd);
3839 4434
3840 land = LandChannel.GetLandObject(acd.startpos.X, acd.startpos.Y); 4435 land = LandChannel.GetLandObject(acd.startpos.X, acd.startpos.Y);
3841 4436
3842 // On login test land permisions 4437 // On login test land permisions
3843 if (vialogin) 4438 if (vialogin)
3844 { 4439 {
@@ -3895,7 +4490,7 @@ namespace OpenSim.Region.Framework.Scenes
3895 "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", 4490 "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})",
3896 Name, (acd.child ? "child" : "root"), acd.firstname, acd.lastname, 4491 Name, (acd.child ? "child" : "root"), acd.firstname, acd.lastname,
3897 acd.AgentID, acd.circuitcode); 4492 acd.AgentID, acd.circuitcode);
3898 4493
3899 if (CapsModule != null) 4494 if (CapsModule != null)
3900 { 4495 {
3901 CapsModule.SetAgentCapsSeeds(acd); 4496 CapsModule.SetAgentCapsSeeds(acd);
@@ -3907,12 +4502,18 @@ namespace OpenSim.Region.Framework.Scenes
3907 // Let the SP know how we got here. This has a lot of interesting 4502 // Let the SP know how we got here. This has a lot of interesting
3908 // uses down the line. 4503 // uses down the line.
3909 sp.TeleportFlags = (TPFlags)teleportFlags; 4504 sp.TeleportFlags = (TPFlags)teleportFlags;
3910 4505
3911 if (sp.IsChildAgent) 4506 if (sp.IsChildAgent)
3912 { 4507 {
3913 m_log.DebugFormat( 4508 m_log.DebugFormat(
3914 "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", 4509 "[SCENE]: Adjusting known seeds for existing agent {0} in {1}",
4510<<<<<<< HEAD
4511 acd.AgentID, RegionInfo.RegionName);
4512
4513 sp.AdjustKnownSeeds();
4514=======
3915 acd.AgentID, RegionInfo.RegionName); 4515 acd.AgentID, RegionInfo.RegionName);
4516>>>>>>> avn/ubitvar
3916 4517
3917 if (CapsModule != null) 4518 if (CapsModule != null)
3918 { 4519 {
@@ -3982,17 +4583,24 @@ namespace OpenSim.Region.Framework.Scenes
3982 else 4583 else
3983 { 4584 {
3984 m_log.DebugFormat( 4585 m_log.DebugFormat(
3985 "[SCENE]: No spawnpoints defined for telehub {0} for {1} in {2}. Continuing.", 4586 "[SCENE]: No spawnpoints defined for telehub {0} for {1} in {2}. Continuing.",
3986 RegionInfo.RegionSettings.TelehubObject, acd.Name, Name); 4587 RegionInfo.RegionSettings.TelehubObject, acd.Name, Name);
3987 } 4588 }
3988 } 4589 }
3989 else 4590 else
3990 { 4591 {
3991 m_log.DebugFormat( 4592 m_log.DebugFormat(
3992 "[SCENE]: No telehub {0} found to direct {1} in {2}. Continuing.", 4593 "[SCENE]: No telehub {0} found to direct {1} in {2}. Continuing.",
3993 RegionInfo.RegionSettings.TelehubObject, acd.Name, Name); 4594 RegionInfo.RegionSettings.TelehubObject, acd.Name, Name);
3994 } 4595 }
3995 4596
4597 // Final permissions check; this time we don't allow changing the position
4598 if (!IsPositionAllowed(acd.AgentID, acd.startpos, ref reason))
4599 {
4600 m_authenticateHandler.RemoveCircuit(acd.circuitcode);
4601 return false;
4602 }
4603
3996 return true; 4604 return true;
3997 } 4605 }
3998 4606
@@ -4004,6 +4612,13 @@ namespace OpenSim.Region.Framework.Scenes
4004 if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) 4612 if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero)
4005 { 4613 {
4006 acd.startpos = land.LandData.UserLocation; 4614 acd.startpos = land.LandData.UserLocation;
4615
4616 // Final permissions check; this time we don't allow changing the position
4617 if (!IsPositionAllowed(acd.AgentID, acd.startpos, ref reason))
4618 {
4619 m_authenticateHandler.RemoveCircuit(acd.circuitcode);
4620 return false;
4621 }
4007 } 4622 }
4008 } 4623 }
4009 */// This is now handled properly in ScenePresence.MakeRootAgent 4624 */// This is now handled properly in ScenePresence.MakeRootAgent
@@ -4012,16 +4627,40 @@ namespace OpenSim.Region.Framework.Scenes
4012 return true; 4627 return true;
4013 } 4628 }
4014 4629
4630 private bool IsPositionAllowed(UUID agentID, Vector3 pos, ref string reason)
4631 {
4632 ILandObject land = LandChannel.GetLandObject(pos);
4633 if (land == null)
4634 return true;
4635
4636 if (land.IsBannedFromLand(agentID) || land.IsRestrictedFromLand(agentID))
4637 {
4638 reason = "You are banned from the region.";
4639 return false;
4640 }
4641
4642 return true;
4643 }
4644
4015 public bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY) 4645 public bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY)
4016 { 4646 {
4017 if (posX < 0) 4647 if (posX < 0)
4018 posX = 0; 4648 posX = 0;
4649<<<<<<< HEAD
4650 else if (posX >= (float)RegionInfo.RegionSizeX)
4651 posX = (float)RegionInfo.RegionSizeX - 0.001f;
4652 if (posY < 0)
4653 posY = 0;
4654 else if (posY >= (float)RegionInfo.RegionSizeY)
4655 posY = (float)RegionInfo.RegionSizeY - 0.001f;
4656=======
4019 else if (posX >= RegionInfo.RegionSizeX) 4657 else if (posX >= RegionInfo.RegionSizeX)
4020 posX = RegionInfo.RegionSizeX - 0.5f; 4658 posX = RegionInfo.RegionSizeX - 0.5f;
4021 if (posY < 0) 4659 if (posY < 0)
4022 posY = 0; 4660 posY = 0;
4023 else if (posY >= RegionInfo.RegionSizeY) 4661 else if (posY >= RegionInfo.RegionSizeY)
4024 posY = RegionInfo.RegionSizeY - 0.5f; 4662 posY = RegionInfo.RegionSizeY - 0.5f;
4663>>>>>>> avn/ubitvar
4025 4664
4026 reason = String.Empty; 4665 reason = String.Empty;
4027 if (Permissions.IsGod(agentID)) 4666 if (Permissions.IsGod(agentID))
@@ -4053,7 +4692,7 @@ namespace OpenSim.Region.Framework.Scenes
4053 else 4692 else
4054 { 4693 {
4055 reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.", 4694 reason = String.Format("Denied access to private region {0}: You are not on the access list for that region.",
4056 RegionInfo.RegionName); 4695 RegionInfo.RegionName);
4057 } 4696 }
4058 return false; 4697 return false;
4059 } 4698 }
@@ -4110,9 +4749,9 @@ namespace OpenSim.Region.Framework.Scenes
4110 if (!AuthorizationService.IsAuthorizedForRegion( 4749 if (!AuthorizationService.IsAuthorizedForRegion(
4111 agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason)) 4750 agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason))
4112 { 4751 {
4113 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because {4}", 4752 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because: {4}",
4114 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName, reason); 4753 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName, reason);
4115 4754
4116 return false; 4755 return false;
4117 } 4756 }
4118 } 4757 }
@@ -4332,7 +4971,7 @@ namespace OpenSim.Region.Framework.Scenes
4332 } 4971 }
4333 4972
4334 // TODO: This check should probably be in QueryAccess(). 4973 // TODO: This check should probably be in QueryAccess().
4335 ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); 4974 ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, RegionInfo.RegionSizeX / 2, RegionInfo.RegionSizeY / 2);
4336 if (nearestParcel == null) 4975 if (nearestParcel == null)
4337 { 4976 {
4338 m_log.InfoFormat( 4977 m_log.InfoFormat(
@@ -4401,7 +5040,10 @@ namespace OpenSim.Region.Framework.Scenes
4401 /// <returns>true if we handled it.</returns> 5040 /// <returns>true if we handled it.</returns>
4402 public virtual bool IncomingUpdateChildAgent(AgentPosition cAgentData) 5041 public virtual bool IncomingUpdateChildAgent(AgentPosition cAgentData)
4403 { 5042 {
4404 //m_log.Debug(" XXX Scene IncomingChildAgentDataUpdate POSITION in " + RegionInfo.RegionName); 5043// m_log.DebugFormat(
5044// "[SCENE PRESENCE]: IncomingChildAgentDataUpdate POSITION for {0} in {1}, position {2}",
5045// cAgentData.AgentID, Name, cAgentData.Position);
5046
4405 ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); 5047 ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID);
4406 if (childAgentUpdate != null) 5048 if (childAgentUpdate != null)
4407 { 5049 {
@@ -4556,7 +5198,7 @@ namespace OpenSim.Region.Framework.Scenes
4556 lock (m_removeClientLock) 5198 lock (m_removeClientLock)
4557 { 5199 {
4558 sp = GetScenePresence(agentID); 5200 sp = GetScenePresence(agentID);
4559 5201
4560 if (sp == null) 5202 if (sp == null)
4561 { 5203 {
4562 // If there is no scene presence, we may be handling a dead 5204 // If there is no scene presence, we may be handling a dead
@@ -4576,7 +5218,7 @@ namespace OpenSim.Region.Framework.Scenes
4576 m_log.DebugFormat( 5218 m_log.DebugFormat(
4577 "[SCENE]: Called CloseClient() with agent ID {0} but no such presence is in {1}", 5219 "[SCENE]: Called CloseClient() with agent ID {0} but no such presence is in {1}",
4578 agentID, Name); 5220 agentID, Name);
4579 5221
4580 return false; 5222 return false;
4581 } 5223 }
4582 5224
@@ -4607,14 +5249,17 @@ namespace OpenSim.Region.Framework.Scenes
4607 sp.LifecycleState = ScenePresenceState.Removing; 5249 sp.LifecycleState = ScenePresenceState.Removing;
4608 } 5250 }
4609 5251
5252<<<<<<< HEAD
5253 sp.ControllingClient.Close(force);
5254=======
4610 if (sp != null) 5255 if (sp != null)
4611 { 5256 {
4612 sp.ControllingClient.Close(force, force); 5257 sp.ControllingClient.Close(force, force);
4613 return true; 5258 return true;
4614 } 5259 }
5260>>>>>>> avn/ubitvar
4615 5261
4616 // Agent not here 5262 return true;
4617 return false;
4618 } 5263 }
4619 5264
4620 /// <summary> 5265 /// <summary>
@@ -4803,7 +5448,7 @@ namespace OpenSim.Region.Framework.Scenes
4803 5448
4804 #region Script Engine 5449 #region Script Engine
4805 5450
4806 private bool ScriptDanger(SceneObjectPart part,Vector3 pos) 5451 private bool ScriptDanger(SceneObjectPart part, Vector3 pos)
4807 { 5452 {
4808 ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y); 5453 ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y);
4809 if (part != null) 5454 if (part != null)
@@ -4814,35 +5459,24 @@ namespace OpenSim.Region.Framework.Scenes
4814 { 5459 {
4815 return true; 5460 return true;
4816 } 5461 }
4817 else if ((parcel.LandData.Flags & (uint)ParcelFlags.AllowGroupScripts) != 0) 5462 else if ((part.OwnerID == parcel.LandData.OwnerID) || Permissions.IsGod(part.OwnerID))
4818 { 5463 {
4819 if (part.OwnerID == parcel.LandData.OwnerID 5464 return true;
4820 || (parcel.LandData.IsGroupOwned && part.GroupID == parcel.LandData.GroupID) 5465 }
4821 || Permissions.IsGod(part.OwnerID)) 5466 else if (((parcel.LandData.Flags & (uint)ParcelFlags.AllowGroupScripts) != 0)
4822 { 5467 && (parcel.LandData.GroupID != UUID.Zero) && (parcel.LandData.GroupID == part.GroupID))
4823 return true; 5468 {
4824 } 5469 return true;
4825 else
4826 {
4827 return false;
4828 }
4829 } 5470 }
4830 else 5471 else
4831 { 5472 {
4832 if (part.OwnerID == parcel.LandData.OwnerID) 5473 return false;
4833 {
4834 return true;
4835 }
4836 else
4837 {
4838 return false;
4839 }
4840 } 5474 }
4841 } 5475 }
4842 else 5476 else
4843 { 5477 {
4844 5478
4845 if (pos.X > 0f && pos.X < Constants.RegionSize && pos.Y > 0f && pos.Y < Constants.RegionSize) 5479 if (pos.X > 0f && pos.X < RegionInfo.RegionSizeX && pos.Y > 0f && pos.Y < RegionInfo.RegionSizeY)
4846 { 5480 {
4847 // The only time parcel != null when an object is inside a region is when 5481 // The only time parcel != null when an object is inside a region is when
4848 // there is nothing behind the landchannel. IE, no land plugin loaded. 5482 // there is nothing behind the landchannel. IE, no land plugin loaded.
@@ -5228,6 +5862,9 @@ namespace OpenSim.Region.Framework.Scenes
5228 // 5 = We have seen a new user enter within the past 4 minutes 5862 // 5 = We have seen a new user enter within the past 4 minutes
5229 // which can be seen as positive confirmation of sim health 5863 // which can be seen as positive confirmation of sim health
5230 // 5864 //
5865<<<<<<< HEAD
5866 int health = 1; // Start at 1, means we're up
5867=======
5231 5868
5232 flags = 0; 5869 flags = 0;
5233 message = String.Empty; 5870 message = String.Empty;
@@ -5243,6 +5880,7 @@ namespace OpenSim.Region.Framework.Scenes
5243 } 5880 }
5244 5881
5245 int health=1; // Start at 1, means we're up 5882 int health=1; // Start at 1, means we're up
5883>>>>>>> avn/ubitvar
5246 5884
5247 if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) 5885 if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000)
5248 { 5886 {
@@ -5315,7 +5953,7 @@ Environment.Exit(1);
5315 case PhysicsJointType.Ball: 5953 case PhysicsJointType.Ball:
5316 { 5954 {
5317 Vector3 jointAnchor = PhysicsScene.GetJointAnchor(joint); 5955 Vector3 jointAnchor = PhysicsScene.GetJointAnchor(joint);
5318 Vector3 proxyPos = new Vector3(jointAnchor.X, jointAnchor.Y, jointAnchor.Z); 5956 Vector3 proxyPos = jointAnchor;
5319 jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update 5957 jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update
5320 } 5958 }
5321 break; 5959 break;
@@ -5340,7 +5978,7 @@ Environment.Exit(1);
5340 jointErrorMessage(joint, "joint.TrackedBodyName is null, joint " + joint.ObjectNameInScene); 5978 jointErrorMessage(joint, "joint.TrackedBodyName is null, joint " + joint.ObjectNameInScene);
5341 } 5979 }
5342 5980
5343 Vector3 proxyPos = new Vector3(jointAnchor.X, jointAnchor.Y, jointAnchor.Z); 5981 Vector3 proxyPos = jointAnchor;
5344 Quaternion q = trackedBody.RotationOffset * joint.LocalRotation; 5982 Quaternion q = trackedBody.RotationOffset * joint.LocalRotation;
5345 5983
5346 jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update 5984 jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update
@@ -5429,6 +6067,10 @@ Environment.Exit(1);
5429 return null; 6067 return null;
5430 } 6068 }
5431 6069
6070 // Get terrain height at the specified <x,y> location.
6071 // Presumes the underlying implementation is a heightmap which is a 1m grid.
6072 // Finds heightmap grid points before and after the point and
6073 // does a linear approximation of the height at this intermediate point.
5432 public float GetGroundHeight(float x, float y) 6074 public float GetGroundHeight(float x, float y)
5433 { 6075 {
5434 if (x < 0) 6076 if (x < 0)
@@ -5441,8 +6083,8 @@ Environment.Exit(1);
5441 y = Heightmap.Height - 1; 6083 y = Heightmap.Height - 1;
5442 6084
5443 Vector3 p0 = new Vector3(x, y, (float)Heightmap[(int)x, (int)y]); 6085 Vector3 p0 = new Vector3(x, y, (float)Heightmap[(int)x, (int)y]);
5444 Vector3 p1 = new Vector3(p0); 6086 Vector3 p1 = p0;
5445 Vector3 p2 = new Vector3(p0); 6087 Vector3 p2 = p0;
5446 6088
5447 p1.X += 1.0f; 6089 p1.X += 1.0f;
5448 if (p1.X < Heightmap.Width) 6090 if (p1.X < Heightmap.Width)
@@ -5505,7 +6147,7 @@ Environment.Exit(1);
5505 Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); 6147 Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel);
5506 if (nearestPoint != null) 6148 if (nearestPoint != null)
5507 { 6149 {
5508 Debug.WriteLine("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString()); 6150 m_log.Debug("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString());
5509 return nearestPoint.Value; 6151 return nearestPoint.Value;
5510 } 6152 }
5511 6153
@@ -5515,16 +6157,16 @@ Environment.Exit(1);
5515 nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); 6157 nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel);
5516 if (nearestPoint != null) 6158 if (nearestPoint != null)
5517 { 6159 {
5518 Debug.WriteLine("They had a zero velocity, sending them to: " + nearestPoint.ToString()); 6160 m_log.Debug("They had a zero velocity, sending them to: " + nearestPoint.ToString());
5519 return nearestPoint.Value; 6161 return nearestPoint.Value;
5520 } 6162 }
5521 6163
5522 ILandObject dest = LandChannel.GetLandObject(avatar.lastKnownAllowedPosition.X, avatar.lastKnownAllowedPosition.Y); 6164 ILandObject dest = LandChannel.GetLandObject(avatar.lastKnownAllowedPosition.X, avatar.lastKnownAllowedPosition.Y);
5523 if (dest != excludeParcel) 6165 if (dest != excludeParcel)
5524 { 6166 {
5525 // Ultimate backup if we have no idea where they are and 6167 // Ultimate backup if we have no idea where they are and
5526 // the last allowed position was in another parcel 6168 // the last allowed position was in another parcel
5527 Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString()); 6169 m_log.Debug("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString());
5528 return avatar.lastKnownAllowedPosition; 6170 return avatar.lastKnownAllowedPosition;
5529 } 6171 }
5530 6172
@@ -5534,8 +6176,13 @@ Environment.Exit(1);
5534 //Go to the edge, this happens in teleporting to a region with no available parcels 6176 //Go to the edge, this happens in teleporting to a region with no available parcels
5535 Vector3 nearestRegionEdgePoint = GetNearestRegionEdgePosition(avatar); 6177 Vector3 nearestRegionEdgePoint = GetNearestRegionEdgePosition(avatar);
5536 6178
6179<<<<<<< HEAD
6180 //m_log.Debug("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString());
6181
6182=======
5537 //Debug.WriteLine("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString()); 6183 //Debug.WriteLine("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString());
5538 6184
6185>>>>>>> avn/ubitvar
5539 return nearestRegionEdgePoint; 6186 return nearestRegionEdgePoint;
5540 } 6187 }
5541 6188
@@ -5549,7 +6196,7 @@ Environment.Exit(1);
5549 { 6196 {
5550 Vector3 unitDirection = Vector3.Normalize(direction); 6197 Vector3 unitDirection = Vector3.Normalize(direction);
5551 //Making distance to search go through some sane limit of distance 6198 //Making distance to search go through some sane limit of distance
5552 for (float distance = 0; distance < Constants.RegionSize * 2; distance += .5f) 6199 for (float distance = 0; distance < Math.Max(RegionInfo.RegionSizeX, RegionInfo.RegionSizeY) * 2; distance += .5f)
5553 { 6200 {
5554 Vector3 testPos = Vector3.Add(pos, Vector3.Multiply(unitDirection, distance)); 6201 Vector3 testPos = Vector3.Add(pos, Vector3.Multiply(unitDirection, distance));
5555 if (parcel.ContainsPoint((int)testPos.X, (int)testPos.Y)) 6202 if (parcel.ContainsPoint((int)testPos.X, (int)testPos.Y))
@@ -5603,9 +6250,9 @@ Environment.Exit(1);
5603 int count = 0; 6250 int count = 0;
5604 int avgx = 0; 6251 int avgx = 0;
5605 int avgy = 0; 6252 int avgy = 0;
5606 for (int x = 0; x < Constants.RegionSize; x++) 6253 for (int x = 0; x < RegionInfo.RegionSizeX; x++)
5607 { 6254 {
5608 for (int y = 0; y < Constants.RegionSize; y++) 6255 for (int y = 0; y < RegionInfo.RegionSizeY; y++)
5609 { 6256 {
5610 //Just keep a running average as we check if all the points are inside or not 6257 //Just keep a running average as we check if all the points are inside or not
5611 if (parcel.ContainsPoint(x, y)) 6258 if (parcel.ContainsPoint(x, y))
@@ -5629,31 +6276,33 @@ Environment.Exit(1);
5629 6276
5630 private Vector3 GetNearestRegionEdgePosition(ScenePresence avatar) 6277 private Vector3 GetNearestRegionEdgePosition(ScenePresence avatar)
5631 { 6278 {
5632 float xdistance = avatar.AbsolutePosition.X < Constants.RegionSize / 2 ? avatar.AbsolutePosition.X : Constants.RegionSize - avatar.AbsolutePosition.X; 6279 float xdistance = avatar.AbsolutePosition.X < RegionInfo.RegionSizeX / 2
5633 float ydistance = avatar.AbsolutePosition.Y < Constants.RegionSize / 2 ? avatar.AbsolutePosition.Y : Constants.RegionSize - avatar.AbsolutePosition.Y; 6280 ? avatar.AbsolutePosition.X : RegionInfo.RegionSizeX - avatar.AbsolutePosition.X;
6281 float ydistance = avatar.AbsolutePosition.Y < RegionInfo.RegionSizeY / 2
6282 ? avatar.AbsolutePosition.Y : RegionInfo.RegionSizeY - avatar.AbsolutePosition.Y;
5634 6283
5635 //find out what vertical edge to go to 6284 //find out what vertical edge to go to
5636 if (xdistance < ydistance) 6285 if (xdistance < ydistance)
5637 { 6286 {
5638 if (avatar.AbsolutePosition.X < Constants.RegionSize / 2) 6287 if (avatar.AbsolutePosition.X < RegionInfo.RegionSizeX / 2)
5639 { 6288 {
5640 return GetPositionAtAvatarHeightOrGroundHeight(avatar, 0.0f, avatar.AbsolutePosition.Y); 6289 return GetPositionAtAvatarHeightOrGroundHeight(avatar, 0.0f, avatar.AbsolutePosition.Y);
5641 } 6290 }
5642 else 6291 else
5643 { 6292 {
5644 return GetPositionAtAvatarHeightOrGroundHeight(avatar, Constants.RegionSize, avatar.AbsolutePosition.Y); 6293 return GetPositionAtAvatarHeightOrGroundHeight(avatar, RegionInfo.RegionSizeY, avatar.AbsolutePosition.Y);
5645 } 6294 }
5646 } 6295 }
5647 //find out what horizontal edge to go to 6296 //find out what horizontal edge to go to
5648 else 6297 else
5649 { 6298 {
5650 if (avatar.AbsolutePosition.Y < Constants.RegionSize / 2) 6299 if (avatar.AbsolutePosition.Y < RegionInfo.RegionSizeY / 2)
5651 { 6300 {
5652 return GetPositionAtAvatarHeightOrGroundHeight(avatar, avatar.AbsolutePosition.X, 0.0f); 6301 return GetPositionAtAvatarHeightOrGroundHeight(avatar, avatar.AbsolutePosition.X, 0.0f);
5653 } 6302 }
5654 else 6303 else
5655 { 6304 {
5656 return GetPositionAtAvatarHeightOrGroundHeight(avatar, avatar.AbsolutePosition.X, Constants.RegionSize); 6305 return GetPositionAtAvatarHeightOrGroundHeight(avatar, avatar.AbsolutePosition.X, RegionInfo.RegionSizeY);
5657 } 6306 }
5658 } 6307 }
5659 } 6308 }
@@ -5719,7 +6368,7 @@ Environment.Exit(1);
5719 /// <param name="maxZ"></param> 6368 /// <param name="maxZ"></param>
5720 /// <returns></returns> 6369 /// <returns></returns>
5721 public static Vector3[] GetCombinedBoundingBox( 6370 public static Vector3[] GetCombinedBoundingBox(
5722 List<SceneObjectGroup> objects, 6371 List<SceneObjectGroup> objects,
5723 out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ) 6372 out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ)
5724 { 6373 {
5725 minX = float.MaxValue; 6374 minX = float.MaxValue;
@@ -5738,7 +6387,7 @@ Environment.Exit(1);
5738 Vector3 vec = g.AbsolutePosition; 6387 Vector3 vec = g.AbsolutePosition;
5739 6388
5740 g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ); 6389 g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ);
5741 6390
5742// m_log.DebugFormat( 6391// m_log.DebugFormat(
5743// "[SCENE]: For {0} found AxisAlignedBoundingBoxRaw {1}, {2}", 6392// "[SCENE]: For {0} found AxisAlignedBoundingBoxRaw {1}, {2}",
5744// g.Name, new Vector3(ominX, ominY, ominZ), new Vector3(omaxX, omaxY, omaxZ)); 6393// g.Name, new Vector3(ominX, ominY, ominZ), new Vector3(omaxX, omaxY, omaxZ));
@@ -5845,7 +6494,7 @@ Environment.Exit(1);
5845 // so that all simulators can retrieve it 6494 // so that all simulators can retrieve it
5846 string error = GridService.RegisterRegion(RegionInfo.ScopeID, new GridRegion(RegionInfo)); 6495 string error = GridService.RegisterRegion(RegionInfo.ScopeID, new GridRegion(RegionInfo));
5847 if (error != string.Empty) 6496 if (error != string.Empty)
5848 throw new Exception(error); 6497 throw new Exception(error);
5849 } 6498 }
5850 6499
5851 /// <summary> 6500 /// <summary>
@@ -5864,9 +6513,13 @@ Environment.Exit(1);
5864 /// <param name='position'></param> 6513 /// <param name='position'></param>
5865 /// <param name='reason'></param> 6514 /// <param name='reason'></param>
5866 /// <returns></returns> 6515 /// <returns></returns>
6516<<<<<<< HEAD
6517 public bool QueryAccess(UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List<UUID> features, out string reason)
6518=======
5867 public bool QueryAccess(UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string reason) 6519 public bool QueryAccess(UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string reason)
6520>>>>>>> avn/ubitvar
5868 { 6521 {
5869 reason = "You are banned from the region"; 6522 reason = string.Empty;
5870 6523
5871 if (Permissions.IsGod(agentID)) 6524 if (Permissions.IsGod(agentID))
5872 { 6525 {
@@ -5874,9 +6527,14 @@ Environment.Exit(1);
5874 return true; 6527 return true;
5875 } 6528 }
5876 6529
6530<<<<<<< HEAD
6531 if (!AllowAvatarCrossing && !viaTeleport)
6532 return false;
6533=======
5877 6534
5878// if (!AllowAvatarCrossing && !viaTeleport) 6535// if (!AllowAvatarCrossing && !viaTeleport)
5879// return false; 6536// return false;
6537>>>>>>> avn/ubitvar
5880 6538
5881 // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. 6539 // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check.
5882 // However, the long term fix is to make sure root agent count is always accurate. 6540 // However, the long term fix is to make sure root agent count is always accurate.
@@ -5929,11 +6587,12 @@ Environment.Exit(1);
5929 } 6587 }
5930 catch (Exception e) 6588 catch (Exception e)
5931 { 6589 {
5932 m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} "+ e.StackTrace, e.Message); 6590 m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} " + e.StackTrace, e.Message);
6591 reason = "Error authorizing agent: " + e.Message;
5933 return false; 6592 return false;
5934 } 6593 }
5935 6594
5936 if (position == Vector3.Zero) // Teleport 6595 if (viaTeleport)
5937 { 6596 {
5938 if (!RegionInfo.EstateSettings.AllowDirectTeleport) 6597 if (!RegionInfo.EstateSettings.AllowDirectTeleport)
5939 { 6598 {
@@ -5956,7 +6615,7 @@ Environment.Exit(1);
5956 6615
5957 if (banned) 6616 if (banned)
5958 { 6617 {
5959 if(Permissions.IsAdministrator(agentID) == false || Permissions.IsGridGod(agentID) == false) 6618 if (Permissions.IsAdministrator(agentID) == false || Permissions.IsGridGod(agentID) == false)
5960 { 6619 {
5961 reason = "No suitable landing point found"; 6620 reason = "No suitable landing point found";
5962 return false; 6621 return false;
@@ -5973,6 +6632,7 @@ Environment.Exit(1);
5973 if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY)) 6632 if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY))
5974 { 6633 {
5975 // m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID); 6634 // m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID);
6635 reason = "You are banned from the region on all parcels";
5976 return false; 6636 return false;
5977 } 6637 }
5978 } 6638 }
@@ -5980,13 +6640,22 @@ Environment.Exit(1);
5980 { 6640 {
5981 ILandObject land = LandChannel.GetLandObject(position.X, position.Y); 6641 ILandObject land = LandChannel.GetLandObject(position.X, position.Y);
5982 if (land == null) 6642 if (land == null)
6643 {
6644 reason = "No parcel found";
5983 return false; 6645 return false;
6646 }
5984 6647
5985 bool banned = land.IsBannedFromLand(agentID); 6648 bool banned = land.IsBannedFromLand(agentID);
5986 bool restricted = land.IsRestrictedFromLand(agentID); 6649 bool restricted = land.IsRestrictedFromLand(agentID);
5987 6650
5988 if (banned || restricted) 6651 if (banned || restricted)
6652 {
6653 if (banned)
6654 reason = "You are banned from the parcel";
6655 else
6656 reason = "The parcel is restricted";
5989 return false; 6657 return false;
6658 }
5990 } 6659 }
5991 6660
5992 reason = String.Empty; 6661 reason = String.Empty;
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index 9648030..c4671f0 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -1,598 +1,1237 @@
1/* 1<<<<<<< HEAD
2 * Copyright (c) Contributors, http://opensimulator.org/ 2/*
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * Copyright (c) Contributors, http://opensimulator.org/
4 * 4 * See CONTRIBUTORS.TXT for a full list of copyright holders.
5 * Redistribution and use in source and binary forms, with or without 5 *
6 * modification, are permitted provided that the following conditions are met: 6 * Redistribution and use in source and binary forms, with or without
7 * * Redistributions of source code must retain the above copyright 7 * modification, are permitted provided that the following conditions are met:
8 * notice, this list of conditions and the following disclaimer. 8 * * Redistributions of source code must retain the above copyright
9 * * Redistributions in binary form must reproduce the above copyright 9 * notice, this list of conditions and the following disclaimer.
10 * notice, this list of conditions and the following disclaimer in the 10 * * Redistributions in binary form must reproduce the above copyright
11 * documentation and/or other materials provided with the distribution. 11 * notice, this list of conditions and the following disclaimer in the
12 * * Neither the name of the OpenSimulator Project nor the 12 * documentation and/or other materials provided with the distribution.
13 * names of its contributors may be used to endorse or promote products 13 * * Neither the name of the OpenSimulator Project nor the
14 * derived from this software without specific prior written permission. 14 * names of its contributors may be used to endorse or promote products
15 * 15 * derived from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 *
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 */ 26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27 */
28using System; 28
29using System.Collections.Generic; 29using System;
30using System.Reflection; 30using System.Collections.Generic;
31using System.Threading; 31using System.Reflection;
32using OpenMetaverse; 32using System.Threading;
33using log4net; 33using OpenMetaverse;
34using Nini.Config; 34using log4net;
35using OpenSim.Framework; 35using Nini.Config;
36using OpenSim.Framework.Console; 36using OpenSim.Framework;
37 37using OpenSim.Framework.Console;
38using OpenSim.Region.Framework.Interfaces; 38
39using GridRegion = OpenSim.Services.Interfaces.GridRegion; 39using OpenSim.Region.Framework.Interfaces;
40 40using GridRegion = OpenSim.Services.Interfaces.GridRegion;
41namespace OpenSim.Region.Framework.Scenes 41
42{ 42namespace OpenSim.Region.Framework.Scenes
43 public abstract class SceneBase : IScene 43{
44 { 44 public abstract class SceneBase : IScene
45 protected static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 {
46 protected static readonly string LogHeader = "[SCENE]"; 46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 47
48 #region Events 48#pragma warning disable 414
49 49 private static readonly string LogHeader = "[SCENE]";
50 public event restart OnRestart; 50#pragma warning restore 414
51 51
52 #endregion 52 #region Events
53 53
54 #region Fields 54 public event restart OnRestart;
55 55
56 public string Name { get { return RegionInfo.RegionName; } } 56 #endregion
57 57
58 public IConfigSource Config 58 #region Fields
59 { 59
60 get { return GetConfig(); } 60 public string Name { get { return RegionInfo.RegionName; } }
61 } 61
62 62 public IConfigSource Config
63 protected virtual IConfigSource GetConfig() 63 {
64 { 64 get { return GetConfig(); }
65 return null; 65 }
66 } 66
67 67 protected virtual IConfigSource GetConfig()
68 /// <value> 68 {
69 /// All the region modules attached to this scene. 69 return null;
70 /// </value> 70 }
71 public Dictionary<string, IRegionModuleBase> RegionModules 71
72 { 72 /// <value>
73 get { return m_regionModules; } 73 /// All the region modules attached to this scene.
74 } 74 /// </value>
75 private Dictionary<string, IRegionModuleBase> m_regionModules = new Dictionary<string, IRegionModuleBase>(); 75 public Dictionary<string, IRegionModuleBase> RegionModules
76 76 {
77 /// <value> 77 get { return m_regionModules; }
78 /// The module interfaces available from this scene. 78 }
79 /// </value> 79 private Dictionary<string, IRegionModuleBase> m_regionModules = new Dictionary<string, IRegionModuleBase>();
80 protected Dictionary<Type, List<object>> ModuleInterfaces = new Dictionary<Type, List<object>>(); 80
81 81 /// <value>
82 protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>(); 82 /// The module interfaces available from this scene.
83 83 /// </value>
84 /// <value> 84 protected Dictionary<Type, List<object>> ModuleInterfaces = new Dictionary<Type, List<object>>();
85 /// The module commanders available from this scene 85
86 /// </value> 86 /// <summary>
87 protected Dictionary<string, ICommander> m_moduleCommanders = new Dictionary<string, ICommander>(); 87 /// These two objects hold the information about any formats used
88 88 /// by modules that hold agent specific data.
89 /// <value> 89 /// </summary>
90 /// Registered classes that are capable of creating entities. 90 protected List<UUID> FormatsOffered = new List<UUID>();
91 /// </value> 91 protected Dictionary<object, List<UUID>> FormatsWanted = new Dictionary<object, List<UUID>>();
92 protected Dictionary<PCode, IEntityCreator> m_entityCreators = new Dictionary<PCode, IEntityCreator>(); 92
93 93 protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>();
94 /// <summary> 94
95 /// The last allocated local prim id. When a new local id is requested, the next number in the sequence is 95 /// <value>
96 /// dispensed. 96 /// The module commanders available from this scene
97 /// </summary> 97 /// </value>
98 protected uint m_lastAllocatedLocalId = 720000; 98 protected Dictionary<string, ICommander> m_moduleCommanders = new Dictionary<string, ICommander>();
99 99
100 private readonly Mutex _primAllocateMutex = new Mutex(false); 100 /// <value>
101 101 /// Registered classes that are capable of creating entities.
102 protected readonly ClientManager m_clientManager = new ClientManager(); 102 /// </value>
103 103 protected Dictionary<PCode, IEntityCreator> m_entityCreators = new Dictionary<PCode, IEntityCreator>();
104 public bool LoginsEnabled 104
105 { 105 /// <summary>
106 get 106 /// The last allocated local prim id. When a new local id is requested, the next number in the sequence is
107 { 107 /// dispensed.
108 return m_loginsEnabled; 108 /// </summary>
109 } 109 protected uint m_lastAllocatedLocalId = 720000;
110 110
111 set 111 private readonly Mutex _primAllocateMutex = new Mutex(false);
112 { 112
113 if (m_loginsEnabled != value) 113 protected readonly ClientManager m_clientManager = new ClientManager();
114 { 114
115 m_loginsEnabled = value; 115 public bool LoginsEnabled
116 EventManager.TriggerRegionLoginsStatusChange(this); 116 {
117 } 117 get
118 } 118 {
119 } 119 return m_loginsEnabled;
120 private bool m_loginsEnabled; 120 }
121 121
122 public bool Ready 122 set
123 { 123 {
124 get 124 if (m_loginsEnabled != value)
125 { 125 {
126 return m_ready; 126 m_loginsEnabled = value;
127 } 127 EventManager.TriggerRegionLoginsStatusChange(this);
128 128 }
129 set 129 }
130 { 130 }
131 if (m_ready != value) 131 private bool m_loginsEnabled;
132 { 132
133 m_ready = value; 133 public bool Ready
134 EventManager.TriggerRegionReadyStatusChange(this); 134 {
135 } 135 get
136 } 136 {
137 } 137 return m_ready;
138 private bool m_ready; 138 }
139 139
140 public float TimeDilation 140 set
141 { 141 {
142 get { return 1.0f; } 142 if (m_ready != value)
143 } 143 {
144 144 m_ready = value;
145 protected ulong m_regionHandle; 145 EventManager.TriggerRegionReadyStatusChange(this);
146 protected string m_regionName; 146 }
147 147 }
148 public ITerrainChannel Heightmap; 148 }
149 149 private bool m_ready;
150 /// <value> 150
151 /// Allows retrieval of land information for this scene. 151 public float TimeDilation
152 /// </value> 152 {
153 public ILandChannel LandChannel; 153 get { return 1.0f; }
154 154 }
155 /// <value> 155
156 /// Manage events that occur in this scene (avatar movement, script rez, etc.). Commonly used by region modules 156 public ITerrainChannel Heightmap;
157 /// to subscribe to scene events. 157
158 /// </value> 158 /// <value>
159 public EventManager EventManager 159 /// Allows retrieval of land information for this scene.
160 { 160 /// </value>
161 get { return m_eventManager; } 161 public ILandChannel LandChannel;
162 } 162
163 protected EventManager m_eventManager; 163 /// <value>
164 164 /// Manage events that occur in this scene (avatar movement, script rez, etc.). Commonly used by region modules
165 protected ScenePermissions m_permissions; 165 /// to subscribe to scene events.
166 public ScenePermissions Permissions 166 /// </value>
167 { 167 public EventManager EventManager
168 get { return m_permissions; } 168 {
169 } 169 get { return m_eventManager; }
170 170 }
171 protected string m_datastore; 171 protected EventManager m_eventManager;
172 172
173 /* Used by the loadbalancer plugin on GForge */ 173 protected ScenePermissions m_permissions;
174 protected RegionStatus m_regStatus; 174 public ScenePermissions Permissions
175 public RegionStatus RegionStatus 175 {
176 { 176 get { return m_permissions; }
177 get { return m_regStatus; } 177 }
178 set { m_regStatus = value; } 178
179 } 179 /* Used by the loadbalancer plugin on GForge */
180 180 protected RegionStatus m_regStatus;
181 #endregion 181 public RegionStatus RegionStatus
182 182 {
183 public SceneBase(RegionInfo regInfo) 183 get { return m_regStatus; }
184 { 184 set { m_regStatus = value; }
185 RegionInfo = regInfo; 185 }
186 } 186
187 187 #endregion
188 #region Update Methods 188
189 189 public SceneBase(RegionInfo regInfo)
190 /// <summary> 190 {
191 /// Called to update the scene loop by a number of frames and until shutdown. 191 RegionInfo = regInfo;
192 /// </summary> 192 }
193 /// <param name="frames"> 193
194 /// Number of frames to update. Exits on shutdown even if there are frames remaining. 194 #region Update Methods
195 /// If -1 then updates until shutdown. 195
196 /// </param> 196 /// <summary>
197 public abstract void Update(int frames); 197 /// Called to update the scene loop by a number of frames and until shutdown.
198 198 /// </summary>
199 #endregion 199 /// <param name="frames">
200 200 /// Number of frames to update. Exits on shutdown even if there are frames remaining.
201 #region Terrain Methods 201 /// If -1 then updates until shutdown.
202 202 /// </param>
203 /// <summary> 203 /// <returns>true if update completed within minimum frame time, false otherwise.</returns>
204 /// Loads the World heightmap 204 public abstract bool Update(int frames);
205 /// </summary> 205
206 public abstract void LoadWorldMap(); 206 #endregion
207 207
208 /// <summary> 208 #region Terrain Methods
209 /// Send the region heightmap to the client 209
210 /// </summary> 210 /// <summary>
211 /// <param name="RemoteClient">Client to send to</param> 211 /// Loads the World heightmap
212 public virtual void SendLayerData(IClientAPI RemoteClient) 212 /// </summary>
213 { 213 public abstract void LoadWorldMap();
214// RemoteClient.SendLayerData(Heightmap.GetFloatsSerialised()); 214
215 ITerrainModule terrModule = RequestModuleInterface<ITerrainModule>(); 215 /// <summary>
216 if (terrModule != null) 216 /// Send the region heightmap to the client
217 { 217 /// </summary>
218 terrModule.PushTerrain(RemoteClient); 218 /// <param name="RemoteClient">Client to send to</param>
219 } 219 public virtual void SendLayerData(IClientAPI RemoteClient)
220 } 220 {
221 221 // RemoteClient.SendLayerData(Heightmap.GetFloatsSerialised());
222 #endregion 222 ITerrainModule terrModule = RequestModuleInterface<ITerrainModule>();
223 223 if (terrModule != null)
224 #region Add/Remove Agent/Avatar 224 {
225 225 terrModule.PushTerrain(RemoteClient);
226 public abstract ISceneAgent AddNewAgent(IClientAPI client, PresenceType type); 226 }
227 227 }
228 public abstract bool CloseAgent(UUID agentID, bool force); 228
229 229 #endregion
230 public bool TryGetScenePresence(UUID agentID, out object scenePresence) 230
231 { 231 #region Add/Remove Agent/Avatar
232 scenePresence = null; 232
233 ScenePresence sp = null; 233 public abstract ISceneAgent AddNewAgent(IClientAPI client, PresenceType type);
234 if (TryGetScenePresence(agentID, out sp)) 234
235 { 235 public abstract bool CloseAgent(UUID agentID, bool force);
236 scenePresence = sp; 236
237 return true; 237 public bool TryGetScenePresence(UUID agentID, out object scenePresence)
238 } 238 {
239 239 scenePresence = null;
240 return false; 240 ScenePresence sp = null;
241 } 241 if (TryGetScenePresence(agentID, out sp))
242 242 {
243 /// <summary> 243 scenePresence = sp;
244 /// Try to get a scene presence from the scene 244 return true;
245 /// </summary> 245 }
246 /// <param name="agentID"></param> 246
247 /// <param name="scenePresence">null if there is no scene presence with the given agent id</param> 247 return false;
248 /// <returns>true if there was a scene presence with the given id, false otherwise.</returns> 248 }
249 public abstract bool TryGetScenePresence(UUID agentID, out ScenePresence scenePresence); 249
250 250 /// <summary>
251 #endregion 251 /// Try to get a scene presence from the scene
252 252 /// </summary>
253 /// <summary> 253 /// <param name="agentID"></param>
254 /// 254 /// <param name="scenePresence">null if there is no scene presence with the given agent id</param>
255 /// </summary> 255 /// <returns>true if there was a scene presence with the given id, false otherwise.</returns>
256 /// <returns></returns> 256 public abstract bool TryGetScenePresence(UUID agentID, out ScenePresence scenePresence);
257 public virtual RegionInfo RegionInfo { get; private set; } 257
258 258 #endregion
259 #region admin stuff 259
260 260 /// <summary>
261 public abstract void OtherRegionUp(GridRegion otherRegion); 261 ///
262 262 /// </summary>
263 public virtual string GetSimulatorVersion() 263 /// <returns></returns>
264 { 264 public virtual RegionInfo RegionInfo { get; private set; }
265 return "OpenSimulator Server"; 265
266 } 266 #region admin stuff
267 267
268 #endregion 268 public abstract void OtherRegionUp(GridRegion otherRegion);
269 269
270 #region Shutdown 270 public virtual string GetSimulatorVersion()
271 271 {
272 /// <summary> 272 return "OpenSimulator Server";
273 /// Tidy before shutdown 273 }
274 /// </summary> 274
275 public virtual void Close() 275 #endregion
276 { 276
277 try 277 #region Shutdown
278 { 278
279 EventManager.TriggerShutdown(); 279 /// <summary>
280 } 280 /// Tidy before shutdown
281 catch (Exception e) 281 /// </summary>
282 { 282 public virtual void Close()
283 m_log.Error(string.Format("[SCENE]: SceneBase.cs: Close() - Failed with exception ", e)); 283 {
284 } 284 try
285 } 285 {
286 286 EventManager.TriggerShutdown();
287 #endregion 287 }
288 288 catch (Exception e)
289 /// <summary> 289 {
290 /// Returns a new unallocated local ID 290 m_log.Error(string.Format("[SCENE]: SceneBase.cs: Close() - Failed with exception ", e));
291 /// </summary> 291 }
292 /// <returns>A brand new local ID</returns> 292 }
293 public uint AllocateLocalId() 293
294 { 294 #endregion
295 uint myID; 295
296 296 /// <summary>
297 _primAllocateMutex.WaitOne(); 297 /// Returns a new unallocated local ID
298 myID = ++m_lastAllocatedLocalId; 298 /// </summary>
299 _primAllocateMutex.ReleaseMutex(); 299 /// <returns>A brand new local ID</returns>
300 300 public uint AllocateLocalId()
301 return myID; 301 {
302 } 302 uint myID;
303 303
304 public uint AllocatePresenceLocalId() 304 _primAllocateMutex.WaitOne();
305 { 305 myID = ++m_lastAllocatedLocalId;
306 uint myID; 306 _primAllocateMutex.ReleaseMutex();
307 307
308 _primAllocateMutex.WaitOne(); 308 return myID;
309 myID = ++m_lastAllocatedLocalId; 309 }
310 ++m_lastAllocatedLocalId; 310
311 _primAllocateMutex.ReleaseMutex(); 311 #region Module Methods
312 312
313 return myID; 313 /// <summary>
314 } 314 /// Add a region-module to this scene. TODO: This will replace AddModule in the future.
315 315 /// </summary>
316 #region Module Methods 316 /// <param name="name"></param>
317 317 /// <param name="module"></param>
318 /// <summary> 318 public void AddRegionModule(string name, IRegionModuleBase module)
319 /// Add a region-module to this scene. TODO: This will replace AddModule in the future. 319 {
320 /// </summary> 320 if (!RegionModules.ContainsKey(name))
321 /// <param name="name"></param> 321 {
322 /// <param name="module"></param> 322 RegionModules.Add(name, module);
323 public void AddRegionModule(string name, IRegionModuleBase module) 323 }
324 { 324 }
325 if (!RegionModules.ContainsKey(name)) 325
326 { 326 public void RemoveRegionModule(string name)
327 RegionModules.Add(name, module); 327 {
328 } 328 RegionModules.Remove(name);
329 } 329 }
330 330
331 public void RemoveRegionModule(string name) 331 /// <summary>
332 { 332 /// Register a module commander.
333 RegionModules.Remove(name); 333 /// </summary>
334 } 334 /// <param name="commander"></param>
335 335 public void RegisterModuleCommander(ICommander commander)
336 /// <summary> 336 {
337 /// Register a module commander. 337 lock (m_moduleCommanders)
338 /// </summary> 338 {
339 /// <param name="commander"></param> 339 m_moduleCommanders.Add(commander.Name, commander);
340 public void RegisterModuleCommander(ICommander commander) 340 }
341 { 341 }
342 lock (m_moduleCommanders) 342
343 { 343 /// <summary>
344 m_moduleCommanders.Add(commander.Name, commander); 344 /// Unregister a module commander and all its commands
345 } 345 /// </summary>
346 } 346 /// <param name="name"></param>
347 347 public void UnregisterModuleCommander(string name)
348 /// <summary> 348 {
349 /// Unregister a module commander and all its commands 349 lock (m_moduleCommanders)
350 /// </summary> 350 {
351 /// <param name="name"></param> 351 ICommander commander;
352 public void UnregisterModuleCommander(string name) 352 if (m_moduleCommanders.TryGetValue(name, out commander))
353 { 353 m_moduleCommanders.Remove(name);
354 lock (m_moduleCommanders) 354 }
355 { 355 }
356 ICommander commander; 356
357 if (m_moduleCommanders.TryGetValue(name, out commander)) 357 /// <summary>
358 m_moduleCommanders.Remove(name); 358 /// Get a module commander
359 } 359 /// </summary>
360 } 360 /// <param name="name"></param>
361 361 /// <returns>The module commander, null if no module commander with that name was found</returns>
362 /// <summary> 362 public ICommander GetCommander(string name)
363 /// Get a module commander 363 {
364 /// </summary> 364 lock (m_moduleCommanders)
365 /// <param name="name"></param> 365 {
366 /// <returns>The module commander, null if no module commander with that name was found</returns> 366 if (m_moduleCommanders.ContainsKey(name))
367 public ICommander GetCommander(string name) 367 return m_moduleCommanders[name];
368 { 368 }
369 lock (m_moduleCommanders) 369
370 { 370 return null;
371 if (m_moduleCommanders.ContainsKey(name)) 371 }
372 return m_moduleCommanders[name]; 372
373 } 373 public Dictionary<string, ICommander> GetCommanders()
374 374 {
375 return null; 375 return m_moduleCommanders;
376 } 376 }
377 377
378 public Dictionary<string, ICommander> GetCommanders() 378 public List<UUID> GetFormatsOffered()
379 { 379 {
380 return m_moduleCommanders; 380 List<UUID> ret = new List<UUID>(FormatsOffered);
381 } 381
382 382 return ret;
383 /// <summary> 383 }
384 /// Register an interface to a region module. This allows module methods to be called directly as 384
385 /// well as via events. If there is already a module registered for this interface, it is not replaced 385 protected void CheckAndAddAgentDataFormats(object mod)
386 /// (is this the best behaviour?) 386 {
387 /// </summary> 387 if (!(mod is IAgentStatefulModule))
388 /// <param name="mod"></param> 388 return;
389 public void RegisterModuleInterface<M>(M mod) 389
390 { 390 IAgentStatefulModule m = (IAgentStatefulModule)mod;
391// m_log.DebugFormat("[SCENE BASE]: Registering interface {0}", typeof(M)); 391
392 392 List<UUID> renderFormats = m.GetRenderStateFormats();
393 List<Object> l = null; 393 List<UUID> acceptFormats = m.GetAcceptStateFormats();
394 if (!ModuleInterfaces.TryGetValue(typeof(M), out l)) 394
395 { 395 foreach (UUID render in renderFormats)
396 l = new List<Object>(); 396 {
397 ModuleInterfaces.Add(typeof(M), l); 397 if (!(FormatsOffered.Contains(render)))
398 } 398 FormatsOffered.Add(render);
399 399 }
400 if (l.Count > 0) 400
401 return; 401 if (acceptFormats.Count == 0)
402 402 return;
403 l.Add(mod); 403
404 404 if (FormatsWanted.ContainsKey(mod))
405 if (mod is IEntityCreator) 405 return;
406 { 406
407 IEntityCreator entityCreator = (IEntityCreator)mod; 407 FormatsWanted[mod] = acceptFormats;
408 foreach (PCode pcode in entityCreator.CreationCapabilities) 408 }
409 { 409
410 m_entityCreators[pcode] = entityCreator; 410 /// <summary>
411 } 411 /// Register an interface to a region module. This allows module methods to be called directly as
412 } 412 /// well as via events. If there is already a module registered for this interface, it is not replaced
413 } 413 /// (is this the best behaviour?)
414 414 /// </summary>
415 public void UnregisterModuleInterface<M>(M mod) 415 /// <param name="mod"></param>
416 { 416 public void RegisterModuleInterface<M>(M mod)
417 List<Object> l; 417 {
418 if (ModuleInterfaces.TryGetValue(typeof(M), out l)) 418// m_log.DebugFormat("[SCENE BASE]: Registering interface {0}", typeof(M));
419 { 419
420 if (l.Remove(mod)) 420 List<Object> l = null;
421 { 421 if (!ModuleInterfaces.TryGetValue(typeof(M), out l))
422 if (mod is IEntityCreator) 422 {
423 { 423 l = new List<Object>();
424 IEntityCreator entityCreator = (IEntityCreator)mod; 424 ModuleInterfaces.Add(typeof(M), l);
425 foreach (PCode pcode in entityCreator.CreationCapabilities) 425 }
426 { 426
427 m_entityCreators[pcode] = null; 427 if (l.Count > 0)
428 } 428 return;
429 } 429
430 } 430 l.Add(mod);
431 } 431
432 } 432 CheckAndAddAgentDataFormats(mod);
433 433
434 public void StackModuleInterface<M>(M mod) 434 if (mod is IEntityCreator)
435 { 435 {
436 List<Object> l; 436 IEntityCreator entityCreator = (IEntityCreator)mod;
437 if (ModuleInterfaces.ContainsKey(typeof(M))) 437 foreach (PCode pcode in entityCreator.CreationCapabilities)
438 l = ModuleInterfaces[typeof(M)]; 438 {
439 else 439 m_entityCreators[pcode] = entityCreator;
440 l = new List<Object>(); 440 }
441 441 }
442 if (l.Contains(mod)) 442 }
443 return; 443
444 444 public void UnregisterModuleInterface<M>(M mod)
445 l.Add(mod); 445 {
446 446 // We can't unregister agent stateful modules because
447 if (mod is IEntityCreator) 447 // that would require much more data to be held about formats
448 { 448 // and would make that code slower and less efficient.
449 IEntityCreator entityCreator = (IEntityCreator)mod; 449 // No known modules are unregistered anyway, ever, unless
450 foreach (PCode pcode in entityCreator.CreationCapabilities) 450 // the simulator shuts down anyway.
451 { 451 if (mod is IAgentStatefulModule)
452 m_entityCreators[pcode] = entityCreator; 452 return;
453 } 453
454 } 454 List<Object> l;
455 455 if (ModuleInterfaces.TryGetValue(typeof(M), out l))
456 ModuleInterfaces[typeof(M)] = l; 456 {
457 } 457 if (l.Remove(mod))
458 458 {
459 /// <summary> 459 if (mod is IEntityCreator)
460 /// For the given interface, retrieve the region module which implements it. 460 {
461 /// </summary> 461 IEntityCreator entityCreator = (IEntityCreator)mod;
462 /// <returns>null if there is no registered module implementing that interface</returns> 462 foreach (PCode pcode in entityCreator.CreationCapabilities)
463 public T RequestModuleInterface<T>() 463 {
464 { 464 m_entityCreators[pcode] = null;
465 if (ModuleInterfaces.ContainsKey(typeof(T)) && 465 }
466 (ModuleInterfaces[typeof(T)].Count > 0)) 466 }
467 return (T)ModuleInterfaces[typeof(T)][0]; 467 }
468 else 468 }
469 return default(T); 469 }
470 } 470
471 471 public void StackModuleInterface<M>(M mod)
472 /// <summary> 472 {
473 /// For the given interface, retrieve an array of region modules that implement it. 473 List<Object> l;
474 /// </summary> 474 if (ModuleInterfaces.ContainsKey(typeof(M)))
475 /// <returns>an empty array if there are no registered modules implementing that interface</returns> 475 l = ModuleInterfaces[typeof(M)];
476 public T[] RequestModuleInterfaces<T>() 476 else
477 { 477 l = new List<Object>();
478 if (ModuleInterfaces.ContainsKey(typeof(T))) 478
479 { 479 if (l.Contains(mod))
480 List<T> ret = new List<T>(); 480 return;
481 481
482 foreach (Object o in ModuleInterfaces[typeof(T)]) 482 l.Add(mod);
483 ret.Add((T)o); 483
484 return ret.ToArray(); 484 CheckAndAddAgentDataFormats(mod);
485 } 485
486 else 486 if (mod is IEntityCreator)
487 { 487 {
488 return new T[] {}; 488 IEntityCreator entityCreator = (IEntityCreator)mod;
489 } 489 foreach (PCode pcode in entityCreator.CreationCapabilities)
490 } 490 {
491 491 m_entityCreators[pcode] = entityCreator;
492 #endregion 492 }
493 493 }
494 /// <summary> 494
495 /// Call this from a region module to add a command to the OpenSim console. 495 ModuleInterfaces[typeof(M)] = l;
496 /// </summary> 496 }
497 /// <param name="mod"></param> 497
498 /// <param name="command"></param> 498 /// <summary>
499 /// <param name="shorthelp"></param> 499 /// For the given interface, retrieve the region module which implements it.
500 /// <param name="longhelp"></param> 500 /// </summary>
501 /// <param name="callback"></param> 501 /// <returns>null if there is no registered module implementing that interface</returns>
502 public void AddCommand(IRegionModuleBase module, string command, string shorthelp, string longhelp, CommandDelegate callback) 502 public T RequestModuleInterface<T>()
503 { 503 {
504 AddCommand(module, command, shorthelp, longhelp, string.Empty, callback); 504 if (ModuleInterfaces.ContainsKey(typeof(T)) &&
505 } 505 (ModuleInterfaces[typeof(T)].Count > 0))
506 506 return (T)ModuleInterfaces[typeof(T)][0];
507 /// <summary> 507 else
508 /// Call this from a region module to add a command to the OpenSim console. 508 return default(T);
509 /// </summary> 509 }
510 /// <param name="mod"> 510
511 /// The use of IRegionModuleBase is a cheap trick to get a different method signature, 511 /// <summary>
512 /// though all new modules should be using interfaces descended from IRegionModuleBase anyway. 512 /// For the given interface, retrieve an array of region modules that implement it.
513 /// </param> 513 /// </summary>
514 /// <param name="category"> 514 /// <returns>an empty array if there are no registered modules implementing that interface</returns>
515 /// Category of the command. This is the section under which it will appear when the user asks for help 515 public T[] RequestModuleInterfaces<T>()
516 /// </param> 516 {
517 /// <param name="command"></param> 517 if (ModuleInterfaces.ContainsKey(typeof(T)))
518 /// <param name="shorthelp"></param> 518 {
519 /// <param name="longhelp"></param> 519 List<T> ret = new List<T>();
520 /// <param name="callback"></param> 520
521 public void AddCommand( 521 foreach (Object o in ModuleInterfaces[typeof(T)])
522 string category, IRegionModuleBase module, string command, string shorthelp, string longhelp, CommandDelegate callback) 522 ret.Add((T)o);
523 { 523 return ret.ToArray();
524 AddCommand(category, module, command, shorthelp, longhelp, string.Empty, callback); 524 }
525 } 525 else
526 526 {
527 /// <summary> 527 return new T[] {};
528 /// Call this from a region module to add a command to the OpenSim console. 528 }
529 /// </summary> 529 }
530 /// <param name="mod"></param> 530
531 /// <param name="command"></param> 531 #endregion
532 /// <param name="shorthelp"></param> 532
533 /// <param name="longhelp"></param> 533 /// <summary>
534 /// <param name="descriptivehelp"></param> 534 /// Call this from a region module to add a command to the OpenSim console.
535 /// <param name="callback"></param> 535 /// </summary>
536 public void AddCommand(IRegionModuleBase module, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) 536 /// <param name="mod"></param>
537 { 537 /// <param name="command"></param>
538 string moduleName = ""; 538 /// <param name="shorthelp"></param>
539 539 /// <param name="longhelp"></param>
540 if (module != null) 540 /// <param name="callback"></param>
541 moduleName = module.Name; 541 public void AddCommand(IRegionModuleBase module, string command, string shorthelp, string longhelp, CommandDelegate callback)
542 542 {
543 AddCommand(moduleName, module, command, shorthelp, longhelp, descriptivehelp, callback); 543 AddCommand(module, command, shorthelp, longhelp, string.Empty, callback);
544 } 544 }
545 545
546 /// <summary> 546 /// <summary>
547 /// Call this from a region module to add a command to the OpenSim console. 547 /// Call this from a region module to add a command to the OpenSim console.
548 /// </summary> 548 /// </summary>
549 /// <param name="category"> 549 /// <param name="mod">
550 /// Category of the command. This is the section under which it will appear when the user asks for help 550 /// The use of IRegionModuleBase is a cheap trick to get a different method signature,
551 /// </param> 551 /// though all new modules should be using interfaces descended from IRegionModuleBase anyway.
552 /// <param name="mod"></param> 552 /// </param>
553 /// <param name="command"></param> 553 /// <param name="category">
554 /// <param name="shorthelp"></param> 554 /// Category of the command. This is the section under which it will appear when the user asks for help
555 /// <param name="longhelp"></param> 555 /// </param>
556 /// <param name="descriptivehelp"></param> 556 /// <param name="command"></param>
557 /// <param name="callback"></param> 557 /// <param name="shorthelp"></param>
558 public void AddCommand( 558 /// <param name="longhelp"></param>
559 string category, IRegionModuleBase module, string command, 559 /// <param name="callback"></param>
560 string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) 560 public void AddCommand(
561 { 561 string category, IRegionModuleBase module, string command, string shorthelp, string longhelp, CommandDelegate callback)
562 if (MainConsole.Instance == null) 562 {
563 return; 563 AddCommand(category, module, command, shorthelp, longhelp, string.Empty, callback);
564 564 }
565 bool shared = false; 565
566 566 /// <summary>
567 if (module != null) 567 /// Call this from a region module to add a command to the OpenSim console.
568 shared = module is ISharedRegionModule; 568 /// </summary>
569 569 /// <param name="mod"></param>
570 MainConsole.Instance.Commands.AddCommand( 570 /// <param name="command"></param>
571 category, shared, command, shorthelp, longhelp, descriptivehelp, callback); 571 /// <param name="shorthelp"></param>
572 } 572 /// <param name="longhelp"></param>
573 573 /// <param name="descriptivehelp"></param>
574 public virtual ISceneObject DeserializeObject(string representation) 574 /// <param name="callback"></param>
575 { 575 public void AddCommand(IRegionModuleBase module, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback)
576 return null; 576 {
577 } 577 string moduleName = "";
578 578
579 public virtual bool AllowScriptCrossings 579 if (module != null)
580 { 580 moduleName = module.Name;
581 get { return false; } 581
582 } 582 AddCommand(moduleName, module, command, shorthelp, longhelp, descriptivehelp, callback);
583 583 }
584 public virtual void Start() 584
585 { 585 /// <summary>
586 } 586 /// Call this from a region module to add a command to the OpenSim console.
587 587 /// </summary>
588 public void Restart() 588 /// <param name="category">
589 { 589 /// Category of the command. This is the section under which it will appear when the user asks for help
590 // This has to be here to fire the event 590 /// </param>
591 restart handlerPhysicsCrash = OnRestart; 591 /// <param name="mod"></param>
592 if (handlerPhysicsCrash != null) 592 /// <param name="command"></param>
593 handlerPhysicsCrash(RegionInfo); 593 /// <param name="shorthelp"></param>
594 } 594 /// <param name="longhelp"></param>
595 595 /// <param name="descriptivehelp"></param>
596 public abstract bool CheckClient(UUID agentID, System.Net.IPEndPoint ep); 596 /// <param name="callback"></param>
597 } 597 public void AddCommand(
598} 598 string category, IRegionModuleBase module, string command,
599 string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback)
600 {
601 if (MainConsole.Instance == null)
602 return;
603
604 bool shared = false;
605
606 if (module != null)
607 shared = module is ISharedRegionModule;
608
609 MainConsole.Instance.Commands.AddCommand(
610 category, shared, command, shorthelp, longhelp, descriptivehelp, callback);
611 }
612
613 public virtual ISceneObject DeserializeObject(string representation)
614 {
615 return null;
616 }
617
618 public virtual bool AllowScriptCrossings
619 {
620 get { return false; }
621 }
622
623 public virtual void Start()
624 {
625 }
626
627 public void Restart()
628 {
629 // This has to be here to fire the event
630 restart handlerPhysicsCrash = OnRestart;
631 if (handlerPhysicsCrash != null)
632 handlerPhysicsCrash(RegionInfo);
633 }
634
635 public abstract bool CheckClient(UUID agentID, System.Net.IPEndPoint ep);
636 }
637}
638=======
639/*
640 * Copyright (c) Contributors, http://opensimulator.org/
641 * See CONTRIBUTORS.TXT for a full list of copyright holders.
642 *
643 * Redistribution and use in source and binary forms, with or without
644 * modification, are permitted provided that the following conditions are met:
645 * * Redistributions of source code must retain the above copyright
646 * notice, this list of conditions and the following disclaimer.
647 * * Redistributions in binary form must reproduce the above copyright
648 * notice, this list of conditions and the following disclaimer in the
649 * documentation and/or other materials provided with the distribution.
650 * * Neither the name of the OpenSimulator Project nor the
651 * names of its contributors may be used to endorse or promote products
652 * derived from this software without specific prior written permission.
653 *
654 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
655 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
656 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
657 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
658 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
659 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
660 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
661 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
662 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
663 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
664 */
665
666using System;
667using System.Collections.Generic;
668using System.Reflection;
669using System.Threading;
670using OpenMetaverse;
671using log4net;
672using Nini.Config;
673using OpenSim.Framework;
674using OpenSim.Framework.Console;
675
676using OpenSim.Region.Framework.Interfaces;
677using GridRegion = OpenSim.Services.Interfaces.GridRegion;
678
679namespace OpenSim.Region.Framework.Scenes
680{
681 public abstract class SceneBase : IScene
682 {
683 protected static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
684 protected static readonly string LogHeader = "[SCENE]";
685
686 #region Events
687
688 public event restart OnRestart;
689
690 #endregion
691
692 #region Fields
693
694 public string Name { get { return RegionInfo.RegionName; } }
695
696 public IConfigSource Config
697 {
698 get { return GetConfig(); }
699 }
700
701 protected virtual IConfigSource GetConfig()
702 {
703 return null;
704 }
705
706 /// <value>
707 /// All the region modules attached to this scene.
708 /// </value>
709 public Dictionary<string, IRegionModuleBase> RegionModules
710 {
711 get { return m_regionModules; }
712 }
713 private Dictionary<string, IRegionModuleBase> m_regionModules = new Dictionary<string, IRegionModuleBase>();
714
715 /// <value>
716 /// The module interfaces available from this scene.
717 /// </value>
718 protected Dictionary<Type, List<object>> ModuleInterfaces = new Dictionary<Type, List<object>>();
719
720 protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>();
721
722 /// <value>
723 /// The module commanders available from this scene
724 /// </value>
725 protected Dictionary<string, ICommander> m_moduleCommanders = new Dictionary<string, ICommander>();
726
727 /// <value>
728 /// Registered classes that are capable of creating entities.
729 /// </value>
730 protected Dictionary<PCode, IEntityCreator> m_entityCreators = new Dictionary<PCode, IEntityCreator>();
731
732 /// <summary>
733 /// The last allocated local prim id. When a new local id is requested, the next number in the sequence is
734 /// dispensed.
735 /// </summary>
736 protected uint m_lastAllocatedLocalId = 720000;
737
738 private readonly Mutex _primAllocateMutex = new Mutex(false);
739
740 protected readonly ClientManager m_clientManager = new ClientManager();
741
742 public bool LoginsEnabled
743 {
744 get
745 {
746 return m_loginsEnabled;
747 }
748
749 set
750 {
751 if (m_loginsEnabled != value)
752 {
753 m_loginsEnabled = value;
754 EventManager.TriggerRegionLoginsStatusChange(this);
755 }
756 }
757 }
758 private bool m_loginsEnabled;
759
760 public bool Ready
761 {
762 get
763 {
764 return m_ready;
765 }
766
767 set
768 {
769 if (m_ready != value)
770 {
771 m_ready = value;
772 EventManager.TriggerRegionReadyStatusChange(this);
773 }
774 }
775 }
776 private bool m_ready;
777
778 public float TimeDilation
779 {
780 get { return 1.0f; }
781 }
782
783 protected ulong m_regionHandle;
784 protected string m_regionName;
785
786 public ITerrainChannel Heightmap;
787
788 /// <value>
789 /// Allows retrieval of land information for this scene.
790 /// </value>
791 public ILandChannel LandChannel;
792
793 /// <value>
794 /// Manage events that occur in this scene (avatar movement, script rez, etc.). Commonly used by region modules
795 /// to subscribe to scene events.
796 /// </value>
797 public EventManager EventManager
798 {
799 get { return m_eventManager; }
800 }
801 protected EventManager m_eventManager;
802
803 protected ScenePermissions m_permissions;
804 public ScenePermissions Permissions
805 {
806 get { return m_permissions; }
807 }
808
809 protected string m_datastore;
810
811 /* Used by the loadbalancer plugin on GForge */
812 protected RegionStatus m_regStatus;
813 public RegionStatus RegionStatus
814 {
815 get { return m_regStatus; }
816 set { m_regStatus = value; }
817 }
818
819 #endregion
820
821 public SceneBase(RegionInfo regInfo)
822 {
823 RegionInfo = regInfo;
824 }
825
826 #region Update Methods
827
828 /// <summary>
829 /// Called to update the scene loop by a number of frames and until shutdown.
830 /// </summary>
831 /// <param name="frames">
832 /// Number of frames to update. Exits on shutdown even if there are frames remaining.
833 /// If -1 then updates until shutdown.
834 /// </param>
835 public abstract void Update(int frames);
836
837 #endregion
838
839 #region Terrain Methods
840
841 /// <summary>
842 /// Loads the World heightmap
843 /// </summary>
844 public abstract void LoadWorldMap();
845
846 /// <summary>
847 /// Send the region heightmap to the client
848 /// </summary>
849 /// <param name="RemoteClient">Client to send to</param>
850 public virtual void SendLayerData(IClientAPI RemoteClient)
851 {
852// RemoteClient.SendLayerData(Heightmap.GetFloatsSerialised());
853 ITerrainModule terrModule = RequestModuleInterface<ITerrainModule>();
854 if (terrModule != null)
855 {
856 terrModule.PushTerrain(RemoteClient);
857 }
858 }
859
860 #endregion
861
862 #region Add/Remove Agent/Avatar
863
864 public abstract ISceneAgent AddNewAgent(IClientAPI client, PresenceType type);
865
866 public abstract bool CloseAgent(UUID agentID, bool force);
867
868 public bool TryGetScenePresence(UUID agentID, out object scenePresence)
869 {
870 scenePresence = null;
871 ScenePresence sp = null;
872 if (TryGetScenePresence(agentID, out sp))
873 {
874 scenePresence = sp;
875 return true;
876 }
877
878 return false;
879 }
880
881 /// <summary>
882 /// Try to get a scene presence from the scene
883 /// </summary>
884 /// <param name="agentID"></param>
885 /// <param name="scenePresence">null if there is no scene presence with the given agent id</param>
886 /// <returns>true if there was a scene presence with the given id, false otherwise.</returns>
887 public abstract bool TryGetScenePresence(UUID agentID, out ScenePresence scenePresence);
888
889 #endregion
890
891 /// <summary>
892 ///
893 /// </summary>
894 /// <returns></returns>
895 public virtual RegionInfo RegionInfo { get; private set; }
896
897 #region admin stuff
898
899 public abstract void OtherRegionUp(GridRegion otherRegion);
900
901 public virtual string GetSimulatorVersion()
902 {
903 return "OpenSimulator Server";
904 }
905
906 #endregion
907
908 #region Shutdown
909
910 /// <summary>
911 /// Tidy before shutdown
912 /// </summary>
913 public virtual void Close()
914 {
915 try
916 {
917 EventManager.TriggerShutdown();
918 }
919 catch (Exception e)
920 {
921 m_log.Error(string.Format("[SCENE]: SceneBase.cs: Close() - Failed with exception ", e));
922 }
923 }
924
925 #endregion
926
927 /// <summary>
928 /// Returns a new unallocated local ID
929 /// </summary>
930 /// <returns>A brand new local ID</returns>
931 public uint AllocateLocalId()
932 {
933 uint myID;
934
935 _primAllocateMutex.WaitOne();
936 myID = ++m_lastAllocatedLocalId;
937 _primAllocateMutex.ReleaseMutex();
938
939 return myID;
940 }
941
942 public uint AllocatePresenceLocalId()
943 {
944 uint myID;
945
946 _primAllocateMutex.WaitOne();
947 myID = ++m_lastAllocatedLocalId;
948 ++m_lastAllocatedLocalId;
949 _primAllocateMutex.ReleaseMutex();
950
951 return myID;
952 }
953
954 #region Module Methods
955
956 /// <summary>
957 /// Add a region-module to this scene. TODO: This will replace AddModule in the future.
958 /// </summary>
959 /// <param name="name"></param>
960 /// <param name="module"></param>
961 public void AddRegionModule(string name, IRegionModuleBase module)
962 {
963 if (!RegionModules.ContainsKey(name))
964 {
965 RegionModules.Add(name, module);
966 }
967 }
968
969 public void RemoveRegionModule(string name)
970 {
971 RegionModules.Remove(name);
972 }
973
974 /// <summary>
975 /// Register a module commander.
976 /// </summary>
977 /// <param name="commander"></param>
978 public void RegisterModuleCommander(ICommander commander)
979 {
980 lock (m_moduleCommanders)
981 {
982 m_moduleCommanders.Add(commander.Name, commander);
983 }
984 }
985
986 /// <summary>
987 /// Unregister a module commander and all its commands
988 /// </summary>
989 /// <param name="name"></param>
990 public void UnregisterModuleCommander(string name)
991 {
992 lock (m_moduleCommanders)
993 {
994 ICommander commander;
995 if (m_moduleCommanders.TryGetValue(name, out commander))
996 m_moduleCommanders.Remove(name);
997 }
998 }
999
1000 /// <summary>
1001 /// Get a module commander
1002 /// </summary>
1003 /// <param name="name"></param>
1004 /// <returns>The module commander, null if no module commander with that name was found</returns>
1005 public ICommander GetCommander(string name)
1006 {
1007 lock (m_moduleCommanders)
1008 {
1009 if (m_moduleCommanders.ContainsKey(name))
1010 return m_moduleCommanders[name];
1011 }
1012
1013 return null;
1014 }
1015
1016 public Dictionary<string, ICommander> GetCommanders()
1017 {
1018 return m_moduleCommanders;
1019 }
1020
1021 /// <summary>
1022 /// Register an interface to a region module. This allows module methods to be called directly as
1023 /// well as via events. If there is already a module registered for this interface, it is not replaced
1024 /// (is this the best behaviour?)
1025 /// </summary>
1026 /// <param name="mod"></param>
1027 public void RegisterModuleInterface<M>(M mod)
1028 {
1029// m_log.DebugFormat("[SCENE BASE]: Registering interface {0}", typeof(M));
1030
1031 List<Object> l = null;
1032 if (!ModuleInterfaces.TryGetValue(typeof(M), out l))
1033 {
1034 l = new List<Object>();
1035 ModuleInterfaces.Add(typeof(M), l);
1036 }
1037
1038 if (l.Count > 0)
1039 return;
1040
1041 l.Add(mod);
1042
1043 if (mod is IEntityCreator)
1044 {
1045 IEntityCreator entityCreator = (IEntityCreator)mod;
1046 foreach (PCode pcode in entityCreator.CreationCapabilities)
1047 {
1048 m_entityCreators[pcode] = entityCreator;
1049 }
1050 }
1051 }
1052
1053 public void UnregisterModuleInterface<M>(M mod)
1054 {
1055 List<Object> l;
1056 if (ModuleInterfaces.TryGetValue(typeof(M), out l))
1057 {
1058 if (l.Remove(mod))
1059 {
1060 if (mod is IEntityCreator)
1061 {
1062 IEntityCreator entityCreator = (IEntityCreator)mod;
1063 foreach (PCode pcode in entityCreator.CreationCapabilities)
1064 {
1065 m_entityCreators[pcode] = null;
1066 }
1067 }
1068 }
1069 }
1070 }
1071
1072 public void StackModuleInterface<M>(M mod)
1073 {
1074 List<Object> l;
1075 if (ModuleInterfaces.ContainsKey(typeof(M)))
1076 l = ModuleInterfaces[typeof(M)];
1077 else
1078 l = new List<Object>();
1079
1080 if (l.Contains(mod))
1081 return;
1082
1083 l.Add(mod);
1084
1085 if (mod is IEntityCreator)
1086 {
1087 IEntityCreator entityCreator = (IEntityCreator)mod;
1088 foreach (PCode pcode in entityCreator.CreationCapabilities)
1089 {
1090 m_entityCreators[pcode] = entityCreator;
1091 }
1092 }
1093
1094 ModuleInterfaces[typeof(M)] = l;
1095 }
1096
1097 /// <summary>
1098 /// For the given interface, retrieve the region module which implements it.
1099 /// </summary>
1100 /// <returns>null if there is no registered module implementing that interface</returns>
1101 public T RequestModuleInterface<T>()
1102 {
1103 if (ModuleInterfaces.ContainsKey(typeof(T)) &&
1104 (ModuleInterfaces[typeof(T)].Count > 0))
1105 return (T)ModuleInterfaces[typeof(T)][0];
1106 else
1107 return default(T);
1108 }
1109
1110 /// <summary>
1111 /// For the given interface, retrieve an array of region modules that implement it.
1112 /// </summary>
1113 /// <returns>an empty array if there are no registered modules implementing that interface</returns>
1114 public T[] RequestModuleInterfaces<T>()
1115 {
1116 if (ModuleInterfaces.ContainsKey(typeof(T)))
1117 {
1118 List<T> ret = new List<T>();
1119
1120 foreach (Object o in ModuleInterfaces[typeof(T)])
1121 ret.Add((T)o);
1122 return ret.ToArray();
1123 }
1124 else
1125 {
1126 return new T[] {};
1127 }
1128 }
1129
1130 #endregion
1131
1132 /// <summary>
1133 /// Call this from a region module to add a command to the OpenSim console.
1134 /// </summary>
1135 /// <param name="mod"></param>
1136 /// <param name="command"></param>
1137 /// <param name="shorthelp"></param>
1138 /// <param name="longhelp"></param>
1139 /// <param name="callback"></param>
1140 public void AddCommand(IRegionModuleBase module, string command, string shorthelp, string longhelp, CommandDelegate callback)
1141 {
1142 AddCommand(module, command, shorthelp, longhelp, string.Empty, callback);
1143 }
1144
1145 /// <summary>
1146 /// Call this from a region module to add a command to the OpenSim console.
1147 /// </summary>
1148 /// <param name="mod">
1149 /// The use of IRegionModuleBase is a cheap trick to get a different method signature,
1150 /// though all new modules should be using interfaces descended from IRegionModuleBase anyway.
1151 /// </param>
1152 /// <param name="category">
1153 /// Category of the command. This is the section under which it will appear when the user asks for help
1154 /// </param>
1155 /// <param name="command"></param>
1156 /// <param name="shorthelp"></param>
1157 /// <param name="longhelp"></param>
1158 /// <param name="callback"></param>
1159 public void AddCommand(
1160 string category, IRegionModuleBase module, string command, string shorthelp, string longhelp, CommandDelegate callback)
1161 {
1162 AddCommand(category, module, command, shorthelp, longhelp, string.Empty, callback);
1163 }
1164
1165 /// <summary>
1166 /// Call this from a region module to add a command to the OpenSim console.
1167 /// </summary>
1168 /// <param name="mod"></param>
1169 /// <param name="command"></param>
1170 /// <param name="shorthelp"></param>
1171 /// <param name="longhelp"></param>
1172 /// <param name="descriptivehelp"></param>
1173 /// <param name="callback"></param>
1174 public void AddCommand(IRegionModuleBase module, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback)
1175 {
1176 string moduleName = "";
1177
1178 if (module != null)
1179 moduleName = module.Name;
1180
1181 AddCommand(moduleName, module, command, shorthelp, longhelp, descriptivehelp, callback);
1182 }
1183
1184 /// <summary>
1185 /// Call this from a region module to add a command to the OpenSim console.
1186 /// </summary>
1187 /// <param name="category">
1188 /// Category of the command. This is the section under which it will appear when the user asks for help
1189 /// </param>
1190 /// <param name="mod"></param>
1191 /// <param name="command"></param>
1192 /// <param name="shorthelp"></param>
1193 /// <param name="longhelp"></param>
1194 /// <param name="descriptivehelp"></param>
1195 /// <param name="callback"></param>
1196 public void AddCommand(
1197 string category, IRegionModuleBase module, string command,
1198 string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback)
1199 {
1200 if (MainConsole.Instance == null)
1201 return;
1202
1203 bool shared = false;
1204
1205 if (module != null)
1206 shared = module is ISharedRegionModule;
1207
1208 MainConsole.Instance.Commands.AddCommand(
1209 category, shared, command, shorthelp, longhelp, descriptivehelp, callback);
1210 }
1211
1212 public virtual ISceneObject DeserializeObject(string representation)
1213 {
1214 return null;
1215 }
1216
1217 public virtual bool AllowScriptCrossings
1218 {
1219 get { return false; }
1220 }
1221
1222 public virtual void Start()
1223 {
1224 }
1225
1226 public void Restart()
1227 {
1228 // This has to be here to fire the event
1229 restart handlerPhysicsCrash = OnRestart;
1230 if (handlerPhysicsCrash != null)
1231 handlerPhysicsCrash(RegionInfo);
1232 }
1233
1234 public abstract bool CheckClient(UUID agentID, System.Net.IPEndPoint ep);
1235 }
1236}
1237>>>>>>> avn/ubitvar
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index a2625c4..df7a72a 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -85,15 +85,12 @@ namespace OpenSim.Region.Framework.Scenes
85 if (neighbourService != null) 85 if (neighbourService != null)
86 neighbour = neighbourService.HelloNeighbour(regionhandle, region); 86 neighbour = neighbourService.HelloNeighbour(regionhandle, region);
87 else 87 else
88 m_log.DebugFormat( 88 m_log.DebugFormat( "{0} neighbour service provided for region {0} to inform neigbhours of status", LogHeader, m_scene.Name);
89 "[SCENE COMMUNICATION SERVICE]: No neighbour service provided for region {0} to inform neigbhours of status",
90 m_scene.Name);
91 89
92 if (neighbour != null) 90 if (neighbour != null)
93 { 91 {
94 m_log.DebugFormat( 92 m_log.DebugFormat( "{0} Region {1} successfully informed neighbour {2} at {3}-{4} that it is up",
95 "[SCENE COMMUNICATION SERVICE]: Region {0} successfully informed neighbour {1} at {2}-{3} that it is up", 93 LogHeader, m_scene.Name, neighbour.RegionName, Util.WorldToRegionLoc(x), Util.WorldToRegionLoc(y));
96 m_scene.Name, neighbour.RegionName, x / Constants.RegionSize, y / Constants.RegionSize);
97 94
98 m_scene.EventManager.TriggerOnRegionUp(neighbour); 95 m_scene.EventManager.TriggerOnRegionUp(neighbour);
99 } 96 }
@@ -112,12 +109,35 @@ namespace OpenSim.Region.Framework.Scenes
112 List<GridRegion> neighbours 109 List<GridRegion> neighbours
113 = m_scene.GridService.GetNeighbours(m_scene.RegionInfo.ScopeID, m_scene.RegionInfo.RegionID); 110 = m_scene.GridService.GetNeighbours(m_scene.RegionInfo.ScopeID, m_scene.RegionInfo.RegionID);
114 111
115 m_log.DebugFormat( 112 List<GridRegion> onlineNeighbours = new List<GridRegion>();
116 "[SCENE COMMUNICATION SERVICE]: Informing {0} neighbours that region {1} is up",
117 neighbours.Count, m_scene.Name);
118 113
119 foreach (GridRegion n in neighbours) 114 foreach (GridRegion n in neighbours)
120 { 115 {
116 OpenSim.Framework.RegionFlags? regionFlags = n.RegionFlags;
117
118// m_log.DebugFormat(
119// "{0}: Region flags for {1} as seen by {2} are {3}",
120// LogHeader, n.RegionName, m_scene.Name, regionFlags != null ? regionFlags.ToString() : "not present");
121
122 // Robust services before 2015-01-14 do not return the regionFlags information. In this case, we could
123 // make a separate RegionFlags call but this would involve a network call for each neighbour.
124 if (regionFlags != null)
125 {
126 if ((regionFlags & OpenSim.Framework.RegionFlags.RegionOnline) != 0)
127 onlineNeighbours.Add(n);
128 }
129 else
130 {
131 onlineNeighbours.Add(n);
132 }
133 }
134
135 m_log.DebugFormat(
136 "{0} Informing {1} neighbours that region {2} is up",
137 LogHeader, onlineNeighbours.Count, m_scene.Name);
138
139 foreach (GridRegion n in onlineNeighbours)
140 {
121 InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync; 141 InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;
122 d.BeginInvoke(neighbourService, region, n.RegionHandle, 142 d.BeginInvoke(neighbourService, region, n.RegionHandle,
123 InformNeighborsThatRegionisUpCompleted, 143 InformNeighborsThatRegionisUpCompleted,
@@ -155,6 +175,10 @@ namespace OpenSim.Region.Framework.Scenes
155 175
156 public void SendChildAgentDataUpdate(AgentPosition cAgentData, ScenePresence presence) 176 public void SendChildAgentDataUpdate(AgentPosition cAgentData, ScenePresence presence)
157 { 177 {
178// m_log.DebugFormat(
179// "[SCENE COMMUNICATION SERVICE]: Sending child agent position updates for {0} in {1}",
180// presence.Name, m_scene.Name);
181
158 // This assumes that we know what our neighbors are. 182 // This assumes that we know what our neighbors are.
159 try 183 try
160 { 184 {
@@ -230,7 +254,10 @@ namespace OpenSim.Region.Framework.Scenes
230 // We must take a copy here since handle acts like a reference when used in an iterator. 254 // We must take a copy here since handle acts like a reference when used in an iterator.
231 // This leads to race conditions if directly passed to SendCloseChildAgent with more than one neighbour region. 255 // This leads to race conditions if directly passed to SendCloseChildAgent with more than one neighbour region.
232 ulong handleCopy = handle; 256 ulong handleCopy = handle;
233 Util.FireAndForget((o) => { SendCloseChildAgent(agentID, handleCopy, auth_code); }); 257 Util.FireAndForget(
258 o => SendCloseChildAgent(agentID, handleCopy, auth_code),
259 null,
260 "SceneCommunicationService.SendCloseChildAgentConnections");
234 } 261 }
235 } 262 }
236 263
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 92ce411..3f6a7f8 100644..100755
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -77,7 +77,9 @@ namespace OpenSim.Region.Framework.Scenes
77 protected Scene m_parentScene; 77 protected Scene m_parentScene;
78 protected Dictionary<UUID, SceneObjectGroup> m_updateList = new Dictionary<UUID, SceneObjectGroup>(); 78 protected Dictionary<UUID, SceneObjectGroup> m_updateList = new Dictionary<UUID, SceneObjectGroup>();
79 protected int m_numRootAgents = 0; 79 protected int m_numRootAgents = 0;
80 protected int m_numTotalPrim = 0;
80 protected int m_numPrim = 0; 81 protected int m_numPrim = 0;
82 protected int m_numMesh = 0;
81 protected int m_numChildAgents = 0; 83 protected int m_numChildAgents = 0;
82 protected int m_physicalPrim = 0; 84 protected int m_physicalPrim = 0;
83 85
@@ -432,7 +434,8 @@ namespace OpenSim.Region.Framework.Scenes
432 434
433 SceneObjectPart[] parts = sceneObject.Parts; 435 SceneObjectPart[] parts = sceneObject.Parts;
434 436
435 // Clamp child prim sizes and add child prims to the m_numPrim count 437 // Clamp the sizes (scales) of the child prims and add the child prims to the count of all primitives
438 // (meshes and geometric primitives) in the scene; add child prims to m_numTotalPrim count
436 if (m_parentScene.m_clampPrimSize) 439 if (m_parentScene.m_clampPrimSize)
437 { 440 {
438 foreach (SceneObjectPart part in parts) 441 foreach (SceneObjectPart part in parts)
@@ -446,7 +449,19 @@ namespace OpenSim.Region.Framework.Scenes
446 part.Shape.Scale = scale; 449 part.Shape.Scale = scale;
447 } 450 }
448 } 451 }
449 m_numPrim += parts.Length; 452 m_numTotalPrim += parts.Length;
453
454 // Go through all parts (geometric primitives and meshes) of this Scene Object
455 foreach (SceneObjectPart part in parts)
456 {
457 // Keep track of the total number of meshes or geometric primitives now in the scene;
458 // determine which object this is based on its primitive type: sculpted (sculpt) prim refers to
459 // a mesh and all other prims (i.e. box, sphere, etc) are geometric primitives
460 if (part.GetPrimType() == PrimType.SCULPT)
461 m_numMesh++;
462 else
463 m_numPrim++;
464 }
450 465
451 sceneObject.AttachToScene(m_parentScene); 466 sceneObject.AttachToScene(m_parentScene);
452 467
@@ -504,7 +519,21 @@ namespace OpenSim.Region.Framework.Scenes
504 519
505 if (!resultOfObjectLinked) 520 if (!resultOfObjectLinked)
506 { 521 {
507 m_numPrim -= grp.PrimCount; 522 // Decrement the total number of primitives (meshes and geometric primitives)
523 // that are part of the Scene Object being removed
524 m_numTotalPrim -= grp.PrimCount;
525
526 // Go through all parts (primitives and meshes) of this Scene Object
527 foreach (SceneObjectPart part in grp.Parts)
528 {
529 // Keep track of the total number of meshes or geometric primitives left in the scene;
530 // determine which object this is based on its primitive type: sculpted (sculpt) prim refers to
531 // a mesh and all other prims (i.e. box, sphere, etc) are geometric primitives
532 if (part.GetPrimType() == PrimType.SCULPT)
533 m_numMesh--;
534 else
535 m_numPrim--;
536 }
508 537
509 if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) 538 if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
510 RemovePhysicalPrim(grp.PrimCount); 539 RemovePhysicalPrim(grp.PrimCount);
@@ -786,9 +815,19 @@ namespace OpenSim.Region.Framework.Scenes
786 815
787 public int GetTotalObjectsCount() 816 public int GetTotalObjectsCount()
788 { 817 {
818 return m_numTotalPrim;
819 }
820
821 public int GetTotalPrimObjectsCount()
822 {
789 return m_numPrim; 823 return m_numPrim;
790 } 824 }
791 825
826 public int GetTotalMeshObjectsCount()
827 {
828 return m_numMesh;
829 }
830
792 public int GetActiveObjectsCount() 831 public int GetActiveObjectsCount()
793 { 832 {
794 return m_physicalPrim; 833 return m_physicalPrim;
@@ -871,7 +910,8 @@ namespace OpenSim.Region.Framework.Scenes
871 List<ScenePresence> presences = GetScenePresences(); 910 List<ScenePresence> presences = GetScenePresences();
872 foreach (ScenePresence presence in presences) 911 foreach (ScenePresence presence in presences)
873 { 912 {
874 if (presence.Firstname == firstName && presence.Lastname == lastName) 913 if (string.Equals(presence.Firstname, firstName, StringComparison.CurrentCultureIgnoreCase)
914 && string.Equals(presence.Lastname, lastName, StringComparison.CurrentCultureIgnoreCase))
875 return presence; 915 return presence;
876 } 916 }
877 return null; 917 return null;
@@ -1491,12 +1531,23 @@ namespace OpenSim.Region.Framework.Scenes
1491 /// <summary> 1531 /// <summary>
1492 /// Update the position of the given group. 1532 /// Update the position of the given group.
1493 /// </summary> 1533 /// </summary>
1494 /// <param name="localID"></param> 1534 /// <param name="localId"></param>
1495 /// <param name="pos"></param> 1535 /// <param name="pos"></param>
1496 /// <param name="remoteClient"></param> 1536 /// <param name="remoteClient"></param>
1497 public void UpdatePrimGroupPosition(uint localID, Vector3 pos, IClientAPI remoteClient) 1537 public void UpdatePrimGroupPosition(uint localId, Vector3 pos, IClientAPI remoteClient)
1498 { 1538 {
1499 SceneObjectGroup group = GetGroupByPrim(localID); 1539 UpdatePrimGroupPosition(localId, pos, remoteClient.AgentId);
1540 }
1541
1542 /// <summary>
1543 /// Update the position of the given group.
1544 /// </summary>
1545 /// <param name="localId"></param>
1546 /// <param name="pos"></param>
1547 /// <param name="updatingAgentId"></param>
1548 public void UpdatePrimGroupPosition(uint localId, Vector3 pos, UUID updatingAgentId)
1549 {
1550 SceneObjectGroup group = GetGroupByPrim(localId);
1500 1551
1501 if (group != null) 1552 if (group != null)
1502 { 1553 {
@@ -1512,7 +1563,7 @@ namespace OpenSim.Region.Framework.Scenes
1512 } 1563 }
1513 else 1564 else
1514 { 1565 {
1515 if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId) 1566 if (m_parentScene.Permissions.CanMoveObject(group.UUID, updatingAgentId)
1516 && m_parentScene.Permissions.CanObjectEntry(group.UUID, false, pos)) 1567 && m_parentScene.Permissions.CanObjectEntry(group.UUID, false, pos))
1517 { 1568 {
1518 group.UpdateGroupPosition(pos); 1569 group.UpdateGroupPosition(pos);
@@ -1612,8 +1663,9 @@ namespace OpenSim.Region.Framework.Scenes
1612 { 1663 {
1613 if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.) 1664 if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.)
1614 { 1665 {
1615 group.GrabMovement(offset, pos, remoteClient); 1666 group.GrabMovement(objectID, offset, pos, remoteClient);
1616 } 1667 }
1668
1617 // This is outside the above permissions condition 1669 // This is outside the above permissions condition
1618 // so that if the object is locked the client moving the object 1670 // so that if the object is locked the client moving the object
1619 // get's it's position on the simulator even if it was the same as before 1671 // get's it's position on the simulator even if it was the same as before
@@ -2102,8 +2154,13 @@ namespace OpenSim.Region.Framework.Scenes
2102 if (m_parentScene.Permissions.CanDuplicateObject( 2154 if (m_parentScene.Permissions.CanDuplicateObject(
2103 original.PrimCount, original.UUID, AgentID, original.AbsolutePosition)) 2155 original.PrimCount, original.UUID, AgentID, original.AbsolutePosition))
2104 { 2156 {
2157<<<<<<< HEAD
2158 m_log.WarnFormat(
2159 "[SCENEGRAPH]: Attempt to duplicate nonexistent prim id {0} by {1}", originalPrimID, AgentID);
2160=======
2105 SceneObjectGroup copy = original.Copy(true); 2161 SceneObjectGroup copy = original.Copy(true);
2106 copy.AbsolutePosition = copy.AbsolutePosition + offset; 2162 copy.AbsolutePosition = copy.AbsolutePosition + offset;
2163>>>>>>> avn/ubitvar
2107 2164
2108 if (original.OwnerID != AgentID) 2165 if (original.OwnerID != AgentID)
2109 { 2166 {
@@ -2140,12 +2197,63 @@ namespace OpenSim.Region.Framework.Scenes
2140 2197
2141 // PROBABLE END OF FIXME 2198 // PROBABLE END OF FIXME
2142 2199
2200<<<<<<< HEAD
2201 // FIXME: This section needs to be refactored so that it just calls AddSceneObject()
2202 Entities.Add(copy);
2203
2204 lock (SceneObjectGroupsByFullID)
2205 SceneObjectGroupsByFullID[copy.UUID] = copy;
2206
2207 SceneObjectPart[] children = copy.Parts;
2208
2209 lock (SceneObjectGroupsByFullPartID)
2210 {
2211 SceneObjectGroupsByFullPartID[copy.UUID] = copy;
2212 foreach (SceneObjectPart part in children)
2213 SceneObjectGroupsByFullPartID[part.UUID] = copy;
2214 }
2215
2216 lock (SceneObjectGroupsByLocalPartID)
2217 {
2218 SceneObjectGroupsByLocalPartID[copy.LocalId] = copy;
2219 foreach (SceneObjectPart part in children)
2220 SceneObjectGroupsByLocalPartID[part.LocalId] = copy;
2221 }
2222 // PROBABLE END OF FIXME
2223
2224 // Since we copy from a source group that is in selected
2225 // state, but the copy is shown deselected in the viewer,
2226 // We need to clear the selection flag here, else that
2227 // prim never gets persisted at all. The client doesn't
2228 // think it's selected, so it will never send a deselect...
2229 copy.IsSelected = false;
2230
2231 m_numTotalPrim += copy.Parts.Length;
2232
2233 // Go through all parts (primitives and meshes) of this Scene Object
2234 foreach (SceneObjectPart part in copy.Parts)
2235 {
2236 // Keep track of the total number of meshes or geometric primitives now in the scene;
2237 // determine which object this is based on its primitive type: sculpted (sculpt) prim refers to
2238 // a mesh and all other prims (i.e. box, sphere, etc) are geometric primitives
2239 if (part.GetPrimType() == PrimType.SCULPT)
2240 m_numMesh++;
2241 else
2242 m_numPrim++;
2243 }
2244
2245 if (rot != Quaternion.Identity)
2246 {
2247 copy.UpdateGroupRotationR(rot);
2248 }
2249=======
2143 // Since we copy from a source group that is in selected 2250 // Since we copy from a source group that is in selected
2144 // state, but the copy is shown deselected in the viewer, 2251 // state, but the copy is shown deselected in the viewer,
2145 // We need to clear the selection flag here, else that 2252 // We need to clear the selection flag here, else that
2146 // prim never gets persisted at all. The client doesn't 2253 // prim never gets persisted at all. The client doesn't
2147 // think it's selected, so it will never send a deselect... 2254 // think it's selected, so it will never send a deselect...
2148 copy.IsSelected = false; 2255 copy.IsSelected = false;
2256>>>>>>> avn/ubitvar
2149 2257
2150 m_numPrim += copy.Parts.Length; 2258 m_numPrim += copy.Parts.Length;
2151 2259
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index 8c50a81..79de6c0 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -266,10 +266,15 @@ namespace OpenSim.Region.Framework.Scenes
266 for (int i = 0; i < parts.Length; i++) 266 for (int i = 0; i < parts.Length; i++)
267 { 267 {
268 SceneObjectPart part = parts[i]; 268 SceneObjectPart part = parts[i];
269<<<<<<< HEAD
270// m_log.DebugFormat("[SCENE OBJECT GROUP INVENTORY]: Effective perms of {0} are {1}", part.Name, (OpenMetaverse.PermissionMask)part.OwnerMask);
271 ownerMask &= part.OwnerMask;
272=======
269 if (useBase) 273 if (useBase)
270 ownerMask &= part.BaseMask; 274 ownerMask &= part.BaseMask;
271 else 275 else
272 ownerMask &= part.OwnerMask; 276 ownerMask &= part.OwnerMask;
277>>>>>>> avn/ubitvar
273 perms &= part.Inventory.MaskEffectivePermissions(); 278 perms &= part.Inventory.MaskEffectivePermissions();
274 } 279 }
275 280
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 1bb5854..a703377 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -77,6 +77,7 @@ namespace OpenSim.Region.Framework.Scenes
77 touch = 8, 77 touch = 8,
78 touch_end = 536870912, 78 touch_end = 536870912,
79 touch_start = 2097152, 79 touch_start = 2097152,
80 transaction_result = 33554432,
80 object_rez = 4194304 81 object_rez = 4194304
81 } 82 }
82 83
@@ -121,12 +122,17 @@ namespace OpenSim.Region.Framework.Scenes
121 /// since the group's last persistent backup 122 /// since the group's last persistent backup
122 /// </summary> 123 /// </summary>
123 private bool m_hasGroupChanged = false; 124 private bool m_hasGroupChanged = false;
125<<<<<<< HEAD
126 private long timeFirstChanged;
127 private long timeLastChanged;
128=======
124 private long timeFirstChanged = 0; 129 private long timeFirstChanged = 0;
125 private long timeLastChanged = 0; 130 private long timeLastChanged = 0;
126 private long m_maxPersistTime = 0; 131 private long m_maxPersistTime = 0;
127 private long m_minPersistTime = 0; 132 private long m_minPersistTime = 0;
128// private Random m_rand; 133// private Random m_rand;
129 private List<ScenePresence> m_linkedAvatars = new List<ScenePresence>(); 134 private List<ScenePresence> m_linkedAvatars = new List<ScenePresence>();
135>>>>>>> avn/ubitvar
130 136
131 /// <summary> 137 /// <summary>
132 /// This indicates whether the object has changed such that it needs to be repersisted to permenant storage 138 /// This indicates whether the object has changed such that it needs to be repersisted to permenant storage
@@ -190,12 +196,31 @@ namespace OpenSim.Region.Framework.Scenes
190 196
191 get { return m_hasGroupChanged; } 197 get { return m_hasGroupChanged; }
192 } 198 }
199
200 private bool m_groupContainsForeignPrims = false;
193 201
194 /// <summary> 202 /// <summary>
195 /// Has the group changed due to an unlink operation? We record this in order to optimize deletion, since 203 /// Whether the group contains prims that came from a different group. This happens when
196 /// an unlinked group currently has to be persisted to the database before we can perform an unlink operation. 204 /// linking or delinking groups. The implication is that until the group is persisted,
205 /// the prims in the database still use the old SceneGroupID. That's a problem if the group
206 /// is deleted, because we delete groups by searching for prims by their SceneGroupID.
197 /// </summary> 207 /// </summary>
208<<<<<<< HEAD
209 public bool GroupContainsForeignPrims
210 {
211 private set
212 {
213 m_groupContainsForeignPrims = value;
214 if (m_groupContainsForeignPrims)
215 HasGroupChanged = true;
216 }
217
218 get { return m_groupContainsForeignPrims; }
219 }
220
221=======
198 public bool HasGroupChangedDueToDelink { get; set; } 222 public bool HasGroupChangedDueToDelink { get; set; }
223>>>>>>> avn/ubitvar
199 224
200 private bool isTimeToPersist() 225 private bool isTimeToPersist()
201 { 226 {
@@ -325,7 +350,17 @@ namespace OpenSim.Region.Framework.Scenes
325 get { return RootPart.VolumeDetectActive; } 350 get { return RootPart.VolumeDetectActive; }
326 } 351 }
327 352
353<<<<<<< HEAD
354 private Vector3 lastPhysGroupPos;
355 private Quaternion lastPhysGroupRot;
356
357 /// <summary>
358 /// Is this entity set to be saved in persistent storage?
359 /// </summary>
360 public bool Backup { get; private set; }
361=======
328 private bool m_isBackedUp; 362 private bool m_isBackedUp;
363>>>>>>> avn/ubitvar
329 364
330 public bool IsBackedUp 365 public bool IsBackedUp
331 { 366 {
@@ -507,7 +542,7 @@ namespace OpenSim.Region.Framework.Scenes
507 /// <returns></returns> 542 /// <returns></returns>
508 public bool IsAttachmentCheckFull() 543 public bool IsAttachmentCheckFull()
509 { 544 {
510 return (IsAttachment || (m_rootPart.Shape.PCode == 9 && m_rootPart.Shape.State != 0)); 545 return (IsAttachment || (m_rootPart.Shape.PCode == (byte)PCodeEnum.Primitive && m_rootPart.Shape.State != 0));
511 } 546 }
512 547
513 private struct avtocrossInfo 548 private struct avtocrossInfo
@@ -535,11 +570,146 @@ namespace OpenSim.Region.Framework.Scenes
535 && !Scene.LoadingPrims 570 && !Scene.LoadingPrims
536 ) 571 )
537 { 572 {
573<<<<<<< HEAD
574 if (
575 !Scene.PositionIsInCurrentRegion(val)
576 && !IsAttachmentCheckFull()
577 && (!Scene.LoadingPrims)
578 )
579 {
580 IEntityTransferModule entityTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
581 string version = String.Empty;
582 Vector3 newpos = Vector3.Zero;
583 string failureReason = String.Empty;
584 OpenSim.Services.Interfaces.GridRegion destination = null;
585
586 if (m_rootPart.KeyframeMotion != null)
587 m_rootPart.KeyframeMotion.StartCrossingCheck();
588
589 bool canCross = true;
590 foreach (ScenePresence av in GetSittingAvatars())
591 {
592 // We need to cross these agents. First, let's find
593 // out if any of them can't cross for some reason.
594 // We have to deny the crossing entirely if any
595 // of them are banned. Alternatively, we could
596 // unsit banned agents....
597
598
599 // We set the avatar position as being the object
600 // position to get the region to send to
601 if ((destination = entityTransfer.GetDestination(m_scene, av.UUID, val, out version, out newpos, out failureReason)) == null)
602 {
603 canCross = false;
604 break;
605 }
606
607 m_log.DebugFormat("[SCENE OBJECT]: Avatar {0} needs to be crossed to {1}", av.Name, destination.RegionName);
608 }
609
610 if (canCross)
611 {
612 // We unparent the SP quietly so that it won't
613 // be made to stand up
614
615 List<avtocrossInfo> avsToCross = new List<avtocrossInfo>();
616
617 foreach (ScenePresence av in GetSittingAvatars())
618 {
619 avtocrossInfo avinfo = new avtocrossInfo();
620 SceneObjectPart parentPart = m_scene.GetSceneObjectPart(av.ParentID);
621 if (parentPart != null)
622 av.ParentUUID = parentPart.UUID;
623
624 avinfo.av = av;
625 avinfo.ParentID = av.ParentID;
626 avsToCross.Add(avinfo);
627
628 av.PrevSitOffset = av.OffsetPosition;
629 av.ParentID = 0;
630 }
631
632 m_scene.CrossPrimGroupIntoNewRegion(val, this, true);
633
634 // Normalize
635 if (val.X >= m_scene.RegionInfo.RegionSizeX)
636 val.X -= m_scene.RegionInfo.RegionSizeX;
637 if (val.Y >= m_scene.RegionInfo.RegionSizeY)
638 val.Y -= m_scene.RegionInfo.RegionSizeY;
639 if (val.X < 0)
640 val.X += m_scene.RegionInfo.RegionSizeX;
641 if (val.Y < 0)
642 val.Y += m_scene.RegionInfo.RegionSizeY;
643
644 // If it's deleted, crossing was successful
645 if (IsDeleted)
646 {
647 foreach (avtocrossInfo avinfo in avsToCross)
648 {
649 ScenePresence av = avinfo.av;
650 if (!av.IsInTransit) // just in case...
651 {
652 m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val);
653
654 av.IsInTransit = true;
655
656 // A temporary measure to allow regression tests to work.
657 // Quite possibly, all BeginInvoke() calls should be replaced by Util.FireAndForget
658 // or similar since BeginInvoke() always uses the system threadpool to launch
659 // threads rather than any replace threadpool that we might be using.
660 if (Util.FireAndForgetMethod == FireAndForgetMethod.RegressionTest)
661 {
662 entityTransfer.CrossAgentToNewRegionAsync(av, val, destination, av.Flying, version);
663 CrossAgentToNewRegionCompleted(av);
664 }
665 else
666 {
667 CrossAgentToNewRegionDelegate d = entityTransfer.CrossAgentToNewRegionAsync;
668 d.BeginInvoke(
669 av, val, destination, av.Flying, version,
670 ar => CrossAgentToNewRegionCompleted(d.EndInvoke(ar)), null);
671 }
672 }
673 else
674 {
675 m_log.DebugFormat("[SCENE OBJECT]: Not crossing avatar {0} to {1} because it's already in transit", av.Name, val);
676 }
677 }
678
679 return;
680 }
681 else // cross failed, put avas back ??
682 {
683 foreach (avtocrossInfo avinfo in avsToCross)
684 {
685 ScenePresence av = avinfo.av;
686 av.ParentUUID = UUID.Zero;
687 av.ParentID = avinfo.ParentID;
688 }
689 }
690 }
691 else
692 {
693 if (m_rootPart.KeyframeMotion != null)
694 m_rootPart.KeyframeMotion.CrossingFailure();
695
696 if (RootPart.PhysActor != null)
697 {
698 RootPart.PhysActor.CrossingFailure();
699 }
700 }
701
702 Vector3 oldp = AbsolutePosition;
703 val.X = Util.Clamp<float>(oldp.X, 0.5f, (float)m_scene.RegionInfo.RegionSizeX - 0.5f);
704 val.Y = Util.Clamp<float>(oldp.Y, 0.5f, (float)m_scene.RegionInfo.RegionSizeY - 0.5f);
705 val.Z = Util.Clamp<float>(oldp.Z, 0.5f, Constants.RegionHeight);
706=======
538 if (!inTransit) 707 if (!inTransit)
539 { 708 {
540 inTransit = true; 709 inTransit = true;
541 SOGCrossDelegate d = CrossAsync; 710 SOGCrossDelegate d = CrossAsync;
542 d.BeginInvoke(this, val, CrossAsyncCompleted, d); 711 d.BeginInvoke(this, val, CrossAsyncCompleted, d);
712>>>>>>> avn/ubitvar
543 } 713 }
544 return; 714 return;
545 } 715 }
@@ -780,11 +950,8 @@ namespace OpenSim.Region.Framework.Scenes
780 } 950 }
781 } 951 }
782 952
783 private void CrossAgentToNewRegionCompleted(IAsyncResult iar) 953 private void CrossAgentToNewRegionCompleted(ScenePresence agent)
784 { 954 {
785 CrossAgentToNewRegionDelegate icon = (CrossAgentToNewRegionDelegate)iar.AsyncState;
786 ScenePresence agent = icon.EndInvoke(iar);
787
788 //// If the cross was successful, this agent is a child agent 955 //// If the cross was successful, this agent is a child agent
789 if (agent.IsChildAgent) 956 if (agent.IsChildAgent)
790 { 957 {
@@ -871,7 +1038,11 @@ namespace OpenSim.Region.Framework.Scenes
871 set { m_rootPart.Text = value; } 1038 set { m_rootPart.Text = value; }
872 } 1039 }
873 1040
874 protected virtual bool InSceneBackup 1041 /// <summary>
1042 /// If set to true then the scene object can be backed up in principle, though this will only actually occur
1043 /// if Backup is set. If false then the scene object will never be backed up, Backup will always be false.
1044 /// </summary>
1045 protected virtual bool CanBeBackedUp
875 { 1046 {
876 get { return true; } 1047 get { return true; }
877 } 1048 }
@@ -1014,6 +1185,12 @@ namespace OpenSim.Region.Framework.Scenes
1014 public UUID FromFolderID { get; set; } 1185 public UUID FromFolderID { get; set; }
1015 1186
1016 /// <summary> 1187 /// <summary>
1188 /// If true then grabs are blocked no matter what the individual part BlockGrab setting.
1189 /// </summary>
1190 /// <value><c>true</c> if block grab override; otherwise, <c>false</c>.</value>
1191 public bool BlockGrabOverride { get; set; }
1192
1193 /// <summary>
1017 /// IDs of all avatars sat on this scene object. 1194 /// IDs of all avatars sat on this scene object.
1018 /// </summary> 1195 /// </summary>
1019 /// <remarks> 1196 /// <remarks>
@@ -1023,7 +1200,7 @@ namespace OpenSim.Region.Framework.Scenes
1023 /// No avatar should appear more than once in this list. 1200 /// No avatar should appear more than once in this list.
1024 /// Do not manipulate this list directly - use the Add/Remove sitting avatar methods on SceneObjectPart. 1201 /// Do not manipulate this list directly - use the Add/Remove sitting avatar methods on SceneObjectPart.
1025 /// </remarks> 1202 /// </remarks>
1026 protected internal List<UUID> m_sittingAvatars = new List<UUID>(); 1203 protected internal List<ScenePresence> m_sittingAvatars = new List<ScenePresence>();
1027 1204
1028 #endregion 1205 #endregion
1029 1206
@@ -1089,23 +1266,67 @@ namespace OpenSim.Region.Framework.Scenes
1089 } 1266 }
1090 } 1267 }
1091 1268
1269 public void LoadScriptState(XmlReader reader)
1270 {
1271// m_log.DebugFormat("[SCENE OBJECT GROUP]: Looking for script state for {0}", Name);
1272
1273 while (true)
1274 {
1275 if (reader.Name == "SavedScriptState" && reader.NodeType == XmlNodeType.Element)
1276 {
1277// m_log.DebugFormat("[SCENE OBJECT GROUP]: Loading script state for {0}", Name);
1278
1279 if (m_savedScriptState == null)
1280 m_savedScriptState = new Dictionary<UUID, string>();
1281
1282 string uuid = reader.GetAttribute("UUID");
1283
1284 // Even if there is no UUID attribute for some strange reason, we must always read the inner XML
1285 // so we don't continually keep checking the same SavedScriptedState element.
1286 string innerXml = reader.ReadInnerXml();
1287
1288 if (uuid != null)
1289 {
1290// m_log.DebugFormat("[SCENE OBJECT GROUP]: Found state for item ID {0} in object {1}", uuid, Name);
1291
1292 UUID itemid = new UUID(uuid);
1293 if (itemid != UUID.Zero)
1294 m_savedScriptState[itemid] = innerXml;
1295 }
1296 else
1297 {
1298 m_log.WarnFormat("[SCENE OBJECT GROUP]: SavedScriptState element had no UUID in object {0}", Name);
1299 }
1300 }
1301 else
1302 {
1303 if (!reader.Read())
1304 break;
1305 }
1306 }
1307 }
1308
1092 /// <summary> 1309 /// <summary>
1093 /// Hooks this object up to the backup event so that it is persisted to the database when the update thread executes. 1310 /// Hooks this object up to the backup event so that it is persisted to the database when the update thread executes.
1094 /// </summary> 1311 /// </summary>
1095 public virtual void AttachToBackup() 1312 public virtual void AttachToBackup()
1096 { 1313 {
1314<<<<<<< HEAD
1315 if (CanBeBackedUp)
1316=======
1097 if (IsAttachment) return; 1317 if (IsAttachment) return;
1098 m_scene.SceneGraph.FireAttachToBackup(this); 1318 m_scene.SceneGraph.FireAttachToBackup(this);
1099 1319
1100 if (InSceneBackup) 1320 if (InSceneBackup)
1321>>>>>>> avn/ubitvar
1101 { 1322 {
1102 //m_log.DebugFormat( 1323// m_log.DebugFormat(
1103 // "[SCENE OBJECT GROUP]: Attaching object {0} {1} to scene presistence sweep", Name, UUID); 1324// "[SCENE OBJECT GROUP]: Attaching object {0} {1} to scene presistence sweep", Name, UUID);
1104 1325
1105 if (!m_isBackedUp) 1326 if (!Backup)
1106 m_scene.EventManager.OnBackup += ProcessBackup; 1327 m_scene.EventManager.OnBackup += ProcessBackup;
1107 1328
1108 m_isBackedUp = true; 1329 Backup = true;
1109 } 1330 }
1110 } 1331 }
1111 1332
@@ -1210,12 +1431,21 @@ namespace OpenSim.Region.Framework.Scenes
1210 /// <returns></returns> 1431 /// <returns></returns>
1211 public void GetAxisAlignedBoundingBoxRaw(out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ) 1432 public void GetAxisAlignedBoundingBoxRaw(out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ)
1212 { 1433 {
1434<<<<<<< HEAD
1435 maxX = -256f;
1436 maxY = -256f;
1437 maxZ = -256f;
1438 minX = 10000f;
1439 minY = 10000f;
1440 minZ = 10000f;
1441=======
1213 maxX = float.MinValue; 1442 maxX = float.MinValue;
1214 maxY = float.MinValue; 1443 maxY = float.MinValue;
1215 maxZ = float.MinValue; 1444 maxZ = float.MinValue;
1216 minX = float.MaxValue; 1445 minX = float.MaxValue;
1217 minY = float.MaxValue; 1446 minY = float.MaxValue;
1218 minZ = float.MaxValue; 1447 minZ = float.MaxValue;
1448>>>>>>> avn/ubitvar
1219 1449
1220 SceneObjectPart[] parts = m_parts.GetArray(); 1450 SceneObjectPart[] parts = m_parts.GetArray();
1221 foreach (SceneObjectPart part in parts) 1451 foreach (SceneObjectPart part in parts)
@@ -1613,6 +1843,17 @@ namespace OpenSim.Region.Framework.Scenes
1613 } 1843 }
1614 } 1844 }
1615 1845
1846<<<<<<< HEAD
1847
1848 /// <summary>
1849 ///
1850 /// </summary>
1851 /// <param name="part"></param>
1852 private void SetPartAsNonRoot(SceneObjectPart part)
1853 {
1854 part.ParentID = m_rootPart.LocalId;
1855 part.ClearUndoState();
1856=======
1616 /// <summary> 1857 /// <summary>
1617 /// Add the avatar to this linkset (avatar is sat). 1858 /// Add the avatar to this linkset (avatar is sat).
1618 /// </summary> 1859 /// </summary>
@@ -1652,6 +1893,7 @@ namespace OpenSim.Region.Framework.Scenes
1652 public List<ScenePresence> GetLinkedAvatars() 1893 public List<ScenePresence> GetLinkedAvatars()
1653 { 1894 {
1654 return m_linkedAvatars; 1895 return m_linkedAvatars;
1896>>>>>>> avn/ubitvar
1655 } 1897 }
1656 1898
1657 /// <summary> 1899 /// <summary>
@@ -1955,7 +2197,14 @@ namespace OpenSim.Region.Framework.Scenes
1955 2197
1956 if (Scene != null) 2198 if (Scene != null)
1957 { 2199 {
2200<<<<<<< HEAD
2201 if (!sp.IsChildAgent && sp.ParentID == part.LocalId)
2202 sp.StandUp();
2203
2204 if (!silent)
2205=======
1958 Scene.ForEachRootScenePresence(delegate(ScenePresence avatar) 2206 Scene.ForEachRootScenePresence(delegate(ScenePresence avatar)
2207>>>>>>> avn/ubitvar
1959 { 2208 {
1960 if (avatar.ParentID == LocalId) 2209 if (avatar.ParentID == LocalId)
1961 avatar.StandUp(); 2210 avatar.StandUp();
@@ -2097,7 +2346,7 @@ namespace OpenSim.Region.Framework.Scenes
2097 /// <param name="datastore"></param> 2346 /// <param name="datastore"></param>
2098 public virtual void ProcessBackup(ISimulationDataService datastore, bool forcedBackup) 2347 public virtual void ProcessBackup(ISimulationDataService datastore, bool forcedBackup)
2099 { 2348 {
2100 if (!m_isBackedUp) 2349 if (!Backup)
2101 { 2350 {
2102// m_log.DebugFormat( 2351// m_log.DebugFormat(
2103// "[WATER WARS]: Ignoring backup of {0} {1} since object is not marked to be backed up", Name, UUID); 2352// "[WATER WARS]: Ignoring backup of {0} {1} since object is not marked to be backed up", Name, UUID);
@@ -2187,7 +2436,7 @@ namespace OpenSim.Region.Framework.Scenes
2187 backup_group.RootPart.AngularVelocity = RootPart.AngularVelocity; 2436 backup_group.RootPart.AngularVelocity = RootPart.AngularVelocity;
2188 backup_group.RootPart.ParticleSystem = RootPart.ParticleSystem; 2437 backup_group.RootPart.ParticleSystem = RootPart.ParticleSystem;
2189 HasGroupChanged = false; 2438 HasGroupChanged = false;
2190 HasGroupChangedDueToDelink = false; 2439 GroupContainsForeignPrims = false;
2191 2440
2192 m_scene.EventManager.TriggerOnSceneObjectPreSave(backup_group, this); 2441 m_scene.EventManager.TriggerOnSceneObjectPreSave(backup_group, this);
2193 2442
@@ -2255,6 +2504,16 @@ namespace OpenSim.Region.Framework.Scenes
2255 /// <returns></returns> 2504 /// <returns></returns>
2256 public SceneObjectGroup Copy(bool userExposed) 2505 public SceneObjectGroup Copy(bool userExposed)
2257 { 2506 {
2507<<<<<<< HEAD
2508 // FIXME: This is dangerous since it's easy to forget to reset some references when necessary and end up
2509 // with bugs that only occur in some circumstances (e.g. crossing between regions on the same simulator
2510 // but not between regions on different simulators). Really, all copying should be done explicitly.
2511 SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone();
2512
2513 dupe.Backup = false;
2514 dupe.m_parts = new MapAndArray<OpenMetaverse.UUID, SceneObjectPart>();
2515 dupe.m_sittingAvatars = new List<ScenePresence>();
2516=======
2258 m_dupeInProgress = true; 2517 m_dupeInProgress = true;
2259 SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone(); 2518 SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone();
2260 dupe.m_isBackedUp = false; 2519 dupe.m_isBackedUp = false;
@@ -2266,6 +2525,7 @@ namespace OpenSim.Region.Framework.Scenes
2266 dupe.m_linkedAvatars = new List<ScenePresence>(); 2525 dupe.m_linkedAvatars = new List<ScenePresence>();
2267 dupe.m_sittingAvatars = new List<UUID>(); 2526 dupe.m_sittingAvatars = new List<UUID>();
2268 2527
2528>>>>>>> avn/ubitvar
2269 dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); 2529 dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed);
2270 dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; 2530 dupe.m_rootPart.LinkNum = m_rootPart.LinkNum;
2271 2531
@@ -2440,16 +2700,19 @@ namespace OpenSim.Region.Framework.Scenes
2440 return RootPart.Torque; 2700 return RootPart.Torque;
2441 } 2701 }
2442 2702
2703<<<<<<< HEAD
2704 public void MoveToTarget(Vector3 target, float tau)
2705=======
2443 // This is used by both Double-Click Auto-Pilot and llMoveToTarget() in an attached object 2706 // This is used by both Double-Click Auto-Pilot and llMoveToTarget() in an attached object
2444 public void moveToTarget(Vector3 target, float tau) 2707 public void moveToTarget(Vector3 target, float tau)
2708>>>>>>> avn/ubitvar
2445 { 2709 {
2446 if (IsAttachment) 2710 if (IsAttachment)
2447 { 2711 {
2448 ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); 2712 ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar);
2713
2449 if (avatar != null) 2714 if (avatar != null)
2450 {
2451 avatar.MoveToTarget(target, false, false); 2715 avatar.MoveToTarget(target, false, false);
2452 }
2453 } 2716 }
2454 else 2717 else
2455 { 2718 {
@@ -2464,11 +2727,26 @@ namespace OpenSim.Region.Framework.Scenes
2464 } 2727 }
2465 } 2728 }
2466 2729
2467 public void stopMoveToTarget() 2730 public void StopMoveToTarget()
2468 { 2731 {
2469 if (IsAttachment) 2732 if (IsAttachment)
2470 { 2733 {
2471 ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar); 2734 ScenePresence avatar = m_scene.GetScenePresence(AttachedAvatar);
2735<<<<<<< HEAD
2736
2737 if (avatar != null)
2738 avatar.ResetMoveToTarget();
2739 }
2740 else
2741 {
2742 PhysicsActor pa = RootPart.PhysActor;
2743
2744 if (pa != null && pa.PIDActive)
2745 {
2746 pa.PIDActive = false;
2747
2748 ScheduleGroupForTerseUpdate();
2749=======
2472 if (avatar != null) 2750 if (avatar != null)
2473 { 2751 {
2474 avatar.ResetMoveToTarget(); 2752 avatar.ResetMoveToTarget();
@@ -2508,6 +2786,7 @@ namespace OpenSim.Region.Framework.Scenes
2508 rootpart.PhysActor.APIDDamping = damping; 2786 rootpart.PhysActor.APIDDamping = damping;
2509 rootpart.PhysActor.APIDActive = true; 2787 rootpart.PhysActor.APIDActive = true;
2510 } 2788 }
2789>>>>>>> avn/ubitvar
2511 } 2790 }
2512 } 2791 }
2513 } 2792 }
@@ -3055,7 +3334,9 @@ namespace OpenSim.Region.Framework.Scenes
3055// objectGroup.m_rootPart = null; 3334// objectGroup.m_rootPart = null;
3056 3335
3057 // If linking prims with different permissions, fix them 3336 // If linking prims with different permissions, fix them
3058 AdjustChildPrimPermissions(); 3337 AdjustChildPrimPermissions(false);
3338
3339 GroupContainsForeignPrims = true;
3059 3340
3060 AttachToBackup(); 3341 AttachToBackup();
3061 3342
@@ -3203,6 +3484,18 @@ namespace OpenSim.Region.Framework.Scenes
3203 3484
3204 linkPart.Rezzed = RootPart.Rezzed; 3485 linkPart.Rezzed = RootPart.Rezzed;
3205 3486
3487<<<<<<< HEAD
3488 // We must persist the delinked group to the database immediately, for safety. The problem
3489 // is that although in memory the new group has a new SceneGroupID, in the database it
3490 // still has the parent group's SceneGroupID (until the next backup). This means that if the
3491 // parent group is deleted then the delinked group will also be deleted from the database.
3492 // This problem will disappear if the region remains alive long enough for another backup,
3493 // since at that time the delinked group's new SceneGroupID will be written to the database.
3494 // But if the region crashes before that then the prims will be permanently gone, and this must
3495 // not happen. (We can't use a just-in-time trick like GroupContainsForeignPrims in this case
3496 // because the delinked group doesn't know when the source group is deleted.)
3497 m_scene.ForceSceneObjectBackup(objectGroup);
3498=======
3206 // When we delete a group, we currently have to force persist to the database if the object id has changed 3499 // When we delete a group, we currently have to force persist to the database if the object id has changed
3207 // (since delete works by deleting all rows which have a given object id) 3500 // (since delete works by deleting all rows which have a given object id)
3208 3501
@@ -3214,6 +3507,7 @@ namespace OpenSim.Region.Framework.Scenes
3214 m_rootPart.PhysActor.Building = false; 3507 m_rootPart.PhysActor.Building = false;
3215 3508
3216 objectGroup.HasGroupChangedDueToDelink = true; 3509 objectGroup.HasGroupChangedDueToDelink = true;
3510>>>>>>> avn/ubitvar
3217 3511
3218 if (sendEvents) 3512 if (sendEvents)
3219 linkPart.TriggerScriptChangedEvent(Changed.LINK); 3513 linkPart.TriggerScriptChangedEvent(Changed.LINK);
@@ -3227,12 +3521,16 @@ namespace OpenSim.Region.Framework.Scenes
3227 /// <param name="objectGroup"></param> 3521 /// <param name="objectGroup"></param>
3228 public virtual void DetachFromBackup() 3522 public virtual void DetachFromBackup()
3229 { 3523 {
3524<<<<<<< HEAD
3525 if (Backup && Scene != null)
3526=======
3230 if (m_scene != null) 3527 if (m_scene != null)
3231 m_scene.SceneGraph.FireDetachFromBackup(this); 3528 m_scene.SceneGraph.FireDetachFromBackup(this);
3232 if (m_isBackedUp && Scene != null) 3529 if (m_isBackedUp && Scene != null)
3530>>>>>>> avn/ubitvar
3233 m_scene.EventManager.OnBackup -= ProcessBackup; 3531 m_scene.EventManager.OnBackup -= ProcessBackup;
3234 3532
3235 m_isBackedUp = false; 3533 Backup = false;
3236 } 3534 }
3237 3535
3238 // This links an SOP from a previous linkset into my linkset. 3536 // This links an SOP from a previous linkset into my linkset.
@@ -3295,20 +3593,26 @@ namespace OpenSim.Region.Framework.Scenes
3295 /// If object is physical, apply force to move it around 3593 /// If object is physical, apply force to move it around
3296 /// If object is not physical, just put it at the resulting location 3594 /// If object is not physical, just put it at the resulting location
3297 /// </summary> 3595 /// </summary>
3596 /// <param name="partID">Part ID to check for grab</param>
3298 /// <param name="offset">Always seems to be 0,0,0, so ignoring</param> 3597 /// <param name="offset">Always seems to be 0,0,0, so ignoring</param>
3299 /// <param name="pos">New position. We do the math here to turn it into a force</param> 3598 /// <param name="pos">New position. We do the math here to turn it into a force</param>
3300 /// <param name="remoteClient"></param> 3599 /// <param name="remoteClient"></param>
3301 public void GrabMovement(Vector3 offset, Vector3 pos, IClientAPI remoteClient) 3600 public void GrabMovement(UUID partID, Vector3 offset, Vector3 pos, IClientAPI remoteClient)
3302 { 3601 {
3303 if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) 3602 if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
3304 { 3603 {
3604 SceneObjectPart part = GetPart(partID);
3605
3606 if (part == null)
3607 return;
3608
3305 PhysicsActor pa = m_rootPart.PhysActor; 3609 PhysicsActor pa = m_rootPart.PhysActor;
3306 3610
3307 if (pa != null) 3611 if (pa != null)
3308 { 3612 {
3309 if (pa.IsPhysical) 3613 if (pa.IsPhysical)
3310 { 3614 {
3311 if (!m_rootPart.BlockGrab) 3615 if (!BlockGrabOverride && !part.BlockGrab)
3312 { 3616 {
3313/* Vector3 llmoveforce = pos - AbsolutePosition; 3617/* Vector3 llmoveforce = pos - AbsolutePosition;
3314 Vector3 grabforce = llmoveforce; 3618 Vector3 grabforce = llmoveforce;
@@ -3323,20 +3627,27 @@ namespace OpenSim.Region.Framework.Scenes
3323 } 3627 }
3324 else 3628 else
3325 { 3629 {
3326 //NonPhysicalGrabMovement(pos); 3630 NonPhysicalGrabMovement(pos);
3327 } 3631 }
3328 } 3632 }
3329 else 3633 else
3330 { 3634 {
3331 //NonPhysicalGrabMovement(pos); 3635 NonPhysicalGrabMovement(pos);
3332 } 3636 }
3333 } 3637 }
3334 } 3638 }
3335 3639
3640 /// <summary>
3641 /// Apply possition for grabbing non-physical linksets (Ctrl+Drag)
3642 /// This MUST be blocked for linksets that contain touch scripts because the viewer triggers grab on the touch
3643 /// event (Viewer Bug?) This would allow anyone to drag a linkset with a touch script. SL behaviour is also to
3644 /// block grab on prims with touch events.
3645 /// </summary>
3646 /// <param name="pos">New Position</param>
3336 public void NonPhysicalGrabMovement(Vector3 pos) 3647 public void NonPhysicalGrabMovement(Vector3 pos)
3337 { 3648 {
3338 AbsolutePosition = pos; 3649 if(!IsAttachment && ScriptCount() == 0)
3339 m_rootPart.SendTerseUpdateToAllClients(); 3650 UpdateGroupPosition(pos);
3340 } 3651 }
3341 3652
3342 /// <summary> 3653 /// <summary>
@@ -3432,17 +3743,28 @@ namespace OpenSim.Region.Framework.Scenes
3432 } 3743 }
3433 else 3744 else
3434 { 3745 {
3435 //NonPhysicalSpinMovement(pos); 3746 NonPhysicalSpinMovement(newOrientation);
3436 } 3747 }
3437 } 3748 }
3438 else 3749 else
3439 { 3750 {
3440 //NonPhysicalSpinMovement(pos); 3751 NonPhysicalSpinMovement(newOrientation);
3441 } 3752 }
3442 } 3753 }
3443 } 3754 }
3444 3755
3445 /// <summary> 3756 /// <summary>
3757 /// Apply rotation for spinning non-physical linksets (Ctrl+Shift+Drag)
3758 /// As with dragging, scripted objects must be blocked from spinning
3759 /// </summary>
3760 /// <param name="newOrientation">New Rotation</param>
3761 private void NonPhysicalSpinMovement(Quaternion newOrientation)
3762 {
3763 if(!IsAttachment && ScriptCount() == 0)
3764 UpdateGroupRotationR(newOrientation);
3765 }
3766
3767 /// <summary>
3446 /// Set the name of a prim 3768 /// Set the name of a prim
3447 /// </summary> 3769 /// </summary>
3448 /// <param name="name"></param> 3770 /// <param name="name"></param>
@@ -3517,12 +3839,22 @@ namespace OpenSim.Region.Framework.Scenes
3517 3839
3518 SceneObjectPart selectionPart = GetPart(localID); 3840 SceneObjectPart selectionPart = GetPart(localID);
3519 3841
3520 if (SetTemporary && Scene != null) 3842 if (Scene != null)
3521 { 3843 {
3522 DetachFromBackup(); 3844 if (SetTemporary)
3523 // Remove from database and parcel prim count 3845 {
3524 // 3846 DetachFromBackup();
3525 m_scene.DeleteFromStorage(UUID); 3847 // Remove from database and parcel prim count
3848 //
3849 m_scene.DeleteFromStorage(UUID);
3850 }
3851 else if (!Backup)
3852 {
3853 // Previously been temporary now switching back so make it
3854 // available for persisting again
3855 AttachToBackup();
3856 }
3857
3526 m_scene.EventManager.TriggerParcelPrimCountTainted(); 3858 m_scene.EventManager.TriggerParcelPrimCountTainted();
3527 } 3859 }
3528 3860
@@ -3611,7 +3943,7 @@ namespace OpenSim.Region.Framework.Scenes
3611 } 3943 }
3612 } 3944 }
3613 3945
3614 public void AdjustChildPrimPermissions() 3946 public void AdjustChildPrimPermissions(bool forceTaskInventoryPermissive)
3615 { 3947 {
3616 uint newOwnerMask = (uint)(PermissionMask.All | PermissionMask.Export) & 0xfffffff8; // Mask folded bits 3948 uint newOwnerMask = (uint)(PermissionMask.All | PermissionMask.Export) & 0xfffffff8; // Mask folded bits
3617 uint foldedPerms = RootPart.OwnerMask & 3; 3949 uint foldedPerms = RootPart.OwnerMask & 3;
@@ -3621,11 +3953,18 @@ namespace OpenSim.Region.Framework.Scenes
3621 newOwnerMask &= part.BaseMask; 3953 newOwnerMask &= part.BaseMask;
3622 if (part != RootPart) 3954 if (part != RootPart)
3623 part.ClonePermissions(RootPart); 3955 part.ClonePermissions(RootPart);
3956 if (forceTaskInventoryPermissive)
3957 part.Inventory.ApplyGodPermissions(part.BaseMask);
3624 }); 3958 });
3625 3959
3626 uint lockMask = ~(uint)(PermissionMask.Move | PermissionMask.Modify); 3960 uint lockMask = ~(uint)(PermissionMask.Move | PermissionMask.Modify);
3627 uint lockBit = RootPart.OwnerMask & (uint)(PermissionMask.Move | PermissionMask.Modify); 3961 uint lockBit = RootPart.OwnerMask & (uint)(PermissionMask.Move | PermissionMask.Modify);
3628 RootPart.OwnerMask = (RootPart.OwnerMask & lockBit) | ((newOwnerMask | foldedPerms) & lockMask); 3962 RootPart.OwnerMask = (RootPart.OwnerMask & lockBit) | ((newOwnerMask | foldedPerms) & lockMask);
3963
3964// m_log.DebugFormat(
3965// "[SCENE OBJECT GROUP]: RootPart.OwnerMask now {0} for {1} in {2}",
3966// (OpenMetaverse.PermissionMask)RootPart.OwnerMask, Name, Scene.Name);
3967
3629 RootPart.ScheduleFullUpdate(); 3968 RootPart.ScheduleFullUpdate();
3630 } 3969 }
3631 3970
@@ -3634,6 +3973,9 @@ namespace OpenSim.Region.Framework.Scenes
3634 { 3973 {
3635 RootPart.UpdatePermissions(AgentID, field, localID, mask, addRemTF); 3974 RootPart.UpdatePermissions(AgentID, field, localID, mask, addRemTF);
3636 3975
3976<<<<<<< HEAD
3977 AdjustChildPrimPermissions(Scene.Permissions.IsGod(AgentID));
3978=======
3637 bool god = Scene.Permissions.IsGod(AgentID); 3979 bool god = Scene.Permissions.IsGod(AgentID);
3638 3980
3639 if (field == 1 && god) 3981 if (field == 1 && god)
@@ -3645,6 +3987,7 @@ namespace OpenSim.Region.Framework.Scenes
3645 } 3987 }
3646 3988
3647 AdjustChildPrimPermissions(); 3989 AdjustChildPrimPermissions();
3990>>>>>>> avn/ubitvar
3648 3991
3649 if (field == 1 && god) // Base mask was set. Update all child part inventories 3992 if (field == 1 && god) // Base mask was set. Update all child part inventories
3650 { 3993 {
@@ -4694,10 +5037,10 @@ namespace OpenSim.Region.Framework.Scenes
4694 /// down after it move one place down the list. 5037 /// down after it move one place down the list.
4695 /// </remarks> 5038 /// </remarks>
4696 /// <returns>A list of the sitting avatars. Returns an empty list if there are no sitting avatars.</returns> 5039 /// <returns>A list of the sitting avatars. Returns an empty list if there are no sitting avatars.</returns>
4697 public List<UUID> GetSittingAvatars() 5040 public List<ScenePresence> GetSittingAvatars()
4698 { 5041 {
4699 lock (m_sittingAvatars) 5042 lock (m_sittingAvatars)
4700 return new List<UUID>(m_sittingAvatars); 5043 return new List<ScenePresence>(m_sittingAvatars);
4701 } 5044 }
4702 5045
4703 /// <summary> 5046 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 8979659..1cfa8ed 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -198,7 +198,7 @@ namespace OpenSim.Region.Framework.Scenes
198 198
199 public bool RETURN_AT_EDGE; 199 public bool RETURN_AT_EDGE;
200 200
201 public bool BlockGrab; 201 public bool BlockGrab { get; set; }
202 202
203 public bool StatusSandbox; 203 public bool StatusSandbox;
204 204
@@ -286,7 +286,7 @@ namespace OpenSim.Region.Framework.Scenes
286 286
287 public Quaternion SpinOldOrientation = Quaternion.Identity; 287 public Quaternion SpinOldOrientation = Quaternion.Identity;
288 288
289 protected int m_APIDIterations = 0; 289 protected bool m_APIDActive = false;
290 protected Quaternion m_APIDTarget = Quaternion.Identity; 290 protected Quaternion m_APIDTarget = Quaternion.Identity;
291 protected float m_APIDDamp = 0; 291 protected float m_APIDDamp = 0;
292 protected float m_APIDStrength = 0; 292 protected float m_APIDStrength = 0;
@@ -680,6 +680,12 @@ namespace OpenSim.Region.Framework.Scenes
680 } 680 }
681 } 681 }
682 682
683 protected bool APIDActive
684 {
685 get { return m_APIDActive; }
686 set { m_APIDActive = value; }
687 }
688
683 protected Quaternion APIDTarget 689 protected Quaternion APIDTarget
684 { 690 {
685 get { return m_APIDTarget; } 691 get { return m_APIDTarget; }
@@ -1001,14 +1007,17 @@ namespace OpenSim.Region.Framework.Scenes
1001 1007
1002 set 1008 set
1003 { 1009 {
1004 m_velocity = value; 1010 if (Util.IsNanOrInfinity(value))
1011 m_velocity = Vector3.Zero;
1012 else
1013 m_velocity = value;
1005 1014
1006 PhysicsActor actor = PhysActor; 1015 PhysicsActor actor = PhysActor;
1007 if (actor != null) 1016 if (actor != null)
1008 { 1017 {
1009 if (actor.IsPhysical) 1018 if (actor.IsPhysical)
1010 { 1019 {
1011 actor.Velocity = value; 1020 actor.Velocity = m_velocity;
1012 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); 1021 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
1013 } 1022 }
1014 } 1023 }
@@ -1037,18 +1046,39 @@ namespace OpenSim.Region.Framework.Scenes
1037 } 1046 }
1038 set 1047 set
1039 { 1048 {
1049<<<<<<< HEAD
1050 if (Util.IsNanOrInfinity(value))
1051 m_angularVelocity = Vector3.Zero;
1052 else
1053 m_angularVelocity = value;
1054
1055 PhysicsActor actor = PhysActor;
1056 if ((actor != null) && actor.IsPhysical)
1057 actor.RotationalVelocity = m_angularVelocity;
1058=======
1040 m_angularVelocity = value; 1059 m_angularVelocity = value;
1041 PhysicsActor actor = PhysActor; 1060 PhysicsActor actor = PhysActor;
1042 if ((actor != null) && actor.IsPhysical && ParentGroup.RootPart == this && VehicleType == (int)Vehicle.TYPE_NONE) 1061 if ((actor != null) && actor.IsPhysical && ParentGroup.RootPart == this && VehicleType == (int)Vehicle.TYPE_NONE)
1043 { 1062 {
1044 actor.RotationalVelocity = m_angularVelocity; 1063 actor.RotationalVelocity = m_angularVelocity;
1045 } 1064 }
1065>>>>>>> avn/ubitvar
1046 } 1066 }
1047 } 1067 }
1048 1068
1049 /// <summary></summary> 1069 /// <summary></summary>
1050 public Vector3 Acceleration 1070 public Vector3 Acceleration
1051 { 1071 {
1072<<<<<<< HEAD
1073 get { return m_acceleration; }
1074 set
1075 {
1076 if (Util.IsNanOrInfinity(value))
1077 m_acceleration = Vector3.Zero;
1078 else
1079 m_acceleration = value;
1080 }
1081=======
1052 get 1082 get
1053 { 1083 {
1054 PhysicsActor actor = PhysActor; 1084 PhysicsActor actor = PhysActor;
@@ -1060,6 +1090,7 @@ namespace OpenSim.Region.Framework.Scenes
1060 } 1090 }
1061 1091
1062 set { m_acceleration = value; } 1092 set { m_acceleration = value; }
1093>>>>>>> avn/ubitvar
1063 } 1094 }
1064 1095
1065 public string Description { get; set; } 1096 public string Description { get; set; }
@@ -1400,7 +1431,7 @@ namespace OpenSim.Region.Framework.Scenes
1400 /// <value> 1431 /// <value>
1401 /// null if there are no sitting avatars. This is to save us create a hashset for every prim in a scene. 1432 /// null if there are no sitting avatars. This is to save us create a hashset for every prim in a scene.
1402 /// </value> 1433 /// </value>
1403 private HashSet<UUID> m_sittingAvatars; 1434 private HashSet<ScenePresence> m_sittingAvatars;
1404 1435
1405 public virtual UUID RegionID 1436 public virtual UUID RegionID
1406 { 1437 {
@@ -1901,11 +1932,25 @@ namespace OpenSim.Region.Framework.Scenes
1901 1932
1902 public void AddTextureAnimation(Primitive.TextureAnimation pTexAnim) 1933 public void AddTextureAnimation(Primitive.TextureAnimation pTexAnim)
1903 { 1934 {
1935<<<<<<< HEAD
1936 byte[] data;
1937
1938 if (pTexAnim.Flags == Primitive.TextureAnimMode.ANIM_OFF)
1939 {
1940 data = Utils.EmptyBytes;
1941 }
1942 else
1943 {
1944 data = new byte[16];
1945 int pos = 0;
1946
1947=======
1904 if (((int)pTexAnim.Flags & 1) != 0) // ANIM_ON 1948 if (((int)pTexAnim.Flags & 1) != 0) // ANIM_ON
1905 { 1949 {
1906 byte[] data = new byte[16]; 1950 byte[] data = new byte[16];
1907 int pos = 0; 1951 int pos = 0;
1908 1952
1953>>>>>>> avn/ubitvar
1909 // The flags don't like conversion from uint to byte, so we have to do 1954 // The flags don't like conversion from uint to byte, so we have to do
1910 // it the crappy way. See the above function :( 1955 // it the crappy way. See the above function :(
1911 1956
@@ -1917,6 +1962,10 @@ namespace OpenSim.Region.Framework.Scenes
1917 Utils.FloatToBytes(pTexAnim.Start).CopyTo(data, pos); 1962 Utils.FloatToBytes(pTexAnim.Start).CopyTo(data, pos);
1918 Utils.FloatToBytes(pTexAnim.Length).CopyTo(data, pos + 4); 1963 Utils.FloatToBytes(pTexAnim.Length).CopyTo(data, pos + 4);
1919 Utils.FloatToBytes(pTexAnim.Rate).CopyTo(data, pos + 8); 1964 Utils.FloatToBytes(pTexAnim.Rate).CopyTo(data, pos + 8);
1965<<<<<<< HEAD
1966 }
1967=======
1968>>>>>>> avn/ubitvar
1920 1969
1921 m_TextureAnimation = data; 1970 m_TextureAnimation = data;
1922 } 1971 }
@@ -2134,7 +2183,11 @@ namespace OpenSim.Region.Framework.Scenes
2134 /// <returns></returns> 2183 /// <returns></returns>
2135 public SceneObjectPart Copy(uint plocalID, UUID AgentID, UUID GroupID, int linkNum, bool userExposed) 2184 public SceneObjectPart Copy(uint plocalID, UUID AgentID, UUID GroupID, int linkNum, bool userExposed)
2136 { 2185 {
2186 // FIXME: This is dangerous since it's easy to forget to reset some references when necessary and end up
2187 // with bugs that only occur in some circumstances (e.g. crossing between regions on the same simulator
2188 // but not between regions on different simulators). Really, all copying should be done explicitly.
2137 SceneObjectPart dupe = (SceneObjectPart)MemberwiseClone(); 2189 SceneObjectPart dupe = (SceneObjectPart)MemberwiseClone();
2190
2138 dupe.m_shape = m_shape.Copy(); 2191 dupe.m_shape = m_shape.Copy();
2139 dupe.m_regionHandle = m_regionHandle; 2192 dupe.m_regionHandle = m_regionHandle;
2140 if (userExposed) 2193 if (userExposed)
@@ -2187,6 +2240,8 @@ namespace OpenSim.Region.Framework.Scenes
2187 Array.Copy(Shape.ExtraParams, extraP, extraP.Length); 2240 Array.Copy(Shape.ExtraParams, extraP, extraP.Length);
2188 dupe.Shape.ExtraParams = extraP; 2241 dupe.Shape.ExtraParams = extraP;
2189 2242
2243 dupe.m_sittingAvatars = new HashSet<ScenePresence>();
2244
2190 // safeguard actual copy is done in sog.copy 2245 // safeguard actual copy is done in sog.copy
2191 dupe.KeyframeMotion = null; 2246 dupe.KeyframeMotion = null;
2192 dupe.PayPrice = (int[])PayPrice.Clone(); 2247 dupe.PayPrice = (int[])PayPrice.Clone();
@@ -2436,7 +2491,7 @@ namespace OpenSim.Region.Framework.Scenes
2436 /// </summary> 2491 /// </summary>
2437 /// <param name="xmlReader"></param> 2492 /// <param name="xmlReader"></param>
2438 /// <returns></returns> 2493 /// <returns></returns>
2439 public static SceneObjectPart FromXml(XmlTextReader xmlReader) 2494 public static SceneObjectPart FromXml(XmlReader xmlReader)
2440 { 2495 {
2441 SceneObjectPart part = SceneObjectSerializer.Xml2ToSOP(xmlReader); 2496 SceneObjectPart part = SceneObjectSerializer.Xml2ToSOP(xmlReader);
2442 2497
@@ -2471,22 +2526,6 @@ namespace OpenSim.Region.Framework.Scenes
2471 ParentGroup.RootPart.RETURN_AT_EDGE = p; 2526 ParentGroup.RootPart.RETURN_AT_EDGE = p;
2472 } 2527 }
2473 2528
2474 public bool GetBlockGrab()
2475 {
2476 if (ParentGroup.IsDeleted)
2477 return false;
2478
2479 return ParentGroup.RootPart.BlockGrab;
2480 }
2481
2482 public void SetBlockGrab(bool p)
2483 {
2484 if (ParentGroup.IsDeleted)
2485 return;
2486
2487 ParentGroup.RootPart.BlockGrab = p;
2488 }
2489
2490 public void SetStatusSandbox(bool p) 2529 public void SetStatusSandbox(bool p)
2491 { 2530 {
2492 if (ParentGroup.IsDeleted) 2531 if (ParentGroup.IsDeleted)
@@ -2649,7 +2688,7 @@ namespace OpenSim.Region.Framework.Scenes
2649 { 2688 {
2650 if (tau > 0) 2689 if (tau > 0)
2651 { 2690 {
2652 ParentGroup.moveToTarget(target, tau); 2691 ParentGroup.MoveToTarget(target, tau);
2653 } 2692 }
2654 else 2693 else
2655 { 2694 {
@@ -2790,7 +2829,7 @@ namespace OpenSim.Region.Framework.Scenes
2790 CollidingMessage = CreateColliderArgs(this, colliders); 2829 CollidingMessage = CreateColliderArgs(this, colliders);
2791 2830
2792 if (CollidingMessage.Colliders.Count > 0) 2831 if (CollidingMessage.Colliders.Count > 0)
2793 notify(LocalId, CollidingMessage); 2832 DoNotify(notify, LocalId, CollidingMessage);
2794 2833
2795 if (PassCollisions) 2834 if (PassCollisions)
2796 sendToRoot = true; 2835 sendToRoot = true;
@@ -2804,7 +2843,7 @@ namespace OpenSim.Region.Framework.Scenes
2804 { 2843 {
2805 CollidingMessage = CreateColliderArgs(ParentGroup.RootPart, colliders); 2844 CollidingMessage = CreateColliderArgs(ParentGroup.RootPart, colliders);
2806 if (CollidingMessage.Colliders.Count > 0) 2845 if (CollidingMessage.Colliders.Count > 0)
2807 notify(ParentGroup.RootPart.LocalId, CollidingMessage); 2846 DoNotify(notify, ParentGroup.RootPart.LocalId, CollidingMessage);
2808 } 2847 }
2809 } 2848 }
2810 } 2849 }
@@ -2819,6 +2858,35 @@ namespace OpenSim.Region.Framework.Scenes
2819 colliding.Add(CreateDetObjectForGround()); 2858 colliding.Add(CreateDetObjectForGround());
2820 LandCollidingMessage.Colliders = colliding; 2859 LandCollidingMessage.Colliders = colliding;
2821 2860
2861<<<<<<< HEAD
2862 DoNotify(notify, LocalId, LandCollidingMessage);
2863 }
2864 }
2865
2866 private void DoNotify(ScriptCollidingNotification notify, uint id, ColliderArgs collargs)
2867 {
2868 if (m_parentGroup != null && ParentGroup.Scene != null && ParentGroup.Scene.ShouldUseFireAndForgetForCollisions)
2869 {
2870 // For those learning C#, FireAndForget takes a function, an object to pass
2871 // to that function and an ID string. The "oo => {}" construct is a lambda expression
2872 // for a function with one arguement ('oo'). The 'new Object[] {}" construct creates an Object
2873 // that is an object array and initializes it with three items (the parameters
2874 // being passed). The parameters passed are the function to call ('notify') and
2875 // its two arguements. Finally, once in the function (called later by the FireAndForget
2876 // thread scheduler), the passed object is cast to an object array and then each
2877 // of its items (aoo[0] to aoo[2]) are individually cast to what they are and
2878 // then used in a call of the passed ScriptCollidingNotification function.
2879 Util.FireAndForget(oo =>
2880 {
2881 Object[] aoo = (Object[])oo;
2882 ((ScriptCollidingNotification)aoo[0])((uint)aoo[1], (ColliderArgs)aoo[2]);
2883
2884 }, new Object[] { notify, id, collargs }, "SOP.Collision");
2885 }
2886 else
2887 {
2888 notify(id, collargs);
2889=======
2822 if (Inventory.ContainsScripts()) 2890 if (Inventory.ContainsScripts())
2823 { 2891 {
2824 if (!PassCollisions) 2892 if (!PassCollisions)
@@ -2830,6 +2898,7 @@ namespace OpenSim.Region.Framework.Scenes
2830 if ((ParentGroup.RootPart.ScriptEvents & ev) != 0 && sendToRoot) 2898 if ((ParentGroup.RootPart.ScriptEvents & ev) != 0 && sendToRoot)
2831 { 2899 {
2832 notify(ParentGroup.RootPart.LocalId, LandCollidingMessage); 2900 notify(ParentGroup.RootPart.LocalId, LandCollidingMessage);
2901>>>>>>> avn/ubitvar
2833 } 2902 }
2834 } 2903 }
2835 2904
@@ -2977,10 +3046,15 @@ namespace OpenSim.Region.Framework.Scenes
2977 3046
2978 if (pa != null) 3047 if (pa != null)
2979 { 3048 {
3049<<<<<<< HEAD
3050 Vector3 newpos = pa.Position;
3051=======
2980 Vector3 newpos = new Vector3(pa.Position.GetBytes(), 0); 3052 Vector3 newpos = new Vector3(pa.Position.GetBytes(), 0);
2981 3053
3054>>>>>>> avn/ubitvar
2982 if (!ParentGroup.Scene.PositionIsInCurrentRegion(newpos)) 3055 if (!ParentGroup.Scene.PositionIsInCurrentRegion(newpos))
2983 { 3056 {
3057 // Setting position outside current region will start region crossing
2984 ParentGroup.AbsolutePosition = newpos; 3058 ParentGroup.AbsolutePosition = newpos;
2985 return; 3059 return;
2986 } 3060 }
@@ -3109,7 +3183,7 @@ namespace OpenSim.Region.Framework.Scenes
3109 return; 3183 return;
3110 } 3184 }
3111 3185
3112 m_APIDIterations = 1 + (int)(Math.PI * APIDStrength); 3186 APIDActive = true;
3113 } 3187 }
3114 3188
3115 // Necessary to get the lookat deltas applied 3189 // Necessary to get the lookat deltas applied
@@ -3123,7 +3197,7 @@ namespace OpenSim.Region.Framework.Scenes
3123 3197
3124 public void StopLookAt() 3198 public void StopLookAt()
3125 { 3199 {
3126 APIDTarget = Quaternion.Identity; 3200 APIDActive = false;
3127 } 3201 }
3128 3202
3129 3203
@@ -3922,10 +3996,14 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
3922 3996
3923 public void StopMoveToTarget() 3997 public void StopMoveToTarget()
3924 { 3998 {
3999<<<<<<< HEAD
4000 ParentGroup.StopMoveToTarget();
4001=======
3925 ParentGroup.stopMoveToTarget(); 4002 ParentGroup.stopMoveToTarget();
3926 4003
3927// ParentGroup.ScheduleGroupForTerseUpdate(); 4004// ParentGroup.ScheduleGroupForTerseUpdate();
3928 //ParentGroup.ScheduleGroupForFullUpdate(); 4005 //ParentGroup.ScheduleGroupForFullUpdate();
4006>>>>>>> avn/ubitvar
3929 } 4007 }
3930 4008
3931 public void StoreUndoState(ObjectChangeType change) 4009 public void StoreUndoState(ObjectChangeType change)
@@ -4773,6 +4851,12 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
4773 } 4851 }
4774 else // it already has a physical representation 4852 else // it already has a physical representation
4775 { 4853 {
4854<<<<<<< HEAD
4855 pa.SetMaterial(Material);
4856 pa.Position = GetWorldPosition();
4857 pa.Orientation = GetWorldRotation();
4858 DoPhysicsPropertyUpdate(UsePhysics, true);
4859=======
4776 DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. 4860 DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status.
4777/* moved into DoPhysicsPropertyUpdate 4861/* moved into DoPhysicsPropertyUpdate
4778 if(VolumeDetectActive) 4862 if(VolumeDetectActive)
@@ -4780,6 +4864,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
4780 else 4864 else
4781 pa.SetVolumeDetect(0); 4865 pa.SetVolumeDetect(0);
4782*/ 4866*/
4867>>>>>>> avn/ubitvar
4783 4868
4784 if (pa.Building != building) 4869 if (pa.Building != building)
4785 pa.Building = building; 4870 pa.Building = building;
@@ -5434,7 +5519,10 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
5434 if (OwnerID != item.Owner) 5519 if (OwnerID != item.Owner)
5435 { 5520 {
5436 //LogPermissions("Before ApplyNextOwnerPermissions"); 5521 //LogPermissions("Before ApplyNextOwnerPermissions");
5437 ApplyNextOwnerPermissions(); 5522
5523 if (scene.Permissions.PropagatePermissions())
5524 ApplyNextOwnerPermissions();
5525
5438 //LogPermissions("After ApplyNextOwnerPermissions"); 5526 //LogPermissions("After ApplyNextOwnerPermissions");
5439 5527
5440 LastOwnerID = OwnerID; 5528 LastOwnerID = OwnerID;
@@ -5468,20 +5556,34 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
5468 { 5556 {
5469 try 5557 try
5470 { 5558 {
5471 if (APIDTarget != Quaternion.Identity) 5559 if (APIDActive)
5472 { 5560 {
5473 if (m_APIDIterations <= 1) 5561 PhysicsActor pa = ParentGroup.RootPart.PhysActor;
5562 if (pa == null || !pa.IsPhysical || APIDStrength < 0.04)
5474 { 5563 {
5475 UpdateRotation(APIDTarget); 5564 StopLookAt();
5476 APIDTarget = Quaternion.Identity;
5477 return; 5565 return;
5478 } 5566 }
5479 5567
5480 Quaternion rot = Quaternion.Slerp(RotationOffset,APIDTarget,1.0f/(float)m_APIDIterations); 5568 Quaternion currRot = GetWorldRotation();
5481 rot.Normalize(); 5569 currRot.Normalize();
5482 UpdateRotation(rot); 5570
5571 // difference between current orientation and desired orientation
5572 Quaternion dR = currRot / APIDTarget;
5573
5574 // find axis and angle of rotation to rotate to desired orientation
5575 Vector3 axis = Vector3.UnitX;
5576 float angle;
5577 dR.GetAxisAngle(out axis, out angle);
5578 axis = axis * currRot;
5579
5580 // clamp strength to avoid overshoot
5581 float strength = 1.0f / APIDStrength;
5582 if (strength > 1.0) strength = 1.0f;
5483 5583
5484 m_APIDIterations--; 5584 // set angular velocity to rotate to desired orientation
5585 // with velocity proportional to strength and angle
5586 AngularVelocity = axis * angle * strength * (float)Math.PI;
5485 5587
5486 // This ensures that we'll check this object on the next iteration 5588 // This ensures that we'll check this object on the next iteration
5487 ParentGroup.QueueForUpdateCheck(); 5589 ParentGroup.QueueForUpdateCheck();
@@ -5519,19 +5621,19 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
5519 /// true if the avatar was not already recorded, false otherwise. 5621 /// true if the avatar was not already recorded, false otherwise.
5520 /// </returns> 5622 /// </returns>
5521 /// <param name='avatarId'></param> 5623 /// <param name='avatarId'></param>
5522 protected internal bool AddSittingAvatar(UUID avatarId) 5624 protected internal bool AddSittingAvatar(ScenePresence sp)
5523 { 5625 {
5524 lock (ParentGroup.m_sittingAvatars) 5626 lock (ParentGroup.m_sittingAvatars)
5525 { 5627 {
5526 if (IsSitTargetSet && SitTargetAvatar == UUID.Zero) 5628 if (IsSitTargetSet && SitTargetAvatar == UUID.Zero)
5527 SitTargetAvatar = avatarId; 5629 SitTargetAvatar = sp.UUID;
5528 5630
5529 if (m_sittingAvatars == null) 5631 if (m_sittingAvatars == null)
5530 m_sittingAvatars = new HashSet<UUID>(); 5632 m_sittingAvatars = new HashSet<ScenePresence>();
5531 5633
5532 if (m_sittingAvatars.Add(avatarId)) 5634 if (m_sittingAvatars.Add(sp))
5533 { 5635 {
5534 ParentGroup.m_sittingAvatars.Add(avatarId); 5636 ParentGroup.m_sittingAvatars.Add(sp);
5535 5637
5536 return true; 5638 return true;
5537 } 5639 }
@@ -5548,22 +5650,22 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
5548 /// true if the avatar was present and removed, false if it was not present. 5650 /// true if the avatar was present and removed, false if it was not present.
5549 /// </returns> 5651 /// </returns>
5550 /// <param name='avatarId'></param> 5652 /// <param name='avatarId'></param>
5551 protected internal bool RemoveSittingAvatar(UUID avatarId) 5653 protected internal bool RemoveSittingAvatar(ScenePresence sp)
5552 { 5654 {
5553 lock (ParentGroup.m_sittingAvatars) 5655 lock (ParentGroup.m_sittingAvatars)
5554 { 5656 {
5555 if (SitTargetAvatar == avatarId) 5657 if (SitTargetAvatar == sp.UUID)
5556 SitTargetAvatar = UUID.Zero; 5658 SitTargetAvatar = UUID.Zero;
5557 5659
5558 if (m_sittingAvatars == null) 5660 if (m_sittingAvatars == null)
5559 return false; 5661 return false;
5560 5662
5561 if (m_sittingAvatars.Remove(avatarId)) 5663 if (m_sittingAvatars.Remove(sp))
5562 { 5664 {
5563 if (m_sittingAvatars.Count == 0) 5665 if (m_sittingAvatars.Count == 0)
5564 m_sittingAvatars = null; 5666 m_sittingAvatars = null;
5565 5667
5566 ParentGroup.m_sittingAvatars.Remove(avatarId); 5668 ParentGroup.m_sittingAvatars.Remove(sp);
5567 5669
5568 return true; 5670 return true;
5569 } 5671 }
@@ -5577,14 +5679,14 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
5577 /// </summary> 5679 /// </summary>
5578 /// <remarks>This applies to all sitting avatars whether there is a sit target set or not.</remarks> 5680 /// <remarks>This applies to all sitting avatars whether there is a sit target set or not.</remarks>
5579 /// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns> 5681 /// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns>
5580 public HashSet<UUID> GetSittingAvatars() 5682 public HashSet<ScenePresence> GetSittingAvatars()
5581 { 5683 {
5582 lock (ParentGroup.m_sittingAvatars) 5684 lock (ParentGroup.m_sittingAvatars)
5583 { 5685 {
5584 if (m_sittingAvatars == null) 5686 if (m_sittingAvatars == null)
5585 return null; 5687 return null;
5586 else 5688 else
5587 return new HashSet<UUID>(m_sittingAvatars); 5689 return new HashSet<ScenePresence>(m_sittingAvatars);
5588 } 5690 }
5589 } 5691 }
5590 5692
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index b9f3f94..7af0b20 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -424,6 +424,10 @@ namespace OpenSim.Region.Framework.Scenes
424 424
425 private UUID RestoreSavedScriptState(UUID loadedID, UUID oldID, UUID newID) 425 private UUID RestoreSavedScriptState(UUID loadedID, UUID oldID, UUID newID)
426 { 426 {
427// m_log.DebugFormat(
428// "[PRIM INVENTORY]: Restoring scripted state for item {0}, oldID {1}, loadedID {2}",
429// newID, oldID, loadedID);
430
427 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); 431 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
428 if (engines.Length == 0) // No engine at all 432 if (engines.Length == 0) // No engine at all
429 return oldID; 433 return oldID;
@@ -436,7 +440,7 @@ namespace OpenSim.Region.Framework.Scenes
436 XmlDocument doc = new XmlDocument(); 440 XmlDocument doc = new XmlDocument();
437 441
438 doc.LoadXml(m_part.ParentGroup.m_savedScriptState[stateID]); 442 doc.LoadXml(m_part.ParentGroup.m_savedScriptState[stateID]);
439 443
440 ////////// CRUFT WARNING /////////////////////////////////// 444 ////////// CRUFT WARNING ///////////////////////////////////
441 // 445 //
442 // Old objects will have <ScriptState><State> ... 446 // Old objects will have <ScriptState><State> ...
@@ -466,6 +470,8 @@ namespace OpenSim.Region.Framework.Scenes
466 // This created document has only the minimun data 470 // This created document has only the minimun data
467 // necessary for XEngine to parse it successfully 471 // necessary for XEngine to parse it successfully
468 472
473// m_log.DebugFormat("[PRIM INVENTORY]: Adding legacy state {0} in {1}", stateID, newID);
474
469 m_part.ParentGroup.m_savedScriptState[stateID] = newDoc.OuterXml; 475 m_part.ParentGroup.m_savedScriptState[stateID] = newDoc.OuterXml;
470 } 476 }
471 477
@@ -886,8 +892,16 @@ namespace OpenSim.Region.Framework.Scenes
886 offsetHeight = 0; 892 offsetHeight = 0;
887 return false; 893 return false;
888 } 894 }
895<<<<<<< HEAD
896
897 Vector3 bbox;
898 float offsetHeight;
899
900 m_part.ParentGroup.Scene.GetObjectsToRez(rezAsset.Data, false, out objlist, out veclist, out bbox, out offsetHeight);
901=======
889 902
890 bool single = m_part.ParentGroup.Scene.GetObjectsToRez(rezAsset.Data, false, out objlist, out veclist, out bbox, out offsetHeight); 903 bool single = m_part.ParentGroup.Scene.GetObjectsToRez(rezAsset.Data, false, out objlist, out veclist, out bbox, out offsetHeight);
904>>>>>>> avn/ubitvar
891 905
892 for (int i = 0; i < objlist.Count; i++) 906 for (int i = 0; i < objlist.Count; i++)
893 { 907 {
@@ -1054,7 +1068,12 @@ namespace OpenSim.Region.Framework.Scenes
1054 m_items.LockItemsForRead(false); 1068 m_items.LockItemsForRead(false);
1055 if (type == 10) // Script 1069 if (type == 10) // Script
1056 { 1070 {
1071<<<<<<< HEAD
1072 // route it through here, to handle script cleanup tasks
1073 RemoveScriptInstance(itemID, false);
1074=======
1057 m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID); 1075 m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID);
1076>>>>>>> avn/ubitvar
1058 } 1077 }
1059 m_items.LockItemsForWrite(true); 1078 m_items.LockItemsForWrite(true);
1060 m_items.Remove(itemID); 1079 m_items.Remove(itemID);
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 6390d26..4bccb7d 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -37,6 +37,7 @@ using log4net;
37using Nini.Config; 37using Nini.Config;
38using OpenSim.Framework; 38using OpenSim.Framework;
39using OpenSim.Framework.Client; 39using OpenSim.Framework.Client;
40using OpenSim.Framework.Monitoring;
40using OpenSim.Region.Framework.Interfaces; 41using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Region.Framework.Scenes.Animation; 42using OpenSim.Region.Framework.Scenes.Animation;
42using OpenSim.Region.Framework.Scenes.Types; 43using OpenSim.Region.Framework.Scenes.Types;
@@ -76,6 +77,7 @@ namespace OpenSim.Region.Framework.Scenes
76 public class ScenePresence : EntityBase, IScenePresence 77 public class ScenePresence : EntityBase, IScenePresence
77 { 78 {
78 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 79 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
80 private static readonly String LogHeader = "[SCENE PRESENCE]";
79 81
80// ~ScenePresence() 82// ~ScenePresence()
81// { 83// {
@@ -297,7 +299,6 @@ namespace OpenSim.Region.Framework.Scenes
297// private int m_lastColCount = -1; //KF: Look for Collision chnages 299// private int m_lastColCount = -1; //KF: Look for Collision chnages
298// private int m_updateCount = 0; //KF: Update Anims for a while 300// private int m_updateCount = 0; //KF: Update Anims for a while
299// private static readonly int UPDATE_COUNT = 10; // how many frames to update for 301// private static readonly int UPDATE_COUNT = 10; // how many frames to update for
300 private List<uint> m_lastColliders = new List<uint>();
301 302
302 private TeleportFlags m_teleportFlags; 303 private TeleportFlags m_teleportFlags;
303 public TeleportFlags TeleportFlags 304 public TeleportFlags TeleportFlags
@@ -360,9 +361,6 @@ namespace OpenSim.Region.Framework.Scenes
360 //private int m_moveToPositionStateStatus; 361 //private int m_moveToPositionStateStatus;
361 //***************************************************** 362 //*****************************************************
362 363
363 private bool m_collisionEventFlag = false;
364 private object m_collisionEventLock = new Object();
365
366 private int m_movementAnimationUpdateCounter = 0; 364 private int m_movementAnimationUpdateCounter = 0;
367 365
368 public Vector3 PrevSitOffset { get; set; } 366 public Vector3 PrevSitOffset { get; set; }
@@ -379,6 +377,8 @@ namespace OpenSim.Region.Framework.Scenes
379 } 377 }
380 } 378 }
381 379
380 public bool SentInitialDataToClient { get; private set; }
381
382 /// <summary> 382 /// <summary>
383 /// Copy of the script states while the agent is in transit. This state may 383 /// Copy of the script states while the agent is in transit. This state may
384 /// need to be placed back in case of transfer fail. 384 /// need to be placed back in case of transfer fail.
@@ -438,6 +438,12 @@ namespace OpenSim.Region.Framework.Scenes
438 private object m_originRegionIDAccessLock = new object(); 438 private object m_originRegionIDAccessLock = new object();
439 439
440 /// <summary> 440 /// <summary>
441 /// Triggered on entity transfer after to allow CompleteMovement() to proceed after we have received an
442 /// UpdateAgent from the originating region.ddkjjkj
443 /// </summary>
444 private AutoResetEvent m_updateAgentReceivedAfterTransferEvent = new AutoResetEvent(false);
445
446 /// <summary>
441 /// Used by the entity transfer module to signal when the presence should not be closed because a subsequent 447 /// Used by the entity transfer module to signal when the presence should not be closed because a subsequent
442 /// teleport is reusing the connection. 448 /// teleport is reusing the connection.
443 /// </summary> 449 /// </summary>
@@ -464,6 +470,11 @@ namespace OpenSim.Region.Framework.Scenes
464 public uint MovementFlag { get; private set; } 470 public uint MovementFlag { get; private set; }
465 471
466 /// <summary> 472 /// <summary>
473 /// Set this if we need to force a movement update on the next received AgentUpdate from the viewer.
474 /// </summary>
475 private const uint ForceUpdateMovementFlagValue = uint.MaxValue;
476
477 /// <summary>
467 /// Is the agent stop control flag currently active? 478 /// Is the agent stop control flag currently active?
468 /// </summary> 479 /// </summary>
469 public bool AgentControlStopActive { get; private set; } 480 public bool AgentControlStopActive { get; private set; }
@@ -545,7 +556,19 @@ namespace OpenSim.Region.Framework.Scenes
545 public string Firstname { get; private set; } 556 public string Firstname { get; private set; }
546 public string Lastname { get; private set; } 557 public string Lastname { get; private set; }
547 558
548 public string Grouptitle { get; set; } 559 public string Grouptitle
560 {
561 get { return UseFakeGroupTitle ? "(Loading)" : m_groupTitle; }
562 set { m_groupTitle = value; }
563 }
564 private string m_groupTitle;
565
566 /// <summary>
567 /// When this is 'true', return a dummy group title instead of the real group title. This is
568 /// used as part of a hack to force viewers to update the displayed avatar name.
569 /// </summary>
570 public bool UseFakeGroupTitle { get; set; }
571
549 572
550 // Agent's Draw distance. 573 // Agent's Draw distance.
551 public float DrawDistance { get; set; } 574 public float DrawDistance { get; set; }
@@ -630,6 +653,12 @@ namespace OpenSim.Region.Framework.Scenes
630 // in the sim unless the avatar is on a sit target. While 653 // in the sim unless the avatar is on a sit target. While
631 // on a sit target, m_pos will contain the desired offset 654 // on a sit target, m_pos will contain the desired offset
632 // without the parent rotation applied. 655 // without the parent rotation applied.
656<<<<<<< HEAD
657 SceneObjectPart sitPart = ParentPart;
658
659 if (sitPart != null)
660 return sitPart.ParentGroup.AbsolutePosition + (m_pos * sitPart.GetWorldRotation());
661=======
633 if (ParentPart != null) 662 if (ParentPart != null)
634 { 663 {
635 SceneObjectPart rootPart = ParentPart.ParentGroup.RootPart; 664 SceneObjectPart rootPart = ParentPart.ParentGroup.RootPart;
@@ -638,6 +667,7 @@ namespace OpenSim.Region.Framework.Scenes
638 if (rootPart != null) 667 if (rootPart != null)
639 return rootPart.AbsolutePosition + (m_pos * rootPart.GetWorldRotation()); 668 return rootPart.AbsolutePosition + (m_pos * rootPart.GetWorldRotation());
640 } 669 }
670>>>>>>> avn/ubitvar
641 } 671 }
642 672
643 return m_pos; 673 return m_pos;
@@ -691,8 +721,11 @@ namespace OpenSim.Region.Framework.Scenes
691 } 721 }
692 722
693 /// <summary> 723 /// <summary>
694 /// Current velocity of the avatar. 724 /// Velocity of the avatar with respect to its local reference frame.
695 /// </summary> 725 /// </summary>
726 /// <remarks>
727 /// So when sat on a vehicle this will be 0. To get velocity with respect to the world use GetWorldVelocity()
728 /// </remarks>
696 public override Vector3 Velocity 729 public override Vector3 Velocity
697 { 730 {
698 get 731 get
@@ -705,11 +738,21 @@ namespace OpenSim.Region.Framework.Scenes
705// "[SCENE PRESENCE]: Set velocity {0} for {1} in {2} via getting Velocity!", 738// "[SCENE PRESENCE]: Set velocity {0} for {1} in {2} via getting Velocity!",
706// m_velocity, Name, Scene.RegionInfo.RegionName); 739// m_velocity, Name, Scene.RegionInfo.RegionName);
707 } 740 }
741// else if (ParentPart != null)
742// {
743// return ParentPart.ParentGroup.Velocity;
744// }
708 745
709 return m_velocity; 746 return m_velocity;
710 } 747 }
748
711 set 749 set
712 { 750 {
751// Util.PrintCallStack();
752// m_log.DebugFormat(
753// "[SCENE PRESENCE]: In {0} set velocity of {1} to {2}",
754// Scene.RegionInfo.RegionName, Name, value);
755
713 if (PhysicsActor != null) 756 if (PhysicsActor != null)
714 { 757 {
715 try 758 try
@@ -722,11 +765,7 @@ namespace OpenSim.Region.Framework.Scenes
722 } 765 }
723 } 766 }
724 767
725 m_velocity = value; 768 m_velocity = value;
726
727// m_log.DebugFormat(
728// "[SCENE PRESENCE]: In {0} set velocity of {1} to {2}",
729// Scene.RegionInfo.RegionName, Name, m_velocity);
730 } 769 }
731 } 770 }
732 771
@@ -810,25 +849,32 @@ namespace OpenSim.Region.Framework.Scenes
810 } 849 }
811 850
812 /// <summary> 851 /// <summary>
813 /// Gets the world rotation of this presence. 852 /// Get rotation relative to the world.
814 /// </summary> 853 /// </summary>
815 /// <remarks>
816 /// Unlike Rotation, this returns the world rotation no matter whether the avatar is sitting on a prim or not.
817 /// </remarks>
818 /// <returns></returns> 854 /// <returns></returns>
819 public Quaternion GetWorldRotation() 855 public Quaternion GetWorldRotation()
820 { 856 {
821 if (IsSatOnObject) 857 SceneObjectPart sitPart = ParentPart;
822 {
823 SceneObjectPart sitPart = ParentPart;
824 858
825 if (sitPart != null) 859 if (sitPart != null)
826 return sitPart.GetWorldRotation() * Rotation; 860 return sitPart.GetWorldRotation() * Rotation;
827 }
828 861
829 return Rotation; 862 return Rotation;
830 } 863 }
831 864
865 /// <summary>
866 /// Get velocity relative to the world.
867 /// </summary>
868 public Vector3 GetWorldVelocity()
869 {
870 SceneObjectPart sitPart = ParentPart;
871
872 if (sitPart != null)
873 return sitPart.ParentGroup.Velocity;
874
875 return Velocity;
876 }
877
832 public void AdjustKnownSeeds() 878 public void AdjustKnownSeeds()
833 { 879 {
834 Dictionary<ulong, string> seeds; 880 Dictionary<ulong, string> seeds;
@@ -844,8 +890,13 @@ namespace OpenSim.Region.Framework.Scenes
844 { 890 {
845 uint x, y; 891 uint x, y;
846 Util.RegionHandleToRegionLoc(handle, out x, out y); 892 Util.RegionHandleToRegionLoc(handle, out x, out y);
893<<<<<<< HEAD
894
895 if (Util.IsOutsideView(DrawDistance, x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY))
896=======
847no information to check this 897no information to check this
848// if (Util.IsOutsideView(DrawDistance, x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY,)) 898// if (Util.IsOutsideView(DrawDistance, x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY,))
899>>>>>>> avn/ubitvar
849 { 900 {
850 old.Add(handle); 901 old.Add(handle);
851 } 902 }
@@ -873,7 +924,7 @@ no information to check this
873 } 924 }
874 925
875 private bool m_mouseLook; 926 private bool m_mouseLook;
876 private bool m_leftButtonDown; 927// private bool m_leftButtonDown;
877 928
878 private bool m_inTransit; 929 private bool m_inTransit;
879 930
@@ -938,9 +989,14 @@ no information to check this
938 989
939 public string Viewer 990 public string Viewer
940 { 991 {
941 get { return m_scene.AuthenticateHandler.GetAgentCircuitData(ControllingClient.CircuitCode).Viewer; } 992 get { return Util.GetViewerName(m_scene.AuthenticateHandler.GetAgentCircuitData(ControllingClient.CircuitCode)); }
942 } 993 }
943 994
995 /// <summary>
996 /// Count of how many terse updates we have sent out. It doesn't matter if this overflows.
997 /// </summary>
998 private int m_terseUpdateCount;
999
944 #endregion 1000 #endregion
945 1001
946 #region Constructor(s) 1002 #region Constructor(s)
@@ -956,7 +1012,8 @@ no information to check this
956 Animator = new ScenePresenceAnimator(this); 1012 Animator = new ScenePresenceAnimator(this);
957 Overrides = new MovementAnimationOverrides(); 1013 Overrides = new MovementAnimationOverrides();
958 PresenceType = type; 1014 PresenceType = type;
959 DrawDistance = world.DefaultDrawDistance; 1015 // DrawDistance = world.DefaultDrawDistance;
1016 DrawDistance = Constants.RegionSize;
960 RegionHandle = world.RegionInfo.RegionHandle; 1017 RegionHandle = world.RegionInfo.RegionHandle;
961 ControllingClient = client; 1018 ControllingClient = client;
962 Firstname = ControllingClient.FirstName; 1019 Firstname = ControllingClient.FirstName;
@@ -1046,6 +1103,21 @@ no information to check this
1046 1103
1047 private void SetDirectionVectors() 1104 private void SetDirectionVectors()
1048 { 1105 {
1106<<<<<<< HEAD
1107 Dir_Vectors[0] = Vector3.UnitX; //FORWARD
1108 Dir_Vectors[1] = -Vector3.UnitX; //BACK
1109 Dir_Vectors[2] = Vector3.UnitY; //LEFT
1110 Dir_Vectors[3] = -Vector3.UnitY; //RIGHT
1111 Dir_Vectors[4] = Vector3.UnitZ; //UP
1112 Dir_Vectors[5] = -Vector3.UnitZ; //DOWN
1113 Dir_Vectors[6] = new Vector3(0.5f, 0f, 0f); //FORWARD_NUDGE
1114 Dir_Vectors[7] = new Vector3(-0.5f, 0f, 0f); //BACK_NUDGE
1115 Dir_Vectors[8] = new Vector3(0f, 0.5f, 0f); //LEFT_NUDGE
1116 Dir_Vectors[9] = new Vector3(0f, -0.5f, 0f); //RIGHT_NUDGE
1117 Dir_Vectors[10] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge
1118 }
1119
1120=======
1049 Dir_Vectors[0] = new Vector3(AgentControlNormalVel,0,0); //FORWARD 1121 Dir_Vectors[0] = new Vector3(AgentControlNormalVel,0,0); //FORWARD
1050 Dir_Vectors[1] = new Vector3(-AgentControlNormalVel,0,0);; //BACK 1122 Dir_Vectors[1] = new Vector3(-AgentControlNormalVel,0,0);; //BACK
1051 Dir_Vectors[2] = new Vector3(0,AgentControlNormalVel,0); //LEFT 1123 Dir_Vectors[2] = new Vector3(0,AgentControlNormalVel,0); //LEFT
@@ -1079,6 +1151,7 @@ no information to check this
1079 return vector; 1151 return vector;
1080 } 1152 }
1081*/ 1153*/
1154>>>>>>> avn/ubitvar
1082 #endregion 1155 #endregion
1083 1156
1084 #region Status Methods 1157 #region Status Methods
@@ -1130,9 +1203,14 @@ no information to check this
1130 } 1203 }
1131 else 1204 else
1132 { 1205 {
1206<<<<<<< HEAD
1207 part.AddSittingAvatar(this);
1208 // ParentPosition = part.GetWorldPosition();
1209=======
1133 part.ParentGroup.AddAvatar(UUID); 1210 part.ParentGroup.AddAvatar(UUID);
1134 if (part.SitTargetPosition != Vector3.Zero) 1211 if (part.SitTargetPosition != Vector3.Zero)
1135 part.SitTargetAvatar = UUID; 1212 part.SitTargetAvatar = UUID;
1213>>>>>>> avn/ubitvar
1136 ParentID = part.LocalId; 1214 ParentID = part.LocalId;
1137 ParentPart = part; 1215 ParentPart = part;
1138 m_pos = PrevSitOffset; 1216 m_pos = PrevSitOffset;
@@ -1159,16 +1237,84 @@ no information to check this
1159 if (gm != null) 1237 if (gm != null)
1160 Grouptitle = gm.GetGroupTitle(m_uuid); 1238 Grouptitle = gm.GetGroupTitle(m_uuid);
1161 1239
1240<<<<<<< HEAD
1241 AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(ControllingClient.CircuitCode);
1242 uint teleportFlags = (aCircuit == null) ? 0 : aCircuit.teleportFlags;
1243 if ((teleportFlags & (uint)TeleportFlags.ViaHGLogin) != 0)
1244 {
1245 // The avatar is arriving from another grid. This means that we may have changed the
1246 // avatar's name to or from the special Hypergrid format ("First.Last @grid.example.com").
1247 // Unfortunately, due to a viewer bug, viewers don't always show the new name.
1248 // But we have a trick that can force them to update the name anyway.
1249 ForceViewersUpdateName();
1250 }
1251=======
1162 m_log.DebugFormat("[MakeRootAgent] Grouptitle: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 1252 m_log.DebugFormat("[MakeRootAgent] Grouptitle: {0}ms", Util.EnvironmentTickCountSubtract(ts));
1253>>>>>>> avn/ubitvar
1163 1254
1164 RegionHandle = m_scene.RegionInfo.RegionHandle; 1255 RegionHandle = m_scene.RegionInfo.RegionHandle;
1165 1256
1166 m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene); 1257 m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene);
1167 m_log.DebugFormat("[MakeRootAgent] TriggerSetRootAgentScene: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 1258 m_log.DebugFormat("[MakeRootAgent] TriggerSetRootAgentScene: {0}ms", Util.EnvironmentTickCountSubtract(ts));
1168 1259
1260<<<<<<< HEAD
1261 UUID groupUUID = ControllingClient.ActiveGroupId;
1262 string groupName = string.Empty;
1263 ulong groupPowers = 0;
1264
1265 // ----------------------------------
1266 // Previous Agent Difference - AGNI sends an unsolicited AgentDataUpdate upon root agent status
1267 try
1268 {
1269 if (groupUUID != UUID.Zero && gm != null)
1270 {
1271 GroupRecord record = gm.GetGroupRecord(groupUUID);
1272 if (record != null)
1273 groupName = record.GroupName;
1274
1275 GroupMembershipData groupMembershipData = gm.GetMembershipData(groupUUID, m_uuid);
1276
1277 if (groupMembershipData != null)
1278 groupPowers = groupMembershipData.GroupPowers;
1279 }
1280
1281 ControllingClient.SendAgentDataUpdate(
1282 m_uuid, groupUUID, Firstname, Lastname, groupPowers, groupName, Grouptitle);
1283 }
1284 catch (Exception e)
1285 {
1286 m_log.Error("[AGENTUPDATE]: Error ", e);
1287 }
1288 // ------------------------------------
1169 1289
1170 if (ParentID == 0) 1290 if (ParentID == 0)
1171 { 1291 {
1292 // Moved this from SendInitialData to ensure that Appearance is initialized
1293 // before the inventory is processed in MakeRootAgent. This fixes a race condition
1294 // related to the handling of attachments
1295 //m_scene.GetAvatarAppearance(ControllingClient, out Appearance);
1296
1297 /* RA 20140111: Commented out these TestBorderCross's.
1298 * Not sure why this code is here. It is not checking all the borders
1299 * and 'in region' sanity checking is done in CheckAndAdjustLandingPoint and below.
1300 if (m_scene.TestBorderCross(pos, Cardinals.E))
1301 {
1302 Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.E);
1303 pos.X = crossedBorder.BorderLine.Z - 1;
1304 }
1305
1306 if (m_scene.TestBorderCross(pos, Cardinals.N))
1307 {
1308 Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.N);
1309 pos.Y = crossedBorder.BorderLine.Z - 1;
1310 }
1311 */
1312
1313=======
1314
1315 if (ParentID == 0)
1316 {
1317>>>>>>> avn/ubitvar
1172 CheckAndAdjustLandingPoint(ref pos); 1318 CheckAndAdjustLandingPoint(ref pos);
1173 1319
1174 if (pos.X < 0f || pos.Y < 0f || pos.Z < 0f) 1320 if (pos.X < 0f || pos.Y < 0f || pos.Z < 0f)
@@ -1198,19 +1344,36 @@ no information to check this
1198 } 1344 }
1199 AbsolutePosition = pos; 1345 AbsolutePosition = pos;
1200 1346
1347// m_log.DebugFormat(
1348// "Set pos {0}, vel {1} in {1} to {2} from input position of {3} on MakeRootAgent",
1349// Name, Scene.Name, AbsolutePosition, pos);
1350//
1201 if (m_teleportFlags == TeleportFlags.Default) 1351 if (m_teleportFlags == TeleportFlags.Default)
1202 { 1352 {
1203 Vector3 vel = Velocity;
1204 AddToPhysicalScene(isFlying); 1353 AddToPhysicalScene(isFlying);
1205 if (PhysicsActor != null) 1354//
1206 PhysicsActor.SetMomentum(vel); 1355// Console.WriteLine(
1356// "Set velocity of {0} in {1} to {2} from input velocity of {3} on MakeRootAgent",
1357// Name, Scene.Name, PhysicsActor.Velocity, vel);
1358// }
1207 } 1359 }
1208 else 1360 else
1209 { 1361 {
1210 AddToPhysicalScene(isFlying); 1362 AddToPhysicalScene(isFlying);
1363<<<<<<< HEAD
1364 }
1365
1366 // XXX: This is to trigger any secondary teleport needed for a megaregion when the user has teleported to a
1367 // location outside the 'root region' (the south-west 256x256 corner). This is the earlist we can do it
1368 // since it requires a physics actor to be present. If it is left any later, then physics appears to reset
1369 // the value to a negative position which does not trigger the border cross.
1370 // This may not be the best location for this.
1371 CheckForBorderCrossing();
1372=======
1211 // reset camera to avatar pos 1373 // reset camera to avatar pos
1212 CameraPosition = pos; 1374 CameraPosition = pos;
1213 } 1375 }
1376>>>>>>> avn/ubitvar
1214 1377
1215 if (ForceFly) 1378 if (ForceFly)
1216 { 1379 {
@@ -1220,6 +1383,40 @@ no information to check this
1220 { 1383 {
1221 Flying = false; 1384 Flying = false;
1222 } 1385 }
1386<<<<<<< HEAD
1387 }
1388
1389 // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying
1390 // avatar to return to the standing position in mid-air. On login it looks like this is being sent
1391 // elsewhere anyway
1392 // Animator.SendAnimPack();
1393
1394 m_scene.SwapRootAgentCount(false);
1395
1396 if (Scene.AttachmentsModule != null)
1397 {
1398 // The initial login scene presence is already root when it gets here
1399 // and it has already rezzed the attachments and started their scripts.
1400 // We do the following only for non-login agents, because their scripts
1401 // haven't started yet.
1402 if (PresenceType == PresenceType.Npc || IsRealLogin(m_teleportFlags))
1403 {
1404 WorkManager.RunJob(
1405 "RezAttachments",
1406 o => Scene.AttachmentsModule.RezAttachments(this),
1407 null,
1408 string.Format("Rez attachments for {0} in {1}", Name, Scene.Name));
1409 }
1410 else
1411 {
1412 WorkManager.RunJob(
1413 "StartAttachmentScripts",
1414 o => RestartAttachmentScripts(),
1415 null,
1416 string.Format("Start attachment scripts for {0} in {1}", Name, Scene.Name),
1417 true);
1418 }
1419=======
1223 1420
1224 // XXX: This is to trigger any secondary teleport needed for a megaregion when the user has teleported to a 1421 // XXX: This is to trigger any secondary teleport needed for a megaregion when the user has teleported to a
1225 // location outside the 'root region' (the south-west 256x256 corner). This is the earlist we can do it 1422 // location outside the 'root region' (the south-west 256x256 corner). This is the earlist we can do it
@@ -1230,17 +1427,28 @@ no information to check this
1230 1427
1231 // its not 1428 // its not
1232// CheckForBorderCrossing(); 1429// CheckForBorderCrossing();
1430>>>>>>> avn/ubitvar
1233 } 1431 }
1234 1432
1235 m_log.DebugFormat("[MakeRootAgent] position and physical: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 1433 m_log.DebugFormat("[MakeRootAgent] position and physical: {0}ms", Util.EnvironmentTickCountSubtract(ts));
1236 m_scene.SwapRootAgentCount(false); 1434 m_scene.SwapRootAgentCount(false);
1237 1435
1436<<<<<<< HEAD
1437 SendAvatarDataToAllClients();
1438
1439 // send the animations of the other presences to me
1440 m_scene.ForEachRootScenePresence(delegate(ScenePresence presence)
1441 {
1442 if (presence != this)
1443 presence.Animator.SendAnimPackToClient(ControllingClient);
1444 });
1445=======
1446>>>>>>> avn/ubitvar
1238 1447
1239 // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will 1448 // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will
1240 // stall on the border crossing since the existing child agent will still have the last movement 1449 // stall on the border crossing since the existing child agent will still have the last movement
1241 // recorded, which stops the input from being processed. 1450 // recorded, which stops the input from being processed.
1242 1451 MovementFlag = ForceUpdateMovementFlagValue;
1243 MovementFlag = 0;
1244 1452
1245 m_scene.EventManager.TriggerOnMakeRootAgent(this); 1453 m_scene.EventManager.TriggerOnMakeRootAgent(this);
1246 m_log.DebugFormat("[MakeRootAgent] TriggerOnMakeRootAgent and done: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 1454 m_log.DebugFormat("[MakeRootAgent] TriggerOnMakeRootAgent and done: {0}ms", Util.EnvironmentTickCountSubtract(ts));
@@ -1248,6 +1456,70 @@ no information to check this
1248 return true; 1456 return true;
1249 } 1457 }
1250 1458
1459 private void RestartAttachmentScripts()
1460 {
1461 // We need to restart scripts here so that they receive the correct changed events (CHANGED_TELEPORT
1462 // and CHANGED_REGION) when the attachments have been rezzed in the new region. This cannot currently
1463 // be done in AttachmentsModule.CopyAttachments(AgentData ad, IScenePresence sp) itself since we are
1464 // not transporting the required data.
1465 //
1466 // We must take a copy of the attachments list here (rather than locking) to avoid a deadlock where a script in one of
1467 // the attachments may start processing an event (which locks ScriptInstance.m_Script) that then calls a method here
1468 // which needs to lock m_attachments. ResumeScripts() needs to take a ScriptInstance.m_Script lock to try to unset the Suspend status.
1469 //
1470 // FIXME: In theory, this deadlock should not arise since scripts should not be processing events until ResumeScripts().
1471 // But XEngine starts all scripts unsuspended. Starting them suspended will not currently work because script rezzing
1472 // is placed in an asynchronous queue in XEngine and so the ResumeScripts() call will almost certainly execute before the
1473 // script is rezzed. This means the ResumeScripts() does absolutely nothing when using XEngine.
1474 List<SceneObjectGroup> attachments = GetAttachments();
1475
1476 m_log.DebugFormat(
1477 "[SCENE PRESENCE]: Restarting scripts in {0} attachments for {1} in {2}", attachments.Count, Name, Scene.Name);
1478
1479 // Resume scripts
1480 foreach (SceneObjectGroup sog in attachments)
1481 {
1482 sog.ScheduleGroupForFullUpdate();
1483 sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource());
1484 sog.ResumeScripts();
1485 }
1486 }
1487
1488 private static bool IsRealLogin(TeleportFlags teleportFlags)
1489 {
1490 return ((teleportFlags & TeleportFlags.ViaLogin) != 0) && ((teleportFlags & TeleportFlags.ViaHGLogin) == 0);
1491 }
1492
1493 /// <summary>
1494 /// Force viewers to show the avatar's current name.
1495 /// </summary>
1496 /// <remarks>
1497 /// The avatar name that is shown above the avatar in the viewers is sent in ObjectUpdate packets,
1498 /// and they get the name from the ScenePresence. Unfortunately, viewers have a bug (as of April 2014)
1499 /// where they ignore changes to the avatar name. However, tey don't ignore changes to the avatar's
1500 /// Group Title. So the following trick makes viewers update the avatar's name by briefly changing
1501 /// the group title (to "(Loading)"), and then restoring it.
1502 /// </remarks>
1503 public void ForceViewersUpdateName()
1504 {
1505 m_log.DebugFormat("[SCENE PRESENCE]: Forcing viewers to update the avatar name for " + Name);
1506
1507 UseFakeGroupTitle = true;
1508 SendAvatarDataToAllClients(false);
1509
1510 Util.FireAndForget(o =>
1511 {
1512 // Viewers only update the avatar name when idle. Therefore, we must wait long
1513 // enough for the viewer to show the fake name that we had set above, and only
1514 // then switch back to the true name. This delay was chosen because it has a high
1515 // chance of succeeding (we don't want to choose a value that's too low).
1516 Thread.Sleep(5000);
1517
1518 UseFakeGroupTitle = false;
1519 SendAvatarDataToAllClients(false);
1520 }, null, "Scenepresence.ForceViewersUpdateName");
1521 }
1522
1251 public int GetStateSource() 1523 public int GetStateSource()
1252 { 1524 {
1253 AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(UUID); 1525 AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(UUID);
@@ -1285,6 +1557,11 @@ no information to check this
1285 lock (m_originRegionIDAccessLock) 1557 lock (m_originRegionIDAccessLock)
1286 m_originRegionID = UUID.Zero; 1558 m_originRegionID = UUID.Zero;
1287 1559
1560 // Reset the m_originRegionID as it has dual use as a flag to signal that the UpdateAgent() call orignating
1561 // from the source simulator has completed on a V2 teleport.
1562 lock (m_originRegionIDAccessLock)
1563 m_originRegionID = UUID.Zero;
1564
1288 // Reset these so that teleporting in and walking out isn't seen 1565 // Reset these so that teleporting in and walking out isn't seen
1289 // as teleporting back 1566 // as teleporting back
1290 TeleportFlags = TeleportFlags.Default; 1567 TeleportFlags = TeleportFlags.Default;
@@ -1332,9 +1609,9 @@ no information to check this
1332 if (PhysicsActor != null) 1609 if (PhysicsActor != null)
1333 { 1610 {
1334// PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; 1611// PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients;
1612 PhysicsActor.UnSubscribeEvents();
1335 PhysicsActor.OnOutOfBounds -= OutOfBoundsCall; 1613 PhysicsActor.OnOutOfBounds -= OutOfBoundsCall;
1336 PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; 1614 PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate;
1337 PhysicsActor.UnSubscribeEvents();
1338 m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); 1615 m_scene.PhysicsScene.RemoveAvatar(PhysicsActor);
1339 PhysicsActor = null; 1616 PhysicsActor = null;
1340 } 1617 }
@@ -1372,8 +1649,6 @@ no information to check this
1372 else 1649 else
1373 PhysicsActor.SetMomentum(vel); 1650 PhysicsActor.SetMomentum(vel);
1374 } 1651 }
1375
1376 SendTerseUpdateToAllClients();
1377 } 1652 }
1378 1653
1379 public void avnLocalTeleport(Vector3 newpos, Vector3? newvel, bool rotateToVelXY) 1654 public void avnLocalTeleport(Vector3 newpos, Vector3? newvel, bool rotateToVelXY)
@@ -1405,12 +1680,8 @@ no information to check this
1405 } 1680 }
1406 } 1681 }
1407 } 1682 }
1408
1409 SendTerseUpdateToAllClients();
1410 } 1683 }
1411 1684
1412
1413
1414 public void StopFlying() 1685 public void StopFlying()
1415 { 1686 {
1416 if (IsInTransit) 1687 if (IsInTransit)
@@ -1644,8 +1915,17 @@ no information to check this
1644 public void SetSize(Vector3 size, float feetoffset) 1915 public void SetSize(Vector3 size, float feetoffset)
1645 { 1916 {
1646 if (PhysicsActor != null && !IsChildAgent) 1917 if (PhysicsActor != null && !IsChildAgent)
1918<<<<<<< HEAD
1919 {
1920 // Eventually there will be a physics call that sets avatar size that includes offset info.
1921 // For the moment, just set the size as passed.
1922 PhysicsActor.Size = size;
1923 // PhysicsActor.setAvatarSize(size, feetoffset);
1924 }
1925=======
1647 PhysicsActor.setAvatarSize(size, feetoffset); 1926 PhysicsActor.setAvatarSize(size, feetoffset);
1648 1927
1928>>>>>>> avn/ubitvar
1649 } 1929 }
1650 1930
1651 private bool WaitForUpdateAgent(IClientAPI client) 1931 private bool WaitForUpdateAgent(IClientAPI client)
@@ -1654,20 +1934,12 @@ no information to check this
1654 // (which triggers Scene.IncomingUpdateChildAgent(AgentData cAgentData) here in the destination, 1934 // (which triggers Scene.IncomingUpdateChildAgent(AgentData cAgentData) here in the destination,
1655 // m_originRegionID is UUID.Zero; after, it's non-Zero. The CompleteMovement sequence initiated from the 1935 // m_originRegionID is UUID.Zero; after, it's non-Zero. The CompleteMovement sequence initiated from the
1656 // viewer (in turn triggered by the source region sending it a TeleportFinish event) waits until it's non-zero 1936 // viewer (in turn triggered by the source region sending it a TeleportFinish event) waits until it's non-zero
1657 int count = 50; 1937 m_updateAgentReceivedAfterTransferEvent.WaitOne(10000);
1658 UUID originID;
1659 1938
1660 lock (m_originRegionIDAccessLock) 1939 UUID originID = UUID.Zero;
1661 originID = m_originRegionID;
1662
1663 while (originID.Equals(UUID.Zero) && count-- > 0)
1664 {
1665 lock (m_originRegionIDAccessLock)
1666 originID = m_originRegionID;
1667 1940
1668 m_log.DebugFormat("[SCENE PRESENCE]: Agent {0} waiting for update in {1}", client.Name, Scene.Name); 1941 lock (m_originRegionIDAccessLock)
1669 Thread.Sleep(200); 1942 originID = m_originRegionID;
1670 }
1671 1943
1672 if (originID.Equals(UUID.Zero)) 1944 if (originID.Equals(UUID.Zero))
1673 { 1945 {
@@ -1698,6 +1970,40 @@ no information to check this
1698 1970
1699 m_inTransit = true; 1971 m_inTransit = true;
1700 1972
1973<<<<<<< HEAD
1974 bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); // Get this ahead of time because IsInTransit modifies 'm_AgentControlFlags'
1975
1976 IsInTransit = true;
1977 try
1978 {
1979 // Make sure it's not a login agent. We don't want to wait for updates during login
1980 if (!(PresenceType == PresenceType.Npc || IsRealLogin(m_teleportFlags)))
1981 {
1982 // Let's wait until UpdateAgent (called by departing region) is done
1983 if (!WaitForUpdateAgent(client))
1984 // The sending region never sent the UpdateAgent data, we have to refuse
1985 return;
1986 }
1987
1988 Vector3 look = Velocity;
1989
1990 // if ((look.X == 0) && (look.Y == 0) && (look.Z == 0))
1991 if ((Math.Abs(look.X) < 0.1) && (Math.Abs(look.Y) < 0.1) && (Math.Abs(look.Z) < 0.1))
1992 {
1993 look = new Vector3(0.99f, 0.042f, 0);
1994 }
1995
1996 // Prevent teleporting to an underground location
1997 // (may crash client otherwise)
1998 //
1999 Vector3 pos = AbsolutePosition;
2000 float ground = m_scene.GetGroundHeight(pos.X, pos.Y);
2001 if (pos.Z < ground + 1.5f)
2002 {
2003 pos.Z = ground + 1.5f;
2004 AbsolutePosition = pos;
2005 }
2006=======
1701 try 2007 try
1702 { 2008 {
1703 // Make sure it's not a login agent. We don't want to wait for updates during login 2009 // Make sure it's not a login agent. We don't want to wait for updates during login
@@ -1713,16 +2019,103 @@ no information to check this
1713 m_log.DebugFormat("[CompleteMovement] WaitForUpdateAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 2019 m_log.DebugFormat("[CompleteMovement] WaitForUpdateAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts));
1714 2020
1715 bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); 2021 bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
2022>>>>>>> avn/ubitvar
1716 2023
1717 if (!MakeRootAgent(AbsolutePosition, flying)) 2024 if (!MakeRootAgent(AbsolutePosition, flying))
1718 { 2025 {
1719 m_log.DebugFormat( 2026 m_log.DebugFormat(
2027<<<<<<< HEAD
2028 "[SCENE PRESENCE]: Aborting CompleteMovement call for {0} in {1} as they are already root",
2029=======
1720 "[SCENE PRESENCE]: Aborting CompleteMovement call for {0} in {1} as they are already root", 2030 "[SCENE PRESENCE]: Aborting CompleteMovement call for {0} in {1} as they are already root",
2031>>>>>>> avn/ubitvar
1721 Name, Scene.Name); 2032 Name, Scene.Name);
1722 2033
1723 return; 2034 return;
1724 } 2035 }
1725 2036
2037<<<<<<< HEAD
2038 // Tell the client that we're totally ready
2039 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
2040
2041 // Child agents send initial data up in LLUDPServer.HandleUseCircuitCode()
2042 if (!SentInitialDataToClient)
2043 SendInitialDataToClient();
2044
2045 // m_log.DebugFormat("[SCENE PRESENCE] Completed movement");
2046
2047 if (!string.IsNullOrEmpty(m_callbackURI))
2048 {
2049 // We cannot sleep here since this would hold up the inbound packet processing thread, as
2050 // CompleteMovement() is executed synchronously. However, it might be better to delay the release
2051 // here until we know for sure that the agent is active in this region. Sending AgentMovementComplete
2052 // is not enough for Imprudence clients - there appears to be a small delay (<200ms, <500ms) until they regard this
2053 // region as the current region, meaning that a close sent before then will fail the teleport.
2054 // System.Threading.Thread.Sleep(2000);
2055
2056 m_log.DebugFormat(
2057 "[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}",
2058 client.Name, client.AgentId, m_callbackURI);
2059
2060 Scene.SimulationService.ReleaseAgent(m_originRegionID, UUID, m_callbackURI);
2061 m_callbackURI = null;
2062 }
2063 // else
2064 // {
2065 // m_log.DebugFormat(
2066 // "[SCENE PRESENCE]: No callback provided on CompleteMovement of {0} {1} to {2}",
2067 // client.Name, client.AgentId, m_scene.RegionInfo.RegionName);
2068 // }
2069
2070 ValidateAndSendAppearanceAndAgentData();
2071
2072 // Create child agents in neighbouring regions
2073 if (openChildAgents && !IsChildAgent)
2074 {
2075 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
2076 if (m_agentTransfer != null)
2077 {
2078 // Note: this call can take a while, because it notifies each of the simulator's neighbours.
2079 // It's important that we don't allow the avatar to cross regions meanwhile, as that will
2080 // cause serious errors. We've prevented that from happening by setting IsInTransit=true.
2081 m_agentTransfer.EnableChildAgents(this);
2082 }
2083
2084 IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
2085 if (friendsModule != null)
2086 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient);
2087
2088 }
2089
2090 // XXX: If we force an update after activity has completed, then multiple attachments do appear correctly on a destination region
2091 // If we do it a little bit earlier (e.g. when converting the child to a root agent) then this does not work.
2092 // This may be due to viewer code or it may be something we're not doing properly simulator side.
2093 WorkManager.RunJob(
2094 "ScheduleAttachmentsForFullUpdate",
2095 o => ScheduleAttachmentsForFullUpdate(),
2096 null,
2097 string.Format("Schedule attachments for full update for {0} in {1}", Name, Scene.Name),
2098 true);
2099
2100 // m_log.DebugFormat(
2101 // "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms",
2102 // client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds);
2103 }
2104 finally
2105 {
2106 IsInTransit = false;
2107 }
2108 }
2109
2110 private void ScheduleAttachmentsForFullUpdate()
2111 {
2112 lock (m_attachments)
2113 {
2114 foreach (SceneObjectGroup sog in m_attachments)
2115 sog.ScheduleGroupForFullUpdate();
2116 }
2117 }
2118=======
1726 m_log.DebugFormat("[CompleteMovement] MakeRootAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 2119 m_log.DebugFormat("[CompleteMovement] MakeRootAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts));
1727 2120
1728 Vector3 look = Lookat; 2121 Vector3 look = Lookat;
@@ -1804,6 +2197,7 @@ no information to check this
1804 // so sequence is clear 2197 // so sequence is clear
1805 2198
1806 // verify baked textures and cache 2199 // verify baked textures and cache
2200>>>>>>> avn/ubitvar
1807 2201
1808 2202
1809 bool cachedbaked = false; 2203 bool cachedbaked = false;
@@ -2043,13 +2437,13 @@ no information to check this
2043 /// </summary> 2437 /// </summary>
2044 public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) 2438 public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData)
2045 { 2439 {
2046 //m_log.DebugFormat( 2440// m_log.DebugFormat(
2047 // "[SCENE PRESENCE]: In {0} received agent update from {1}, flags {2}", 2441// "[SCENE PRESENCE]: In {0} received agent update from {1}, flags {2}",
2048 // Scene.RegionInfo.RegionName, remoteClient.Name, (AgentManager.ControlFlags)agentData.ControlFlags); 2442// Scene.Name, remoteClient.Name, (AgentManager.ControlFlags)agentData.ControlFlags);
2049 2443
2050 if (IsChildAgent) 2444 if (IsChildAgent)
2051 { 2445 {
2052 // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); 2446// m_log.DebugFormat("DEBUG: HandleAgentUpdate: child agent in {0}", Scene.Name);
2053 return; 2447 return;
2054 } 2448 }
2055 2449
@@ -2090,13 +2484,23 @@ no information to check this
2090 // When we get to the point of re-computing neighbors everytime this 2484 // When we get to the point of re-computing neighbors everytime this
2091 // changes, then start using the agent's drawdistance rather than the 2485 // changes, then start using the agent's drawdistance rather than the
2092 // region's draw distance. 2486 // region's draw distance.
2487<<<<<<< HEAD
2488 DrawDistance = agentData.Far;
2489 // DrawDistance = Scene.DefaultDrawDistance;
2490=======
2093 2491
2094 DrawDistance = Util.Clamp(agentData.Far, 32, m_scene.MaxDrawDistance); 2492 DrawDistance = Util.Clamp(agentData.Far, 32, m_scene.MaxDrawDistance);
2095 2493
2096// DrawDistance = Scene.DefaultDrawDistance; 2494// DrawDistance = Scene.DefaultDrawDistance;
2495>>>>>>> avn/ubitvar
2097 2496
2098 m_mouseLook = (flags & AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0; 2497 m_mouseLook = (flags & AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0;
2099 m_leftButtonDown = (flags & AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0; 2498
2499 // FIXME: This does not work as intended because the viewer only sends the lbutton down when the button
2500 // is first pressed, not whilst it is held down. If this is required in the future then need to look
2501 // for an AGENT_CONTROL_LBUTTON_UP event and make sure to handle cases where an initial DOWN is not
2502 // received (e.g. on holding LMB down on the avatar in a viewer).
2503// m_leftButtonDown = (flags & AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0;
2100 2504
2101 #endregion Inputs 2505 #endregion Inputs
2102 2506
@@ -2188,6 +2592,14 @@ no information to check this
2188 2592
2189 bool update_movementflag = false; 2593 bool update_movementflag = false;
2190 2594
2595 // If we were just made root agent then we must perform movement updates for the first AgentUpdate that
2596 // we get
2597 if (MovementFlag == ForceUpdateMovementFlagValue)
2598 {
2599 MovementFlag = 0;
2600 update_movementflag = true;
2601 }
2602
2191 if (agentData.UseClientAgentPosition) 2603 if (agentData.UseClientAgentPosition)
2192 { 2604 {
2193 MovingToTarget = (agentData.ClientAgentPosition - AbsolutePosition).Length() > 0.2f; 2605 MovingToTarget = (agentData.ClientAgentPosition - AbsolutePosition).Length() > 0.2f;
@@ -2219,6 +2631,8 @@ no information to check this
2219 { 2631 {
2220 bool bAllowUpdateMoveToPosition = false; 2632 bool bAllowUpdateMoveToPosition = false;
2221 2633
2634<<<<<<< HEAD
2635=======
2222 Vector3[] dirVectors; 2636 Vector3[] dirVectors;
2223 2637
2224 // use camera up angle when in mouselook and not flying or when holding the left mouse button down and not flying 2638 // use camera up angle when in mouselook and not flying or when holding the left mouse button down and not flying
@@ -2229,6 +2643,7 @@ no information to check this
2229 dirVectors = Dir_Vectors; 2643 dirVectors = Dir_Vectors;
2230 2644
2231 2645
2646>>>>>>> avn/ubitvar
2232 // A DIR_CONTROL_FLAG occurs when the user is trying to move in a particular direction. 2647 // A DIR_CONTROL_FLAG occurs when the user is trying to move in a particular direction.
2233 foreach (Dir_ControlFlags DCF in DIR_CONTROL_FLAGS) 2648 foreach (Dir_ControlFlags DCF in DIR_CONTROL_FLAGS)
2234 { 2649 {
@@ -2238,7 +2653,9 @@ no information to check this
2238 2653
2239 try 2654 try
2240 { 2655 {
2241 agent_control_v3 += dirVectors[i]; 2656 // Don't slide against ground when crouching if camera is panned around avatar
2657 if (Flying || DCF != Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN)
2658 agent_control_v3 += Dir_Vectors[i];
2242 //m_log.DebugFormat("[Motion]: {0}, {1}",i, dirVectors[i]); 2659 //m_log.DebugFormat("[Motion]: {0}, {1}",i, dirVectors[i]);
2243 } 2660 }
2244 catch (IndexOutOfRangeException) 2661 catch (IndexOutOfRangeException)
@@ -2448,7 +2865,12 @@ no information to check this
2448 // When we get to the point of re-computing neighbors everytime this 2865 // When we get to the point of re-computing neighbors everytime this
2449 // changes, then start using the agent's drawdistance rather than the 2866 // changes, then start using the agent's drawdistance rather than the
2450 // region's draw distance. 2867 // region's draw distance.
2868<<<<<<< HEAD
2869 DrawDistance = agentData.Far;
2870 // DrawDistance = Scene.DefaultDrawDistance;
2871=======
2451 DrawDistance = Util.Clamp(agentData.Far, 32, m_scene.MaxDrawDistance); 2872 DrawDistance = Util.Clamp(agentData.Far, 32, m_scene.MaxDrawDistance);
2873>>>>>>> avn/ubitvar
2452 2874
2453 // Check if Client has camera in 'follow cam' or 'build' mode. 2875 // Check if Client has camera in 'follow cam' or 'build' mode.
2454 Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); 2876 Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation);
@@ -2643,6 +3065,8 @@ no information to check this
2643 || pos.Z < 0) 3065 || pos.Z < 0)
2644 return; 3066 return;
2645 3067
3068 Scene targetScene = m_scene;
3069
2646// Vector3 heightAdjust = new Vector3(0, 0, Appearance.AvatarHeight / 2); 3070// Vector3 heightAdjust = new Vector3(0, 0, Appearance.AvatarHeight / 2);
2647// pos += heightAdjust; 3071// pos += heightAdjust;
2648// 3072//
@@ -2654,6 +3078,8 @@ no information to check this
2654// } 3078// }
2655 3079
2656 // Get terrain height for sub-region in a megaregion if necessary 3080 // Get terrain height for sub-region in a megaregion if necessary
3081<<<<<<< HEAD
3082=======
2657 int X = (int)((m_scene.RegionInfo.WorldLocX) + pos.X); 3083 int X = (int)((m_scene.RegionInfo.WorldLocX) + pos.X);
2658 int Y = (int)((m_scene.RegionInfo.WorldLocY) + pos.Y); 3084 int Y = (int)((m_scene.RegionInfo.WorldLocY) + pos.Y);
2659 GridRegion target_region = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y); 3085 GridRegion target_region = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y);
@@ -2662,13 +3088,30 @@ no information to check this
2662 return; 3088 return;
2663 UUID target_regionID = target_region.RegionID; 3089 UUID target_regionID = target_region.RegionID;
2664 Scene targetScene = m_scene; 3090 Scene targetScene = m_scene;
3091>>>>>>> avn/ubitvar
3092
3093 //COMMENT: If its only nessesary in a megaregion, why do it on normal region's too?
2665 3094
2666 if (!SceneManager.Instance.TryGetScene(target_regionID, out targetScene)) 3095 if (regionCombinerModule != null)
2667 targetScene = m_scene; 3096 {
3097 int x = (int)((m_scene.RegionInfo.WorldLocX) + pos.X);
3098 int y = (int)((m_scene.RegionInfo.WorldLocY) + pos.Y);
3099 GridRegion target_region = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, x, y);
3100
3101<<<<<<< HEAD
3102 // If X and Y is NaN, target_region will be null
3103 if (target_region == null)
3104 return;
3105
3106 SceneManager.Instance.TryGetScene(target_region.RegionID, out targetScene);
3107 }
2668 3108
2669 float terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % regionSize.X), (int)(pos.Y % regionSize.Y)]; 3109 float terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % regionSize.X), (int)(pos.Y % regionSize.Y)];
3110=======
3111 float terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % regionSize.X), (int)(pos.Y % regionSize.Y)];
2670 // dont try to land underground 3112 // dont try to land underground
2671 terrainHeight += Appearance.AvatarHeight / 2; 3113 terrainHeight += Appearance.AvatarHeight / 2;
3114>>>>>>> avn/ubitvar
2672 pos.Z = Math.Max(terrainHeight, pos.Z); 3115 pos.Z = Math.Max(terrainHeight, pos.Z);
2673 3116
2674 // Fudge factor. It appears that if one clicks "go here" on a piece of ground, the go here request is 3117 // Fudge factor. It appears that if one clicks "go here" on a piece of ground, the go here request is
@@ -2677,16 +3120,26 @@ no information to check this
2677 if (pos.Z - terrainHeight < 0.2) 3120 if (pos.Z - terrainHeight < 0.2)
2678 pos.Z = terrainHeight; 3121 pos.Z = terrainHeight;
2679 3122
3123<<<<<<< HEAD
3124=======
2680// m_log.DebugFormat( 3125// m_log.DebugFormat(
2681// "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}", 3126// "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}",
2682// Name, pos, terrainHeight, m_scene.RegionInfo.RegionName); 3127// Name, pos, terrainHeight, m_scene.RegionInfo.RegionName);
2683 3128
2684 3129
3130>>>>>>> avn/ubitvar
2685 if (noFly) 3131 if (noFly)
2686 Flying = false; 3132 Flying = false;
2687 else if (pos.Z > terrainHeight + Appearance.AvatarHeight / 2 || Flying) 3133 else if (pos.Z > terrainHeight + Appearance.AvatarHeight / 2 || Flying)
2688 Flying = true; 3134 Flying = true;
2689 3135
3136// m_log.DebugFormat(
3137// "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}",
3138// Name, pos, terrainHeight, m_scene.RegionInfo.RegionName);
3139
3140 if (noFly)
3141 Flying = false;
3142
2690 LandAtTarget = landAtTarget; 3143 LandAtTarget = landAtTarget;
2691 MovingToTarget = true; 3144 MovingToTarget = true;
2692 MoveToPositionTarget = pos; 3145 MoveToPositionTarget = pos;
@@ -2761,10 +3214,13 @@ no information to check this
2761 } 3214 }
2762 } 3215 }
2763 3216
3217<<<<<<< HEAD
3218=======
2764 part.ParentGroup.DeleteAvatar(UUID); 3219 part.ParentGroup.DeleteAvatar(UUID);
2765 3220
2766 Quaternion standRotation = part.ParentGroup.RootPart.RotationOffset; 3221 Quaternion standRotation = part.ParentGroup.RootPart.RotationOffset;
2767 Vector3 sitPartWorldPosition = part.ParentGroup.AbsolutePosition + m_pos * standRotation; 3222 Vector3 sitPartWorldPosition = part.ParentGroup.AbsolutePosition + m_pos * standRotation;
3223>>>>>>> avn/ubitvar
2768 ControllingClient.SendClearFollowCamProperties(part.ParentUUID); 3224 ControllingClient.SendClearFollowCamProperties(part.ParentUUID);
2769 3225
2770 ParentID = 0; 3226 ParentID = 0;
@@ -2792,9 +3248,24 @@ no information to check this
2792 standRotationZ.Z = 0f; 3248 standRotationZ.Z = 0f;
2793 } 3249 }
2794 3250
3251<<<<<<< HEAD
3252 //Vector3 standPos = ParentPosition + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight);
3253 //Vector3 standPos = ParentPosition;
3254
3255// Vector3 standPositionAdjustment
3256// = part.SitTargetPosition + new Vector3(0.5f, 0f, m_sitAvatarHeight / 2f);
3257 Vector3 adjustmentForSitPosition = OffsetPosition * part.ParentGroup.GroupRotation - SIT_TARGET_ADJUSTMENT * part.GetWorldRotation();
3258
3259 // XXX: This is based on the physics capsule sizes. Need to find a better way to read this rather than
3260 // hardcoding here.
3261 Vector3 adjustmentForSitPose = new Vector3(0.74f, 0f, 0f) * standRotation;
3262
3263 Vector3 standPos = part.ParentGroup.AbsolutePosition + adjustmentForSitPosition + adjustmentForSitPose;
3264=======
2795 Vector3 adjustmentForSitPose = new Vector3(0.75f, 0, m_sitAvatarHeight + .3f) * standRotationZ; 3265 Vector3 adjustmentForSitPose = new Vector3(0.75f, 0, m_sitAvatarHeight + .3f) * standRotationZ;
2796 3266
2797 Vector3 standPos = sitPartWorldPosition + adjustmentForSitPose; 3267 Vector3 standPos = sitPartWorldPosition + adjustmentForSitPose;
3268>>>>>>> avn/ubitvar
2798 3269
2799 m_pos = standPos; 3270 m_pos = standPos;
2800 } 3271 }
@@ -2806,8 +3277,16 @@ no information to check this
2806 3277
2807 if (satOnObject) 3278 if (satOnObject)
2808 { 3279 {
3280<<<<<<< HEAD
3281 SendAvatarDataToAllClients();
3282 m_requestedSitTargetID = 0;
3283
3284 part.RemoveSittingAvatar(this);
3285
3286=======
2809 m_requestedSitTargetID = 0; 3287 m_requestedSitTargetID = 0;
2810 part.RemoveSittingAvatar(UUID); 3288 part.RemoveSittingAvatar(UUID);
3289>>>>>>> avn/ubitvar
2811 part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); 3290 part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
2812 3291
2813 SendAvatarDataToAllAgents(); 3292 SendAvatarDataToAllAgents();
@@ -2907,10 +3386,37 @@ no information to check this
2907 3386
2908 Velocity = Vector3.Zero; 3387 Velocity = Vector3.Zero;
2909 3388
2910 part.AddSittingAvatar(UUID); 3389 part.AddSittingAvatar(this);
2911 3390
2912 cameraAtOffset = part.GetCameraAtOffset(); 3391 cameraAtOffset = part.GetCameraAtOffset();
3392
3393 if (!part.IsRoot && cameraAtOffset == Vector3.Zero)
3394 cameraAtOffset = part.ParentGroup.RootPart.GetCameraAtOffset();
3395
3396 bool cameraEyeOffsetFromRootForChild = false;
2913 cameraEyeOffset = part.GetCameraEyeOffset(); 3397 cameraEyeOffset = part.GetCameraEyeOffset();
3398
3399 if (!part.IsRoot && cameraEyeOffset == Vector3.Zero)
3400 {
3401 cameraEyeOffset = part.ParentGroup.RootPart.GetCameraEyeOffset();
3402 cameraEyeOffsetFromRootForChild = true;
3403 }
3404
3405 if ((cameraEyeOffset != Vector3.Zero && !cameraEyeOffsetFromRootForChild) || cameraAtOffset != Vector3.Zero)
3406 {
3407 if (!part.IsRoot)
3408 {
3409 cameraEyeOffset = cameraEyeOffset * part.RotationOffset;
3410 cameraAtOffset += part.OffsetPosition;
3411 }
3412
3413 cameraEyeOffset += part.OffsetPosition;
3414 }
3415
3416// m_log.DebugFormat(
3417// "[SCENE PRESENCE]: Using cameraAtOffset {0}, cameraEyeOffset {1} for sit on {2} by {3} in {4}",
3418// cameraAtOffset, cameraEyeOffset, part.Name, Name, Scene.Name);
3419
2914 forceMouselook = part.GetForceMouselook(); 3420 forceMouselook = part.GetForceMouselook();
2915 3421
2916 if (!part.IsRoot) 3422 if (!part.IsRoot)
@@ -3054,7 +3560,7 @@ no information to check this
3054 Velocity = Vector3.Zero; 3560 Velocity = Vector3.Zero;
3055 m_AngularVelocity = Vector3.Zero; 3561 m_AngularVelocity = Vector3.Zero;
3056 3562
3057 part.AddSittingAvatar(UUID); 3563 part.AddSittingAvatar(this);
3058 3564
3059 Vector3 cameraAtOffset = part.GetCameraAtOffset(); 3565 Vector3 cameraAtOffset = part.GetCameraAtOffset();
3060 Vector3 cameraEyeOffset = part.GetCameraEyeOffset(); 3566 Vector3 cameraEyeOffset = part.GetCameraEyeOffset();
@@ -3090,7 +3596,6 @@ no information to check this
3090 3596
3091 3597
3092 m_requestedSitTargetID = 0; 3598 m_requestedSitTargetID = 0;
3093 part.ParentGroup.AddAvatar(UUID);
3094 3599
3095 ParentPart = part; 3600 ParentPart = part;
3096 ParentID = part.LocalId; 3601 ParentID = part.LocalId;
@@ -3102,6 +3607,9 @@ no information to check this
3102 Animator.TrySetMovementAnimation("SIT_GROUND"); 3607 Animator.TrySetMovementAnimation("SIT_GROUND");
3103 else 3608 else
3104 Animator.TrySetMovementAnimation("SIT"); 3609 Animator.TrySetMovementAnimation("SIT");
3610<<<<<<< HEAD
3611 SendAvatarDataToAllClients();
3612=======
3105*/ 3613*/
3106 if (status == 3) 3614 if (status == 3)
3107 sitAnimation = "SIT_GROUND"; 3615 sitAnimation = "SIT_GROUND";
@@ -3109,11 +3617,11 @@ no information to check this
3109 sitAnimation = "SIT"; 3617 sitAnimation = "SIT";
3110 3618
3111 Animator.SetMovementAnimations("SIT"); 3619 Animator.SetMovementAnimations("SIT");
3620>>>>>>> avn/ubitvar
3112 3621
3113 part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); 3622 part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
3114 } 3623 }
3115 3624
3116
3117 public void HandleAgentSit(IClientAPI remoteClient, UUID agentID) 3625 public void HandleAgentSit(IClientAPI remoteClient, UUID agentID)
3118 { 3626 {
3119 if (IsChildAgent) 3627 if (IsChildAgent)
@@ -3132,7 +3640,6 @@ no information to check this
3132 return; 3640 return;
3133 } 3641 }
3134 3642
3135
3136 if (part.SitTargetAvatar == UUID) 3643 if (part.SitTargetAvatar == UUID)
3137 { 3644 {
3138 Vector3 sitTargetPos = part.SitTargetPosition; 3645 Vector3 sitTargetPos = part.SitTargetPosition;
@@ -3147,28 +3654,40 @@ no information to check this
3147 3654
3148 //Quaternion result = (sitTargetOrient * vq) * nq; 3655 //Quaternion result = (sitTargetOrient * vq) * nq;
3149 3656
3150 double x, y, z, m; 3657 double x, y, z, m1, m2;
3151 3658
3152 Quaternion r = sitTargetOrient; 3659 Quaternion r = sitTargetOrient;
3153 m = r.X * r.X + r.Y * r.Y + r.Z * r.Z + r.W * r.W; 3660 m1 = r.X * r.X + r.Y * r.Y;
3154 3661 m2 = r.Z * r.Z + r.W * r.W;
3155 if (Math.Abs(1.0 - m) > 0.000001)
3156 {
3157 m = 1.0 / Math.Sqrt(m);
3158 r.X *= (float)m;
3159 r.Y *= (float)m;
3160 r.Z *= (float)m;
3161 r.W *= (float)m;
3162 }
3163 3662
3663 // Rotate the vector <0, 0, 1>
3164 x = 2 * (r.X * r.Z + r.Y * r.W); 3664 x = 2 * (r.X * r.Z + r.Y * r.W);
3165 y = 2 * (-r.X * r.W + r.Y * r.Z); 3665 y = 2 * (-r.X * r.W + r.Y * r.Z);
3166 z = -r.X * r.X - r.Y * r.Y + r.Z * r.Z + r.W * r.W; 3666 z = m2 - m1;
3667
3668 // Set m to be the square of the norm of r.
3669 double m = m1 + m2;
3670
3671 // This constant is emperically determined to be what is used in SL.
3672 // See also http://opensimulator.org/mantis/view.php?id=7096
3673 double offset = 0.05;
3674
3675 // Normally m will be ~ 1, but if someone passed a handcrafted quaternion
3676 // to llSitTarget with values so small that squaring them is rounded off
3677 // to zero, then m could be zero. The result of this floating point
3678 // round off error (causing us to skip this impossible normalization)
3679 // is only 5 cm.
3680 if (m > 0.000001)
3681 {
3682 offset /= m;
3683 }
3167 3684
3168 Vector3 up = new Vector3((float)x, (float)y, (float)z); 3685 Vector3 up = new Vector3((float)x, (float)y, (float)z);
3169 Vector3 sitOffset = up * Appearance.AvatarHeight * 0.02638f; 3686 Vector3 sitOffset = up * (float)offset;
3170 3687
3171 Vector3 newPos = sitTargetPos + sitOffset + SIT_TARGET_ADJUSTMENT; 3688 // sitOffset is in Avatar Center coordinates: from origin to 'sitTargetPos + SIT_TARGET_ADJUSTMENT'.
3689 // So, we need to _substract_ it to get to the origin of the Avatar Center.
3690 Vector3 newPos = sitTargetPos + SIT_TARGET_ADJUSTMENT - sitOffset;
3172 Quaternion newRot; 3691 Quaternion newRot;
3173 3692
3174 if (part.IsRoot) 3693 if (part.IsRoot)
@@ -3201,8 +3720,7 @@ no information to check this
3201// Name, part.AbsolutePosition, m_pos, ParentPosition, part.Name, part.LocalId); 3720// Name, part.AbsolutePosition, m_pos, ParentPosition, part.Name, part.LocalId);
3202 } 3721 }
3203 3722
3204 part.ParentGroup.AddAvatar(UUID); 3723 ParentPart = part;
3205 ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID);
3206 ParentID = m_requestedSitTargetID; 3724 ParentID = m_requestedSitTargetID;
3207 m_AngularVelocity = Vector3.Zero; 3725 m_AngularVelocity = Vector3.Zero;
3208 Velocity = Vector3.Zero; 3726 Velocity = Vector3.Zero;
@@ -3215,8 +3733,13 @@ no information to check this
3215 { 3733 {
3216 sitAnimation = part.SitAnimation; 3734 sitAnimation = part.SitAnimation;
3217 } 3735 }
3736<<<<<<< HEAD
3737 Animator.TrySetMovementAnimation(sitAnimation);
3738 SendAvatarDataToAllClients();
3739=======
3218// Animator.TrySetMovementAnimation(sitAnimation); 3740// Animator.TrySetMovementAnimation(sitAnimation);
3219 Animator.SetMovementAnimations("SIT"); 3741 Animator.SetMovementAnimations("SIT");
3742>>>>>>> avn/ubitvar
3220 TriggerScenePresenceUpdated(); 3743 TriggerScenePresenceUpdated();
3221 } 3744 }
3222 } 3745 }
@@ -3278,10 +3801,25 @@ no information to check this
3278 // "[SCENE PRESENCE]: Adding new movement {0} with rotation {1}, thisAddSpeedModifier {2} for {3}", 3801 // "[SCENE PRESENCE]: Adding new movement {0} with rotation {1}, thisAddSpeedModifier {2} for {3}",
3279 // vec, Rotation, thisAddSpeedModifier, Name); 3802 // vec, Rotation, thisAddSpeedModifier, Name);
3280 3803
3804<<<<<<< HEAD
3805 Quaternion rot = Rotation;
3806 if (!Flying && PresenceType != PresenceType.Npc)
3807 {
3808 // The only situation in which we care about X and Y is avatar flying. The rest of the time
3809 // these parameters are not relevant for determining avatar movement direction and cause issues such
3810 // as wrong walk speed if the camera is rotated.
3811 rot.X = 0;
3812 rot.Y = 0;
3813 rot.Normalize();
3814 }
3815
3816 Vector3 direc = vec * rot;
3817=======
3281 // rotate from avatar coord space to world 3818 // rotate from avatar coord space to world
3282 // for now all controls assume this is only a rotation around Z 3819 // for now all controls assume this is only a rotation around Z
3283 // if not all checks below need to be done before this rotation 3820 // if not all checks below need to be done before this rotation
3284 Vector3 direc = vec * Rotation; 3821 Vector3 direc = vec * Rotation;
3822>>>>>>> avn/ubitvar
3285 direc.Normalize(); 3823 direc.Normalize();
3286 3824
3287 // mouse look situation ? 3825 // mouse look situation ?
@@ -3331,10 +3869,6 @@ no information to check this
3331 3869
3332 public override void Update() 3870 public override void Update()
3333 { 3871 {
3334 const float ROTATION_TOLERANCE = 0.01f;
3335 const float VELOCITY_TOLERANCE = 0.001f;
3336 const float POSITION_TOLERANCE = 0.05f;
3337
3338 if (IsChildAgent == false) 3872 if (IsChildAgent == false)
3339 { 3873 {
3340 CheckForBorderCrossing(); 3874 CheckForBorderCrossing();
@@ -3346,11 +3880,21 @@ no information to check this
3346 // grab the latest PhysicsActor velocity, whereas m_velocity is often 3880 // grab the latest PhysicsActor velocity, whereas m_velocity is often
3347 // storing a requested force instead of an actual traveling velocity 3881 // storing a requested force instead of an actual traveling velocity
3348 if (Appearance.AvatarSize != m_lastSize && !IsLoggingIn) 3882 if (Appearance.AvatarSize != m_lastSize && !IsLoggingIn)
3349 SendAvatarDataToAllAgents(); 3883 SendAvatarDataToAllClients();
3350 3884
3351 if (!Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || 3885 // Allow any updates for sitting avatars to that llSetPrimitiveLinkParams() can work for very
3352 !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || 3886 // small increments (e.g. sit position adjusters). An alternative may be to eliminate the tolerance
3353 !m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE)) 3887 // checks on all updates but the ramifications of this would need careful consideration.
3888 bool updateClients
3889 = IsSatOnObject && (Rotation != m_lastRotation || Velocity != m_lastVelocity || m_pos != m_lastPosition);
3890
3891 if (!updateClients)
3892 updateClients
3893 = !Rotation.ApproxEquals(m_lastRotation, Scene.RootRotationUpdateTolerance)
3894 || !Velocity.ApproxEquals(m_lastVelocity, Scene.RootVelocityUpdateTolerance)
3895 || !m_pos.ApproxEquals(m_lastPosition, Scene.RootPositionUpdateTolerance);
3896
3897 if (updateClients)
3354 { 3898 {
3355 SendTerseUpdateToAllClients(); 3899 SendTerseUpdateToAllClients();
3356 3900
@@ -3360,6 +3904,12 @@ no information to check this
3360 m_lastVelocity = Velocity; 3904 m_lastVelocity = Velocity;
3361 } 3905 }
3362 3906
3907<<<<<<< HEAD
3908 if (Scene.AllowAvatarCrossing)
3909 CheckForBorderCrossing();
3910
3911=======
3912>>>>>>> avn/ubitvar
3363 CheckForSignificantMovement(); // sends update to the modules. 3913 CheckForSignificantMovement(); // sends update to the modules.
3364 } 3914 }
3365 } 3915 }
@@ -3368,6 +3918,8 @@ no information to check this
3368 3918
3369 #region Update Client(s) 3919 #region Update Client(s)
3370 3920
3921<<<<<<< HEAD
3922=======
3371 public void SendUpdateToAgent(ScenePresence p) 3923 public void SendUpdateToAgent(ScenePresence p)
3372 { 3924 {
3373 IClientAPI remoteClient = p.ControllingClient; 3925 IClientAPI remoteClient = p.ControllingClient;
@@ -3397,6 +3949,7 @@ no information to check this
3397 ControllingClient.SendAgentTerseUpdate(p); 3949 ControllingClient.SendAgentTerseUpdate(p);
3398 } 3950 }
3399 3951
3952>>>>>>> avn/ubitvar
3400 /// <summary> 3953 /// <summary>
3401 /// Sends a location update to the client connected to this scenePresence 3954 /// Sends a location update to the client connected to this scenePresence
3402 /// via entity updates 3955 /// via entity updates
@@ -3408,6 +3961,29 @@ no information to check this
3408 // server. 3961 // server.
3409 if (remoteClient.IsActive) 3962 if (remoteClient.IsActive)
3410 { 3963 {
3964 if (Scene.RootTerseUpdatePeriod > 1)
3965 {
3966// Console.WriteLine(
3967// "{0} {1} {2} {3} {4} {5} for {6} to {7}",
3968// remoteClient.AgentId, UUID, remoteClient.SceneAgent.IsChildAgent, m_terseUpdateCount, Scene.RootTerseUpdatePeriod, Velocity.ApproxEquals(Vector3.Zero, 0.001f), Name, remoteClient.Name);
3969 if (remoteClient.AgentId != UUID
3970 && !remoteClient.SceneAgent.IsChildAgent
3971 && m_terseUpdateCount % Scene.RootTerseUpdatePeriod != 0
3972 && !Velocity.ApproxEquals(Vector3.Zero, 0.001f))
3973 {
3974// m_log.DebugFormat("[SCENE PRESENCE]: Discarded update from {0} to {1}, args {2} {3} {4} {5} {6} {7}",
3975// Name, remoteClient.Name, remoteClient.AgentId, UUID, remoteClient.SceneAgent.IsChildAgent, m_terseUpdateCount, Scene.RootTerseUpdatePeriod, Velocity.ApproxEquals(Vector3.Zero, 0.001f));
3976
3977 return;
3978 }
3979 }
3980
3981 if (Scene.ChildTerseUpdatePeriod > 1
3982 && remoteClient.SceneAgent.IsChildAgent
3983 && m_terseUpdateCount % Scene.ChildTerseUpdatePeriod != 0
3984 && !Velocity.ApproxEquals(Vector3.Zero, 0.001f))
3985 return;
3986
3411 //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity); 3987 //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity);
3412 remoteClient.SendEntityUpdate( 3988 remoteClient.SendEntityUpdate(
3413 this, 3989 this,
@@ -3476,7 +4052,11 @@ no information to check this
3476 float distanceError = Vector3.Distance(OffsetPosition, expectedPosition); 4052 float distanceError = Vector3.Distance(OffsetPosition, expectedPosition);
3477 4053
3478 float speed = Velocity.Length(); 4054 float speed = Velocity.Length();
3479 float velocidyDiff = Vector3.Distance(lastVelocitySentToAllClients, Velocity); 4055 float velocityDiff = Vector3.Distance(lastVelocitySentToAllClients, Velocity);
4056
4057// m_log.DebugFormat(
4058// "[SCENE PRESENCE]: Delta-v {0}, lastVelocity {1}, Velocity {2} for {3} in {4}",
4059// velocidyDiff, lastVelocitySentToAllClients, Velocity, Name, Scene.Name);
3480 4060
3481 // assuming 5 ms. worst case precision for timer, use 2x that 4061 // assuming 5 ms. worst case precision for timer, use 2x that
3482 // for distance error threshold 4062 // for distance error threshold
@@ -3484,12 +4064,18 @@ no information to check this
3484 4064
3485 if (speed < 0.01f // allow rotation updates if avatar position is unchanged 4065 if (speed < 0.01f // allow rotation updates if avatar position is unchanged
3486 || Math.Abs(distanceError) > distanceErrorThreshold 4066 || Math.Abs(distanceError) > distanceErrorThreshold
3487 || velocidyDiff > 0.01f) // did velocity change from last update? 4067 || velocityDiff > 0.01f) // did velocity change from last update?
3488 { 4068 {
4069// m_log.DebugFormat(
4070// "[SCENE PRESENCE]: Update triggered with speed {0}, distanceError {1}, distanceThreshold {2}, delta-v {3} for {4} in {5}",
4071// speed, distanceError, distanceErrorThreshold, velocidyDiff, Name, Scene.Name);
4072
3489 lastVelocitySentToAllClients = Velocity; 4073 lastVelocitySentToAllClients = Velocity;
3490 lastTerseUpdateToAllClientsTick = currentTick; 4074 lastTerseUpdateToAllClientsTick = currentTick;
3491 lastPositionSentToAllClients = OffsetPosition; 4075 lastPositionSentToAllClients = OffsetPosition;
3492 4076
4077 m_terseUpdateCount++;
4078
3493// Console.WriteLine("Scheduled update for {0} in {1}", Name, Scene.Name); 4079// Console.WriteLine("Scheduled update for {0} in {1}", Name, Scene.Name);
3494// m_scene.ForEachClient(SendTerseUpdateToClient); 4080// m_scene.ForEachClient(SendTerseUpdateToClient);
3495 m_scene.ForEachScenePresence(SendTerseUpdateToAgent); 4081 m_scene.ForEachScenePresence(SendTerseUpdateToAgent);
@@ -3517,14 +4103,24 @@ no information to check this
3517 ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); 4103 ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations);
3518 } 4104 }
3519 4105
3520 public void SendInitialDataToMe() 4106 public void SendInitialDataToClient()
3521 { 4107 {
4108 SentInitialDataToClient = true;
4109
3522 // Send all scene object to the new client 4110 // Send all scene object to the new client
3523 Util.FireAndForget(delegate 4111 WorkManager.RunJob("SendInitialDataToClient", delegate
3524 { 4112 {
4113// m_log.DebugFormat(
4114// "[SCENE PRESENCE]: Sending initial data to {0} agent {1} in {2}, tp flags {3}",
4115// IsChildAgent ? "child" : "root", Name, Scene.Name, m_teleportFlags);
4116
3525 // we created a new ScenePresence (a new child agent) in a fresh region. 4117 // we created a new ScenePresence (a new child agent) in a fresh region.
3526 // Request info about all the (root) agents in this region 4118 // Request info about all the (root) agents in this region
3527 // Note: This won't send data *to* other clients in that region (children don't send) 4119 // Note: This won't send data *to* other clients in that region (children don't send)
4120<<<<<<< HEAD
4121 SendOtherAgentsAvatarDataToClient();
4122 SendOtherAgentsAppearanceToClient();
4123=======
3528 if (m_teleportFlags <= 0) 4124 if (m_teleportFlags <= 0)
3529 { 4125 {
3530 ILandChannel landch = m_scene.LandChannel; 4126 ILandChannel landch = m_scene.LandChannel;
@@ -3533,6 +4129,7 @@ no information to check this
3533 landch.sendClientInitialLandInfo(ControllingClient); 4129 landch.sendClientInitialLandInfo(ControllingClient);
3534 } 4130 }
3535 } 4131 }
4132>>>>>>> avn/ubitvar
3536 4133
3537 SendOtherAgentsAvatarFullToMe(); 4134 SendOtherAgentsAvatarFullToMe();
3538 EntityBase[] entities = Scene.Entities.GetEntities(); 4135 EntityBase[] entities = Scene.Entities.GetEntities();
@@ -3541,7 +4138,11 @@ no information to check this
3541 if (e != null && e is SceneObjectGroup && !((SceneObjectGroup)e).IsAttachment) 4138 if (e != null && e is SceneObjectGroup && !((SceneObjectGroup)e).IsAttachment)
3542 ((SceneObjectGroup)e).SendFullUpdateToClient(ControllingClient); 4139 ((SceneObjectGroup)e).SendFullUpdateToClient(ControllingClient);
3543 } 4140 }
4141<<<<<<< HEAD
4142 }, null, string.Format("SendInitialDataToClient ({0} in {1})", Name, Scene.Name), false, true);
4143=======
3544 }); 4144 });
4145>>>>>>> avn/ubitvar
3545 } 4146 }
3546 4147
3547 /// <summary> 4148 /// <summary>
@@ -3570,6 +4171,17 @@ no information to check this
3570 if (m_scene.AvatarFactory != null) 4171 if (m_scene.AvatarFactory != null)
3571 m_scene.AvatarFactory.QueueAppearanceSave(UUID); 4172 m_scene.AvatarFactory.QueueAppearanceSave(UUID);
3572 } 4173 }
4174<<<<<<< HEAD
4175
4176 // This agent just became root. We are going to tell everyone about it. The process of
4177 // getting other avatars information was initiated elsewhere immediately after the child circuit connected... don't do it
4178 // again here... this comes after the cached appearance check because the avatars
4179 // appearance goes into the avatar update packet
4180 SendAvatarDataToAllClients();
4181
4182 // This invocation always shows up in the viewer logs as an error. Is it needed?
4183 SendAppearanceToClient(this);
4184=======
3573 4185
3574 // send avatar object to all viewers so they cross it into region 4186 // send avatar object to all viewers so they cross it into region
3575 bool newhide = m_currentParcelHide; 4187 bool newhide = m_currentParcelHide;
@@ -3585,6 +4197,7 @@ no information to check this
3585 } 4197 }
3586 4198
3587 SendAppearanceToAgent(this); 4199 SendAppearanceToAgent(this);
4200>>>>>>> avn/ubitvar
3588 4201
3589 m_inTransit = false; 4202 m_inTransit = false;
3590 4203
@@ -3607,6 +4220,13 @@ no information to check this
3607 if (p.UUID == UUID) 4220 if (p.UUID == UUID)
3608 return; 4221 return;
3609 4222
4223<<<<<<< HEAD
4224 // If the avatars baked textures are all in the cache, then we have a
4225 // complete appearance... send it out, if not, then we'll send it when
4226 // the avatar finishes updating its appearance
4227 SendAppearanceToAllOtherClients();
4228 }
4229=======
3610 // get the avatar, then a kill if can't see it 4230 // get the avatar, then a kill if can't see it
3611 p.SendInitialAvatarDataToAgent(this); 4231 p.SendInitialAvatarDataToAgent(this);
3612 4232
@@ -3620,13 +4240,19 @@ no information to check this
3620 }); 4240 });
3621 4241
3622 m_scene.StatsReporter.AddAgentUpdates(count); 4242 m_scene.StatsReporter.AddAgentUpdates(count);
4243>>>>>>> avn/ubitvar
4244 }
4245
4246 public void SendAvatarDataToAllClients()
4247 {
4248 SendAvatarDataToAllClients(true);
3623 } 4249 }
3624 4250
3625 /// <summary> 4251 /// <summary>
3626 /// Send this agent's avatar data to all other root and child agents in the scene 4252 /// Send this agent's avatar data to all other root and child agents in the scene
3627 /// This agent must be root. This avatar will receive its own update. 4253 /// This agent must be root. This avatar will receive its own update.
3628 /// </summary> 4254 /// </summary>
3629 public void SendAvatarDataToAllAgents() 4255 public void SendAvatarDataToAllClients(bool full)
3630 { 4256 {
3631 //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAllAgents: {0} ({1})", Name, UUID); 4257 //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAllAgents: {0} ({1})", Name, UUID);
3632 // only send update from root agents to other clients; children are only "listening posts" 4258 // only send update from root agents to other clients; children are only "listening posts"
@@ -3643,19 +4269,46 @@ no information to check this
3643 4269
3644 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) 4270 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
3645 { 4271 {
4272<<<<<<< HEAD
4273 if (full)
4274 SendAvatarDataToClient(scenePresence);
4275 else
4276 scenePresence.ControllingClient.SendAvatarDataImmediate(this);
4277=======
3646 SendAvatarDataToAgent(scenePresence); 4278 SendAvatarDataToAgent(scenePresence);
4279>>>>>>> avn/ubitvar
3647 count++; 4280 count++;
3648 }); 4281 });
3649 4282
3650 m_scene.StatsReporter.AddAgentUpdates(count); 4283 m_scene.StatsReporter.AddAgentUpdates(count);
3651 } 4284 }
3652 4285
4286<<<<<<< HEAD
4287 /// <summary>
4288 /// Send avatar data for all other root agents to this agent, this agent
4289 /// can be either a child or root
4290 /// </summary>
4291 public void SendOtherAgentsAvatarDataToClient()
4292=======
3653 // sends avatar object to all clients so they cross it into region 4293 // sends avatar object to all clients so they cross it into region
3654 // then sends kills to hide 4294 // then sends kills to hide
3655 public void SendInitialAvatarDataToAllAgents(List<ScenePresence> presences) 4295 public void SendInitialAvatarDataToAllAgents(List<ScenePresence> presences)
4296>>>>>>> avn/ubitvar
3656 { 4297 {
3657 m_lastSize = Appearance.AvatarSize; 4298 m_lastSize = Appearance.AvatarSize;
3658 int count = 0; 4299 int count = 0;
4300<<<<<<< HEAD
4301 m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence)
4302 {
4303 // only send information about other root agents
4304 if (scenePresence.UUID == UUID)
4305 return;
4306
4307 scenePresence.SendAvatarDataToClient(this);
4308 count++;
4309 });
4310=======
4311>>>>>>> avn/ubitvar
3659 4312
3660 foreach (ScenePresence p in presences) 4313 foreach (ScenePresence p in presences)
3661 { 4314 {
@@ -3684,11 +4337,16 @@ no information to check this
3684 /// Send avatar data to an agent. 4337 /// Send avatar data to an agent.
3685 /// </summary> 4338 /// </summary>
3686 /// <param name="avatar"></param> 4339 /// <param name="avatar"></param>
3687 public void SendAvatarDataToAgent(ScenePresence avatar) 4340 public void SendAvatarDataToClient(ScenePresence avatar)
3688 { 4341 {
4342<<<<<<< HEAD
4343 //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToClient from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID);
4344
4345=======
3689 //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID); 4346 //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID);
3690 if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && avatar.GodLevel < 200) 4347 if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && avatar.GodLevel < 200)
3691 return; 4348 return;
4349>>>>>>> avn/ubitvar
3692 avatar.ControllingClient.SendAvatarDataImmediate(this); 4350 avatar.ControllingClient.SendAvatarDataImmediate(this);
3693 } 4351 }
3694 4352
@@ -3701,9 +4359,13 @@ no information to check this
3701 /// Send this agent's appearance to all other root and child agents in the scene 4359 /// Send this agent's appearance to all other root and child agents in the scene
3702 /// This agent must be root. 4360 /// This agent must be root.
3703 /// </summary> 4361 /// </summary>
3704 public void SendAppearanceToAllOtherAgents() 4362 public void SendAppearanceToAllOtherClients()
3705 { 4363 {
4364<<<<<<< HEAD
4365// m_log.DebugFormat("[SCENE PRESENCE] SendAppearanceToAllOtherClients: {0} {1}", Name, UUID);
4366=======
3706 // m_log.DebugFormat("[SCENE PRESENCE] SendAppearanceToAllOtherAgents: {0} {1}", Name, UUID); 4367 // m_log.DebugFormat("[SCENE PRESENCE] SendAppearanceToAllOtherAgents: {0} {1}", Name, UUID);
4368>>>>>>> avn/ubitvar
3707 4369
3708 // only send update from root agents to other clients; children are only "listening posts" 4370 // only send update from root agents to other clients; children are only "listening posts"
3709 if (IsChildAgent) 4371 if (IsChildAgent)
@@ -3722,9 +4384,35 @@ no information to check this
3722 if (scenePresence.UUID == UUID) 4384 if (scenePresence.UUID == UUID)
3723 return; 4385 return;
3724 4386
3725 SendAppearanceToAgent(scenePresence); 4387 SendAppearanceToClient(scenePresence);
3726 count++; 4388 count++;
3727 }); 4389 });
4390<<<<<<< HEAD
4391
4392 m_scene.StatsReporter.AddAgentUpdates(count);
4393 }
4394
4395 /// <summary>
4396 /// Send appearance from all other root agents to this agent. this agent
4397 /// can be either root or child
4398 /// </summary>
4399 public void SendOtherAgentsAppearanceToClient()
4400 {
4401// m_log.DebugFormat("[SCENE PRESENCE] SendOtherAgentsAppearanceToClient {0} {1}", Name, UUID);
4402
4403 int count = 0;
4404 m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence)
4405 {
4406 // only send information about other root agents
4407 if (scenePresence.UUID == UUID)
4408 return;
4409
4410 scenePresence.SendAppearanceToClient(this);
4411 count++;
4412 });
4413
4414=======
4415>>>>>>> avn/ubitvar
3728 m_scene.StatsReporter.AddAgentUpdates(count); 4416 m_scene.StatsReporter.AddAgentUpdates(count);
3729 } 4417 }
3730 4418
@@ -3732,7 +4420,7 @@ no information to check this
3732 /// Send appearance data to an agent. 4420 /// Send appearance data to an agent.
3733 /// </summary> 4421 /// </summary>
3734 /// <param name="avatar"></param> 4422 /// <param name="avatar"></param>
3735 public void SendAppearanceToAgent(ScenePresence avatar) 4423 public void SendAppearanceToClient(ScenePresence avatar)
3736 { 4424 {
3737// m_log.DebugFormat( 4425// m_log.DebugFormat(
3738// "[SCENE PRESENCE]: Sending appearance data from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID); 4426// "[SCENE PRESENCE]: Sending appearance data from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID);
@@ -3858,7 +4546,8 @@ no information to check this
3858 4546
3859 4547
3860 // Let's get this out of the update loop 4548 // Let's get this out of the update loop
3861 Util.FireAndForget(delegate { m_scene.SendOutChildAgentUpdates(agentpos, this); }); 4549 Util.FireAndForget(
4550 o => m_scene.SendOutChildAgentUpdates(agentpos, this), null, "ScenePresence.SendOutChildAgentUpdates");
3862 } 4551 }
3863 } 4552 }
3864 4553
@@ -3885,6 +4574,81 @@ no information to check this
3885 if (ParentID != 0 || PhysicsActor == null || ParentUUID != UUID.Zero) 4574 if (ParentID != 0 || PhysicsActor == null || ParentUUID != UUID.Zero)
3886 return; 4575 return;
3887 4576
4577<<<<<<< HEAD
4578 if (IsInTransit)
4579 return;
4580
4581 Vector3 pos2 = AbsolutePosition;
4582 Vector3 origPosition = pos2;
4583 Vector3 vel = Velocity;
4584
4585 // Compute the future avatar position.
4586 // If the avatar will be crossing, we force the crossing to happen now
4587 // in the hope that this will make the avatar movement smoother when crossing.
4588 pos2 += vel * 0.05f;
4589
4590 if (m_scene.PositionIsInCurrentRegion(pos2))
4591 return;
4592
4593 m_log.DebugFormat("{0} CheckForBorderCrossing: position outside region. {1} in {2} at pos {3}",
4594 LogHeader, Name, Scene.Name, pos2);
4595
4596 // Disconnect from the current region
4597 bool isFlying = Flying;
4598 RemoveFromPhysicalScene();
4599
4600 // pos2 is the forcasted position so make that the 'current' position so the crossing
4601 // code will move us into the newly addressed region.
4602 m_pos = pos2;
4603
4604 if (CrossToNewRegion())
4605 {
4606 AddToPhysicalScene(isFlying);
4607 }
4608 else
4609 {
4610 // Tried to make crossing happen but it failed.
4611 if (m_requestedSitTargetUUID == UUID.Zero)
4612 {
4613 m_log.DebugFormat("{0} CheckForBorderCrossing: Crossing failed. Restoring old position.", LogHeader);
4614
4615 Velocity = Vector3.Zero;
4616 AbsolutePosition = EnforceSanityOnPosition(origPosition);
4617
4618 AddToPhysicalScene(isFlying);
4619 }
4620 }
4621 }
4622
4623 // Given a position, make sure it is within the current region.
4624 // If just outside some border, the returned position will be just inside the border on that side.
4625 private Vector3 EnforceSanityOnPosition(Vector3 origPosition)
4626 {
4627 const float borderFudge = 0.1f;
4628 Vector3 ret = origPosition;
4629
4630 // Sanity checking on the position to make sure it is in the region we couldn't cross from
4631 float extentX = (float)m_scene.RegionInfo.RegionSizeX;
4632 float extentY = (float)m_scene.RegionInfo.RegionSizeY;
4633 IRegionCombinerModule combiner = m_scene.RequestModuleInterface<IRegionCombinerModule>();
4634 if (combiner != null)
4635 {
4636 // If a mega-region, the size could be much bigger
4637 Vector2 megaExtent = combiner.GetSizeOfMegaregion(m_scene.RegionInfo.RegionID);
4638 extentX = megaExtent.X;
4639 extentY = megaExtent.Y;
4640 }
4641 if (ret.X < 0)
4642 ret.X = borderFudge;
4643 else if (ret.X >= extentX)
4644 ret.X = extentX - borderFudge;
4645 if (ret.Y < 0)
4646 ret.Y = borderFudge;
4647 else if (ret.Y >= extentY)
4648 ret.Y = extentY - borderFudge;
4649
4650 return ret;
4651=======
3888 Vector3 pos2 = AbsolutePosition; 4652 Vector3 pos2 = AbsolutePosition;
3889 Vector3 vel = Velocity; 4653 Vector3 vel = Velocity;
3890 4654
@@ -3947,6 +4711,7 @@ no information to check this
3947 AddToPhysicalScene(isFlying); 4711 AddToPhysicalScene(isFlying);
3948 } 4712 }
3949 4713
4714>>>>>>> avn/ubitvar
3950 } 4715 }
3951 4716
3952 /// <summary> 4717 /// <summary>
@@ -4014,6 +4779,16 @@ no information to check this
4014 // Don't close the agent on this region yet 4779 // Don't close the agent on this region yet
4015 if (handle != Scene.RegionInfo.RegionHandle) 4780 if (handle != Scene.RegionInfo.RegionHandle)
4016 { 4781 {
4782<<<<<<< HEAD
4783 uint x, y;
4784 Util.RegionHandleToRegionLoc(handle, out x, out y);
4785
4786// m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX)));
4787// m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY)));
4788 float dist = (float)Math.Max(Scene.DefaultDrawDistance,
4789 (float)Math.Max(Scene.RegionInfo.RegionSizeX, Scene.RegionInfo.RegionSizeY));
4790 if (Util.IsOutsideView(dist, x, newRegionX, y, newRegionY))
4791=======
4017 Util.RegionHandleToRegionLoc(handle, out x, out y); 4792 Util.RegionHandleToRegionLoc(handle, out x, out y);
4018 if (m_knownChildRegionsSizeInfo.TryGetValue(handle, out regInfo)) 4793 if (m_knownChildRegionsSizeInfo.TryGetValue(handle, out regInfo))
4019 { 4794 {
@@ -4027,6 +4802,7 @@ no information to check this
4027 } 4802 }
4028 } 4803 }
4029 else 4804 else
4805>>>>>>> avn/ubitvar
4030 { 4806 {
4031 if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY, 4807 if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY,
4032 (int)Constants.RegionSize, (int)Constants.RegionSize, newRegionSizeX, newRegionSizeY)) 4808 (int)Constants.RegionSize, (int)Constants.RegionSize, newRegionSizeX, newRegionSizeY))
@@ -4099,6 +4875,8 @@ no information to check this
4099 return; 4875 return;
4100 4876
4101 CopyFrom(cAgentData); 4877 CopyFrom(cAgentData);
4878
4879 m_updateAgentReceivedAfterTransferEvent.Set();
4102 } 4880 }
4103 4881
4104 private static Vector3 marker = new Vector3(-1f, -1f, -1f); 4882 private static Vector3 marker = new Vector3(-1f, -1f, -1f);
@@ -4117,11 +4895,23 @@ no information to check this
4117 if (!IsChildAgent) 4895 if (!IsChildAgent)
4118 return; 4896 return;
4119 4897
4898<<<<<<< HEAD
4899// m_log.DebugFormat(
4900// "[SCENE PRESENCE]: ChildAgentPositionUpdate for {0} in {1}, tRegion {2},{3}, rRegion {4},{5}, pos {6}",
4901// Name, Scene.Name, tRegionX, tRegionY, rRegionX, rRegionY, cAgentData.Position);
4902
4903 // Find the distance (in meters) between the two regions
4904 // XXX: We cannot use Util.RegionLocToHandle() here because a negative value will silently overflow the
4905 // uint
4906 int shiftx = (int)(((int)rRegionX - (int)tRegionX) * Constants.RegionSize);
4907 int shifty = (int)(((int)rRegionY - (int)tRegionY) * Constants.RegionSize);
4908=======
4120 RegionHandle = cAgentData.RegionHandle; 4909 RegionHandle = cAgentData.RegionHandle;
4121 4910
4122 //m_log.Debug(" >>> ChildAgentPositionUpdate <<< " + rRegionX + "-" + rRegionY); 4911 //m_log.Debug(" >>> ChildAgentPositionUpdate <<< " + rRegionX + "-" + rRegionY);
4123 int shiftx = ((int)rRegionX - (int)tRegionX) * (int)Constants.RegionSize; 4912 int shiftx = ((int)rRegionX - (int)tRegionX) * (int)Constants.RegionSize;
4124 int shifty = ((int)rRegionY - (int)tRegionY) * (int)Constants.RegionSize; 4913 int shifty = ((int)rRegionY - (int)tRegionY) * (int)Constants.RegionSize;
4914>>>>>>> avn/ubitvar
4125 4915
4126 Vector3 offset = new Vector3(shiftx, shifty, 0f); 4916 Vector3 offset = new Vector3(shiftx, shifty, 0f);
4127 4917
@@ -4129,7 +4919,11 @@ no information to check this
4129 // changes, then start using the agent's drawdistance rather than the 4919 // changes, then start using the agent's drawdistance rather than the
4130 // region's draw distance. 4920 // region's draw distance.
4131 DrawDistance = cAgentData.Far; 4921 DrawDistance = cAgentData.Far;
4922<<<<<<< HEAD
4923 // DrawDistance = Scene.DefaultDrawDistance;
4924=======
4132// DrawDistance = Scene.DefaultDrawDistance; 4925// DrawDistance = Scene.DefaultDrawDistance;
4926>>>>>>> avn/ubitvar
4133 4927
4134 if (cAgentData.Position != marker) // UGH!! 4928 if (cAgentData.Position != marker) // UGH!!
4135 m_pos = cAgentData.Position + offset; 4929 m_pos = cAgentData.Position + offset;
@@ -4244,7 +5038,10 @@ no information to check this
4244 5038
4245 private void CopyFrom(AgentData cAgent) 5039 private void CopyFrom(AgentData cAgent)
4246 { 5040 {
5041<<<<<<< HEAD
5042=======
4247 5043
5044>>>>>>> avn/ubitvar
4248 m_callbackURI = cAgent.CallbackURI; 5045 m_callbackURI = cAgent.CallbackURI;
4249// m_log.DebugFormat( 5046// m_log.DebugFormat(
4250// "[SCENE PRESENCE]: Set callback for {0} in {1} to {2} in CopyFrom()", 5047// "[SCENE PRESENCE]: Set callback for {0} in {1} to {2} in CopyFrom()",
@@ -4263,6 +5060,9 @@ no information to check this
4263 // changes, then start using the agent's drawdistance rather than the 5060 // changes, then start using the agent's drawdistance rather than the
4264 // region's draw distance. 5061 // region's draw distance.
4265 DrawDistance = cAgent.Far; 5062 DrawDistance = cAgent.Far;
5063<<<<<<< HEAD
5064 // DrawDistance = Scene.DefaultDrawDistance;
5065=======
4266 //DrawDistance = Scene.DefaultDrawDistance; 5066 //DrawDistance = Scene.DefaultDrawDistance;
4267 5067
4268 if (cAgent.ChildrenCapSeeds != null && cAgent.ChildrenCapSeeds.Count > 0) 5068 if (cAgent.ChildrenCapSeeds != null && cAgent.ChildrenCapSeeds.Count > 0)
@@ -4273,6 +5073,7 @@ no information to check this
4273 } 5073 }
4274 KnownRegions = cAgent.ChildrenCapSeeds; 5074 KnownRegions = cAgent.ChildrenCapSeeds;
4275 } 5075 }
5076>>>>>>> avn/ubitvar
4276 5077
4277 if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0) 5078 if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0)
4278 ControllingClient.SetChildAgentThrottle(cAgent.Throttles); 5079 ControllingClient.SetChildAgentThrottle(cAgent.Throttles);
@@ -4334,11 +5135,35 @@ no information to check this
4334 Animator.currentControlState = (ScenePresenceAnimator.motionControlStates) cAgent.MotionState; 5135 Animator.currentControlState = (ScenePresenceAnimator.motionControlStates) cAgent.MotionState;
4335 5136
4336 if (Scene.AttachmentsModule != null) 5137 if (Scene.AttachmentsModule != null)
5138<<<<<<< HEAD
5139 {
5140 // If the JobEngine is running we can schedule this job now and continue rather than waiting for all
5141 // attachments to copy, which might take a long time in the Hypergrid case as the entire inventory
5142 // graph is inspected for each attachments and assets possibly fetched.
5143 //
5144 // We don't need to worry about a race condition as the job to later start the scripts is also
5145 // JobEngine scheduled and so will always occur after this task.
5146 // XXX: This will not be true if JobEngine ever gets more than one thread.
5147 WorkManager.RunJob(
5148 "CopyAttachments",
5149 o => Scene.AttachmentsModule.CopyAttachments(cAgent, this),
5150 null,
5151 string.Format("Copy attachments for {0} entering {1}", Name, Scene.Name),
5152 true);
5153 }
5154
5155 // This must occur after attachments are copied or scheduled to be copied, as it releases the CompleteMovement() calling thread
5156 // originating from the client completing a teleport. Otherwise, CompleteMovement() code to restart
5157 // script attachments can outrace this thread.
5158 lock (m_originRegionIDAccessLock)
5159 m_originRegionID = cAgent.RegionID;
5160=======
4337 Scene.AttachmentsModule.CopyAttachments(cAgent, this); 5161 Scene.AttachmentsModule.CopyAttachments(cAgent, this);
4338 5162
4339 lock (m_originRegionIDAccessLock) 5163 lock (m_originRegionIDAccessLock)
4340 m_originRegionID = cAgent.RegionID; 5164 m_originRegionID = cAgent.RegionID;
4341 5165
5166>>>>>>> avn/ubitvar
4342 } 5167 }
4343 5168
4344 public bool CopyAgent(out IAgentData agent) 5169 public bool CopyAgent(out IAgentData agent)
@@ -4387,20 +5212,22 @@ no information to check this
4387 if (Appearance.AvatarHeight == 0) 5212 if (Appearance.AvatarHeight == 0)
4388// Appearance.SetHeight(); 5213// Appearance.SetHeight();
4389 Appearance.SetSize(new Vector3(0.45f,0.6f,1.9f)); 5214 Appearance.SetSize(new Vector3(0.45f,0.6f,1.9f));
4390 5215
4391 PhysicsScene scene = m_scene.PhysicsScene;
4392
4393 Vector3 pVec = AbsolutePosition;
4394
4395/* 5216/*
4396 PhysicsActor = scene.AddAvatar( 5217 PhysicsActor = scene.AddAvatar(
4397 LocalId, Firstname + "." + Lastname, pVec, 5218 LocalId, Firstname + "." + Lastname, pVec,
4398 new Vector3(0.45f, 0.6f, Appearance.AvatarHeight), isFlying); 5219 new Vector3(0.45f, 0.6f, Appearance.AvatarHeight), isFlying);
4399*/ 5220*/
4400 5221
5222<<<<<<< HEAD
5223 PhysicsActor = m_scene.PhysicsScene.AddAvatar(
5224 LocalId, Firstname + "." + Lastname, AbsolutePosition, Velocity,
5225 Appearance.AvatarBoxSize, isFlying);
5226=======
4401 PhysicsActor = scene.AddAvatar( 5227 PhysicsActor = scene.AddAvatar(
4402 LocalId, Firstname + "." + Lastname, pVec, 5228 LocalId, Firstname + "." + Lastname, pVec,
4403 Appearance.AvatarBoxSize,Appearance.AvatarFeetOffset, isFlying); 5229 Appearance.AvatarBoxSize,Appearance.AvatarFeetOffset, isFlying);
5230>>>>>>> avn/ubitvar
4404 5231
4405 //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; 5232 //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
4406 PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; 5233 PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
@@ -5099,7 +5926,7 @@ no information to check this
5099 } 5926 }
5100 } 5927 }
5101 } 5928 }
5102 }); 5929 }, null, "ScenePresence.SendScriptEventToAttachments");
5103 } 5930 }
5104 5931
5105 /// <summary> 5932 /// <summary>
@@ -5536,6 +6363,7 @@ no information to check this
5536 } 6363 }
5537 } 6364 }
5538 6365
6366 // Modify landing point based on possible banning, telehubs or parcel restrictions.
5539 private void CheckAndAdjustLandingPoint(ref Vector3 pos) 6367 private void CheckAndAdjustLandingPoint(ref Vector3 pos)
5540 { 6368 {
5541 string reason; 6369 string reason;
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs
index 5cb271d..998789d 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs
@@ -119,21 +119,22 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
119 return output; 119 return output;
120 } 120 }
121 } 121 }
122 122
123 public static bool TryFromXml(string xml, out CoalescedSceneObjects coa) 123 public static bool TryFromXml(string xml, out CoalescedSceneObjects coa)
124 { 124 {
125// m_log.DebugFormat("[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() deserializing {0}", xml); 125// m_log.DebugFormat("[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() deserializing {0}", xml);
126 126
127 coa = null; 127 coa = null;
128 int i = 0;
129 128
130 using (StringReader sr = new StringReader(xml)) 129 try
131 { 130 {
132 using (XmlTextReader reader = new XmlTextReader(sr)) 131 // Quickly check if this is a coalesced object, without fully parsing the XML
133 { 132 using (StringReader sr = new StringReader(xml))
134 try 133 {
134 using (XmlTextReader reader = new XmlTextReader(sr))
135 { 135 {
136 reader.Read(); 136 reader.MoveToContent(); // skip possible xml declaration
137
137 if (reader.Name != "CoalescedObject") 138 if (reader.Name != "CoalescedObject")
138 { 139 {
139 // m_log.DebugFormat( 140 // m_log.DebugFormat(
@@ -142,49 +143,47 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
142 143
143 return false; 144 return false;
144 } 145 }
145 146 }
146 coa = new CoalescedSceneObjects(UUID.Zero); 147 }
147 reader.Read();
148
149 while (reader.NodeType != XmlNodeType.EndElement && reader.Name != "CoalescedObject")
150 {
151 if (reader.Name == "SceneObjectGroup")
152 {
153 string soXml = reader.ReadOuterXml();
154
155 SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(soXml);
156
157 if (so != null)
158 {
159 coa.Add(so);
160 }
161 else
162 {
163 // XXX: Possibly we should fail outright here rather than continuing if a particular component of the
164 // coalesced object fails to load.
165 m_log.WarnFormat(
166 "[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml for component {0} failed. Continuing.",
167 i);
168 }
169 148
170 i++; 149 XmlDocument doc = new XmlDocument();
171 } 150 doc.LoadXml(xml);
172 } 151 XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject");
152 if (e == null)
153 return false;
173 154
174 reader.ReadEndElement(); // CoalescedObject 155 coa = new CoalescedSceneObjects(UUID.Zero);
156
157 XmlNodeList groups = e.SelectNodes("SceneObjectGroup");
158 int i = 0;
159
160 foreach (XmlNode n in groups)
161 {
162 SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml);
163 if (so != null)
164 {
165 coa.Add(so);
175 } 166 }
176 catch (Exception e) 167 else
177 { 168 {
178 m_log.ErrorFormat( 169 // XXX: Possibly we should fail outright here rather than continuing if a particular component of the
179 "[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml failed with {0} {1}", 170 // coalesced object fails to load.
180 e.Message, e.StackTrace); 171 m_log.WarnFormat(
181 172 "[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml for component {0} failed. Continuing.",
182 return false; 173 i);
183 } 174 }
175
176 i++;
184 } 177 }
185 } 178 }
179 catch (Exception e)
180 {
181 m_log.Error("[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml failed ", e);
182 Util.LogFailedXML("[COALESCED SCENE OBJECTS SERIALIZER]:", xml);
183 return false;
184 }
186 185
187 return true; 186 return true;
188 } 187 }
189 } 188 }
190} \ No newline at end of file 189}
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 3d14943..dc5de58 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -38,6 +38,7 @@ using OpenSim.Framework;
38using OpenSim.Framework.Serialization.External; 38using OpenSim.Framework.Serialization.External;
39using OpenSim.Region.Framework.Interfaces; 39using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Services.Interfaces;
41 42
42namespace OpenSim.Region.Framework.Scenes.Serialization 43namespace OpenSim.Region.Framework.Scenes.Serialization
43{ 44{
@@ -51,7 +52,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 53
53 private static IUserManagement m_UserManagement; 54 private static IUserManagement m_UserManagement;
54 55
55 /// <summary> 56 /// <summary>
56 /// Deserialize a scene object from the original xml format 57 /// Deserialize a scene object from the original xml format
57 /// </summary> 58 /// </summary>
@@ -59,57 +60,62 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
59 /// <returns>The scene object deserialized. Null on failure.</returns> 60 /// <returns>The scene object deserialized. Null on failure.</returns>
60 public static SceneObjectGroup FromOriginalXmlFormat(string xmlData) 61 public static SceneObjectGroup FromOriginalXmlFormat(string xmlData)
61 { 62 {
62 //m_log.DebugFormat("[SOG]: Starting deserialization of SOG"); 63 String fixedData = ExternalRepresentationUtils.SanitizeXml(xmlData);
63 //int time = System.Environment.TickCount; 64 using (XmlTextReader wrappedReader = new XmlTextReader(fixedData, XmlNodeType.Element, null))
64
65 try
66 { 65 {
67 StringReader sr; 66 using (XmlReader reader = XmlReader.Create(wrappedReader, new XmlReaderSettings() { IgnoreWhitespace = true, ConformanceLevel = ConformanceLevel.Fragment }))
68 XmlTextReader reader; 67 {
69 XmlNodeList parts; 68 try {
70 XmlDocument doc; 69 return FromOriginalXmlFormat(reader);
71 int linkNum; 70 }
72 71 catch (Exception e)
73 doc = new XmlDocument(); 72 {
74 doc.LoadXml(xmlData); 73 m_log.Error("[SERIALIZER]: Deserialization of xml failed ", e);
75 parts = doc.GetElementsByTagName("RootPart"); 74 Util.LogFailedXML("[SERIALIZER]:", fixedData);
75 return null;
76 }
77 }
78 }
79 }
76 80
77 if (parts.Count == 0) 81 /// <summary>
78 throw new Exception("Invalid Xml format - no root part"); 82 /// Deserialize a scene object from the original xml format
83 /// </summary>
84 /// <param name="xmlData"></param>
85 /// <returns>The scene object deserialized. Null on failure.</returns>
86 public static SceneObjectGroup FromOriginalXmlFormat(XmlReader reader)
87 {
88 //m_log.DebugFormat("[SOG]: Starting deserialization of SOG");
89 //int time = System.Environment.TickCount;
79 90
80 sr = new StringReader(parts[0].InnerXml); 91 int linkNum;
81 reader = new XmlTextReader(sr);
82 SceneObjectGroup sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(reader));
83 reader.Close();
84 sr.Close();
85 92
86 parts = doc.GetElementsByTagName("Part"); 93 reader.ReadToFollowing("RootPart");
94 reader.ReadToFollowing("SceneObjectPart");
95 SceneObjectGroup sceneObject = new SceneObjectGroup(SceneObjectPart.FromXml(reader));
96 reader.ReadToFollowing("OtherParts");
87 97
88 for (int i = 0; i < parts.Count; i++) 98 if (reader.ReadToDescendant("Part"))
99 {
100 do
89 { 101 {
90 sr = new StringReader(parts[i].InnerXml); 102 if (reader.ReadToDescendant("SceneObjectPart"))
91 reader = new XmlTextReader(sr); 103 {
92 SceneObjectPart part = SceneObjectPart.FromXml(reader); 104 SceneObjectPart part = SceneObjectPart.FromXml(reader);
93 linkNum = part.LinkNum; 105 linkNum = part.LinkNum;
94 sceneObject.AddPart(part); 106 sceneObject.AddPart(part);
95 part.LinkNum = linkNum; 107 part.LinkNum = linkNum;
96 part.TrimPermissions(); 108 part.TrimPermissions();
97 reader.Close(); 109 }
98 sr.Close(); 110 }
99 } 111 while (reader.ReadToNextSibling("Part"));
112 }
100 113
101 // Script state may, or may not, exist. Not having any, is NOT 114 // Script state may, or may not, exist. Not having any, is NOT
102 // ever a problem. 115 // ever a problem.
103 sceneObject.LoadScriptState(doc); 116 sceneObject.LoadScriptState(reader);
104 117
105 return sceneObject; 118 return sceneObject;
106 }
107 catch (Exception e)
108 {
109 m_log.ErrorFormat(
110 "[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData);
111 return null;
112 }
113 } 119 }
114 120
115 /// <summary> 121 /// <summary>
@@ -232,7 +238,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
232 238
233 if (parts.Count == 0) 239 if (parts.Count == 0)
234 { 240 {
235 m_log.ErrorFormat("[SERIALIZER]: Deserialization of xml failed: No SceneObjectPart nodes. xml was " + xmlData); 241 m_log.Error("[SERIALIZER]: Deserialization of xml failed: No SceneObjectPart nodes");
242 Util.LogFailedXML("[SERIALIZER]:", xmlData);
236 return null; 243 return null;
237 } 244 }
238 245
@@ -276,7 +283,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
276 } 283 }
277 catch (Exception e) 284 catch (Exception e)
278 { 285 {
279 m_log.ErrorFormat("[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData); 286 m_log.Error("[SERIALIZER]: Deserialization of xml failed ", e);
287 Util.LogFailedXML("[SERIALIZER]:", xmlData);
280 return null; 288 return null;
281 } 289 }
282 } 290 }
@@ -299,13 +307,21 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
299 } 307 }
300 } 308 }
301 309
310<<<<<<< HEAD
311
312=======
313>>>>>>> avn/ubitvar
302 /// <summary> 314 /// <summary>
303 /// Modifies a SceneObjectGroup. 315 /// Modifies a SceneObjectGroup.
304 /// </summary> 316 /// </summary>
305 /// <param name="sog">The object</param> 317 /// <param name="sog">The object</param>
306 /// <returns>Whether the object was actually modified</returns> 318 /// <returns>Whether the object was actually modified</returns>
307 public delegate bool SceneObjectModifier(SceneObjectGroup sog); 319 public delegate bool SceneObjectModifier(SceneObjectGroup sog);
320<<<<<<< HEAD
321
322=======
308 323
324>>>>>>> avn/ubitvar
309 /// <summary> 325 /// <summary>
310 /// Modifies an object by deserializing it; applying 'modifier' to each SceneObjectGroup; and reserializing. 326 /// Modifies an object by deserializing it; applying 'modifier' to each SceneObjectGroup; and reserializing.
311 /// </summary> 327 /// </summary>
@@ -319,7 +335,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
319 CoalescedSceneObjects coa = null; 335 CoalescedSceneObjects coa = null;
320 336
321 string xmlData = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(data)); 337 string xmlData = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(data));
338<<<<<<< HEAD
339
340=======
322 341
342>>>>>>> avn/ubitvar
323 if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa)) 343 if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa))
324 { 344 {
325 // m_log.DebugFormat("[SERIALIZER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count); 345 // m_log.DebugFormat("[SERIALIZER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count);
@@ -364,17 +384,21 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
364 384
365 return data; 385 return data;
366 } 386 }
387<<<<<<< HEAD
388
389=======
390>>>>>>> avn/ubitvar
367 391
368 #region manual serialization 392 #region manual serialization
369 393
370 private static Dictionary<string, Action<SceneObjectPart, XmlTextReader>> m_SOPXmlProcessors 394 private static Dictionary<string, Action<SceneObjectPart, XmlReader>> m_SOPXmlProcessors
371 = new Dictionary<string, Action<SceneObjectPart, XmlTextReader>>(); 395 = new Dictionary<string, Action<SceneObjectPart, XmlReader>>();
372 396
373 private static Dictionary<string, Action<TaskInventoryItem, XmlTextReader>> m_TaskInventoryXmlProcessors 397 private static Dictionary<string, Action<TaskInventoryItem, XmlReader>> m_TaskInventoryXmlProcessors
374 = new Dictionary<string, Action<TaskInventoryItem, XmlTextReader>>(); 398 = new Dictionary<string, Action<TaskInventoryItem, XmlReader>>();
375 399
376 private static Dictionary<string, Action<PrimitiveBaseShape, XmlTextReader>> m_ShapeXmlProcessors 400 private static Dictionary<string, Action<PrimitiveBaseShape, XmlReader>> m_ShapeXmlProcessors
377 = new Dictionary<string, Action<PrimitiveBaseShape, XmlTextReader>>(); 401 = new Dictionary<string, Action<PrimitiveBaseShape, XmlReader>>();
378 402
379 static SceneObjectSerializer() 403 static SceneObjectSerializer()
380 { 404 {
@@ -521,7 +545,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
521 m_ShapeXmlProcessors.Add("HollowShape", ProcessShpHollowShape); 545 m_ShapeXmlProcessors.Add("HollowShape", ProcessShpHollowShape);
522 m_ShapeXmlProcessors.Add("SculptTexture", ProcessShpSculptTexture); 546 m_ShapeXmlProcessors.Add("SculptTexture", ProcessShpSculptTexture);
523 m_ShapeXmlProcessors.Add("SculptType", ProcessShpSculptType); 547 m_ShapeXmlProcessors.Add("SculptType", ProcessShpSculptType);
524 m_ShapeXmlProcessors.Add("SculptData", ProcessShpSculptData); 548 // Ignore "SculptData"; this element is deprecated
525 m_ShapeXmlProcessors.Add("FlexiSoftness", ProcessShpFlexiSoftness); 549 m_ShapeXmlProcessors.Add("FlexiSoftness", ProcessShpFlexiSoftness);
526 m_ShapeXmlProcessors.Add("FlexiTension", ProcessShpFlexiTension); 550 m_ShapeXmlProcessors.Add("FlexiTension", ProcessShpFlexiTension);
527 m_ShapeXmlProcessors.Add("FlexiDrag", ProcessShpFlexiDrag); 551 m_ShapeXmlProcessors.Add("FlexiDrag", ProcessShpFlexiDrag);
@@ -546,112 +570,112 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
546 } 570 }
547 571
548 #region SOPXmlProcessors 572 #region SOPXmlProcessors
549 private static void ProcessAllowedDrop(SceneObjectPart obj, XmlTextReader reader) 573 private static void ProcessAllowedDrop(SceneObjectPart obj, XmlReader reader)
550 { 574 {
551 obj.AllowedDrop = Util.ReadBoolean(reader); 575 obj.AllowedDrop = Util.ReadBoolean(reader);
552 } 576 }
553 577
554 private static void ProcessCreatorID(SceneObjectPart obj, XmlTextReader reader) 578 private static void ProcessCreatorID(SceneObjectPart obj, XmlReader reader)
555 { 579 {
556 obj.CreatorID = Util.ReadUUID(reader, "CreatorID"); 580 obj.CreatorID = Util.ReadUUID(reader, "CreatorID");
557 } 581 }
558 582
559 private static void ProcessCreatorData(SceneObjectPart obj, XmlTextReader reader) 583 private static void ProcessCreatorData(SceneObjectPart obj, XmlReader reader)
560 { 584 {
561 obj.CreatorData = reader.ReadElementContentAsString("CreatorData", String.Empty); 585 obj.CreatorData = reader.ReadElementContentAsString("CreatorData", String.Empty);
562 } 586 }
563 587
564 private static void ProcessFolderID(SceneObjectPart obj, XmlTextReader reader) 588 private static void ProcessFolderID(SceneObjectPart obj, XmlReader reader)
565 { 589 {
566 obj.FolderID = Util.ReadUUID(reader, "FolderID"); 590 obj.FolderID = Util.ReadUUID(reader, "FolderID");
567 } 591 }
568 592
569 private static void ProcessInventorySerial(SceneObjectPart obj, XmlTextReader reader) 593 private static void ProcessInventorySerial(SceneObjectPart obj, XmlReader reader)
570 { 594 {
571 obj.InventorySerial = (uint)reader.ReadElementContentAsInt("InventorySerial", String.Empty); 595 obj.InventorySerial = (uint)reader.ReadElementContentAsInt("InventorySerial", String.Empty);
572 } 596 }
573 597
574 private static void ProcessTaskInventory(SceneObjectPart obj, XmlTextReader reader) 598 private static void ProcessTaskInventory(SceneObjectPart obj, XmlReader reader)
575 { 599 {
576 obj.TaskInventory = ReadTaskInventory(reader, "TaskInventory"); 600 obj.TaskInventory = ReadTaskInventory(reader, "TaskInventory");
577 } 601 }
578 602
579 private static void ProcessUUID(SceneObjectPart obj, XmlTextReader reader) 603 private static void ProcessUUID(SceneObjectPart obj, XmlReader reader)
580 { 604 {
581 obj.UUID = Util.ReadUUID(reader, "UUID"); 605 obj.UUID = Util.ReadUUID(reader, "UUID");
582 } 606 }
583 607
584 private static void ProcessLocalId(SceneObjectPart obj, XmlTextReader reader) 608 private static void ProcessLocalId(SceneObjectPart obj, XmlReader reader)
585 { 609 {
586 obj.LocalId = (uint)reader.ReadElementContentAsLong("LocalId", String.Empty); 610 obj.LocalId = (uint)reader.ReadElementContentAsLong("LocalId", String.Empty);
587 } 611 }
588 612
589 private static void ProcessName(SceneObjectPart obj, XmlTextReader reader) 613 private static void ProcessName(SceneObjectPart obj, XmlReader reader)
590 { 614 {
591 obj.Name = reader.ReadElementString("Name"); 615 obj.Name = reader.ReadElementString("Name");
592 } 616 }
593 617
594 private static void ProcessMaterial(SceneObjectPart obj, XmlTextReader reader) 618 private static void ProcessMaterial(SceneObjectPart obj, XmlReader reader)
595 { 619 {
596 obj.Material = (byte)reader.ReadElementContentAsInt("Material", String.Empty); 620 obj.Material = (byte)reader.ReadElementContentAsInt("Material", String.Empty);
597 } 621 }
598 622
599 private static void ProcessPassTouches(SceneObjectPart obj, XmlTextReader reader) 623 private static void ProcessPassTouches(SceneObjectPart obj, XmlReader reader)
600 { 624 {
601 obj.PassTouches = Util.ReadBoolean(reader); 625 obj.PassTouches = Util.ReadBoolean(reader);
602 } 626 }
603 627
604 private static void ProcessPassCollisions(SceneObjectPart obj, XmlTextReader reader) 628 private static void ProcessPassCollisions(SceneObjectPart obj, XmlReader reader)
605 { 629 {
606 obj.PassCollisions = Util.ReadBoolean(reader); 630 obj.PassCollisions = Util.ReadBoolean(reader);
607 } 631 }
608 632
609 private static void ProcessRegionHandle(SceneObjectPart obj, XmlTextReader reader) 633 private static void ProcessRegionHandle(SceneObjectPart obj, XmlReader reader)
610 { 634 {
611 obj.RegionHandle = (ulong)reader.ReadElementContentAsLong("RegionHandle", String.Empty); 635 obj.RegionHandle = (ulong)reader.ReadElementContentAsLong("RegionHandle", String.Empty);
612 } 636 }
613 637
614 private static void ProcessScriptAccessPin(SceneObjectPart obj, XmlTextReader reader) 638 private static void ProcessScriptAccessPin(SceneObjectPart obj, XmlReader reader)
615 { 639 {
616 obj.ScriptAccessPin = reader.ReadElementContentAsInt("ScriptAccessPin", String.Empty); 640 obj.ScriptAccessPin = reader.ReadElementContentAsInt("ScriptAccessPin", String.Empty);
617 } 641 }
618 642
619 private static void ProcessGroupPosition(SceneObjectPart obj, XmlTextReader reader) 643 private static void ProcessGroupPosition(SceneObjectPart obj, XmlReader reader)
620 { 644 {
621 obj.GroupPosition = Util.ReadVector(reader, "GroupPosition"); 645 obj.GroupPosition = Util.ReadVector(reader, "GroupPosition");
622 } 646 }
623 647
624 private static void ProcessOffsetPosition(SceneObjectPart obj, XmlTextReader reader) 648 private static void ProcessOffsetPosition(SceneObjectPart obj, XmlReader reader)
625 { 649 {
626 obj.OffsetPosition = Util.ReadVector(reader, "OffsetPosition"); ; 650 obj.OffsetPosition = Util.ReadVector(reader, "OffsetPosition"); ;
627 } 651 }
628 652
629 private static void ProcessRotationOffset(SceneObjectPart obj, XmlTextReader reader) 653 private static void ProcessRotationOffset(SceneObjectPart obj, XmlReader reader)
630 { 654 {
631 obj.RotationOffset = Util.ReadQuaternion(reader, "RotationOffset"); 655 obj.RotationOffset = Util.ReadQuaternion(reader, "RotationOffset");
632 } 656 }
633 657
634 private static void ProcessVelocity(SceneObjectPart obj, XmlTextReader reader) 658 private static void ProcessVelocity(SceneObjectPart obj, XmlReader reader)
635 { 659 {
636 obj.Velocity = Util.ReadVector(reader, "Velocity"); 660 obj.Velocity = Util.ReadVector(reader, "Velocity");
637 } 661 }
638 662
639 private static void ProcessAngularVelocity(SceneObjectPart obj, XmlTextReader reader) 663 private static void ProcessAngularVelocity(SceneObjectPart obj, XmlReader reader)
640 { 664 {
641 obj.AngularVelocity = Util.ReadVector(reader, "AngularVelocity"); 665 obj.AngularVelocity = Util.ReadVector(reader, "AngularVelocity");
642 } 666 }
643 667
644 private static void ProcessAcceleration(SceneObjectPart obj, XmlTextReader reader) 668 private static void ProcessAcceleration(SceneObjectPart obj, XmlReader reader)
645 { 669 {
646 obj.Acceleration = Util.ReadVector(reader, "Acceleration"); 670 obj.Acceleration = Util.ReadVector(reader, "Acceleration");
647 } 671 }
648 672
649 private static void ProcessDescription(SceneObjectPart obj, XmlTextReader reader) 673 private static void ProcessDescription(SceneObjectPart obj, XmlReader reader)
650 { 674 {
651 obj.Description = reader.ReadElementString("Description"); 675 obj.Description = reader.ReadElementString("Description");
652 } 676 }
653 677
654 private static void ProcessColor(SceneObjectPart obj, XmlTextReader reader) 678 private static void ProcessColor(SceneObjectPart obj, XmlReader reader)
655 { 679 {
656 reader.ReadStartElement("Color"); 680 reader.ReadStartElement("Color");
657 if (reader.Name == "R") 681 if (reader.Name == "R")
@@ -665,56 +689,59 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
665 } 689 }
666 } 690 }
667 691
668 private static void ProcessText(SceneObjectPart obj, XmlTextReader reader) 692 private static void ProcessText(SceneObjectPart obj, XmlReader reader)
669 { 693 {
670 obj.Text = reader.ReadElementString("Text", String.Empty); 694 obj.Text = reader.ReadElementString("Text", String.Empty);
671 } 695 }
672 696
673 private static void ProcessSitName(SceneObjectPart obj, XmlTextReader reader) 697 private static void ProcessSitName(SceneObjectPart obj, XmlReader reader)
674 { 698 {
675 obj.SitName = reader.ReadElementString("SitName", String.Empty); 699 obj.SitName = reader.ReadElementString("SitName", String.Empty);
676 } 700 }
677 701
678 private static void ProcessTouchName(SceneObjectPart obj, XmlTextReader reader) 702 private static void ProcessTouchName(SceneObjectPart obj, XmlReader reader)
679 { 703 {
680 obj.TouchName = reader.ReadElementString("TouchName", String.Empty); 704 obj.TouchName = reader.ReadElementString("TouchName", String.Empty);
681 } 705 }
682 706
683 private static void ProcessLinkNum(SceneObjectPart obj, XmlTextReader reader) 707 private static void ProcessLinkNum(SceneObjectPart obj, XmlReader reader)
684 { 708 {
685 obj.LinkNum = reader.ReadElementContentAsInt("LinkNum", String.Empty); 709 obj.LinkNum = reader.ReadElementContentAsInt("LinkNum", String.Empty);
686 } 710 }
687 711
688 private static void ProcessClickAction(SceneObjectPart obj, XmlTextReader reader) 712 private static void ProcessClickAction(SceneObjectPart obj, XmlReader reader)
689 { 713 {
690 obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty); 714 obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty);
691 } 715 }
692 716
693 private static void ProcessPhysicsShapeType(SceneObjectPart obj, XmlTextReader reader) 717 private static void ProcessPhysicsShapeType(SceneObjectPart obj, XmlReader reader)
694 { 718 {
695 obj.PhysicsShapeType = (byte)reader.ReadElementContentAsInt("PhysicsShapeType", String.Empty); 719 obj.PhysicsShapeType = (byte)reader.ReadElementContentAsInt("PhysicsShapeType", String.Empty);
696 } 720 }
697 721
698 private static void ProcessDensity(SceneObjectPart obj, XmlTextReader reader) 722 private static void ProcessDensity(SceneObjectPart obj, XmlReader reader)
699 { 723 {
700 obj.Density = reader.ReadElementContentAsFloat("Density", String.Empty); 724 obj.Density = reader.ReadElementContentAsFloat("Density", String.Empty);
701 } 725 }
702 726
703 private static void ProcessFriction(SceneObjectPart obj, XmlTextReader reader) 727 private static void ProcessFriction(SceneObjectPart obj, XmlReader reader)
704 { 728 {
705 obj.Friction = reader.ReadElementContentAsFloat("Friction", String.Empty); 729 obj.Friction = reader.ReadElementContentAsFloat("Friction", String.Empty);
706 } 730 }
707 731
708 private static void ProcessBounce(SceneObjectPart obj, XmlTextReader reader) 732 private static void ProcessBounce(SceneObjectPart obj, XmlReader reader)
709 { 733 {
710 obj.Restitution = reader.ReadElementContentAsFloat("Bounce", String.Empty); 734 obj.Restitution = reader.ReadElementContentAsFloat("Bounce", String.Empty);
711 } 735 }
712 736
713 private static void ProcessGravityModifier(SceneObjectPart obj, XmlTextReader reader) 737 private static void ProcessGravityModifier(SceneObjectPart obj, XmlReader reader)
714 { 738 {
715 obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty); 739 obj.GravityModifier = reader.ReadElementContentAsFloat("GravityModifier", String.Empty);
716 } 740 }
717 741
742<<<<<<< HEAD
743 private static void ProcessShape(SceneObjectPart obj, XmlReader reader)
744=======
718 private static void ProcessCameraEyeOffset(SceneObjectPart obj, XmlTextReader reader) 745 private static void ProcessCameraEyeOffset(SceneObjectPart obj, XmlTextReader reader)
719 { 746 {
720 obj.SetCameraEyeOffset(Util.ReadVector(reader, "CameraEyeOffset")); 747 obj.SetCameraEyeOffset(Util.ReadVector(reader, "CameraEyeOffset"));
@@ -767,9 +794,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
767 } 794 }
768 795
769 private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader) 796 private static void ProcessShape(SceneObjectPart obj, XmlTextReader reader)
797>>>>>>> avn/ubitvar
770 { 798 {
771 List<string> errorNodeNames; 799 List<string> errorNodeNames;
772 obj.Shape = ReadShape(reader, "Shape", out errorNodeNames); 800 obj.Shape = ReadShape(reader, "Shape", out errorNodeNames, obj);
773 801
774 if (errorNodeNames != null) 802 if (errorNodeNames != null)
775 { 803 {
@@ -779,163 +807,163 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
779 } 807 }
780 } 808 }
781 809
782 private static void ProcessScale(SceneObjectPart obj, XmlTextReader reader) 810 private static void ProcessScale(SceneObjectPart obj, XmlReader reader)
783 { 811 {
784 obj.Scale = Util.ReadVector(reader, "Scale"); 812 obj.Scale = Util.ReadVector(reader, "Scale");
785 } 813 }
786 814
787 private static void ProcessSitTargetOrientation(SceneObjectPart obj, XmlTextReader reader) 815 private static void ProcessSitTargetOrientation(SceneObjectPart obj, XmlReader reader)
788 { 816 {
789 obj.SitTargetOrientation = Util.ReadQuaternion(reader, "SitTargetOrientation"); 817 obj.SitTargetOrientation = Util.ReadQuaternion(reader, "SitTargetOrientation");
790 } 818 }
791 819
792 private static void ProcessSitTargetPosition(SceneObjectPart obj, XmlTextReader reader) 820 private static void ProcessSitTargetPosition(SceneObjectPart obj, XmlReader reader)
793 { 821 {
794 obj.SitTargetPosition = Util.ReadVector(reader, "SitTargetPosition"); 822 obj.SitTargetPosition = Util.ReadVector(reader, "SitTargetPosition");
795 } 823 }
796 824
797 private static void ProcessSitTargetPositionLL(SceneObjectPart obj, XmlTextReader reader) 825 private static void ProcessSitTargetPositionLL(SceneObjectPart obj, XmlReader reader)
798 { 826 {
799 obj.SitTargetPositionLL = Util.ReadVector(reader, "SitTargetPositionLL"); 827 obj.SitTargetPositionLL = Util.ReadVector(reader, "SitTargetPositionLL");
800 } 828 }
801 829
802 private static void ProcessSitTargetOrientationLL(SceneObjectPart obj, XmlTextReader reader) 830 private static void ProcessSitTargetOrientationLL(SceneObjectPart obj, XmlReader reader)
803 { 831 {
804 obj.SitTargetOrientationLL = Util.ReadQuaternion(reader, "SitTargetOrientationLL"); 832 obj.SitTargetOrientationLL = Util.ReadQuaternion(reader, "SitTargetOrientationLL");
805 } 833 }
806 834
807 private static void ProcessParentID(SceneObjectPart obj, XmlTextReader reader) 835 private static void ProcessParentID(SceneObjectPart obj, XmlReader reader)
808 { 836 {
809 string str = reader.ReadElementContentAsString("ParentID", String.Empty); 837 string str = reader.ReadElementContentAsString("ParentID", String.Empty);
810 obj.ParentID = Convert.ToUInt32(str); 838 obj.ParentID = Convert.ToUInt32(str);
811 } 839 }
812 840
813 private static void ProcessCreationDate(SceneObjectPart obj, XmlTextReader reader) 841 private static void ProcessCreationDate(SceneObjectPart obj, XmlReader reader)
814 { 842 {
815 obj.CreationDate = reader.ReadElementContentAsInt("CreationDate", String.Empty); 843 obj.CreationDate = reader.ReadElementContentAsInt("CreationDate", String.Empty);
816 } 844 }
817 845
818 private static void ProcessCategory(SceneObjectPart obj, XmlTextReader reader) 846 private static void ProcessCategory(SceneObjectPart obj, XmlReader reader)
819 { 847 {
820 obj.Category = (uint)reader.ReadElementContentAsInt("Category", String.Empty); 848 obj.Category = (uint)reader.ReadElementContentAsInt("Category", String.Empty);
821 } 849 }
822 850
823 private static void ProcessSalePrice(SceneObjectPart obj, XmlTextReader reader) 851 private static void ProcessSalePrice(SceneObjectPart obj, XmlReader reader)
824 { 852 {
825 obj.SalePrice = reader.ReadElementContentAsInt("SalePrice", String.Empty); 853 obj.SalePrice = reader.ReadElementContentAsInt("SalePrice", String.Empty);
826 } 854 }
827 855
828 private static void ProcessObjectSaleType(SceneObjectPart obj, XmlTextReader reader) 856 private static void ProcessObjectSaleType(SceneObjectPart obj, XmlReader reader)
829 { 857 {
830 obj.ObjectSaleType = (byte)reader.ReadElementContentAsInt("ObjectSaleType", String.Empty); 858 obj.ObjectSaleType = (byte)reader.ReadElementContentAsInt("ObjectSaleType", String.Empty);
831 } 859 }
832 860
833 private static void ProcessOwnershipCost(SceneObjectPart obj, XmlTextReader reader) 861 private static void ProcessOwnershipCost(SceneObjectPart obj, XmlReader reader)
834 { 862 {
835 obj.OwnershipCost = reader.ReadElementContentAsInt("OwnershipCost", String.Empty); 863 obj.OwnershipCost = reader.ReadElementContentAsInt("OwnershipCost", String.Empty);
836 } 864 }
837 865
838 private static void ProcessGroupID(SceneObjectPart obj, XmlTextReader reader) 866 private static void ProcessGroupID(SceneObjectPart obj, XmlReader reader)
839 { 867 {
840 obj.GroupID = Util.ReadUUID(reader, "GroupID"); 868 obj.GroupID = Util.ReadUUID(reader, "GroupID");
841 } 869 }
842 870
843 private static void ProcessOwnerID(SceneObjectPart obj, XmlTextReader reader) 871 private static void ProcessOwnerID(SceneObjectPart obj, XmlReader reader)
844 { 872 {
845 obj.OwnerID = Util.ReadUUID(reader, "OwnerID"); 873 obj.OwnerID = Util.ReadUUID(reader, "OwnerID");
846 } 874 }
847 875
848 private static void ProcessLastOwnerID(SceneObjectPart obj, XmlTextReader reader) 876 private static void ProcessLastOwnerID(SceneObjectPart obj, XmlReader reader)
849 { 877 {
850 obj.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID"); 878 obj.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID");
851 } 879 }
852 880
853 private static void ProcessBaseMask(SceneObjectPart obj, XmlTextReader reader) 881 private static void ProcessBaseMask(SceneObjectPart obj, XmlReader reader)
854 { 882 {
855 obj.BaseMask = (uint)reader.ReadElementContentAsInt("BaseMask", String.Empty); 883 obj.BaseMask = (uint)reader.ReadElementContentAsInt("BaseMask", String.Empty);
856 } 884 }
857 885
858 private static void ProcessOwnerMask(SceneObjectPart obj, XmlTextReader reader) 886 private static void ProcessOwnerMask(SceneObjectPart obj, XmlReader reader)
859 { 887 {
860 obj.OwnerMask = (uint)reader.ReadElementContentAsInt("OwnerMask", String.Empty); 888 obj.OwnerMask = (uint)reader.ReadElementContentAsInt("OwnerMask", String.Empty);
861 } 889 }
862 890
863 private static void ProcessGroupMask(SceneObjectPart obj, XmlTextReader reader) 891 private static void ProcessGroupMask(SceneObjectPart obj, XmlReader reader)
864 { 892 {
865 obj.GroupMask = (uint)reader.ReadElementContentAsInt("GroupMask", String.Empty); 893 obj.GroupMask = (uint)reader.ReadElementContentAsInt("GroupMask", String.Empty);
866 } 894 }
867 895
868 private static void ProcessEveryoneMask(SceneObjectPart obj, XmlTextReader reader) 896 private static void ProcessEveryoneMask(SceneObjectPart obj, XmlReader reader)
869 { 897 {
870 obj.EveryoneMask = (uint)reader.ReadElementContentAsInt("EveryoneMask", String.Empty); 898 obj.EveryoneMask = (uint)reader.ReadElementContentAsInt("EveryoneMask", String.Empty);
871 } 899 }
872 900
873 private static void ProcessNextOwnerMask(SceneObjectPart obj, XmlTextReader reader) 901 private static void ProcessNextOwnerMask(SceneObjectPart obj, XmlReader reader)
874 { 902 {
875 obj.NextOwnerMask = (uint)reader.ReadElementContentAsInt("NextOwnerMask", String.Empty); 903 obj.NextOwnerMask = (uint)reader.ReadElementContentAsInt("NextOwnerMask", String.Empty);
876 } 904 }
877 905
878 private static void ProcessFlags(SceneObjectPart obj, XmlTextReader reader) 906 private static void ProcessFlags(SceneObjectPart obj, XmlReader reader)
879 { 907 {
880 obj.Flags = Util.ReadEnum<PrimFlags>(reader, "Flags"); 908 obj.Flags = Util.ReadEnum<PrimFlags>(reader, "Flags");
881 } 909 }
882 910
883 private static void ProcessCollisionSound(SceneObjectPart obj, XmlTextReader reader) 911 private static void ProcessCollisionSound(SceneObjectPart obj, XmlReader reader)
884 { 912 {
885 obj.CollisionSound = Util.ReadUUID(reader, "CollisionSound"); 913 obj.CollisionSound = Util.ReadUUID(reader, "CollisionSound");
886 } 914 }
887 915
888 private static void ProcessCollisionSoundVolume(SceneObjectPart obj, XmlTextReader reader) 916 private static void ProcessCollisionSoundVolume(SceneObjectPart obj, XmlReader reader)
889 { 917 {
890 obj.CollisionSoundVolume = reader.ReadElementContentAsFloat("CollisionSoundVolume", String.Empty); 918 obj.CollisionSoundVolume = reader.ReadElementContentAsFloat("CollisionSoundVolume", String.Empty);
891 } 919 }
892 920
893 private static void ProcessMediaUrl(SceneObjectPart obj, XmlTextReader reader) 921 private static void ProcessMediaUrl(SceneObjectPart obj, XmlReader reader)
894 { 922 {
895 obj.MediaUrl = reader.ReadElementContentAsString("MediaUrl", String.Empty); 923 obj.MediaUrl = reader.ReadElementContentAsString("MediaUrl", String.Empty);
896 } 924 }
897 925
898 private static void ProcessAttachedPos(SceneObjectPart obj, XmlTextReader reader) 926 private static void ProcessAttachedPos(SceneObjectPart obj, XmlReader reader)
899 { 927 {
900 obj.AttachedPos = Util.ReadVector(reader, "AttachedPos"); 928 obj.AttachedPos = Util.ReadVector(reader, "AttachedPos");
901 } 929 }
902 930
903 private static void ProcessDynAttrs(SceneObjectPart obj, XmlTextReader reader) 931 private static void ProcessDynAttrs(SceneObjectPart obj, XmlReader reader)
904 { 932 {
905 obj.DynAttrs.ReadXml(reader); 933 obj.DynAttrs.ReadXml(reader);
906 } 934 }
907 935
908 private static void ProcessTextureAnimation(SceneObjectPart obj, XmlTextReader reader) 936 private static void ProcessTextureAnimation(SceneObjectPart obj, XmlReader reader)
909 { 937 {
910 obj.TextureAnimation = Convert.FromBase64String(reader.ReadElementContentAsString("TextureAnimation", String.Empty)); 938 obj.TextureAnimation = Convert.FromBase64String(reader.ReadElementContentAsString("TextureAnimation", String.Empty));
911 } 939 }
912 940
913 private static void ProcessParticleSystem(SceneObjectPart obj, XmlTextReader reader) 941 private static void ProcessParticleSystem(SceneObjectPart obj, XmlReader reader)
914 { 942 {
915 obj.ParticleSystem = Convert.FromBase64String(reader.ReadElementContentAsString("ParticleSystem", String.Empty)); 943 obj.ParticleSystem = Convert.FromBase64String(reader.ReadElementContentAsString("ParticleSystem", String.Empty));
916 } 944 }
917 945
918 private static void ProcessPayPrice0(SceneObjectPart obj, XmlTextReader reader) 946 private static void ProcessPayPrice0(SceneObjectPart obj, XmlReader reader)
919 { 947 {
920 obj.PayPrice[0] = (int)reader.ReadElementContentAsInt("PayPrice0", String.Empty); 948 obj.PayPrice[0] = (int)reader.ReadElementContentAsInt("PayPrice0", String.Empty);
921 } 949 }
922 950
923 private static void ProcessPayPrice1(SceneObjectPart obj, XmlTextReader reader) 951 private static void ProcessPayPrice1(SceneObjectPart obj, XmlReader reader)
924 { 952 {
925 obj.PayPrice[1] = (int)reader.ReadElementContentAsInt("PayPrice1", String.Empty); 953 obj.PayPrice[1] = (int)reader.ReadElementContentAsInt("PayPrice1", String.Empty);
926 } 954 }
927 955
928 private static void ProcessPayPrice2(SceneObjectPart obj, XmlTextReader reader) 956 private static void ProcessPayPrice2(SceneObjectPart obj, XmlReader reader)
929 { 957 {
930 obj.PayPrice[2] = (int)reader.ReadElementContentAsInt("PayPrice2", String.Empty); 958 obj.PayPrice[2] = (int)reader.ReadElementContentAsInt("PayPrice2", String.Empty);
931 } 959 }
932 960
933 private static void ProcessPayPrice3(SceneObjectPart obj, XmlTextReader reader) 961 private static void ProcessPayPrice3(SceneObjectPart obj, XmlReader reader)
934 { 962 {
935 obj.PayPrice[3] = (int)reader.ReadElementContentAsInt("PayPrice3", String.Empty); 963 obj.PayPrice[3] = (int)reader.ReadElementContentAsInt("PayPrice3", String.Empty);
936 } 964 }
937 965
938 private static void ProcessPayPrice4(SceneObjectPart obj, XmlTextReader reader) 966 private static void ProcessPayPrice4(SceneObjectPart obj, XmlReader reader)
939 { 967 {
940 obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty); 968 obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty);
941 } 969 }
@@ -962,122 +990,122 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
962 #endregion 990 #endregion
963 991
964 #region TaskInventoryXmlProcessors 992 #region TaskInventoryXmlProcessors
965 private static void ProcessTIAssetID(TaskInventoryItem item, XmlTextReader reader) 993 private static void ProcessTIAssetID(TaskInventoryItem item, XmlReader reader)
966 { 994 {
967 item.AssetID = Util.ReadUUID(reader, "AssetID"); 995 item.AssetID = Util.ReadUUID(reader, "AssetID");
968 } 996 }
969 997
970 private static void ProcessTIBasePermissions(TaskInventoryItem item, XmlTextReader reader) 998 private static void ProcessTIBasePermissions(TaskInventoryItem item, XmlReader reader)
971 { 999 {
972 item.BasePermissions = (uint)reader.ReadElementContentAsInt("BasePermissions", String.Empty); 1000 item.BasePermissions = (uint)reader.ReadElementContentAsInt("BasePermissions", String.Empty);
973 } 1001 }
974 1002
975 private static void ProcessTICreationDate(TaskInventoryItem item, XmlTextReader reader) 1003 private static void ProcessTICreationDate(TaskInventoryItem item, XmlReader reader)
976 { 1004 {
977 item.CreationDate = (uint)reader.ReadElementContentAsInt("CreationDate", String.Empty); 1005 item.CreationDate = (uint)reader.ReadElementContentAsInt("CreationDate", String.Empty);
978 } 1006 }
979 1007
980 private static void ProcessTICreatorID(TaskInventoryItem item, XmlTextReader reader) 1008 private static void ProcessTICreatorID(TaskInventoryItem item, XmlReader reader)
981 { 1009 {
982 item.CreatorID = Util.ReadUUID(reader, "CreatorID"); 1010 item.CreatorID = Util.ReadUUID(reader, "CreatorID");
983 } 1011 }
984 1012
985 private static void ProcessTICreatorData(TaskInventoryItem item, XmlTextReader reader) 1013 private static void ProcessTICreatorData(TaskInventoryItem item, XmlReader reader)
986 { 1014 {
987 item.CreatorData = reader.ReadElementContentAsString("CreatorData", String.Empty); 1015 item.CreatorData = reader.ReadElementContentAsString("CreatorData", String.Empty);
988 } 1016 }
989 1017
990 private static void ProcessTIDescription(TaskInventoryItem item, XmlTextReader reader) 1018 private static void ProcessTIDescription(TaskInventoryItem item, XmlReader reader)
991 { 1019 {
992 item.Description = reader.ReadElementContentAsString("Description", String.Empty); 1020 item.Description = reader.ReadElementContentAsString("Description", String.Empty);
993 } 1021 }
994 1022
995 private static void ProcessTIEveryonePermissions(TaskInventoryItem item, XmlTextReader reader) 1023 private static void ProcessTIEveryonePermissions(TaskInventoryItem item, XmlReader reader)
996 { 1024 {
997 item.EveryonePermissions = (uint)reader.ReadElementContentAsInt("EveryonePermissions", String.Empty); 1025 item.EveryonePermissions = (uint)reader.ReadElementContentAsInt("EveryonePermissions", String.Empty);
998 } 1026 }
999 1027
1000 private static void ProcessTIFlags(TaskInventoryItem item, XmlTextReader reader) 1028 private static void ProcessTIFlags(TaskInventoryItem item, XmlReader reader)
1001 { 1029 {
1002 item.Flags = (uint)reader.ReadElementContentAsInt("Flags", String.Empty); 1030 item.Flags = (uint)reader.ReadElementContentAsInt("Flags", String.Empty);
1003 } 1031 }
1004 1032
1005 private static void ProcessTIGroupID(TaskInventoryItem item, XmlTextReader reader) 1033 private static void ProcessTIGroupID(TaskInventoryItem item, XmlReader reader)
1006 { 1034 {
1007 item.GroupID = Util.ReadUUID(reader, "GroupID"); 1035 item.GroupID = Util.ReadUUID(reader, "GroupID");
1008 } 1036 }
1009 1037
1010 private static void ProcessTIGroupPermissions(TaskInventoryItem item, XmlTextReader reader) 1038 private static void ProcessTIGroupPermissions(TaskInventoryItem item, XmlReader reader)
1011 { 1039 {
1012 item.GroupPermissions = (uint)reader.ReadElementContentAsInt("GroupPermissions", String.Empty); 1040 item.GroupPermissions = (uint)reader.ReadElementContentAsInt("GroupPermissions", String.Empty);
1013 } 1041 }
1014 1042
1015 private static void ProcessTIInvType(TaskInventoryItem item, XmlTextReader reader) 1043 private static void ProcessTIInvType(TaskInventoryItem item, XmlReader reader)
1016 { 1044 {
1017 item.InvType = reader.ReadElementContentAsInt("InvType", String.Empty); 1045 item.InvType = reader.ReadElementContentAsInt("InvType", String.Empty);
1018 } 1046 }
1019 1047
1020 private static void ProcessTIItemID(TaskInventoryItem item, XmlTextReader reader) 1048 private static void ProcessTIItemID(TaskInventoryItem item, XmlReader reader)
1021 { 1049 {
1022 item.ItemID = Util.ReadUUID(reader, "ItemID"); 1050 item.ItemID = Util.ReadUUID(reader, "ItemID");
1023 } 1051 }
1024 1052
1025 private static void ProcessTIOldItemID(TaskInventoryItem item, XmlTextReader reader) 1053 private static void ProcessTIOldItemID(TaskInventoryItem item, XmlReader reader)
1026 { 1054 {
1027 item.OldItemID = Util.ReadUUID(reader, "OldItemID"); 1055 item.OldItemID = Util.ReadUUID(reader, "OldItemID");
1028 } 1056 }
1029 1057
1030 private static void ProcessTILastOwnerID(TaskInventoryItem item, XmlTextReader reader) 1058 private static void ProcessTILastOwnerID(TaskInventoryItem item, XmlReader reader)
1031 { 1059 {
1032 item.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID"); 1060 item.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID");
1033 } 1061 }
1034 1062
1035 private static void ProcessTIName(TaskInventoryItem item, XmlTextReader reader) 1063 private static void ProcessTIName(TaskInventoryItem item, XmlReader reader)
1036 { 1064 {
1037 item.Name = reader.ReadElementContentAsString("Name", String.Empty); 1065 item.Name = reader.ReadElementContentAsString("Name", String.Empty);
1038 } 1066 }
1039 1067
1040 private static void ProcessTINextPermissions(TaskInventoryItem item, XmlTextReader reader) 1068 private static void ProcessTINextPermissions(TaskInventoryItem item, XmlReader reader)
1041 { 1069 {
1042 item.NextPermissions = (uint)reader.ReadElementContentAsInt("NextPermissions", String.Empty); 1070 item.NextPermissions = (uint)reader.ReadElementContentAsInt("NextPermissions", String.Empty);
1043 } 1071 }
1044 1072
1045 private static void ProcessTIOwnerID(TaskInventoryItem item, XmlTextReader reader) 1073 private static void ProcessTIOwnerID(TaskInventoryItem item, XmlReader reader)
1046 { 1074 {
1047 item.OwnerID = Util.ReadUUID(reader, "OwnerID"); 1075 item.OwnerID = Util.ReadUUID(reader, "OwnerID");
1048 } 1076 }
1049 1077
1050 private static void ProcessTICurrentPermissions(TaskInventoryItem item, XmlTextReader reader) 1078 private static void ProcessTICurrentPermissions(TaskInventoryItem item, XmlReader reader)
1051 { 1079 {
1052 item.CurrentPermissions = (uint)reader.ReadElementContentAsInt("CurrentPermissions", String.Empty); 1080 item.CurrentPermissions = (uint)reader.ReadElementContentAsInt("CurrentPermissions", String.Empty);
1053 } 1081 }
1054 1082
1055 private static void ProcessTIParentID(TaskInventoryItem item, XmlTextReader reader) 1083 private static void ProcessTIParentID(TaskInventoryItem item, XmlReader reader)
1056 { 1084 {
1057 item.ParentID = Util.ReadUUID(reader, "ParentID"); 1085 item.ParentID = Util.ReadUUID(reader, "ParentID");
1058 } 1086 }
1059 1087
1060 private static void ProcessTIParentPartID(TaskInventoryItem item, XmlTextReader reader) 1088 private static void ProcessTIParentPartID(TaskInventoryItem item, XmlReader reader)
1061 { 1089 {
1062 item.ParentPartID = Util.ReadUUID(reader, "ParentPartID"); 1090 item.ParentPartID = Util.ReadUUID(reader, "ParentPartID");
1063 } 1091 }
1064 1092
1065 private static void ProcessTIPermsGranter(TaskInventoryItem item, XmlTextReader reader) 1093 private static void ProcessTIPermsGranter(TaskInventoryItem item, XmlReader reader)
1066 { 1094 {
1067 item.PermsGranter = Util.ReadUUID(reader, "PermsGranter"); 1095 item.PermsGranter = Util.ReadUUID(reader, "PermsGranter");
1068 } 1096 }
1069 1097
1070 private static void ProcessTIPermsMask(TaskInventoryItem item, XmlTextReader reader) 1098 private static void ProcessTIPermsMask(TaskInventoryItem item, XmlReader reader)
1071 { 1099 {
1072 item.PermsMask = reader.ReadElementContentAsInt("PermsMask", String.Empty); 1100 item.PermsMask = reader.ReadElementContentAsInt("PermsMask", String.Empty);
1073 } 1101 }
1074 1102
1075 private static void ProcessTIType(TaskInventoryItem item, XmlTextReader reader) 1103 private static void ProcessTIType(TaskInventoryItem item, XmlReader reader)
1076 { 1104 {
1077 item.Type = reader.ReadElementContentAsInt("Type", String.Empty); 1105 item.Type = reader.ReadElementContentAsInt("Type", String.Empty);
1078 } 1106 }
1079 1107
1080 private static void ProcessTIOwnerChanged(TaskInventoryItem item, XmlTextReader reader) 1108 private static void ProcessTIOwnerChanged(TaskInventoryItem item, XmlReader reader)
1081 { 1109 {
1082 item.OwnerChanged = Util.ReadBoolean(reader); 1110 item.OwnerChanged = Util.ReadBoolean(reader);
1083 } 1111 }
@@ -1085,250 +1113,243 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1085 #endregion 1113 #endregion
1086 1114
1087 #region ShapeXmlProcessors 1115 #region ShapeXmlProcessors
1088 private static void ProcessShpProfileCurve(PrimitiveBaseShape shp, XmlTextReader reader) 1116 private static void ProcessShpProfileCurve(PrimitiveBaseShape shp, XmlReader reader)
1089 { 1117 {
1090 shp.ProfileCurve = (byte)reader.ReadElementContentAsInt("ProfileCurve", String.Empty); 1118 shp.ProfileCurve = (byte)reader.ReadElementContentAsInt("ProfileCurve", String.Empty);
1091 } 1119 }
1092 1120
1093 private static void ProcessShpTextureEntry(PrimitiveBaseShape shp, XmlTextReader reader) 1121 private static void ProcessShpTextureEntry(PrimitiveBaseShape shp, XmlReader reader)
1094 { 1122 {
1095 byte[] teData = Convert.FromBase64String(reader.ReadElementString("TextureEntry")); 1123 byte[] teData = Convert.FromBase64String(reader.ReadElementString("TextureEntry"));
1096 shp.Textures = new Primitive.TextureEntry(teData, 0, teData.Length); 1124 shp.Textures = new Primitive.TextureEntry(teData, 0, teData.Length);
1097 } 1125 }
1098 1126
1099 private static void ProcessShpExtraParams(PrimitiveBaseShape shp, XmlTextReader reader) 1127 private static void ProcessShpExtraParams(PrimitiveBaseShape shp, XmlReader reader)
1100 { 1128 {
1101 shp.ExtraParams = Convert.FromBase64String(reader.ReadElementString("ExtraParams")); 1129 shp.ExtraParams = Convert.FromBase64String(reader.ReadElementString("ExtraParams"));
1102 } 1130 }
1103 1131
1104 private static void ProcessShpPathBegin(PrimitiveBaseShape shp, XmlTextReader reader) 1132 private static void ProcessShpPathBegin(PrimitiveBaseShape shp, XmlReader reader)
1105 { 1133 {
1106 shp.PathBegin = (ushort)reader.ReadElementContentAsInt("PathBegin", String.Empty); 1134 shp.PathBegin = (ushort)reader.ReadElementContentAsInt("PathBegin", String.Empty);
1107 } 1135 }
1108 1136
1109 private static void ProcessShpPathCurve(PrimitiveBaseShape shp, XmlTextReader reader) 1137 private static void ProcessShpPathCurve(PrimitiveBaseShape shp, XmlReader reader)
1110 { 1138 {
1111 shp.PathCurve = (byte)reader.ReadElementContentAsInt("PathCurve", String.Empty); 1139 shp.PathCurve = (byte)reader.ReadElementContentAsInt("PathCurve", String.Empty);
1112 } 1140 }
1113 1141
1114 private static void ProcessShpPathEnd(PrimitiveBaseShape shp, XmlTextReader reader) 1142 private static void ProcessShpPathEnd(PrimitiveBaseShape shp, XmlReader reader)
1115 { 1143 {
1116 shp.PathEnd = (ushort)reader.ReadElementContentAsInt("PathEnd", String.Empty); 1144 shp.PathEnd = (ushort)reader.ReadElementContentAsInt("PathEnd", String.Empty);
1117 } 1145 }
1118 1146
1119 private static void ProcessShpPathRadiusOffset(PrimitiveBaseShape shp, XmlTextReader reader) 1147 private static void ProcessShpPathRadiusOffset(PrimitiveBaseShape shp, XmlReader reader)
1120 { 1148 {
1121 shp.PathRadiusOffset = (sbyte)reader.ReadElementContentAsInt("PathRadiusOffset", String.Empty); 1149 shp.PathRadiusOffset = (sbyte)reader.ReadElementContentAsInt("PathRadiusOffset", String.Empty);
1122 } 1150 }
1123 1151
1124 private static void ProcessShpPathRevolutions(PrimitiveBaseShape shp, XmlTextReader reader) 1152 private static void ProcessShpPathRevolutions(PrimitiveBaseShape shp, XmlReader reader)
1125 { 1153 {
1126 shp.PathRevolutions = (byte)reader.ReadElementContentAsInt("PathRevolutions", String.Empty); 1154 shp.PathRevolutions = (byte)reader.ReadElementContentAsInt("PathRevolutions", String.Empty);
1127 } 1155 }
1128 1156
1129 private static void ProcessShpPathScaleX(PrimitiveBaseShape shp, XmlTextReader reader) 1157 private static void ProcessShpPathScaleX(PrimitiveBaseShape shp, XmlReader reader)
1130 { 1158 {
1131 shp.PathScaleX = (byte)reader.ReadElementContentAsInt("PathScaleX", String.Empty); 1159 shp.PathScaleX = (byte)reader.ReadElementContentAsInt("PathScaleX", String.Empty);
1132 } 1160 }
1133 1161
1134 private static void ProcessShpPathScaleY(PrimitiveBaseShape shp, XmlTextReader reader) 1162 private static void ProcessShpPathScaleY(PrimitiveBaseShape shp, XmlReader reader)
1135 { 1163 {
1136 shp.PathScaleY = (byte)reader.ReadElementContentAsInt("PathScaleY", String.Empty); 1164 shp.PathScaleY = (byte)reader.ReadElementContentAsInt("PathScaleY", String.Empty);
1137 } 1165 }
1138 1166
1139 private static void ProcessShpPathShearX(PrimitiveBaseShape shp, XmlTextReader reader) 1167 private static void ProcessShpPathShearX(PrimitiveBaseShape shp, XmlReader reader)
1140 { 1168 {
1141 shp.PathShearX = (byte)reader.ReadElementContentAsInt("PathShearX", String.Empty); 1169 shp.PathShearX = (byte)reader.ReadElementContentAsInt("PathShearX", String.Empty);
1142 } 1170 }
1143 1171
1144 private static void ProcessShpPathShearY(PrimitiveBaseShape shp, XmlTextReader reader) 1172 private static void ProcessShpPathShearY(PrimitiveBaseShape shp, XmlReader reader)
1145 { 1173 {
1146 shp.PathShearY = (byte)reader.ReadElementContentAsInt("PathShearY", String.Empty); 1174 shp.PathShearY = (byte)reader.ReadElementContentAsInt("PathShearY", String.Empty);
1147 } 1175 }
1148 1176
1149 private static void ProcessShpPathSkew(PrimitiveBaseShape shp, XmlTextReader reader) 1177 private static void ProcessShpPathSkew(PrimitiveBaseShape shp, XmlReader reader)
1150 { 1178 {
1151 shp.PathSkew = (sbyte)reader.ReadElementContentAsInt("PathSkew", String.Empty); 1179 shp.PathSkew = (sbyte)reader.ReadElementContentAsInt("PathSkew", String.Empty);
1152 } 1180 }
1153 1181
1154 private static void ProcessShpPathTaperX(PrimitiveBaseShape shp, XmlTextReader reader) 1182 private static void ProcessShpPathTaperX(PrimitiveBaseShape shp, XmlReader reader)
1155 { 1183 {
1156 shp.PathTaperX = (sbyte)reader.ReadElementContentAsInt("PathTaperX", String.Empty); 1184 shp.PathTaperX = (sbyte)reader.ReadElementContentAsInt("PathTaperX", String.Empty);
1157 } 1185 }
1158 1186
1159 private static void ProcessShpPathTaperY(PrimitiveBaseShape shp, XmlTextReader reader) 1187 private static void ProcessShpPathTaperY(PrimitiveBaseShape shp, XmlReader reader)
1160 { 1188 {
1161 shp.PathTaperY = (sbyte)reader.ReadElementContentAsInt("PathTaperY", String.Empty); 1189 shp.PathTaperY = (sbyte)reader.ReadElementContentAsInt("PathTaperY", String.Empty);
1162 } 1190 }
1163 1191
1164 private static void ProcessShpPathTwist(PrimitiveBaseShape shp, XmlTextReader reader) 1192 private static void ProcessShpPathTwist(PrimitiveBaseShape shp, XmlReader reader)
1165 { 1193 {
1166 shp.PathTwist = (sbyte)reader.ReadElementContentAsInt("PathTwist", String.Empty); 1194 shp.PathTwist = (sbyte)reader.ReadElementContentAsInt("PathTwist", String.Empty);
1167 } 1195 }
1168 1196
1169 private static void ProcessShpPathTwistBegin(PrimitiveBaseShape shp, XmlTextReader reader) 1197 private static void ProcessShpPathTwistBegin(PrimitiveBaseShape shp, XmlReader reader)
1170 { 1198 {
1171 shp.PathTwistBegin = (sbyte)reader.ReadElementContentAsInt("PathTwistBegin", String.Empty); 1199 shp.PathTwistBegin = (sbyte)reader.ReadElementContentAsInt("PathTwistBegin", String.Empty);
1172 } 1200 }
1173 1201
1174 private static void ProcessShpPCode(PrimitiveBaseShape shp, XmlTextReader reader) 1202 private static void ProcessShpPCode(PrimitiveBaseShape shp, XmlReader reader)
1175 { 1203 {
1176 shp.PCode = (byte)reader.ReadElementContentAsInt("PCode", String.Empty); 1204 shp.PCode = (byte)reader.ReadElementContentAsInt("PCode", String.Empty);
1177 } 1205 }
1178 1206
1179 private static void ProcessShpProfileBegin(PrimitiveBaseShape shp, XmlTextReader reader) 1207 private static void ProcessShpProfileBegin(PrimitiveBaseShape shp, XmlReader reader)
1180 { 1208 {
1181 shp.ProfileBegin = (ushort)reader.ReadElementContentAsInt("ProfileBegin", String.Empty); 1209 shp.ProfileBegin = (ushort)reader.ReadElementContentAsInt("ProfileBegin", String.Empty);
1182 } 1210 }
1183 1211
1184 private static void ProcessShpProfileEnd(PrimitiveBaseShape shp, XmlTextReader reader) 1212 private static void ProcessShpProfileEnd(PrimitiveBaseShape shp, XmlReader reader)
1185 { 1213 {
1186 shp.ProfileEnd = (ushort)reader.ReadElementContentAsInt("ProfileEnd", String.Empty); 1214 shp.ProfileEnd = (ushort)reader.ReadElementContentAsInt("ProfileEnd", String.Empty);
1187 } 1215 }
1188 1216
1189 private static void ProcessShpProfileHollow(PrimitiveBaseShape shp, XmlTextReader reader) 1217 private static void ProcessShpProfileHollow(PrimitiveBaseShape shp, XmlReader reader)
1190 { 1218 {
1191 shp.ProfileHollow = (ushort)reader.ReadElementContentAsInt("ProfileHollow", String.Empty); 1219 shp.ProfileHollow = (ushort)reader.ReadElementContentAsInt("ProfileHollow", String.Empty);
1192 } 1220 }
1193 1221
1194 private static void ProcessShpScale(PrimitiveBaseShape shp, XmlTextReader reader) 1222 private static void ProcessShpScale(PrimitiveBaseShape shp, XmlReader reader)
1195 { 1223 {
1196 shp.Scale = Util.ReadVector(reader, "Scale"); 1224 shp.Scale = Util.ReadVector(reader, "Scale");
1197 } 1225 }
1198 1226
1199 private static void ProcessShpState(PrimitiveBaseShape shp, XmlTextReader reader) 1227 private static void ProcessShpState(PrimitiveBaseShape shp, XmlReader reader)
1200 { 1228 {
1201 shp.State = (byte)reader.ReadElementContentAsInt("State", String.Empty); 1229 shp.State = (byte)reader.ReadElementContentAsInt("State", String.Empty);
1202 } 1230 }
1203 1231
1204 private static void ProcessShpLastAttach(PrimitiveBaseShape shp, XmlTextReader reader) 1232 private static void ProcessShpLastAttach(PrimitiveBaseShape shp, XmlReader reader)
1205 { 1233 {
1206 shp.LastAttachPoint = (byte)reader.ReadElementContentAsInt("LastAttachPoint", String.Empty); 1234 shp.LastAttachPoint = (byte)reader.ReadElementContentAsInt("LastAttachPoint", String.Empty);
1207 } 1235 }
1208 1236
1209 private static void ProcessShpProfileShape(PrimitiveBaseShape shp, XmlTextReader reader) 1237 private static void ProcessShpProfileShape(PrimitiveBaseShape shp, XmlReader reader)
1210 { 1238 {
1211 shp.ProfileShape = Util.ReadEnum<ProfileShape>(reader, "ProfileShape"); 1239 shp.ProfileShape = Util.ReadEnum<ProfileShape>(reader, "ProfileShape");
1212 } 1240 }
1213 1241
1214 private static void ProcessShpHollowShape(PrimitiveBaseShape shp, XmlTextReader reader) 1242 private static void ProcessShpHollowShape(PrimitiveBaseShape shp, XmlReader reader)
1215 { 1243 {
1216 shp.HollowShape = Util.ReadEnum<HollowShape>(reader, "HollowShape"); 1244 shp.HollowShape = Util.ReadEnum<HollowShape>(reader, "HollowShape");
1217 } 1245 }
1218 1246
1219 private static void ProcessShpSculptTexture(PrimitiveBaseShape shp, XmlTextReader reader) 1247 private static void ProcessShpSculptTexture(PrimitiveBaseShape shp, XmlReader reader)
1220 { 1248 {
1221 shp.SculptTexture = Util.ReadUUID(reader, "SculptTexture"); 1249 shp.SculptTexture = Util.ReadUUID(reader, "SculptTexture");
1222 } 1250 }
1223 1251
1224 private static void ProcessShpSculptType(PrimitiveBaseShape shp, XmlTextReader reader) 1252 private static void ProcessShpSculptType(PrimitiveBaseShape shp, XmlReader reader)
1225 { 1253 {
1226 shp.SculptType = (byte)reader.ReadElementContentAsInt("SculptType", String.Empty); 1254 shp.SculptType = (byte)reader.ReadElementContentAsInt("SculptType", String.Empty);
1227 } 1255 }
1228 1256
1229 private static void ProcessShpSculptData(PrimitiveBaseShape shp, XmlTextReader reader) 1257 private static void ProcessShpFlexiSoftness(PrimitiveBaseShape shp, XmlReader reader)
1230 {
1231// m_log.DebugFormat("[SCENE OBJECT SERIALIZER]: Setting sculpt data length {0}", shp.SculptData.Length);
1232
1233 shp.SculptData = Convert.FromBase64String(reader.ReadElementString("SculptData"));
1234 }
1235
1236 private static void ProcessShpFlexiSoftness(PrimitiveBaseShape shp, XmlTextReader reader)
1237 { 1258 {
1238 shp.FlexiSoftness = reader.ReadElementContentAsInt("FlexiSoftness", String.Empty); 1259 shp.FlexiSoftness = reader.ReadElementContentAsInt("FlexiSoftness", String.Empty);
1239 } 1260 }
1240 1261
1241 private static void ProcessShpFlexiTension(PrimitiveBaseShape shp, XmlTextReader reader) 1262 private static void ProcessShpFlexiTension(PrimitiveBaseShape shp, XmlReader reader)
1242 { 1263 {
1243 shp.FlexiTension = reader.ReadElementContentAsFloat("FlexiTension", String.Empty); 1264 shp.FlexiTension = reader.ReadElementContentAsFloat("FlexiTension", String.Empty);
1244 } 1265 }
1245 1266
1246 private static void ProcessShpFlexiDrag(PrimitiveBaseShape shp, XmlTextReader reader) 1267 private static void ProcessShpFlexiDrag(PrimitiveBaseShape shp, XmlReader reader)
1247 { 1268 {
1248 shp.FlexiDrag = reader.ReadElementContentAsFloat("FlexiDrag", String.Empty); 1269 shp.FlexiDrag = reader.ReadElementContentAsFloat("FlexiDrag", String.Empty);
1249 } 1270 }
1250 1271
1251 private static void ProcessShpFlexiGravity(PrimitiveBaseShape shp, XmlTextReader reader) 1272 private static void ProcessShpFlexiGravity(PrimitiveBaseShape shp, XmlReader reader)
1252 { 1273 {
1253 shp.FlexiGravity = reader.ReadElementContentAsFloat("FlexiGravity", String.Empty); 1274 shp.FlexiGravity = reader.ReadElementContentAsFloat("FlexiGravity", String.Empty);
1254 } 1275 }
1255 1276
1256 private static void ProcessShpFlexiWind(PrimitiveBaseShape shp, XmlTextReader reader) 1277 private static void ProcessShpFlexiWind(PrimitiveBaseShape shp, XmlReader reader)
1257 { 1278 {
1258 shp.FlexiWind = reader.ReadElementContentAsFloat("FlexiWind", String.Empty); 1279 shp.FlexiWind = reader.ReadElementContentAsFloat("FlexiWind", String.Empty);
1259 } 1280 }
1260 1281
1261 private static void ProcessShpFlexiForceX(PrimitiveBaseShape shp, XmlTextReader reader) 1282 private static void ProcessShpFlexiForceX(PrimitiveBaseShape shp, XmlReader reader)
1262 { 1283 {
1263 shp.FlexiForceX = reader.ReadElementContentAsFloat("FlexiForceX", String.Empty); 1284 shp.FlexiForceX = reader.ReadElementContentAsFloat("FlexiForceX", String.Empty);
1264 } 1285 }
1265 1286
1266 private static void ProcessShpFlexiForceY(PrimitiveBaseShape shp, XmlTextReader reader) 1287 private static void ProcessShpFlexiForceY(PrimitiveBaseShape shp, XmlReader reader)
1267 { 1288 {
1268 shp.FlexiForceY = reader.ReadElementContentAsFloat("FlexiForceY", String.Empty); 1289 shp.FlexiForceY = reader.ReadElementContentAsFloat("FlexiForceY", String.Empty);
1269 } 1290 }
1270 1291
1271 private static void ProcessShpFlexiForceZ(PrimitiveBaseShape shp, XmlTextReader reader) 1292 private static void ProcessShpFlexiForceZ(PrimitiveBaseShape shp, XmlReader reader)
1272 { 1293 {
1273 shp.FlexiForceZ = reader.ReadElementContentAsFloat("FlexiForceZ", String.Empty); 1294 shp.FlexiForceZ = reader.ReadElementContentAsFloat("FlexiForceZ", String.Empty);
1274 } 1295 }
1275 1296
1276 private static void ProcessShpLightColorR(PrimitiveBaseShape shp, XmlTextReader reader) 1297 private static void ProcessShpLightColorR(PrimitiveBaseShape shp, XmlReader reader)
1277 { 1298 {
1278 shp.LightColorR = reader.ReadElementContentAsFloat("LightColorR", String.Empty); 1299 shp.LightColorR = reader.ReadElementContentAsFloat("LightColorR", String.Empty);
1279 } 1300 }
1280 1301
1281 private static void ProcessShpLightColorG(PrimitiveBaseShape shp, XmlTextReader reader) 1302 private static void ProcessShpLightColorG(PrimitiveBaseShape shp, XmlReader reader)
1282 { 1303 {
1283 shp.LightColorG = reader.ReadElementContentAsFloat("LightColorG", String.Empty); 1304 shp.LightColorG = reader.ReadElementContentAsFloat("LightColorG", String.Empty);
1284 } 1305 }
1285 1306
1286 private static void ProcessShpLightColorB(PrimitiveBaseShape shp, XmlTextReader reader) 1307 private static void ProcessShpLightColorB(PrimitiveBaseShape shp, XmlReader reader)
1287 { 1308 {
1288 shp.LightColorB = reader.ReadElementContentAsFloat("LightColorB", String.Empty); 1309 shp.LightColorB = reader.ReadElementContentAsFloat("LightColorB", String.Empty);
1289 } 1310 }
1290 1311
1291 private static void ProcessShpLightColorA(PrimitiveBaseShape shp, XmlTextReader reader) 1312 private static void ProcessShpLightColorA(PrimitiveBaseShape shp, XmlReader reader)
1292 { 1313 {
1293 shp.LightColorA = reader.ReadElementContentAsFloat("LightColorA", String.Empty); 1314 shp.LightColorA = reader.ReadElementContentAsFloat("LightColorA", String.Empty);
1294 } 1315 }
1295 1316
1296 private static void ProcessShpLightRadius(PrimitiveBaseShape shp, XmlTextReader reader) 1317 private static void ProcessShpLightRadius(PrimitiveBaseShape shp, XmlReader reader)
1297 { 1318 {
1298 shp.LightRadius = reader.ReadElementContentAsFloat("LightRadius", String.Empty); 1319 shp.LightRadius = reader.ReadElementContentAsFloat("LightRadius", String.Empty);
1299 } 1320 }
1300 1321
1301 private static void ProcessShpLightCutoff(PrimitiveBaseShape shp, XmlTextReader reader) 1322 private static void ProcessShpLightCutoff(PrimitiveBaseShape shp, XmlReader reader)
1302 { 1323 {
1303 shp.LightCutoff = reader.ReadElementContentAsFloat("LightCutoff", String.Empty); 1324 shp.LightCutoff = reader.ReadElementContentAsFloat("LightCutoff", String.Empty);
1304 } 1325 }
1305 1326
1306 private static void ProcessShpLightFalloff(PrimitiveBaseShape shp, XmlTextReader reader) 1327 private static void ProcessShpLightFalloff(PrimitiveBaseShape shp, XmlReader reader)
1307 { 1328 {
1308 shp.LightFalloff = reader.ReadElementContentAsFloat("LightFalloff", String.Empty); 1329 shp.LightFalloff = reader.ReadElementContentAsFloat("LightFalloff", String.Empty);
1309 } 1330 }
1310 1331
1311 private static void ProcessShpLightIntensity(PrimitiveBaseShape shp, XmlTextReader reader) 1332 private static void ProcessShpLightIntensity(PrimitiveBaseShape shp, XmlReader reader)
1312 { 1333 {
1313 shp.LightIntensity = reader.ReadElementContentAsFloat("LightIntensity", String.Empty); 1334 shp.LightIntensity = reader.ReadElementContentAsFloat("LightIntensity", String.Empty);
1314 } 1335 }
1315 1336
1316 private static void ProcessShpFlexiEntry(PrimitiveBaseShape shp, XmlTextReader reader) 1337 private static void ProcessShpFlexiEntry(PrimitiveBaseShape shp, XmlReader reader)
1317 { 1338 {
1318 shp.FlexiEntry = Util.ReadBoolean(reader); 1339 shp.FlexiEntry = Util.ReadBoolean(reader);
1319 } 1340 }
1320 1341
1321 private static void ProcessShpLightEntry(PrimitiveBaseShape shp, XmlTextReader reader) 1342 private static void ProcessShpLightEntry(PrimitiveBaseShape shp, XmlReader reader)
1322 { 1343 {
1323 shp.LightEntry = Util.ReadBoolean(reader); 1344 shp.LightEntry = Util.ReadBoolean(reader);
1324 } 1345 }
1325 1346
1326 private static void ProcessShpSculptEntry(PrimitiveBaseShape shp, XmlTextReader reader) 1347 private static void ProcessShpSculptEntry(PrimitiveBaseShape shp, XmlReader reader)
1327 { 1348 {
1328 shp.SculptEntry = Util.ReadBoolean(reader); 1349 shp.SculptEntry = Util.ReadBoolean(reader);
1329 } 1350 }
1330 1351
1331 private static void ProcessShpMedia(PrimitiveBaseShape shp, XmlTextReader reader) 1352 private static void ProcessShpMedia(PrimitiveBaseShape shp, XmlReader reader)
1332 { 1353 {
1333 string value = reader.ReadElementContentAsString("Media", String.Empty); 1354 string value = reader.ReadElementContentAsString("Media", String.Empty);
1334 shp.Media = PrimitiveBaseShape.MediaList.FromXml(value); 1355 shp.Media = PrimitiveBaseShape.MediaList.FromXml(value);
@@ -1382,7 +1403,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1382 if (m_UserManagement == null) 1403 if (m_UserManagement == null)
1383 m_UserManagement = sop.ParentGroup.Scene.RequestModuleInterface<IUserManagement>(); 1404 m_UserManagement = sop.ParentGroup.Scene.RequestModuleInterface<IUserManagement>();
1384 string name = m_UserManagement.GetUserName(sop.CreatorID); 1405 string name = m_UserManagement.GetUserName(sop.CreatorID);
1385 writer.WriteElementString("CreatorData", (string)options["home"] + ";" + name); 1406 writer.WriteElementString("CreatorData", ExternalRepresentationUtils.CalcCreatorData((string)options["home"], name));
1386 } 1407 }
1387 1408
1388 WriteUUID(writer, "FolderID", sop.FolderID, options); 1409 WriteUUID(writer, "FolderID", sop.FolderID, options);
@@ -1435,7 +1456,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1435 writer.WriteElementString("SalePrice", sop.SalePrice.ToString()); 1456 writer.WriteElementString("SalePrice", sop.SalePrice.ToString());
1436 writer.WriteElementString("ObjectSaleType", sop.ObjectSaleType.ToString()); 1457 writer.WriteElementString("ObjectSaleType", sop.ObjectSaleType.ToString());
1437 writer.WriteElementString("OwnershipCost", sop.OwnershipCost.ToString()); 1458 writer.WriteElementString("OwnershipCost", sop.OwnershipCost.ToString());
1438 WriteUUID(writer, "GroupID", sop.GroupID, options); 1459
1460 UUID groupID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.GroupID;
1461 WriteUUID(writer, "GroupID", groupID, options);
1439 1462
1440 UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.OwnerID; 1463 UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.OwnerID;
1441 WriteUUID(writer, "OwnerID", ownerID, options); 1464 WriteUUID(writer, "OwnerID", ownerID, options);
@@ -1575,13 +1598,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1575 if (m_UserManagement == null) 1598 if (m_UserManagement == null)
1576 m_UserManagement = scene.RequestModuleInterface<IUserManagement>(); 1599 m_UserManagement = scene.RequestModuleInterface<IUserManagement>();
1577 string name = m_UserManagement.GetUserName(item.CreatorID); 1600 string name = m_UserManagement.GetUserName(item.CreatorID);
1578 writer.WriteElementString("CreatorData", (string)options["home"] + ";" + name); 1601 writer.WriteElementString("CreatorData", ExternalRepresentationUtils.CalcCreatorData((string)options["home"], name));
1579 } 1602 }
1580 1603
1581 writer.WriteElementString("Description", item.Description); 1604 writer.WriteElementString("Description", item.Description);
1582 writer.WriteElementString("EveryonePermissions", item.EveryonePermissions.ToString()); 1605 writer.WriteElementString("EveryonePermissions", item.EveryonePermissions.ToString());
1583 writer.WriteElementString("Flags", item.Flags.ToString()); 1606 writer.WriteElementString("Flags", item.Flags.ToString());
1584 WriteUUID(writer, "GroupID", item.GroupID, options); 1607
1608 UUID groupID = options.ContainsKey("wipe-owners") ? UUID.Zero : item.GroupID;
1609 WriteUUID(writer, "GroupID", groupID, options);
1610
1585 writer.WriteElementString("GroupPermissions", item.GroupPermissions.ToString()); 1611 writer.WriteElementString("GroupPermissions", item.GroupPermissions.ToString());
1586 writer.WriteElementString("InvType", item.InvType.ToString()); 1612 writer.WriteElementString("InvType", item.InvType.ToString());
1587 WriteUUID(writer, "ItemID", item.ItemID, options); 1613 WriteUUID(writer, "ItemID", item.ItemID, options);
@@ -1602,7 +1628,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1602 WriteUUID(writer, "PermsGranter", item.PermsGranter, options); 1628 WriteUUID(writer, "PermsGranter", item.PermsGranter, options);
1603 writer.WriteElementString("PermsMask", item.PermsMask.ToString()); 1629 writer.WriteElementString("PermsMask", item.PermsMask.ToString());
1604 writer.WriteElementString("Type", item.Type.ToString()); 1630 writer.WriteElementString("Type", item.Type.ToString());
1605 writer.WriteElementString("OwnerChanged", item.OwnerChanged.ToString().ToLower()); 1631
1632 bool ownerChanged = options.ContainsKey("wipe-owners") ? false : item.OwnerChanged;
1633 writer.WriteElementString("OwnerChanged", ownerChanged.ToString().ToLower());
1606 1634
1607 writer.WriteEndElement(); // TaskInventoryItem 1635 writer.WriteEndElement(); // TaskInventoryItem
1608 } 1636 }
@@ -1663,14 +1691,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1663 1691
1664 WriteUUID(writer, "SculptTexture", shp.SculptTexture, options); 1692 WriteUUID(writer, "SculptTexture", shp.SculptTexture, options);
1665 writer.WriteElementString("SculptType", shp.SculptType.ToString()); 1693 writer.WriteElementString("SculptType", shp.SculptType.ToString());
1666 writer.WriteStartElement("SculptData"); 1694 // Don't serialize SculptData. It's just a copy of the asset, which can be loaded separately using 'SculptTexture'.
1667 byte[] sd;
1668 if (shp.SculptData != null)
1669 sd = shp.SculptData;
1670 else
1671 sd = Utils.EmptyBytes;
1672 writer.WriteBase64(sd, 0, sd.Length);
1673 writer.WriteEndElement(); // SculptData
1674 1695
1675 writer.WriteElementString("FlexiSoftness", shp.FlexiSoftness.ToString()); 1696 writer.WriteElementString("FlexiSoftness", shp.FlexiSoftness.ToString());
1676 writer.WriteElementString("FlexiTension", shp.FlexiTension.ToString()); 1697 writer.WriteElementString("FlexiTension", shp.FlexiTension.ToString());
@@ -1701,28 +1722,31 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1701 } 1722 }
1702 } 1723 }
1703 1724
1704 public static SceneObjectPart Xml2ToSOP(XmlTextReader reader) 1725 public static SceneObjectPart Xml2ToSOP(XmlReader reader)
1705 { 1726 {
1706 SceneObjectPart obj = new SceneObjectPart(); 1727 SceneObjectPart obj = new SceneObjectPart();
1707 1728
1708 reader.ReadStartElement("SceneObjectPart"); 1729 reader.ReadStartElement("SceneObjectPart");
1709 1730
1710 ExternalRepresentationUtils.ExecuteReadProcessors( 1731 bool errors = ExternalRepresentationUtils.ExecuteReadProcessors(
1711 obj, 1732 obj,
1712 m_SOPXmlProcessors, 1733 m_SOPXmlProcessors,
1713 reader, 1734 reader,
1714 (o, nodeName, e) 1735 (o, nodeName, e) => {
1715 => m_log.DebugFormat( 1736 m_log.Debug(string.Format("[SceneObjectSerializer]: Error while parsing element {0} in object {1} {2} ",
1716 "[SceneObjectSerializer]: Exception while parsing {0} in object {1} {2}: {3}{4}", 1737 nodeName, ((SceneObjectPart)o).Name, ((SceneObjectPart)o).UUID), e);
1717 ((SceneObjectPart)o).Name, ((SceneObjectPart)o).UUID, nodeName, e.Message, e.StackTrace)); 1738 });
1739
1740 if (errors)
1741 throw new XmlException(string.Format("Error parsing object {0} {1}", obj.Name, obj.UUID));
1718 1742
1719 reader.ReadEndElement(); // SceneObjectPart 1743 reader.ReadEndElement(); // SceneObjectPart
1720 1744
1721 //m_log.DebugFormat("[XXX]: parsed SOP {0} - {1}", obj.Name, obj.UUID); 1745 // m_log.DebugFormat("[SceneObjectSerializer]: parsed SOP {0} {1}", obj.Name, obj.UUID);
1722 return obj; 1746 return obj;
1723 } 1747 }
1724 1748
1725 public static TaskInventoryDictionary ReadTaskInventory(XmlTextReader reader, string name) 1749 public static TaskInventoryDictionary ReadTaskInventory(XmlReader reader, string name)
1726 { 1750 {
1727 TaskInventoryDictionary tinv = new TaskInventoryDictionary(); 1751 TaskInventoryDictionary tinv = new TaskInventoryDictionary();
1728 1752
@@ -1757,7 +1781,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1757 /// <param name="name">The name of the xml element containing the shape</param> 1781 /// <param name="name">The name of the xml element containing the shape</param>
1758 /// <param name="errors">a list containing the failing node names. If no failures then null.</param> 1782 /// <param name="errors">a list containing the failing node names. If no failures then null.</param>
1759 /// <returns>The shape parsed</returns> 1783 /// <returns>The shape parsed</returns>
1760 public static PrimitiveBaseShape ReadShape(XmlTextReader reader, string name, out List<string> errorNodeNames) 1784 public static PrimitiveBaseShape ReadShape(XmlReader reader, string name, out List<string> errorNodeNames, SceneObjectPart obj)
1761 { 1785 {
1762 List<string> internalErrorNodeNames = null; 1786 List<string> internalErrorNodeNames = null;
1763 1787
@@ -1776,18 +1800,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1776 shape, 1800 shape,
1777 m_ShapeXmlProcessors, 1801 m_ShapeXmlProcessors,
1778 reader, 1802 reader,
1779 (o, nodeName, e) 1803 (o, nodeName, e) => {
1780 => 1804 m_log.Debug(string.Format("[SceneObjectSerializer]: Error while parsing element {0} in Shape property of object {1} {2} ",
1781 { 1805 nodeName, obj.Name, obj.UUID), e);
1782// m_log.DebugFormat(
1783// "[SceneObjectSerializer]: Exception while parsing Shape property {0}: {1}{2}",
1784// nodeName, e.Message, e.StackTrace);
1785 if (internalErrorNodeNames == null)
1786 internalErrorNodeNames = new List<string>();
1787 1806
1788 internalErrorNodeNames.Add(nodeName); 1807 if (internalErrorNodeNames == null)
1789 } 1808 internalErrorNodeNames = new List<string>();
1790 ); 1809 internalErrorNodeNames.Add(nodeName);
1810 });
1791 1811
1792 reader.ReadEndElement(); // Shape 1812 reader.ReadEndElement(); // Shape
1793 1813
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
index bf32251..52e3ff1 100644..100755
--- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
@@ -61,6 +61,10 @@ namespace OpenSim.Region.Framework.Scenes
61 61
62 private YourStatsAreWrong handlerStatsIncorrect; 62 private YourStatsAreWrong handlerStatsIncorrect;
63 63
64 // Determines the size of the array that is used to collect StatBlocks
65 // for sending to the SimStats and SimExtraStatsCollector
66 private const int m_statisticArraySize = 28;
67
64 /// <summary> 68 /// <summary>
65 /// These are the IDs of stats sent in the StatsPacket to the viewer. 69 /// These are the IDs of stats sent in the StatsPacket to the viewer.
66 /// </summary> 70 /// </summary>
@@ -104,7 +108,12 @@ namespace OpenSim.Region.Framework.Scenes
104 ScriptEps = 31, 108 ScriptEps = 31,
105 SimSpareMs = 32, 109 SimSpareMs = 32,
106 SimSleepMs = 33, 110 SimSleepMs = 33,
107 SimIoPumpTime = 34 111 SimIoPumpTime = 34,
112 FrameDilation = 35,
113 UsersLoggingIn = 36,
114 TotalGeoPrim = 37,
115 TotalMesh = 38,
116 ThreadCount = 39
108 } 117 }
109 118
110 /// <summary> 119 /// <summary>
@@ -175,7 +184,11 @@ namespace OpenSim.Region.Framework.Scenes
175 184
176 // saved last reported value so there is something available for llGetRegionFPS 185 // saved last reported value so there is something available for llGetRegionFPS
177 private float lastReportedSimFPS; 186 private float lastReportedSimFPS;
187<<<<<<< HEAD
188 private float[] lastReportedSimStats = new float[m_statisticArraySize];
189=======
178 private float[] lastReportedSimStats = new float[23]; 190 private float[] lastReportedSimStats = new float[23];
191>>>>>>> avn/ubitvar
179 private float m_pfps; 192 private float m_pfps;
180 193
181 /// <summary> 194 /// <summary>
@@ -195,14 +208,20 @@ namespace OpenSim.Region.Framework.Scenes
195 private int m_physicsMS; 208 private int m_physicsMS;
196 private int m_imageMS; 209 private int m_imageMS;
197 private int m_otherMS; 210 private int m_otherMS;
211<<<<<<< HEAD
212 private int m_scriptMS;
213=======
198 private int m_sleeptimeMS; 214 private int m_sleeptimeMS;
199 215
200//Ckrinke: (3-21-08) Comment out to remove a compiler warning. Bring back into play when needed. 216//Ckrinke: (3-21-08) Comment out to remove a compiler warning. Bring back into play when needed.
201//Ckrinke private int m_scriptMS = 0; 217//Ckrinke private int m_scriptMS = 0;
218>>>>>>> avn/ubitvar
202 219
203 private int m_rootAgents; 220 private int m_rootAgents;
204 private int m_childAgents; 221 private int m_childAgents;
205 private int m_numPrim; 222 private int m_numPrim;
223 private int m_numGeoPrim;
224 private int m_numMesh;
206 private int m_inPacketsPerSecond; 225 private int m_inPacketsPerSecond;
207 private int m_outPacketsPerSecond; 226 private int m_outPacketsPerSecond;
208 private int m_activePrim; 227 private int m_activePrim;
@@ -214,6 +233,34 @@ namespace OpenSim.Region.Framework.Scenes
214 233
215 private int m_objectCapacity = 45000; 234 private int m_objectCapacity = 45000;
216 235
236 // This is the number of frames that will be stored and then averaged for
237 // the Total, Simulation, Physics, and Network Frame Time; It is set to
238 // 10 by default but can be changed by the OpenSim.ini configuration file
239 // NumberOfFrames parameter
240 private int m_numberFramesStored;
241
242 // The arrays that will hold the time it took to run the past N frames,
243 // where N is the num_frames_to_average given by the configuration file
244 private double[] m_totalFrameTimeMilliseconds;
245 private double[] m_simulationFrameTimeMilliseconds;
246 private double[] m_physicsFrameTimeMilliseconds;
247 private double[] m_networkFrameTimeMilliseconds;
248
249 // The location of the next time in milliseconds that will be
250 // (over)written when the next frame completes
251 private int m_nextLocation = 0;
252
253 // The correct number of frames that have completed since the last stats
254 // update for physics
255 private int m_numberPhysicsFrames;
256
257 // The current number of users attempting to login to the region
258 private int m_usersLoggingIn;
259
260 // The last reported value of threads from the SmartThreadPool inside of
261 // XEngine
262 private int m_inUseThreads;
263
217 private Scene m_scene; 264 private Scene m_scene;
218 265
219 private RegionInfo ReportingRegion; 266 private RegionInfo ReportingRegion;
@@ -223,9 +270,26 @@ namespace OpenSim.Region.Framework.Scenes
223 private IEstateModule estateModule; 270 private IEstateModule estateModule;
224 271
225 public SimStatsReporter(Scene scene) 272 public SimStatsReporter(Scene scene)
273 : this(scene, Scene.m_defaultNumberFramesStored)
226 { 274 {
275 }
276
277 public SimStatsReporter(Scene scene, int numberOfFrames)
278 {
279 // Store the number of frames from the OpenSim.ini configuration file
280 m_numberFramesStored = numberOfFrames;
281
282 // Initialize the different frame time arrays to the correct sizes
283 m_totalFrameTimeMilliseconds = new double[m_numberFramesStored];
284 m_simulationFrameTimeMilliseconds = new double[m_numberFramesStored];
285 m_physicsFrameTimeMilliseconds = new double[m_numberFramesStored];
286 m_networkFrameTimeMilliseconds = new double[m_numberFramesStored];
287
288 // Initialize the current number of users logging into the region
289 m_usersLoggingIn = 0;
290
227 m_scene = scene; 291 m_scene = scene;
228 m_reportedFpsCorrectionFactor = scene.MinFrameTime * m_nominalReportedFps; 292 m_reportedFpsCorrectionFactor = scene.MinFrameSeconds * m_nominalReportedFps;
229 m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000); 293 m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000);
230 ReportingRegion = scene.RegionInfo; 294 ReportingRegion = scene.RegionInfo;
231 295
@@ -240,7 +304,7 @@ namespace OpenSim.Region.Framework.Scenes
240 304
241 /// At the moment, we'll only report if a frame is over 120% of target, since commonly frames are a bit 305 /// At the moment, we'll only report if a frame is over 120% of target, since commonly frames are a bit
242 /// longer than ideal (which in itself is a concern). 306 /// longer than ideal (which in itself is a concern).
243 SlowFramesStatReportThreshold = (int)Math.Ceiling(m_scene.MinFrameTime * 1000 * 1.2); 307 SlowFramesStatReportThreshold = (int)Math.Ceiling(scene.MinFrameTicks * 1.2);
244 308
245 SlowFramesStat 309 SlowFramesStat
246 = new Stat( 310 = new Stat(
@@ -255,8 +319,10 @@ namespace OpenSim.Region.Framework.Scenes
255 StatVerbosity.Info); 319 StatVerbosity.Info);
256 320
257 StatsManager.RegisterStat(SlowFramesStat); 321 StatsManager.RegisterStat(SlowFramesStat);
322
258 } 323 }
259 324
325
260 public void Close() 326 public void Close()
261 { 327 {
262 m_report.Elapsed -= TriggerStatsHeartbeat; 328 m_report.Elapsed -= TriggerStatsHeartbeat;
@@ -290,10 +356,25 @@ namespace OpenSim.Region.Framework.Scenes
290 356
291 private void statsHeartBeat(object sender, EventArgs e) 357 private void statsHeartBeat(object sender, EventArgs e)
292 { 358 {
359 double totalSumFrameTime;
360 double simulationSumFrameTime;
361 double physicsSumFrameTime;
362 double networkSumFrameTime;
363 float frameDilation;
364 int currentFrame;
365
293 if (!m_scene.Active) 366 if (!m_scene.Active)
294 return; 367 return;
295 368
369<<<<<<< HEAD
370 // Create arrays to hold the statistics for this current scene,
371 // these will be passed to the SimExtraStatsCollector, they are also
372 // sent to the SimStats class
373 SimStatsPacket.StatBlock[] sb = new
374 SimStatsPacket.StatBlock[m_statisticArraySize];
375=======
296 SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[23]; 376 SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[23];
377>>>>>>> avn/ubitvar
297 SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock(); 378 SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock();
298 379
299 // Know what's not thread safe in Mono... modifying timers. 380 // Know what's not thread safe in Mono... modifying timers.
@@ -315,14 +396,21 @@ namespace OpenSim.Region.Framework.Scenes
315 396
316#region various statistic googly moogly 397#region various statistic googly moogly
317 398
399 // ORIGINAL code commented out until we have time to add our own
400 // statistics to the statistics window, this will be done as a
401 // new section given the title of our current project
318 // We're going to lie about the FPS because we've been lying since 2008. The actual FPS is currently 402 // We're going to lie about the FPS because we've been lying since 2008. The actual FPS is currently
319 // locked at a maximum of 11. Maybe at some point this can change so that we're not lying. 403 // locked at a maximum of 11. Maybe at some point this can change so that we're not lying.
320 int reportedFPS = (int)(m_fps * m_reportedFpsCorrectionFactor); 404 //int reportedFPS = (int)(m_fps * m_reportedFpsCorrectionFactor);
405 int reportedFPS = m_fps;
321 406
322 // save the reported value so there is something available for llGetRegionFPS 407 // save the reported value so there is something available for llGetRegionFPS
323 lastReportedSimFPS = reportedFPS / m_statsUpdateFactor; 408 lastReportedSimFPS = reportedFPS / m_statsUpdateFactor;
324 409
325 float physfps = ((m_pfps / 1000)); 410 // ORIGINAL code commented out until we have time to add our own
411 // statistics to the statistics window
412 //float physfps = ((m_pfps / 1000));
413 float physfps = m_numberPhysicsFrames;
326 414
327 //if (physfps > 600) 415 //if (physfps > 600)
328 //physfps = physfps - (physfps - 600); 416 //physfps = physfps - (physfps - 600);
@@ -364,6 +452,8 @@ namespace OpenSim.Region.Framework.Scenes
364 m_rootAgents = m_scene.SceneGraph.GetRootAgentCount(); 452 m_rootAgents = m_scene.SceneGraph.GetRootAgentCount();
365 m_childAgents = m_scene.SceneGraph.GetChildAgentCount(); 453 m_childAgents = m_scene.SceneGraph.GetChildAgentCount();
366 m_numPrim = m_scene.SceneGraph.GetTotalObjectsCount(); 454 m_numPrim = m_scene.SceneGraph.GetTotalObjectsCount();
455 m_numGeoPrim = m_scene.SceneGraph.GetTotalPrimObjectsCount();
456 m_numMesh = m_scene.SceneGraph.GetTotalMeshObjectsCount();
367 m_activePrim = m_scene.SceneGraph.GetActiveObjectsCount(); 457 m_activePrim = m_scene.SceneGraph.GetActiveObjectsCount();
368 m_activeScripts = m_scene.SceneGraph.GetActiveScriptsCount(); 458 m_activeScripts = m_scene.SceneGraph.GetActiveScriptsCount();
369 459
@@ -375,15 +465,61 @@ namespace OpenSim.Region.Framework.Scenes
375 // m_otherMS = m_frameMS - m_physicsMS - m_imageMS - m_netMS - m_agentMS; 465 // m_otherMS = m_frameMS - m_physicsMS - m_imageMS - m_netMS - m_agentMS;
376 // m_imageMS m_netMS are not included in m_frameMS 466 // m_imageMS m_netMS are not included in m_frameMS
377 467
468<<<<<<< HEAD
469 uint thisFrame = m_scene.Frame;
470 uint numFrames = thisFrame - m_lastUpdateFrame;
471 float framesUpdated = (float)numFrames * m_reportedFpsCorrectionFactor;
472 m_lastUpdateFrame = thisFrame;
473
474 // Avoid div-by-zero if somehow we've not updated any frames.
475 if (framesUpdated == 0)
476 framesUpdated = 1;
477
478 for (int i = 0; i < m_statisticArraySize; i++)
479=======
378 m_otherMS = m_frameMS - m_physicsMS - m_agentMS - m_sleeptimeMS; 480 m_otherMS = m_frameMS - m_physicsMS - m_agentMS - m_sleeptimeMS;
379 if (m_otherMS < 0) 481 if (m_otherMS < 0)
380 m_otherMS = 0; 482 m_otherMS = 0;
381 483
382 for (int i = 0; i < 23; i++) 484 for (int i = 0; i < 23; i++)
485>>>>>>> avn/ubitvar
383 { 486 {
384 sb[i] = new SimStatsPacket.StatBlock(); 487 sb[i] = new SimStatsPacket.StatBlock();
385 } 488 }
386 489
490 // Resetting the sums of the frame times to prevent any errors
491 // in calculating the moving average for frame time
492 totalSumFrameTime = 0;
493 simulationSumFrameTime = 0;
494 physicsSumFrameTime = 0;
495 networkSumFrameTime = 0;
496
497 // Loop through all the frames that were stored for the current
498 // heartbeat to process the moving average of frame times
499 for (int i = 0; i < m_numberFramesStored; i++)
500 {
501 // Sum up each frame time in order to calculate the moving
502 // average of frame time
503 totalSumFrameTime += m_totalFrameTimeMilliseconds[i];
504 simulationSumFrameTime +=
505 m_simulationFrameTimeMilliseconds[i];
506 physicsSumFrameTime += m_physicsFrameTimeMilliseconds[i];
507 networkSumFrameTime += m_networkFrameTimeMilliseconds[i];
508 }
509
510 // Get the index that represents the current frame based on the next one known; go back
511 // to the last index if next one is stated to restart at 0
512 if (m_nextLocation == 0)
513 currentFrame = m_numberFramesStored - 1;
514 else
515 currentFrame = m_nextLocation - 1;
516
517 // Calculate the frame dilation; which is currently based on the ratio between the sum of the
518 // physics and simulation rate, and the set minimum time to run a scene's frame
519 frameDilation = (float)(m_simulationFrameTimeMilliseconds[currentFrame] +
520 m_physicsFrameTimeMilliseconds[currentFrame]) / m_scene.MinFrameTicks;
521
522 // ORIGINAL code commented out until we have time to add our own
387 sb[0].StatID = (uint) Stats.TimeDilation; 523 sb[0].StatID = (uint) Stats.TimeDilation;
388 sb[0].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor)); 524 sb[0].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor));
389 525
@@ -408,7 +544,21 @@ namespace OpenSim.Region.Framework.Scenes
408 sb[7].StatID = (uint) Stats.ActivePrim; 544 sb[7].StatID = (uint) Stats.ActivePrim;
409 sb[7].StatValue = m_activePrim; 545 sb[7].StatValue = m_activePrim;
410 546
547 // ORIGINAL code commented out until we have time to add our own
548 // statistics to the statistics window
411 sb[8].StatID = (uint)Stats.FrameMS; 549 sb[8].StatID = (uint)Stats.FrameMS;
550<<<<<<< HEAD
551 //sb[8].StatValue = m_frameMS / framesUpdated;
552 sb[8].StatValue = (float) totalSumFrameTime / m_numberFramesStored;
553
554 sb[9].StatID = (uint)Stats.NetMS;
555 //sb[9].StatValue = m_netMS / framesUpdated;
556 sb[9].StatValue = (float) networkSumFrameTime / m_numberFramesStored;
557
558 sb[10].StatID = (uint)Stats.PhysicsMS;
559 //sb[10].StatValue = m_physicsMS / framesUpdated;
560 sb[10].StatValue = (float) physicsSumFrameTime / m_numberFramesStored;
561=======
412 sb[8].StatValue = TotalFrameTime; 562 sb[8].StatValue = TotalFrameTime;
413 563
414 sb[9].StatID = (uint)Stats.NetMS; 564 sb[9].StatID = (uint)Stats.NetMS;
@@ -416,12 +566,18 @@ namespace OpenSim.Region.Framework.Scenes
416 566
417 sb[10].StatID = (uint)Stats.PhysicsMS; 567 sb[10].StatID = (uint)Stats.PhysicsMS;
418 sb[10].StatValue = m_physicsMS * perframe; 568 sb[10].StatValue = m_physicsMS * perframe;
569>>>>>>> avn/ubitvar
419 570
420 sb[11].StatID = (uint)Stats.ImageMS ; 571 sb[11].StatID = (uint)Stats.ImageMS ;
421 sb[11].StatValue = m_imageMS * perframe; 572 sb[11].StatValue = m_imageMS * perframe;
422 573
423 sb[12].StatID = (uint)Stats.OtherMS; 574 sb[12].StatID = (uint)Stats.OtherMS;
575<<<<<<< HEAD
576 //sb[12].StatValue = m_otherMS / framesUpdated;
577 sb[12].StatValue = (float) simulationSumFrameTime / m_numberFramesStored;
578=======
424 sb[12].StatValue = m_otherMS * perframe; 579 sb[12].StatValue = m_otherMS * perframe;
580>>>>>>> avn/ubitvar
425 581
426 sb[13].StatID = (uint)Stats.InPacketsPerSecond; 582 sb[13].StatID = (uint)Stats.InPacketsPerSecond;
427 sb[13].StatValue = (m_inPacketsPerSecond / m_statsUpdateFactor); 583 sb[13].StatValue = (m_inPacketsPerSecond / m_statsUpdateFactor);
@@ -453,7 +609,31 @@ namespace OpenSim.Region.Framework.Scenes
453 sb[22].StatID = (uint)Stats.SimSleepMs; 609 sb[22].StatID = (uint)Stats.SimSleepMs;
454 sb[22].StatValue = sleeptime; 610 sb[22].StatValue = sleeptime;
455 611
456 for (int i = 0; i < 22; i++) 612 // Current ratio between the sum of physics and sim rate, and the
613 // minimum time to run a scene's frame
614 sb[22].StatID = (uint)Stats.FrameDilation;
615 sb[22].StatValue = frameDilation;
616
617 // Current number of users currently attemptint to login to region
618 sb[23].StatID = (uint)Stats.UsersLoggingIn;
619 sb[23].StatValue = m_usersLoggingIn;
620
621 // Total number of geometric primitives in the scene
622 sb[24].StatID = (uint)Stats.TotalGeoPrim;
623 sb[24].StatValue = m_numGeoPrim;
624
625 // Total number of mesh objects in the scene
626 sb[25].StatID = (uint)Stats.TotalMesh;
627 sb[25].StatValue = m_numMesh;
628
629 // Current number of threads that XEngine is using
630 sb[26].StatID = (uint)Stats.ThreadCount;
631 sb[26].StatValue = m_inUseThreads;
632
633 sb[27].StatID = (uint)Stats.ScriptMS;
634 sb[27].StatValue = (numFrames <= 0) ? 0 : ((float)m_scriptMS / numFrames);
635
636 for (int i = 0; i < m_statisticArraySize; i++)
457 { 637 {
458 lastReportedSimStats[i] = sb[i].StatValue; 638 lastReportedSimStats[i] = sb[i].StatValue;
459 } 639 }
@@ -502,6 +682,10 @@ namespace OpenSim.Region.Framework.Scenes
502 682
503 private void ResetValues() 683 private void ResetValues()
504 { 684 {
685 // Reset the number of frames that the physics library has
686 // processed since the last stats report
687 m_numberPhysicsFrames = 0;
688
505 m_timeDilation = 0; 689 m_timeDilation = 0;
506 m_fps = 0; 690 m_fps = 0;
507 m_pfps = 0; 691 m_pfps = 0;
@@ -518,11 +702,16 @@ namespace OpenSim.Region.Framework.Scenes
518 m_physicsMS = 0; 702 m_physicsMS = 0;
519 m_imageMS = 0; 703 m_imageMS = 0;
520 m_otherMS = 0; 704 m_otherMS = 0;
705<<<<<<< HEAD
706 m_scriptMS = 0;
707 m_spareMS = 0;
708=======
521// m_spareMS = 0; 709// m_spareMS = 0;
522 m_sleeptimeMS = 0; 710 m_sleeptimeMS = 0;
523 711
524//Ckrinke This variable is not used, so comment to remove compiler warning until it is used. 712//Ckrinke This variable is not used, so comment to remove compiler warning until it is used.
525//Ckrinke m_scriptMS = 0; 713//Ckrinke m_scriptMS = 0;
714>>>>>>> avn/ubitvar
526 } 715 }
527 716
528 # region methods called from Scene 717 # region methods called from Scene
@@ -628,9 +817,41 @@ namespace OpenSim.Region.Framework.Scenes
628 m_otherMS += ms; 817 m_otherMS += ms;
629 } 818 }
630 819
820<<<<<<< HEAD
821 public void AddScriptMS(int ms)
822 {
823 m_scriptMS += ms;
824 }
825
826 public void addPhysicsFrame(int frames)
827 {
828 // Add the number of physics frames to the correct total physics
829 // frames
830 m_numberPhysicsFrames += frames;
831 }
832
833 public void addFrameTimeMilliseconds(double total, double simulation,
834 double physics, double network)
835 {
836 // Save the frame times from the current frame into the appropriate
837 // arrays
838 m_totalFrameTimeMilliseconds[m_nextLocation] = total;
839 m_simulationFrameTimeMilliseconds[m_nextLocation] = simulation;
840 m_physicsFrameTimeMilliseconds[m_nextLocation] = physics;
841 m_networkFrameTimeMilliseconds[m_nextLocation] = network;
842
843 // Update to the next location in the list
844 m_nextLocation++;
845
846 // Since the list will begin to overwrite the oldest frame values
847 // first, the next location needs to loop back to the beginning of the
848 // list whenever it reaches the end
849 m_nextLocation = m_nextLocation % m_numberFramesStored;
850=======
631 public void addSleepMS(int ms) 851 public void addSleepMS(int ms)
632 { 852 {
633 m_sleeptimeMS += ms; 853 m_sleeptimeMS += ms;
854>>>>>>> avn/ubitvar
634 } 855 }
635 856
636 public void AddPendingDownloads(int count) 857 public void AddPendingDownloads(int count)
@@ -655,6 +876,31 @@ namespace OpenSim.Region.Framework.Scenes
655 AddunAckedBytes(unAckedBytes); 876 AddunAckedBytes(unAckedBytes);
656 } 877 }
657 878
879 public void UpdateUsersLoggingIn(bool isLoggingIn)
880 {
881 // Determine whether the user has started logging in or has completed
882 // logging into the region
883 if (isLoggingIn)
884 {
885 // The user is starting to login to the region so increment the
886 // number of users attempting to login to the region
887 m_usersLoggingIn++;
888 }
889 else
890 {
891 // The user has finished logging into the region so decrement the
892 // number of users logging into the region
893 m_usersLoggingIn--;
894 }
895 }
896
897 public void SetThreadCount(int inUseThreads)
898 {
899 // Save the new number of threads to our member variable to send to
900 // the extra stats collector
901 m_inUseThreads = inUseThreads;
902 }
903
658 #endregion 904 #endregion
659 905
660 public Dictionary<string, float> GetExtraSimStats() 906 public Dictionary<string, float> GetExtraSimStats()
diff --git a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs
index 6abdc29..6fd9096 100644
--- a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs
+++ b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs
@@ -49,6 +49,7 @@ namespace OpenSim.Region.Framework.Scenes
49 { 49 {
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51 private static string LogHeader = "[TERRAIN CHANNEL]"; 51 private static string LogHeader = "[TERRAIN CHANNEL]";
52<<<<<<< HEAD
52 53
53 protected TerrainData m_terrainData; 54 protected TerrainData m_terrainData;
54 55
@@ -57,6 +58,16 @@ namespace OpenSim.Region.Framework.Scenes
57 public int Height { get { return m_terrainData.SizeY; } } // Y dimension 58 public int Height { get { return m_terrainData.SizeY; } } // Y dimension
58 public int Altitude { get { return m_terrainData.SizeZ; } } // Y dimension 59 public int Altitude { get { return m_terrainData.SizeZ; } } // Y dimension
59 60
61=======
62
63 protected TerrainData m_terrainData;
64
65 public int Width { get { return m_terrainData.SizeX; } } // X dimension
66 // Unfortunately, for historical reasons, in this module 'Width' is X and 'Height' is Y
67 public int Height { get { return m_terrainData.SizeY; } } // Y dimension
68 public int Altitude { get { return m_terrainData.SizeZ; } } // Y dimension
69
70>>>>>>> avn/ubitvar
60 // Default, not-often-used builder 71 // Default, not-often-used builder
61 public TerrainChannel() 72 public TerrainChannel()
62 { 73 {
@@ -157,11 +168,15 @@ namespace OpenSim.Region.Framework.Scenes
157 { 168 {
158 if (Double.IsNaN(value) || Double.IsInfinity(value)) 169 if (Double.IsNaN(value) || Double.IsInfinity(value))
159 return; 170 return;
171<<<<<<< HEAD
172
173=======
160 if (value < 0) 174 if (value < 0)
161 value = 0; 175 value = 0;
162 else 176 else
163 if (value > 655.35) 177 if (value > 655.35)
164 value = 655.35; 178 value = 655.35;
179>>>>>>> avn/ubitvar
165 m_terrainData[x, y] = (float)value; 180 m_terrainData[x, y] = (float)value;
166 } 181 }
167 } 182 }
@@ -367,8 +382,13 @@ namespace OpenSim.Region.Framework.Scenes
367 public int SizeY; 382 public int SizeY;
368 public int SizeZ; 383 public int SizeZ;
369 public float CompressionFactor; 384 public float CompressionFactor;
385<<<<<<< HEAD
386 public int[] Map;
387 public TerrainChannelXMLPackage(int pX, int pY, int pZ, float pCompressionFactor, int[] pMap)
388=======
370 public float[] Map; 389 public float[] Map;
371 public TerrainChannelXMLPackage(int pX, int pY, int pZ, float pCompressionFactor, float[] pMap) 390 public TerrainChannelXMLPackage(int pX, int pY, int pZ, float pCompressionFactor, float[] pMap)
391>>>>>>> avn/ubitvar
372 { 392 {
373 Version = 1; 393 Version = 1;
374 SizeX = pX; 394 SizeX = pX;
@@ -399,13 +419,25 @@ namespace OpenSim.Region.Framework.Scenes
399 // Fill the heightmap with the center bump terrain 419 // Fill the heightmap with the center bump terrain
400 private void PinHeadIsland() 420 private void PinHeadIsland()
401 { 421 {
422<<<<<<< HEAD
423=======
402 float cx = m_terrainData.SizeX * 0.5f; 424 float cx = m_terrainData.SizeX * 0.5f;
403 float cy = m_terrainData.SizeY * 0.5f; 425 float cy = m_terrainData.SizeY * 0.5f;
404 float h; 426 float h;
427>>>>>>> avn/ubitvar
405 for (int x = 0; x < Width; x++) 428 for (int x = 0; x < Width; x++)
406 { 429 {
407 for (int y = 0; y < Height; y++) 430 for (int y = 0; y < Height; y++)
408 { 431 {
432<<<<<<< HEAD
433 m_terrainData[x, y] = (float)TerrainUtil.PerlinNoise2D(x, y, 2, 0.125) * 10;
434 float spherFacA = (float)(TerrainUtil.SphericalFactor(x, y, m_terrainData.SizeX / 2.0, m_terrainData.SizeY / 2.0, 50) * 0.01d);
435 float spherFacB = (float)(TerrainUtil.SphericalFactor(x, y, m_terrainData.SizeX / 2.0, m_terrainData.SizeY / 2.0, 100) * 0.001d);
436 if (m_terrainData[x, y]< spherFacA)
437 m_terrainData[x, y]= spherFacA;
438 if (m_terrainData[x, y]< spherFacB)
439 m_terrainData[x, y] = spherFacB;
440=======
409 // h = (float)TerrainUtil.PerlinNoise2D(x, y, 2, 0.125) * 10; 441 // h = (float)TerrainUtil.PerlinNoise2D(x, y, 2, 0.125) * 10;
410 h = 1.0f; 442 h = 1.0f;
411 float spherFacA = (float)(TerrainUtil.SphericalFactor(x, y, cx, cy, 50) * 0.01d); 443 float spherFacA = (float)(TerrainUtil.SphericalFactor(x, y, cx, cy, 50) * 0.01d);
@@ -415,6 +447,7 @@ namespace OpenSim.Region.Framework.Scenes
415 if (h < spherFacB) 447 if (h < spherFacB)
416 h = spherFacB; 448 h = spherFacB;
417 m_terrainData[x, y] = h; 449 m_terrainData[x, y] = h;
450>>>>>>> avn/ubitvar
418 } 451 }
419 } 452 }
420 } 453 }
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
index 575a081..b6b3344 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
@@ -35,7 +35,6 @@ using OpenSim.Framework;
35using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
36using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
37using OpenSim.Tests.Common; 37using OpenSim.Tests.Common;
38using OpenSim.Tests.Common.Mock;
39 38
40namespace OpenSim.Region.Framework.Scenes.Tests 39namespace OpenSim.Region.Framework.Scenes.Tests
41{ 40{
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs
index 2d831fa..6118004 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs
@@ -36,7 +36,6 @@ using OpenSim.Framework.Communications;
36using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
37using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
38using OpenSim.Tests.Common; 38using OpenSim.Tests.Common;
39using OpenSim.Tests.Common.Mock;
40 39
41namespace OpenSim.Region.Framework.Scenes.Tests 40namespace OpenSim.Region.Framework.Scenes.Tests
42{ 41{
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
index a07d64c..bdf0700 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
@@ -37,7 +37,6 @@ using OpenSim.Framework.Communications;
37using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
39using OpenSim.Tests.Common; 39using OpenSim.Tests.Common;
40using OpenSim.Tests.Common.Mock;
41 40
42namespace OpenSim.Region.Framework.Scenes.Tests 41namespace OpenSim.Region.Framework.Scenes.Tests
43{ 42{
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs
new file mode 100644
index 0000000..1d41d33
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs
@@ -0,0 +1,347 @@
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
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using Nini.Config;
32using NUnit.Framework;
33using OpenMetaverse;
34using OpenSim.Framework;
35using OpenSim.Framework.Communications;
36using OpenSim.Region.CoreModules.Framework.EntityTransfer;
37using OpenSim.Region.CoreModules.Framework.InventoryAccess;
38using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
39using OpenSim.Region.CoreModules.World.Permissions;
40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Services.Interfaces;
42using OpenSim.Tests.Common;
43
44namespace OpenSim.Region.Framework.Scenes.Tests
45{
46 /// <summary>
47 /// Test copying of scene objects.
48 /// </summary>
49 /// <remarks>
50 /// This is at a level above the SceneObjectBasicTests, which act on the scene directly.
51 /// </remarks>
52 [TestFixture]
53 public class SceneObjectCopyTests : OpenSimTestCase
54 {
55 [TestFixtureSetUp]
56 public void FixtureInit()
57 {
58 // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread.
59 // This facility was added after the original async delete tests were written, so it may be possible now
60 // to not bother explicitly disabling their async (since everything will be running sync).
61 Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest;
62 }
63
64 [TestFixtureTearDown]
65 public void TearDown()
66 {
67 // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple
68 // threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression
69 // tests really shouldn't).
70 Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
71 }
72
73 [Test]
74 public void TestTakeCopyWhenCopierIsOwnerWithPerms()
75 {
76 TestHelpers.InMethod();
77// TestHelpers.EnableLogging();
78
79 IConfigSource config = new IniConfigSource();
80 config.AddConfig("Modules");
81 config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
82
83 TestScene scene = new SceneHelpers().SetupScene("s1", TestHelpers.ParseTail(0x99), 1000, 1000, config);
84 SceneHelpers.SetupSceneModules(scene, config, new PermissionsModule(), new BasicInventoryAccessModule());
85 UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(0x1));
86 TestClient client = (TestClient)SceneHelpers.AddScenePresence(scene, ua.PrincipalID).ControllingClient;
87
88 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
89 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
90 sogd.Enabled = false;
91
92 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", ua.PrincipalID);
93 uint soLocalId = so.LocalId;
94// so.UpdatePermissions(
95// ua.PrincipalID, (byte)PermissionWho.Owner, so.LocalId, (uint)OpenMetaverse.PermissionMask.Copy, 1);
96// so.UpdatePermissions(
97// ua.PrincipalID, (byte)PermissionWho.Owner, so.LocalId, (uint)OpenMetaverse.PermissionMask.Transfer, 0);
98// so.UpdatePermissions(
99// ua.PrincipalID, (byte)PermissionWho.Base, so.LocalId, (uint)OpenMetaverse.PermissionMask.Transfer, 0);
100// scene.HandleObjectPermissionsUpdate(client, client.AgentId, client.SessionId, (byte)PermissionWho.Owner, so.LocalId, (uint)OpenMetaverse.PermissionMask.Transfer, 0);
101
102 // Ideally we might change these via client-focussed method calls as commented out above. However, this
103 // becomes very convoluted so we will set only the copy perm directly.
104 so.RootPart.BaseMask = (uint)OpenMetaverse.PermissionMask.Copy;
105// so.RootPart.OwnerMask = (uint)OpenMetaverse.PermissionMask.Copy;
106
107 List<uint> localIds = new List<uint>();
108 localIds.Add(so.LocalId);
109
110 // Specifying a UUID.Zero in this case will currently plop it in Lost and Found
111 scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero);
112
113 // Check that object isn't copied until we crank the sogd handle.
114 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
115 Assert.That(retrievedPart, Is.Not.Null);
116 Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
117
118 sogd.InventoryDeQueueAndDelete();
119
120 // Check that object is still there.
121 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
122 Assert.That(retrievedPart2, Is.Not.Null);
123 Assert.That(client.ReceivedKills.Count, Is.EqualTo(0));
124
125 // Check that we have a copy in inventory
126 InventoryItemBase item
127 = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Lost And Found/so1");
128 Assert.That(item, Is.Not.Null);
129 }
130
131 [Test]
132 public void TestTakeCopyWhenCopierIsOwnerWithoutPerms()
133 {
134 TestHelpers.InMethod();
135// TestHelpers.EnableLogging();
136
137 IConfigSource config = new IniConfigSource();
138 config.AddConfig("Modules");
139 config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
140
141 TestScene scene = new SceneHelpers().SetupScene("s1", TestHelpers.ParseTail(0x99), 1000, 1000, config);
142 SceneHelpers.SetupSceneModules(scene, config, new PermissionsModule(), new BasicInventoryAccessModule());
143 UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(0x1));
144 TestClient client = (TestClient)SceneHelpers.AddScenePresence(scene, ua.PrincipalID).ControllingClient;
145
146 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
147 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
148 sogd.Enabled = false;
149
150 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", ua.PrincipalID);
151 uint soLocalId = so.LocalId;
152
153 so.RootPart.BaseMask = (uint)(OpenMetaverse.PermissionMask.All & ~OpenMetaverse.PermissionMask.Copy);
154 //so.RootPart.OwnerMask = (uint)(OpenMetaverse.PermissionMask.Copy & ~OpenMetaverse.PermissionMask.Copy);
155
156 List<uint> localIds = new List<uint>();
157 localIds.Add(so.LocalId);
158
159 // Specifying a UUID.Zero in this case will currently plop it in Lost and Found
160 scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero);
161
162 // Check that object isn't copied until we crank the sogd handle.
163 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
164 Assert.That(retrievedPart, Is.Not.Null);
165 Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
166
167 sogd.InventoryDeQueueAndDelete();
168
169 // Check that object is still there.
170 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
171 Assert.That(retrievedPart2, Is.Not.Null);
172 Assert.That(client.ReceivedKills.Count, Is.EqualTo(0));
173
174 // Check that we do not have a copy in inventory
175 InventoryItemBase item
176 = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Lost And Found/so1");
177 Assert.That(item, Is.Null);
178 }
179
180 [Test]
181 public void TestTakeCopyWhenCopierIsNotOwnerWithPerms()
182 {
183 TestHelpers.InMethod();
184// TestHelpers.EnableLogging();
185
186 IConfigSource config = new IniConfigSource();
187 config.AddConfig("Modules");
188 config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
189
190 TestScene scene = new SceneHelpers().SetupScene("s1", TestHelpers.ParseTail(0x99), 1000, 1000, config);
191 SceneHelpers.SetupSceneModules(scene, config, new PermissionsModule(), new BasicInventoryAccessModule());
192 UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(0x1));
193 TestClient client = (TestClient)SceneHelpers.AddScenePresence(scene, ua.PrincipalID).ControllingClient;
194
195 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
196 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
197 sogd.Enabled = false;
198
199 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", TestHelpers.ParseTail(0x2));
200 uint soLocalId = so.LocalId;
201
202 // Base must allow transfer and copy
203 so.RootPart.BaseMask = (uint)(OpenMetaverse.PermissionMask.Copy | OpenMetaverse.PermissionMask.Transfer);
204 // Must be set so anyone can copy
205 so.RootPart.EveryoneMask = (uint)OpenMetaverse.PermissionMask.Copy;
206
207 List<uint> localIds = new List<uint>();
208 localIds.Add(so.LocalId);
209
210 // Specifying a UUID.Zero in this case will plop it in the Objects folder
211 scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero);
212
213 // Check that object isn't copied until we crank the sogd handle.
214 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
215 Assert.That(retrievedPart, Is.Not.Null);
216 Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
217
218 sogd.InventoryDeQueueAndDelete();
219
220 // Check that object is still there.
221 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
222 Assert.That(retrievedPart2, Is.Not.Null);
223 Assert.That(client.ReceivedKills.Count, Is.EqualTo(0));
224
225 // Check that we have a copy in inventory
226 InventoryItemBase item
227 = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Objects/so1");
228 Assert.That(item, Is.Not.Null);
229 }
230
231 [Test]
232 public void TestTakeCopyWhenCopierIsNotOwnerWithoutPerms()
233 {
234 TestHelpers.InMethod();
235// TestHelpers.EnableLogging();
236
237 IConfigSource config = new IniConfigSource();
238 config.AddConfig("Modules");
239 config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
240
241 TestScene scene = new SceneHelpers().SetupScene("s1", TestHelpers.ParseTail(0x99), 1000, 1000, config);
242 SceneHelpers.SetupSceneModules(scene, config, new PermissionsModule(), new BasicInventoryAccessModule());
243 UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(0x1));
244 TestClient client = (TestClient)SceneHelpers.AddScenePresence(scene, ua.PrincipalID).ControllingClient;
245
246 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
247 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
248 sogd.Enabled = false;
249
250 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", TestHelpers.ParseTail(0x2));
251 uint soLocalId = so.LocalId;
252
253 {
254 // Check that object is not copied if copy base perms is missing.
255 // Should not allow copy if base does not have this.
256 so.RootPart.BaseMask = (uint)OpenMetaverse.PermissionMask.Transfer;
257 // Must be set so anyone can copy
258 so.RootPart.EveryoneMask = (uint)OpenMetaverse.PermissionMask.Copy;
259
260 // Check that object is not copied
261 List<uint> localIds = new List<uint>();
262 localIds.Add(so.LocalId);
263
264 // Specifying a UUID.Zero in this case will plop it in the Objects folder if we have perms
265 scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero);
266
267 // Check that object isn't copied until we crank the sogd handle.
268 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
269 Assert.That(retrievedPart, Is.Not.Null);
270 Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
271
272 sogd.InventoryDeQueueAndDelete();
273 // Check that object is still there.
274 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
275 Assert.That(retrievedPart2, Is.Not.Null);
276 Assert.That(client.ReceivedKills.Count, Is.EqualTo(0));
277
278 // Check that we have a copy in inventory
279 InventoryItemBase item
280 = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Objects/so1");
281 Assert.That(item, Is.Null);
282 }
283
284 {
285 // Check that object is not copied if copy trans perms is missing.
286 // Should not allow copy if base does not have this.
287 so.RootPart.BaseMask = (uint)OpenMetaverse.PermissionMask.Copy;
288 // Must be set so anyone can copy
289 so.RootPart.EveryoneMask = (uint)OpenMetaverse.PermissionMask.Copy;
290
291 // Check that object is not copied
292 List<uint> localIds = new List<uint>();
293 localIds.Add(so.LocalId);
294
295 // Specifying a UUID.Zero in this case will plop it in the Objects folder if we have perms
296 scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero);
297
298 // Check that object isn't copied until we crank the sogd handle.
299 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
300 Assert.That(retrievedPart, Is.Not.Null);
301 Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
302
303 sogd.InventoryDeQueueAndDelete();
304 // Check that object is still there.
305 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
306 Assert.That(retrievedPart2, Is.Not.Null);
307 Assert.That(client.ReceivedKills.Count, Is.EqualTo(0));
308
309 // Check that we have a copy in inventory
310 InventoryItemBase item
311 = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Objects/so1");
312 Assert.That(item, Is.Null);
313 }
314
315 {
316 // Check that object is not copied if everyone copy perms is missing.
317 // Should not allow copy if base does not have this.
318 so.RootPart.BaseMask = (uint)(OpenMetaverse.PermissionMask.Copy | OpenMetaverse.PermissionMask.Transfer);
319 // Make sure everyone perm does not allow copy
320 so.RootPart.EveryoneMask = (uint)(OpenMetaverse.PermissionMask.All & ~OpenMetaverse.PermissionMask.Copy);
321
322 // Check that object is not copied
323 List<uint> localIds = new List<uint>();
324 localIds.Add(so.LocalId);
325
326 // Specifying a UUID.Zero in this case will plop it in the Objects folder if we have perms
327 scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero);
328
329 // Check that object isn't copied until we crank the sogd handle.
330 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
331 Assert.That(retrievedPart, Is.Not.Null);
332 Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
333
334 sogd.InventoryDeQueueAndDelete();
335 // Check that object is still there.
336 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
337 Assert.That(retrievedPart2, Is.Not.Null);
338 Assert.That(client.ReceivedKills.Count, Is.EqualTo(0));
339
340 // Check that we have a copy in inventory
341 InventoryItemBase item
342 = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Objects/so1");
343 Assert.That(item, Is.Null);
344 }
345 }
346 }
347} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs
new file mode 100644
index 0000000..5635c20
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs
@@ -0,0 +1,259 @@
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
28using System;
29using System.Collections.Generic;
30using Nini.Config;
31using NUnit.Framework;
32using OpenMetaverse;
33using OpenSim.Framework;
34using OpenSim.Region.CoreModules.Framework;
35using OpenSim.Region.CoreModules.Framework.EntityTransfer;
36using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
37using OpenSim.Region.CoreModules.World.Land;
38using OpenSim.Region.OptionalModules;
39using OpenSim.Tests.Common;
40
41namespace OpenSim.Region.Framework.Scenes.Tests
42{
43 public class SceneObjectCrossingTests : OpenSimTestCase
44 {
45 [TestFixtureSetUp]
46 public void FixtureInit()
47 {
48 // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread.
49 Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest;
50 }
51
52 [TestFixtureTearDown]
53 public void TearDown()
54 {
55 // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple
56 // threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression
57 // tests really shouldn't).
58 Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
59 }
60
61 /// <summary>
62 /// Test cross with no prim limit module.
63 /// </summary>
64 [Test]
65 public void TestCrossOnSameSimulator()
66 {
67 TestHelpers.InMethod();
68// TestHelpers.EnableLogging();
69
70 UUID userId = TestHelpers.ParseTail(0x1);
71 int sceneObjectIdTail = 0x2;
72
73 EntityTransferModule etmA = new EntityTransferModule();
74 EntityTransferModule etmB = new EntityTransferModule();
75 LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
76
77 IConfigSource config = new IniConfigSource();
78 IConfig modulesConfig = config.AddConfig("Modules");
79 modulesConfig.Set("EntityTransferModule", etmA.Name);
80 modulesConfig.Set("SimulationServices", lscm.Name);
81
82 SceneHelpers sh = new SceneHelpers();
83 TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
84 TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1000, 999);
85
86 SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
87 SceneHelpers.SetupSceneModules(sceneA, config, etmA);
88 SceneHelpers.SetupSceneModules(sceneB, config, etmB);
89
90 SceneObjectGroup so1 = SceneHelpers.AddSceneObject(sceneA, 1, userId, "", sceneObjectIdTail);
91 UUID so1Id = so1.UUID;
92 so1.AbsolutePosition = new Vector3(128, 10, 20);
93
94 // Cross with a negative value
95 so1.AbsolutePosition = new Vector3(128, -10, 20);
96
97 Assert.IsNull(sceneA.GetSceneObjectGroup(so1Id));
98 Assert.NotNull(sceneB.GetSceneObjectGroup(so1Id));
99 }
100
101 /// <summary>
102 /// Test cross with no prim limit module.
103 /// </summary>
104 /// <remarks>
105 /// Possibly this should belong in ScenePresenceCrossingTests, though here it is the object that is being moved
106 /// where the avatar is just a passenger.
107 /// </remarks>
108 [Test]
109 public void TestCrossOnSameSimulatorWithSittingAvatar()
110 {
111 TestHelpers.InMethod();
112// TestHelpers.EnableLogging();
113
114 UUID userId = TestHelpers.ParseTail(0x1);
115 int sceneObjectIdTail = 0x2;
116 Vector3 so1StartPos = new Vector3(128, 10, 20);
117
118 EntityTransferModule etmA = new EntityTransferModule();
119 EntityTransferModule etmB = new EntityTransferModule();
120 LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
121
122 IConfigSource config = new IniConfigSource();
123 IConfig modulesConfig = config.AddConfig("Modules");
124 modulesConfig.Set("EntityTransferModule", etmA.Name);
125 modulesConfig.Set("SimulationServices", lscm.Name);
126 IConfig entityTransferConfig = config.AddConfig("EntityTransfer");
127
128 // In order to run a single threaded regression test we do not want the entity transfer module waiting
129 // for a callback from the destination scene before removing its avatar data.
130 entityTransferConfig.Set("wait_for_callback", false);
131
132 SceneHelpers sh = new SceneHelpers();
133 TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
134 TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1000, 999);
135
136 SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
137 SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA);
138 SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB);
139
140 SceneObjectGroup so1 = SceneHelpers.AddSceneObject(sceneA, 1, userId, "", sceneObjectIdTail);
141 UUID so1Id = so1.UUID;
142 so1.AbsolutePosition = so1StartPos;
143
144 AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId);
145 TestClient tc = new TestClient(acd, sceneA);
146 List<TestClient> destinationTestClients = new List<TestClient>();
147 EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(tc, destinationTestClients);
148
149 ScenePresence sp1SceneA = SceneHelpers.AddScenePresence(sceneA, tc, acd);
150 sp1SceneA.AbsolutePosition = so1StartPos;
151 sp1SceneA.HandleAgentRequestSit(sp1SceneA.ControllingClient, sp1SceneA.UUID, so1.UUID, Vector3.Zero);
152
153 // Cross
154 sceneA.SceneGraph.UpdatePrimGroupPosition(
155 so1.LocalId, new Vector3(so1StartPos.X, so1StartPos.Y - 20, so1StartPos.Z), userId);
156
157 SceneObjectGroup so1PostCross;
158
159 {
160 ScenePresence sp1SceneAPostCross = sceneA.GetScenePresence(userId);
161 Assert.IsTrue(sp1SceneAPostCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly false");
162
163 ScenePresence sp1SceneBPostCross = sceneB.GetScenePresence(userId);
164 TestClient sceneBTc = ((TestClient)sp1SceneBPostCross.ControllingClient);
165 sceneBTc.CompleteMovement();
166
167 Assert.IsFalse(sp1SceneBPostCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly true");
168 Assert.IsTrue(sp1SceneBPostCross.IsSatOnObject);
169
170 Assert.IsNull(sceneA.GetSceneObjectGroup(so1Id), "uck");
171 so1PostCross = sceneB.GetSceneObjectGroup(so1Id);
172 Assert.NotNull(so1PostCross);
173 Assert.AreEqual(1, so1PostCross.GetSittingAvatarsCount());
174 }
175
176 Vector3 so1PostCrossPos = so1PostCross.AbsolutePosition;
177
178// Console.WriteLine("CRISSCROSS");
179
180 // Recross
181 sceneB.SceneGraph.UpdatePrimGroupPosition(
182 so1PostCross.LocalId, new Vector3(so1PostCrossPos.X, so1PostCrossPos.Y + 20, so1PostCrossPos.Z), userId);
183
184 {
185 ScenePresence sp1SceneBPostReCross = sceneB.GetScenePresence(userId);
186 Assert.IsTrue(sp1SceneBPostReCross.IsChildAgent, "sp1SceneBPostReCross.IsChildAgent unexpectedly false");
187
188 ScenePresence sp1SceneAPostReCross = sceneA.GetScenePresence(userId);
189 TestClient sceneATc = ((TestClient)sp1SceneAPostReCross.ControllingClient);
190 sceneATc.CompleteMovement();
191
192 Assert.IsFalse(sp1SceneAPostReCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly true");
193 Assert.IsTrue(sp1SceneAPostReCross.IsSatOnObject);
194
195 Assert.IsNull(sceneB.GetSceneObjectGroup(so1Id), "uck2");
196 SceneObjectGroup so1PostReCross = sceneA.GetSceneObjectGroup(so1Id);
197 Assert.NotNull(so1PostReCross);
198 Assert.AreEqual(1, so1PostReCross.GetSittingAvatarsCount());
199 }
200 }
201
202 /// <summary>
203 /// Test cross with no prim limit module.
204 /// </summary>
205 /// <remarks>
206 /// XXX: This test may FCbe better off in a specific PrimLimitsModuleTest class in optional module tests in the
207 /// future (though it is configured as active by default, so not really optional).
208 /// </remarks>
209 [Test]
210 public void TestCrossOnSameSimulatorPrimLimitsOkay()
211 {
212 TestHelpers.InMethod();
213// TestHelpers.EnableLogging();
214
215 UUID userId = TestHelpers.ParseTail(0x1);
216 int sceneObjectIdTail = 0x2;
217
218 EntityTransferModule etmA = new EntityTransferModule();
219 EntityTransferModule etmB = new EntityTransferModule();
220 LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
221 LandManagementModule lmmA = new LandManagementModule();
222 LandManagementModule lmmB = new LandManagementModule();
223
224 IConfigSource config = new IniConfigSource();
225 IConfig modulesConfig = config.AddConfig("Modules");
226 modulesConfig.Set("EntityTransferModule", etmA.Name);
227 modulesConfig.Set("SimulationServices", lscm.Name);
228
229 IConfig permissionsConfig = config.AddConfig("Permissions");
230 permissionsConfig.Set("permissionmodules", "PrimLimitsModule");
231
232 SceneHelpers sh = new SceneHelpers();
233 TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
234 TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1000, 999);
235
236 SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
237 SceneHelpers.SetupSceneModules(
238 sceneA, config, etmA, lmmA, new PrimLimitsModule(), new PrimCountModule());
239 SceneHelpers.SetupSceneModules(
240 sceneB, config, etmB, lmmB, new PrimLimitsModule(), new PrimCountModule());
241
242 // We must set up the parcel for this to work. Normally this is taken care of by OpenSimulator startup
243 // code which is not yet easily invoked by tests.
244 lmmA.EventManagerOnNoLandDataFromStorage();
245 lmmB.EventManagerOnNoLandDataFromStorage();
246
247 SceneObjectGroup so1 = SceneHelpers.AddSceneObject(sceneA, 1, userId, "", sceneObjectIdTail);
248 UUID so1Id = so1.UUID;
249 so1.AbsolutePosition = new Vector3(128, 10, 20);
250
251 // Cross with a negative value. We must make this call rather than setting AbsolutePosition directly
252 // because only this will execute permission checks in the source region.
253 sceneA.SceneGraph.UpdatePrimGroupPosition(so1.LocalId, new Vector3(128, -10, 20), userId);
254
255 Assert.IsNull(sceneA.GetSceneObjectGroup(so1Id));
256 Assert.NotNull(sceneB.GetSceneObjectGroup(so1Id));
257 }
258 }
259} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
index 95b30d5..b7e9499 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
@@ -40,7 +40,6 @@ using OpenSim.Region.CoreModules.World.Permissions;
40using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Services.Interfaces; 41using OpenSim.Services.Interfaces;
42using OpenSim.Tests.Common; 42using OpenSim.Tests.Common;
43using OpenSim.Tests.Common.Mock;
44 43
45namespace OpenSim.Region.Framework.Scenes.Tests 44namespace OpenSim.Region.Framework.Scenes.Tests
46{ 45{
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
index 9378e20..c2e0ae3 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
@@ -34,7 +34,6 @@ using OpenSim.Framework;
34using OpenSim.Framework.Communications; 34using OpenSim.Framework.Communications;
35using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
36using OpenSim.Tests.Common; 36using OpenSim.Tests.Common;
37using OpenSim.Tests.Common.Mock;
38using log4net; 37using log4net;
39 38
40namespace OpenSim.Region.Framework.Scenes.Tests 39namespace OpenSim.Region.Framework.Scenes.Tests
@@ -91,7 +90,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests
91 grp2.RootPart.ClearUpdateSchedule(); 90 grp2.RootPart.ClearUpdateSchedule();
92 91
93 // Link grp2 to grp1. part2 becomes child prim to grp1. grp2 is eliminated. 92 // Link grp2 to grp1. part2 becomes child prim to grp1. grp2 is eliminated.
93 Assert.IsFalse(grp1.GroupContainsForeignPrims);
94 grp1.LinkToGroup(grp2); 94 grp1.LinkToGroup(grp2);
95 Assert.IsTrue(grp1.GroupContainsForeignPrims);
96
97 scene.Backup(true);
98 Assert.IsFalse(grp1.GroupContainsForeignPrims);
95 99
96 // FIXME: Can't do this test yet since group 2 still has its root part! We can't yet null this since 100 // FIXME: Can't do this test yet since group 2 still has its root part! We can't yet null this since
97 // it might cause SOG.ProcessBackup() to fail due to the race condition. This really needs to be fixed. 101 // it might cause SOG.ProcessBackup() to fail due to the race condition. This really needs to be fixed.
@@ -143,7 +147,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
143 147
144 Assert.That(grp1.Parts.Length, Is.EqualTo(1), "Group 1 still contained part2 after delink."); 148 Assert.That(grp1.Parts.Length, Is.EqualTo(1), "Group 1 still contained part2 after delink.");
145 Assert.That(part2.AbsolutePosition == Vector3.Zero, "The absolute position should be zero"); 149 Assert.That(part2.AbsolutePosition == Vector3.Zero, "The absolute position should be zero");
146 Assert.That(grp3.HasGroupChangedDueToDelink, Is.True); 150 Assert.NotNull(grp3);
147 } 151 }
148 152
149 [Test] 153 [Test]
@@ -335,30 +339,34 @@ namespace OpenSim.Region.Framework.Scenes.Tests
335 SceneObjectPart rootPart 339 SceneObjectPart rootPart
336 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) 340 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
337 { Name = rootPartName, UUID = rootPartUuid }; 341 { Name = rootPartName, UUID = rootPartUuid };
342
338 SceneObjectPart linkPart 343 SceneObjectPart linkPart
339 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) 344 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
340 { Name = linkPartName, UUID = linkPartUuid }; 345 { Name = linkPartName, UUID = linkPartUuid };
346 SceneObjectGroup linkGroup = new SceneObjectGroup(linkPart);
347 scene.AddNewSceneObject(linkGroup, true);
341 348
342 SceneObjectGroup sog = new SceneObjectGroup(rootPart); 349 SceneObjectGroup sog = new SceneObjectGroup(rootPart);
343 sog.AddPart(linkPart); 350 scene.AddNewSceneObject(sog, true);
344 scene.AddNewSceneObject(sog, true); 351
345 352 Assert.IsFalse(sog.GroupContainsForeignPrims);
346 // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked 353 sog.LinkToGroup(linkGroup);
347 // scene backup thread. 354 Assert.IsTrue(sog.GroupContainsForeignPrims);
355
348 scene.Backup(true); 356 scene.Backup(true);
349 357 Assert.AreEqual(1, scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID).Count);
358
350 // These changes should occur immediately without waiting for a backup pass 359 // These changes should occur immediately without waiting for a backup pass
351 SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false); 360 SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false);
352 361 Assert.IsFalse(groupToDelete.GroupContainsForeignPrims);
353 Assert.That(groupToDelete.HasGroupChangedDueToDelink, Is.True); 362
354 scene.DeleteSceneObject(groupToDelete, false); 363 scene.DeleteSceneObject(groupToDelete, false);
355 Assert.That(groupToDelete.HasGroupChangedDueToDelink, Is.False);
356 364
357 List<SceneObjectGroup> storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID); 365 List<SceneObjectGroup> storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID);
358 366
359 Assert.That(storedObjects.Count, Is.EqualTo(1)); 367 Assert.AreEqual(1, storedObjects.Count);
360 Assert.That(storedObjects[0].Parts.Length, Is.EqualTo(1)); 368 Assert.AreEqual(1, storedObjects[0].Parts.Length);
361 Assert.That(storedObjects[0].ContainsPart(rootPartUuid)); 369 Assert.IsTrue(storedObjects[0].ContainsPart(rootPartUuid));
362 } 370 }
363 } 371 }
364} 372}
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs
index 1182c96..ce7fc0e 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs
@@ -33,7 +33,6 @@ using OpenSim.Framework;
33using OpenSim.Framework.Communications; 33using OpenSim.Framework.Communications;
34using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
35using OpenSim.Tests.Common; 35using OpenSim.Tests.Common;
36using OpenSim.Tests.Common.Mock;
37 36
38namespace OpenSim.Region.Framework.Scenes.Tests 37namespace OpenSim.Region.Framework.Scenes.Tests
39{ 38{
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs
index a58e735..fdbe7ae 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs
@@ -35,7 +35,6 @@ using OpenSim.Framework.Communications;
35using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
37using OpenSim.Tests.Common; 37using OpenSim.Tests.Common;
38using OpenSim.Tests.Common.Mock;
39 38
40namespace OpenSim.Region.Framework.Scenes.Tests 39namespace OpenSim.Region.Framework.Scenes.Tests
41{ 40{
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSerializationTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSerializationTests.cs
new file mode 100644
index 0000000..927d8e8
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSerializationTests.cs
@@ -0,0 +1,136 @@
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
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using System.Threading;
32using System.Xml;
33using System.Linq;
34using Nini.Config;
35using NUnit.Framework;
36using OpenMetaverse;
37using OpenSim.Framework;
38using OpenSim.Framework.Serialization.External;
39using OpenSim.Framework.Communications;
40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Region.Framework.Scenes.Serialization;
42using OpenSim.Services.Interfaces;
43using OpenSim.Tests.Common;
44
45namespace OpenSim.Region.Framework.Scenes.Tests
46{
47 /// <summary>
48 /// Basic scene object serialization tests.
49 /// </summary>
50 [TestFixture]
51 public class SceneObjectSerializationTests : OpenSimTestCase
52 {
53
54 /// <summary>
55 /// Serialize and deserialize.
56 /// </summary>
57 [Test]
58 public void TestSerialDeserial()
59 {
60 TestHelpers.InMethod();
61
62 Scene scene = new SceneHelpers().SetupScene();
63 int partsToTestCount = 3;
64
65 SceneObjectGroup so
66 = SceneHelpers.CreateSceneObject(partsToTestCount, TestHelpers.ParseTail(0x1), "obj1", 0x10);
67 SceneObjectPart[] parts = so.Parts;
68 so.Name = "obj1";
69 so.Description = "xpto";
70
71 string xml = SceneObjectSerializer.ToXml2Format(so);
72 Assert.That(!string.IsNullOrEmpty(xml), "SOG serialization resulted in empty or null string");
73
74 XmlDocument doc = new XmlDocument();
75 doc.LoadXml(xml);
76 XmlNodeList nodes = doc.GetElementsByTagName("SceneObjectPart");
77 Assert.That(nodes.Count, Is.EqualTo(3), "SOG serialization resulted in wrong number of SOPs");
78
79 SceneObjectGroup so2 = SceneObjectSerializer.FromXml2Format(xml);
80 Assert.IsNotNull(so2, "SOG deserialization resulted in null object");
81 Assert.That(so2.Name == so.Name, "Name of deserialized object does not match original name");
82 Assert.That(so2.Description == so.Description, "Description of deserialized object does not match original name");
83 }
84
85 /// <summary>
86 /// This checks for a bug reported in mantis #7514
87 /// </summary>
88 [Test]
89 public void TestNamespaceAttribute()
90 {
91 TestHelpers.InMethod();
92
93 Scene scene = new SceneHelpers().SetupScene();
94 UserAccount account = new UserAccount(UUID.Zero, UUID.Random(), "Test", "User", string.Empty);
95 scene.UserAccountService.StoreUserAccount(account);
96 int partsToTestCount = 1;
97
98 SceneObjectGroup so
99 = SceneHelpers.CreateSceneObject(partsToTestCount, TestHelpers.ParseTail(0x1), "obj1", 0x10);
100 SceneObjectPart[] parts = so.Parts;
101 so.Name = "obj1";
102 so.Description = "xpto";
103 so.OwnerID = account.PrincipalID;
104 so.RootPart.CreatorID = so.OwnerID;
105
106 string xml = SceneObjectSerializer.ToXml2Format(so);
107 Assert.That(!string.IsNullOrEmpty(xml), "SOG serialization resulted in empty or null string");
108
109 xml = ExternalRepresentationUtils.RewriteSOP(xml, "Test Scene", "http://localhost", scene.UserAccountService, UUID.Zero);
110 //Console.WriteLine(xml);
111
112 XmlDocument doc = new XmlDocument();
113 doc.LoadXml(xml);
114
115 XmlNodeList nodes = doc.GetElementsByTagName("SceneObjectPart");
116 Assert.That(nodes.Count, Is.GreaterThan(0), "SOG serialization resulted in no SOPs");
117 foreach (XmlAttribute a in nodes[0].Attributes)
118 {
119 int count = a.Name.Count(c => c == ':');
120 Assert.That(count, Is.EqualTo(1), "Cannot have multiple ':' in attribute name in SOP");
121 }
122 nodes = doc.GetElementsByTagName("CreatorData");
123 Assert.That(nodes.Count, Is.GreaterThan(0), "SOG serialization resulted in no CreatorData");
124 foreach (XmlAttribute a in nodes[0].Attributes)
125 {
126 int count = a.Name.Count(c => c == ':');
127 Assert.That(count, Is.EqualTo(1), "Cannot have multiple ':' in attribute name in CreatorData");
128 }
129
130 SceneObjectGroup so2 = SceneObjectSerializer.FromXml2Format(xml);
131 Assert.IsNotNull(so2, "SOG deserialization resulted in null object");
132 Assert.AreNotEqual(so.RootPart.CreatorIdentification, so2.RootPart.CreatorIdentification, "RewriteSOP failed to transform CreatorData.");
133 Assert.That(so2.RootPart.CreatorIdentification.Contains("http://"), "RewriteSOP failed to add the homeURL to CreatorData");
134 }
135 }
136} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs
index abaa1d1..974529a 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs
@@ -34,7 +34,6 @@ using OpenSim.Framework;
34using OpenSim.Framework.Communications; 34using OpenSim.Framework.Communications;
35using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
36using OpenSim.Tests.Common; 36using OpenSim.Tests.Common;
37using OpenSim.Tests.Common.Mock;
38 37
39namespace OpenSim.Region.Framework.Scenes.Tests 38namespace OpenSim.Region.Framework.Scenes.Tests
40{ 39{
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
index 8eb3191..5ba754c 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
@@ -34,7 +34,6 @@ using OpenSim.Framework;
34using OpenSim.Framework.Communications; 34using OpenSim.Framework.Communications;
35using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
36using OpenSim.Tests.Common; 36using OpenSim.Tests.Common;
37using OpenSim.Tests.Common.Mock;
38 37
39namespace OpenSim.Region.Framework.Scenes.Tests 38namespace OpenSim.Region.Framework.Scenes.Tests
40{ 39{
@@ -58,6 +57,25 @@ namespace OpenSim.Region.Framework.Scenes.Tests
58 } 57 }
59 58
60 [Test] 59 [Test]
60 public void TestSetTemporary()
61 {
62 TestHelpers.InMethod();
63
64 m_scene.AddSceneObject(m_so1);
65 m_so1.ScriptSetTemporaryStatus(true);
66
67 // Is this really the correct flag?
68 Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.TemporaryOnRez));
69 Assert.That(m_so1.Backup, Is.False);
70
71 // Test setting back to non-temporary
72 m_so1.ScriptSetTemporaryStatus(false);
73
74 Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.None));
75 Assert.That(m_so1.Backup, Is.True);
76 }
77
78 [Test]
61 public void TestSetPhantomSinglePrim() 79 public void TestSetPhantomSinglePrim()
62 { 80 {
63 TestHelpers.InMethod(); 81 TestHelpers.InMethod();
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs
new file mode 100644
index 0000000..cdebe25
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs
@@ -0,0 +1,183 @@
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
28using System;
29using System.Reflection;
30using NUnit.Framework;
31using OpenMetaverse;
32using OpenSim.Framework;
33using OpenSim.Framework.Communications;
34using OpenSim.Region.Framework.Scenes;
35using OpenSim.Tests.Common;
36
37namespace OpenSim.Region.Framework.Scenes.Tests
38{
39 /// <summary>
40 /// Tests for undo/redo
41 /// </summary>
42 public class SceneObjectUndoRedoTests : OpenSimTestCase
43 {
44 [Test]
45 public void TestUndoRedoResizeSceneObject()
46 {
47 TestHelpers.InMethod();
48// TestHelpers.EnableLogging();
49
50 Vector3 firstSize = new Vector3(2, 3, 4);
51 Vector3 secondSize = new Vector3(5, 6, 7);
52
53 Scene scene = new SceneHelpers().SetupScene();
54 scene.MaxUndoCount = 20;
55 SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene);
56
57 // TODO: It happens to be the case that we are not storing undo states for SOPs which are not yet in a SOG,
58 // which is the way that AddSceneObject() sets up the object (i.e. it creates the SOP first). However,
59 // this is somewhat by chance. Really, we shouldn't be storing undo states at all if the object is not
60 // in a scene.
61 Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0));
62
63 g1.GroupResize(firstSize);
64 Assert.That(g1.RootPart.UndoCount, Is.EqualTo(1));
65
66 g1.GroupResize(secondSize);
67 Assert.That(g1.RootPart.UndoCount, Is.EqualTo(2));
68
69 g1.RootPart.Undo();
70 Assert.That(g1.RootPart.UndoCount, Is.EqualTo(1));
71 Assert.That(g1.GroupScale, Is.EqualTo(firstSize));
72
73 g1.RootPart.Redo();
74 Assert.That(g1.RootPart.UndoCount, Is.EqualTo(2));
75 Assert.That(g1.GroupScale, Is.EqualTo(secondSize));
76 }
77
78 [Test]
79 public void TestUndoLimit()
80 {
81 TestHelpers.InMethod();
82
83 Vector3 firstSize = new Vector3(2, 3, 4);
84 Vector3 secondSize = new Vector3(5, 6, 7);
85 Vector3 thirdSize = new Vector3(8, 9, 10);
86 Vector3 fourthSize = new Vector3(11, 12, 13);
87
88 Scene scene = new SceneHelpers().SetupScene();
89 scene.MaxUndoCount = 2;
90 SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene);
91
92 g1.GroupResize(firstSize);
93 g1.GroupResize(secondSize);
94 g1.GroupResize(thirdSize);
95 g1.GroupResize(fourthSize);
96
97 g1.RootPart.Undo();
98 g1.RootPart.Undo();
99 g1.RootPart.Undo();
100
101 Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0));
102 Assert.That(g1.GroupScale, Is.EqualTo(secondSize));
103 }
104
105 [Test]
106 public void TestNoUndoOnObjectsNotInScene()
107 {
108 TestHelpers.InMethod();
109
110 Vector3 firstSize = new Vector3(2, 3, 4);
111 Vector3 secondSize = new Vector3(5, 6, 7);
112// Vector3 thirdSize = new Vector3(8, 9, 10);
113// Vector3 fourthSize = new Vector3(11, 12, 13);
114
115 Scene scene = new SceneHelpers().SetupScene();
116 scene.MaxUndoCount = 20;
117 SceneObjectGroup g1 = SceneHelpers.CreateSceneObject(1, TestHelpers.ParseTail(0x1));
118
119 g1.GroupResize(firstSize);
120 g1.GroupResize(secondSize);
121
122 Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0));
123
124 g1.RootPart.Undo();
125
126 Assert.That(g1.GroupScale, Is.EqualTo(secondSize));
127 }
128
129 [Test]
130 public void TestUndoBeyondAvailable()
131 {
132 TestHelpers.InMethod();
133
134 Vector3 newSize = new Vector3(2, 3, 4);
135
136 Scene scene = new SceneHelpers().SetupScene();
137 scene.MaxUndoCount = 20;
138 SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene);
139 Vector3 originalSize = g1.GroupScale;
140
141 g1.RootPart.Undo();
142
143 Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0));
144 Assert.That(g1.GroupScale, Is.EqualTo(originalSize));
145
146 g1.GroupResize(newSize);
147 Assert.That(g1.RootPart.UndoCount, Is.EqualTo(1));
148 Assert.That(g1.GroupScale, Is.EqualTo(newSize));
149
150 g1.RootPart.Undo();
151 g1.RootPart.Undo();
152
153 Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0));
154 Assert.That(g1.GroupScale, Is.EqualTo(originalSize));
155 }
156
157 [Test]
158 public void TestRedoBeyondAvailable()
159 {
160 TestHelpers.InMethod();
161
162 Vector3 newSize = new Vector3(2, 3, 4);
163
164 Scene scene = new SceneHelpers().SetupScene();
165 scene.MaxUndoCount = 20;
166 SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene);
167 Vector3 originalSize = g1.GroupScale;
168
169 g1.RootPart.Redo();
170
171 Assert.That(g1.RootPart.UndoCount, Is.EqualTo(0));
172 Assert.That(g1.GroupScale, Is.EqualTo(originalSize));
173
174 g1.GroupResize(newSize);
175 g1.RootPart.Undo();
176 g1.RootPart.Redo();
177 g1.RootPart.Redo();
178
179 Assert.That(g1.RootPart.UndoCount, Is.EqualTo(1));
180 Assert.That(g1.GroupScale, Is.EqualTo(newSize));
181 }
182 }
183} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs
index e7a1fe0..32d6649 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs
@@ -39,7 +39,6 @@ using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
40using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups; 40using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups;
41using OpenSim.Tests.Common; 41using OpenSim.Tests.Common;
42using OpenSim.Tests.Common.Mock;
43 42
44namespace OpenSim.Region.Framework.Scenes.Tests 43namespace OpenSim.Region.Framework.Scenes.Tests
45{ 44{
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index 1ff1329..06e6423 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
@@ -44,7 +44,6 @@ using OpenSim.Region.CoreModules.Framework.EntityTransfer;
44using OpenSim.Region.CoreModules.World.Serialiser; 44using OpenSim.Region.CoreModules.World.Serialiser;
45using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; 45using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
46using OpenSim.Tests.Common; 46using OpenSim.Tests.Common;
47using OpenSim.Tests.Common.Mock;
48using GridRegion = OpenSim.Services.Interfaces.GridRegion; 47using GridRegion = OpenSim.Services.Interfaces.GridRegion;
49 48
50namespace OpenSim.Region.Framework.Scenes.Tests 49namespace OpenSim.Region.Framework.Scenes.Tests
@@ -228,7 +227,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
228 // *** This is the first stage, when a neighbouring region is told that a viewer is about to try and 227 // *** This is the first stage, when a neighbouring region is told that a viewer is about to try and
229 // establish a child scene presence. We pass in the circuit code that the client has to connect with *** 228 // establish a child scene presence. We pass in the circuit code that the client has to connect with ***
230 // XXX: ViaLogin may not be correct here. 229 // XXX: ViaLogin may not be correct here.
231 scene.SimulationService.CreateAgent(region, acd, (uint)TeleportFlags.ViaLogin, out reason); 230 scene.SimulationService.CreateAgent(null, region, acd, (uint)TeleportFlags.ViaLogin, out reason);
232 231
233 Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(agentId), Is.Not.Null); 232 Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(agentId), Is.Not.Null);
234 Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1)); 233 Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1));
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs
index 1cd8ae9..42cfa1b 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs
@@ -43,7 +43,6 @@ using OpenSim.Region.CoreModules.World.Serialiser;
43using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; 43using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
44using OpenSim.Region.Physics.Manager; 44using OpenSim.Region.Physics.Manager;
45using OpenSim.Tests.Common; 45using OpenSim.Tests.Common;
46using OpenSim.Tests.Common.Mock;
47 46
48namespace OpenSim.Region.Framework.Scenes.Tests 47namespace OpenSim.Region.Framework.Scenes.Tests
49{ 48{
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs
index d80afd3..c6e3b8b 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs
@@ -37,7 +37,6 @@ using OpenSim.Framework.Communications;
37using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
39using OpenSim.Tests.Common; 39using OpenSim.Tests.Common;
40using OpenSim.Tests.Common.Mock;
41 40
42namespace OpenSim.Region.Framework.Scenes.Tests 41namespace OpenSim.Region.Framework.Scenes.Tests
43{ 42{
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs
index 9fa0a71..45bfbff 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs
@@ -47,7 +47,6 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
47using OpenSim.Region.Framework.Scenes; 47using OpenSim.Region.Framework.Scenes;
48using OpenSim.Region.Framework.Interfaces; 48using OpenSim.Region.Framework.Interfaces;
49using OpenSim.Tests.Common; 49using OpenSim.Tests.Common;
50using OpenSim.Tests.Common.Mock;
51using GridRegion = OpenSim.Services.Interfaces.GridRegion; 50using GridRegion = OpenSim.Services.Interfaces.GridRegion;
52 51
53namespace OpenSim.Region.Framework.Scenes.Tests 52namespace OpenSim.Region.Framework.Scenes.Tests
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
index b806a97..c193a97 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
@@ -40,7 +40,6 @@ using OpenSim.Region.CoreModules.Framework.EntityTransfer;
40using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; 40using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
41using OpenSim.Region.CoreModules.World.Permissions; 41using OpenSim.Region.CoreModules.World.Permissions;
42using OpenSim.Tests.Common; 42using OpenSim.Tests.Common;
43using OpenSim.Tests.Common.Mock;
44 43
45namespace OpenSim.Region.Framework.Scenes.Tests 44namespace OpenSim.Region.Framework.Scenes.Tests
46{ 45{
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs
index 0911f00..b775178 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs
@@ -37,7 +37,6 @@ using OpenSim.Framework.Servers;
37using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; 38using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
39using OpenSim.Tests.Common; 39using OpenSim.Tests.Common;
40using OpenSim.Tests.Common.Mock;
41using System.Threading; 40using System.Threading;
42 41
43namespace OpenSim.Region.Framework.Scenes.Tests 42namespace OpenSim.Region.Framework.Scenes.Tests
@@ -73,6 +72,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
73 Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(0)); 72 Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(0));
74 Assert.That(part.GetSittingAvatars(), Is.Null); 73 Assert.That(part.GetSittingAvatars(), Is.Null);
75 Assert.That(m_sp.ParentID, Is.EqualTo(0)); 74 Assert.That(m_sp.ParentID, Is.EqualTo(0));
75 Assert.AreEqual(startPos, m_sp.AbsolutePosition);
76 } 76 }
77 77
78 [Test] 78 [Test]
@@ -87,15 +87,21 @@ namespace OpenSim.Region.Framework.Scenes.Tests
87 87
88 SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; 88 SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart;
89 89
90 // We need to preserve this here because phys actor is removed by the sit.
91 Vector3 spPhysActorSize = m_sp.PhysicsActor.Size;
90 m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero); 92 m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero);
91 93
92 Assert.That(m_sp.PhysicsActor, Is.Null); 94 Assert.That(m_sp.PhysicsActor, Is.Null);
93 95
96 Assert.That(
97 m_sp.AbsolutePosition,
98 Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, spPhysActorSize.Z / 2)));
99
94 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); 100 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
95 Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1)); 101 Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1));
96 HashSet<UUID> sittingAvatars = part.GetSittingAvatars(); 102 HashSet<ScenePresence> sittingAvatars = part.GetSittingAvatars();
97 Assert.That(sittingAvatars.Count, Is.EqualTo(1)); 103 Assert.That(sittingAvatars.Count, Is.EqualTo(1));
98 Assert.That(sittingAvatars.Contains(m_sp.UUID)); 104 Assert.That(sittingAvatars.Contains(m_sp));
99 Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId)); 105 Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId));
100 } 106 }
101 107
@@ -129,6 +135,36 @@ namespace OpenSim.Region.Framework.Scenes.Tests
129 } 135 }
130 136
131 [Test] 137 [Test]
138 public void TestSitAndStandWithNoSitTargetChildPrim()
139 {
140 TestHelpers.InMethod();
141// log4net.Config.XmlConfigurator.Configure();
142
143 // Make sure we're within range to sit
144 Vector3 startPos = new Vector3(1, 1, 1);
145 m_sp.AbsolutePosition = startPos;
146
147 SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene, 2, m_sp.UUID, "part", 0x10).Parts[1];
148 part.OffsetPosition = new Vector3(2, 3, 4);
149
150 // We need to preserve this here because phys actor is removed by the sit.
151 Vector3 spPhysActorSize = m_sp.PhysicsActor.Size;
152 m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero);
153
154 Assert.That(
155 m_sp.AbsolutePosition,
156 Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, spPhysActorSize.Z / 2)));
157
158 m_sp.StandUp();
159
160 Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
161 Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(0));
162 Assert.That(part.GetSittingAvatars(), Is.Null);
163 Assert.That(m_sp.ParentID, Is.EqualTo(0));
164 Assert.That(m_sp.PhysicsActor, Is.Not.Null);
165 }
166
167 [Test]
132 public void TestSitAndStandWithSitTarget() 168 public void TestSitAndStandWithSitTarget()
133 { 169 {
134 TestHelpers.InMethod(); 170 TestHelpers.InMethod();
@@ -145,15 +181,39 @@ namespace OpenSim.Region.Framework.Scenes.Tests
145 181
146 Assert.That(part.SitTargetAvatar, Is.EqualTo(m_sp.UUID)); 182 Assert.That(part.SitTargetAvatar, Is.EqualTo(m_sp.UUID));
147 Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId)); 183 Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId));
148// Assert.That( 184
149// m_sp.AbsolutePosition, 185 // This section is copied from ScenePresence.HandleAgentSit(). Correctness is not guaranteed.
150// Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT)); 186 double x, y, z, m1, m2;
187
188 Quaternion r = part.SitTargetOrientation;;
189 m1 = r.X * r.X + r.Y * r.Y;
190 m2 = r.Z * r.Z + r.W * r.W;
191
192 // Rotate the vector <0, 0, 1>
193 x = 2 * (r.X * r.Z + r.Y * r.W);
194 y = 2 * (-r.X * r.W + r.Y * r.Z);
195 z = m2 - m1;
196
197 // Set m to be the square of the norm of r.
198 double m = m1 + m2;
199
200 // This constant is emperically determined to be what is used in SL.
201 // See also http://opensimulator.org/mantis/view.php?id=7096
202 double offset = 0.05;
203
204 Vector3 up = new Vector3((float)x, (float)y, (float)z);
205 Vector3 sitOffset = up * (float)offset;
206 // End of copied section.
207
208 Assert.That(
209 m_sp.AbsolutePosition,
210 Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition - sitOffset + ScenePresence.SIT_TARGET_ADJUSTMENT));
151 Assert.That(m_sp.PhysicsActor, Is.Null); 211 Assert.That(m_sp.PhysicsActor, Is.Null);
152 212
153 Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1)); 213 Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1));
154 HashSet<UUID> sittingAvatars = part.GetSittingAvatars(); 214 HashSet<ScenePresence> sittingAvatars = part.GetSittingAvatars();
155 Assert.That(sittingAvatars.Count, Is.EqualTo(1)); 215 Assert.That(sittingAvatars.Count, Is.EqualTo(1));
156 Assert.That(sittingAvatars.Contains(m_sp.UUID)); 216 Assert.That(sittingAvatars.Contains(m_sp));
157 217
158 m_sp.StandUp(); 218 m_sp.StandUp();
159 219
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
index fff542b..42276dd 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
@@ -43,7 +43,6 @@ using OpenSim.Region.CoreModules.Framework.EntityTransfer;
43using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; 43using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
44using OpenSim.Region.CoreModules.World.Permissions; 44using OpenSim.Region.CoreModules.World.Permissions;
45using OpenSim.Tests.Common; 45using OpenSim.Tests.Common;
46using OpenSim.Tests.Common.Mock;
47 46
48namespace OpenSim.Region.Framework.Scenes.Tests 47namespace OpenSim.Region.Framework.Scenes.Tests
49{ 48{
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneStatisticsTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneStatisticsTests.cs
index 1667002..2d36214 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneStatisticsTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneStatisticsTests.cs
@@ -34,7 +34,6 @@ using OpenSim.Framework;
34using OpenSim.Framework.Communications; 34using OpenSim.Framework.Communications;
35using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
36using OpenSim.Tests.Common; 36using OpenSim.Tests.Common;
37using OpenSim.Tests.Common.Mock;
38 37
39namespace OpenSim.Region.Framework.Scenes.Tests 38namespace OpenSim.Region.Framework.Scenes.Tests
40{ 39{
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTelehubTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTelehubTests.cs
index 9a97acc..584a03c 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneTelehubTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTelehubTests.cs
@@ -32,7 +32,6 @@ using OpenSim.Region.Framework.Scenes;
32using OpenSim.Region.Framework.Interfaces; 32using OpenSim.Region.Framework.Interfaces;
33using OpenSim.Services.Interfaces; 33using OpenSim.Services.Interfaces;
34using OpenSim.Tests.Common; 34using OpenSim.Tests.Common;
35using OpenSim.Tests.Common.Mock;
36 35
37namespace OpenSim.Region.Framework.Scenes.Tests 36namespace OpenSim.Region.Framework.Scenes.Tests
38{ 37{
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
index 9d8eb0b..33ef83b 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
@@ -42,7 +42,6 @@ using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.CoreModules.World.Serialiser; 42using OpenSim.Region.CoreModules.World.Serialiser;
43using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; 43using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
44using OpenSim.Tests.Common; 44using OpenSim.Tests.Common;
45using OpenSim.Tests.Common.Mock;
46 45
47namespace OpenSim.Region.Framework.Scenes.Tests 46namespace OpenSim.Region.Framework.Scenes.Tests
48{ 47{
@@ -52,6 +51,29 @@ namespace OpenSim.Region.Framework.Scenes.Tests
52 [TestFixture] 51 [TestFixture]
53 public class SceneTests : OpenSimTestCase 52 public class SceneTests : OpenSimTestCase
54 { 53 {
54 [Test]
55 public void TestCreateScene()
56 {
57 TestHelpers.InMethod();
58
59 new SceneHelpers().SetupScene();
60 }
61
62 [Test]
63 public void TestCreateVarScene()
64 {
65 TestHelpers.InMethod();
66 UUID regionUuid = TestHelpers.ParseTail(0x1);
67 uint sizeX = 512;
68 uint sizeY = 512;
69
70 Scene scene
71 = new SceneHelpers().SetupScene("scene", regionUuid, 1000, 1000, sizeX, sizeY, new IniConfigSource());
72
73 Assert.AreEqual(sizeX, scene.RegionInfo.RegionSizeX);
74 Assert.AreEqual(sizeY, scene.RegionInfo.RegionSizeY);
75 }
76
55 /// <summary> 77 /// <summary>
56 /// Very basic scene update test. Should become more elaborate with time. 78 /// Very basic scene update test. Should become more elaborate with time.
57 /// </summary> 79 /// </summary>
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SharedRegionModuleTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SharedRegionModuleTests.cs
new file mode 100644
index 0000000..eeda84f
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Tests/SharedRegionModuleTests.cs
@@ -0,0 +1,249 @@
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
28using System;
29using System.Collections.Generic;
30using System.Net;
31using Mono.Addins;
32using Nini.Config;
33using NUnit.Framework;
34using OpenMetaverse;
35using OpenSim;
36using OpenSim.ApplicationPlugins.RegionModulesController;
37using OpenSim.Framework;
38using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid;
39using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Tests.Common;
41
42namespace OpenSim.Region.Framework.Scenes.Tests
43{
44 public class SharedRegionModuleTests : OpenSimTestCase
45 {
46// [Test]
47 public void TestLifecycle()
48 {
49 TestHelpers.InMethod();
50 TestHelpers.EnableLogging();
51
52 UUID estateOwnerId = TestHelpers.ParseTail(0x1);
53 UUID regionId = TestHelpers.ParseTail(0x10);
54
55 IConfigSource configSource = new IniConfigSource();
56 configSource.AddConfig("Startup");
57 configSource.AddConfig("Modules");
58
59// // We use this to skip estate questions
60 // Turns out not to be needed is estate owner id is pre-set in region information.
61// IConfig estateConfig = configSource.AddConfig(OpenSimBase.ESTATE_SECTION_NAME);
62// estateConfig.Set("DefaultEstateOwnerName", "Zaphod Beeblebrox");
63// estateConfig.Set("DefaultEstateOwnerUUID", estateOwnerId);
64// estateConfig.Set("DefaultEstateOwnerEMail", "zaphod@galaxy.com");
65// estateConfig.Set("DefaultEstateOwnerPassword", "two heads");
66
67 // For grid servic
68 configSource.AddConfig("GridService");
69 configSource.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector");
70 configSource.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData");
71 configSource.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService");
72 configSource.Configs["GridService"].Set("ConnectionString", "!static");
73
74 LocalGridServicesConnector gridService = new LocalGridServicesConnector();
75//
76 OpenSim sim = new OpenSim(configSource);
77
78 sim.SuppressExit = true;
79 sim.EnableInitialPluginLoad = false;
80 sim.LoadEstateDataService = false;
81 sim.NetServersInfo.HttpListenerPort = 0;
82
83 IRegistryCore reg = sim.ApplicationRegistry;
84
85 RegionInfo ri = new RegionInfo();
86 ri.RegionID = regionId;
87 ri.EstateSettings.EstateOwner = estateOwnerId;
88 ri.InternalEndPoint = new IPEndPoint(0, 0);
89
90 MockRegionModulesControllerPlugin rmcp = new MockRegionModulesControllerPlugin();
91 sim.m_plugins = new List<IApplicationPlugin>() { rmcp };
92 reg.RegisterInterface<IRegionModulesController>(rmcp);
93
94 // XXX: Have to initialize directly for now
95 rmcp.Initialise(sim);
96
97 rmcp.AddNode(gridService);
98
99 TestSharedRegion tsr = new TestSharedRegion();
100 rmcp.AddNode(tsr);
101
102 // FIXME: Want to use the real one eventually but this is currently directly tied into Mono.Addins
103 // which has been written in such a way that makes it impossible to use for regression tests.
104// RegionModulesControllerPlugin rmcp = new RegionModulesControllerPlugin();
105// rmcp.LoadModulesFromAddins = false;
106//// reg.RegisterInterface<IRegionModulesController>(rmcp);
107// rmcp.Initialise(sim);
108// rmcp.PostInitialise();
109// TypeExtensionNode node = new TypeExtensionNode();
110// node.
111// rmcp.AddNode(node, configSource.Configs["Modules"], new Dictionary<RuntimeAddin, IList<int>>());
112
113 sim.Startup();
114 IScene scene;
115 sim.CreateRegion(ri, out scene);
116
117 sim.Shutdown();
118
119 List<string> co = tsr.CallOrder;
120 int expectedEventCount = 6;
121
122 Assert.AreEqual(
123 expectedEventCount,
124 co.Count,
125 "Expected {0} events but only got {1} ({2})",
126 expectedEventCount, co.Count, string.Join(",", co));
127 Assert.AreEqual("Initialise", co[0]);
128 Assert.AreEqual("PostInitialise", co[1]);
129 Assert.AreEqual("AddRegion", co[2]);
130 Assert.AreEqual("RegionLoaded", co[3]);
131 Assert.AreEqual("RemoveRegion", co[4]);
132 Assert.AreEqual("Close", co[5]);
133 }
134 }
135
136 class TestSharedRegion : ISharedRegionModule
137 {
138 // FIXME: Should really use MethodInfo
139 public List<string> CallOrder = new List<string>();
140
141 public string Name { get { return "TestSharedRegion"; } }
142
143 public Type ReplaceableInterface { get { return null; } }
144
145 public void PostInitialise()
146 {
147 CallOrder.Add("PostInitialise");
148 }
149
150 public void Initialise(IConfigSource source)
151 {
152 CallOrder.Add("Initialise");
153 }
154
155 public void Close()
156 {
157 CallOrder.Add("Close");
158 }
159
160 public void AddRegion(Scene scene)
161 {
162 CallOrder.Add("AddRegion");
163 }
164
165 public void RemoveRegion(Scene scene)
166 {
167 CallOrder.Add("RemoveRegion");
168 }
169
170 public void RegionLoaded(Scene scene)
171 {
172 CallOrder.Add("RegionLoaded");
173 }
174 }
175
176 class MockRegionModulesControllerPlugin : IRegionModulesController, IApplicationPlugin
177 {
178 // List of shared module instances, for adding to Scenes
179 private List<ISharedRegionModule> m_sharedInstances = new List<ISharedRegionModule>();
180
181 // Config access
182 private OpenSimBase m_openSim;
183
184 public string Version { get { return "0"; } }
185 public string Name { get { return "MockRegionModulesControllerPlugin"; } }
186
187 public void Initialise() {}
188
189 public void Initialise(OpenSimBase sim)
190 {
191 m_openSim = sim;
192 }
193
194 /// <summary>
195 /// Called when the application loading is completed
196 /// </summary>
197 public void PostInitialise()
198 {
199 foreach (ISharedRegionModule module in m_sharedInstances)
200 module.PostInitialise();
201 }
202
203 public void AddRegionToModules(Scene scene)
204 {
205 List<ISharedRegionModule> sharedlist = new List<ISharedRegionModule>();
206
207 foreach (ISharedRegionModule module in m_sharedInstances)
208 {
209 module.AddRegion(scene);
210 scene.AddRegionModule(module.Name, module);
211
212 sharedlist.Add(module);
213 }
214
215 foreach (ISharedRegionModule module in sharedlist)
216 {
217 module.RegionLoaded(scene);
218 }
219 }
220
221 public void RemoveRegionFromModules(Scene scene)
222 {
223 foreach (IRegionModuleBase module in scene.RegionModules.Values)
224 {
225// m_log.DebugFormat("[REGIONMODULE]: Removing scene {0} from module {1}",
226// scene.RegionInfo.RegionName, module.Name);
227 module.RemoveRegion(scene);
228 }
229
230 scene.RegionModules.Clear();
231 }
232
233 public void AddNode(ISharedRegionModule module)
234 {
235 m_sharedInstances.Add(module);
236 module.Initialise(m_openSim.ConfigSource.Source);
237 }
238
239 public void Dispose()
240 {
241 // We expect that all regions have been removed already
242 while (m_sharedInstances.Count > 0)
243 {
244 m_sharedInstances[0].Close();
245 m_sharedInstances.RemoveAt(0);
246 }
247 }
248 }
249} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
index 020bb6c..3caea8b 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
@@ -45,7 +45,6 @@ using OpenSim.Region.CoreModules.World.Serialiser;
45using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; 45using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
46using OpenSim.Services.Interfaces; 46using OpenSim.Services.Interfaces;
47using OpenSim.Tests.Common; 47using OpenSim.Tests.Common;
48using OpenSim.Tests.Common.Mock;
49 48
50namespace OpenSim.Region.Framework.Tests 49namespace OpenSim.Region.Framework.Tests
51{ 50{
@@ -65,7 +64,7 @@ namespace OpenSim.Region.Framework.Tests
65 64
66 // Create an object embedded inside the first 65 // Create an object embedded inside the first
67 UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); 66 UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000");
68 TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID); 67 TaskInventoryHelpers.AddSceneObject(scene.AssetService, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID);
69 68
70 TaskInventoryItem addedItem = sop1.Inventory.GetInventoryItem(taskSceneObjectItemId); 69 TaskInventoryItem addedItem = sop1.Inventory.GetInventoryItem(taskSceneObjectItemId);
71 Assert.That(addedItem.ItemID, Is.EqualTo(taskSceneObjectItemId)); 70 Assert.That(addedItem.ItemID, Is.EqualTo(taskSceneObjectItemId));
@@ -89,7 +88,7 @@ namespace OpenSim.Region.Framework.Tests
89 // Create an object embedded inside the first 88 // Create an object embedded inside the first
90 UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); 89 UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000");
91 TaskInventoryItem taskSceneObjectItem 90 TaskInventoryItem taskSceneObjectItem
92 = TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID); 91 = TaskInventoryHelpers.AddSceneObject(scene.AssetService, sop1, "tso", taskSceneObjectItemId, user1.PrincipalID);
93 92
94 scene.AddSceneObject(sog1); 93 scene.AddSceneObject(sog1);
95 94
@@ -130,13 +129,14 @@ namespace OpenSim.Region.Framework.Tests
130 SceneObjectPart sop1 = sog1.RootPart; 129 SceneObjectPart sop1 = sog1.RootPart;
131 TaskInventoryItem sopItem1 130 TaskInventoryItem sopItem1
132 = TaskInventoryHelpers.AddNotecard( 131 = TaskInventoryHelpers.AddNotecard(
133 scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); 132 scene.AssetService, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!");
134 133
135 InventoryFolderBase folder 134 InventoryFolderBase folder
136 = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0]; 135 = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0];
137 136
138 // Perform test 137 // Perform test
139 scene.MoveTaskInventoryItem(user1.PrincipalID, folder.ID, sop1, sopItem1.ItemID); 138 string message;
139 scene.MoveTaskInventoryItem(user1.PrincipalID, folder.ID, sop1, sopItem1.ItemID, out message);
140 140
141 InventoryItemBase ncUserItem 141 InventoryItemBase ncUserItem
142 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Objects/ncItem"); 142 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Objects/ncItem");
@@ -162,10 +162,11 @@ namespace OpenSim.Region.Framework.Tests
162 SceneObjectPart sop1 = sog1.RootPart; 162 SceneObjectPart sop1 = sog1.RootPart;
163 TaskInventoryItem sopItem1 163 TaskInventoryItem sopItem1
164 = TaskInventoryHelpers.AddNotecard( 164 = TaskInventoryHelpers.AddNotecard(
165 scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); 165 scene.AssetService, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!");
166 166
167 // Perform test 167 // Perform test
168 scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID); 168 string message;
169 scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID, out message);
169 170
170 InventoryItemBase ncUserItem 171 InventoryItemBase ncUserItem
171 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Notecards/ncItem"); 172 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Notecards/ncItem");
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs
index e50b4da..edc0a52 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs
@@ -45,7 +45,6 @@ using OpenSim.Region.CoreModules.World.Serialiser;
45using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; 45using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
46using OpenSim.Services.Interfaces; 46using OpenSim.Services.Interfaces;
47using OpenSim.Tests.Common; 47using OpenSim.Tests.Common;
48using OpenSim.Tests.Common.Mock;
49 48
50namespace OpenSim.Region.Framework.Tests 49namespace OpenSim.Region.Framework.Tests
51{ 50{
@@ -95,7 +94,9 @@ namespace OpenSim.Region.Framework.Tests
95 UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); 94 UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002));
96 InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID); 95 InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID);
97 96
98 scene.GiveInventoryItem(user2.PrincipalID, user1.PrincipalID, item1.ID); 97 string message;
98
99 scene.GiveInventoryItem(user2.PrincipalID, user1.PrincipalID, item1.ID, out message);
99 100
100 InventoryItemBase retrievedItem1 101 InventoryItemBase retrievedItem1
101 = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, user2.PrincipalID, "Notecards/item1"); 102 = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, user2.PrincipalID, "Notecards/item1");
@@ -103,7 +104,7 @@ namespace OpenSim.Region.Framework.Tests
103 Assert.That(retrievedItem1, Is.Not.Null); 104 Assert.That(retrievedItem1, Is.Not.Null);
104 105
105 // Try giving back the freshly received item 106 // Try giving back the freshly received item
106 scene.GiveInventoryItem(user1.PrincipalID, user2.PrincipalID, retrievedItem1.ID); 107 scene.GiveInventoryItem(user1.PrincipalID, user2.PrincipalID, retrievedItem1.ID, out message);
107 108
108 List<InventoryItemBase> reretrievedItems 109 List<InventoryItemBase> reretrievedItems
109 = UserInventoryHelpers.GetInventoryItems(scene.InventoryService, user1.PrincipalID, "Notecards/item1"); 110 = UserInventoryHelpers.GetInventoryItems(scene.InventoryService, user1.PrincipalID, "Notecards/item1");
@@ -123,7 +124,7 @@ namespace OpenSim.Region.Framework.Tests
123 InventoryFolderBase folder1 124 InventoryFolderBase folder1
124 = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, "folder1", false); 125 = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, "folder1", false);
125 126
126 scene.GiveInventoryFolder(user2.PrincipalID, user1.PrincipalID, folder1.ID, UUID.Zero); 127 scene.GiveInventoryFolder(null, user2.PrincipalID, user1.PrincipalID, folder1.ID, UUID.Zero);
127 128
128 InventoryFolderBase retrievedFolder1 129 InventoryFolderBase retrievedFolder1
129 = UserInventoryHelpers.GetInventoryFolder(scene.InventoryService, user2.PrincipalID, "folder1"); 130 = UserInventoryHelpers.GetInventoryFolder(scene.InventoryService, user2.PrincipalID, "folder1");
@@ -131,7 +132,7 @@ namespace OpenSim.Region.Framework.Tests
131 Assert.That(retrievedFolder1, Is.Not.Null); 132 Assert.That(retrievedFolder1, Is.Not.Null);
132 133
133 // Try giving back the freshly received folder 134 // Try giving back the freshly received folder
134 scene.GiveInventoryFolder(user1.PrincipalID, user2.PrincipalID, retrievedFolder1.ID, UUID.Zero); 135 scene.GiveInventoryFolder(null, user1.PrincipalID, user2.PrincipalID, retrievedFolder1.ID, UUID.Zero);
135 136
136 List<InventoryFolderBase> reretrievedFolders 137 List<InventoryFolderBase> reretrievedFolders
137 = UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, "folder1"); 138 = UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, "folder1");
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
index 1e59e3f..937c414 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
@@ -33,7 +33,6 @@ using OpenSim.Framework;
33using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
34using OpenSim.Services.Interfaces; 34using OpenSim.Services.Interfaces;
35using OpenSim.Tests.Common; 35using OpenSim.Tests.Common;
36using OpenSim.Tests.Common.Mock;
37 36
38namespace OpenSim.Region.Framework.Scenes.Tests 37namespace OpenSim.Region.Framework.Scenes.Tests
39{ 38{
@@ -62,11 +61,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
62 = AssetHelpers.CreateAsset(corruptAssetUuid, AssetType.Notecard, "CORRUPT ASSET", UUID.Zero); 61 = AssetHelpers.CreateAsset(corruptAssetUuid, AssetType.Notecard, "CORRUPT ASSET", UUID.Zero);
63 m_assetService.Store(corruptAsset); 62 m_assetService.Store(corruptAsset);
64 63
65 IDictionary<UUID, sbyte> foundAssetUuids = new Dictionary<UUID, sbyte>(); 64 m_uuidGatherer.AddForInspection(corruptAssetUuid);
66 m_uuidGatherer.GatherAssetUuids(corruptAssetUuid, (sbyte)AssetType.Object, foundAssetUuids); 65 m_uuidGatherer.GatherAll();
67 66
68 // We count the uuid as gathered even if the asset itself is corrupt. 67 // We count the uuid as gathered even if the asset itself is corrupt.
69 Assert.That(foundAssetUuids.Count, Is.EqualTo(1)); 68 Assert.That(m_uuidGatherer.GatheredUuids.Count, Is.EqualTo(1));
70 } 69 }
71 70
72 /// <summary> 71 /// <summary>
@@ -78,38 +77,82 @@ namespace OpenSim.Region.Framework.Scenes.Tests
78 TestHelpers.InMethod(); 77 TestHelpers.InMethod();
79 78
80 UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); 79 UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666");
81 IDictionary<UUID, sbyte> foundAssetUuids = new Dictionary<UUID, sbyte>();
82
83 m_uuidGatherer.GatherAssetUuids(missingAssetUuid, (sbyte)AssetType.Object, foundAssetUuids);
84 80
85 // We count the uuid as gathered even if the asset itself is missing. 81 m_uuidGatherer.AddForInspection(missingAssetUuid);
86 Assert.That(foundAssetUuids.Count, Is.EqualTo(1)); 82 m_uuidGatherer.GatherAll();
83
84 Assert.That(m_uuidGatherer.GatheredUuids.Count, Is.EqualTo(0));
87 } 85 }
88 86
89 [Test] 87 [Test]
90 public void TestNotecardAsset() 88 public void TestNotecardAsset()
91 { 89 {
92 TestHelpers.InMethod(); 90 TestHelpers.InMethod();
93// log4net.Config.XmlConfigurator.Configure(); 91// TestHelpers.EnableLogging();
94 92
95 UUID ownerId = TestHelpers.ParseTail(0x10); 93 UUID ownerId = TestHelpers.ParseTail(0x10);
96 UUID soAssetId = TestHelpers.ParseTail(0x20); 94 UUID embeddedId = TestHelpers.ParseTail(0x20);
95 UUID secondLevelEmbeddedId = TestHelpers.ParseTail(0x21);
96 UUID missingEmbeddedId = TestHelpers.ParseTail(0x22);
97 UUID ncAssetId = TestHelpers.ParseTail(0x30); 97 UUID ncAssetId = TestHelpers.ParseTail(0x30);
98 98
99 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, ownerId); 99 AssetBase ncAsset
100 AssetBase soAsset = AssetHelpers.CreateAsset(soAssetId, so); 100 = AssetHelpers.CreateNotecardAsset(
101 m_assetService.Store(soAsset); 101 ncAssetId, string.Format("Hello{0}World{1}", embeddedId, missingEmbeddedId));
102
103 AssetBase ncAsset = AssetHelpers.CreateNotecardAsset(ncAssetId, soAssetId.ToString());
104 m_assetService.Store(ncAsset); 102 m_assetService.Store(ncAsset);
105 103
106 IDictionary<UUID, sbyte> foundAssetUuids = new Dictionary<UUID, sbyte>(); 104 AssetBase embeddedAsset
107 m_uuidGatherer.GatherAssetUuids(ncAssetId, (sbyte)AssetType.Notecard, foundAssetUuids); 105 = AssetHelpers.CreateNotecardAsset(embeddedId, string.Format("{0} We'll meet again.", secondLevelEmbeddedId));
106 m_assetService.Store(embeddedAsset);
108 107
109 // We count the uuid as gathered even if the asset itself is corrupt. 108 AssetBase secondLevelEmbeddedAsset
110 Assert.That(foundAssetUuids.Count, Is.EqualTo(2)); 109 = AssetHelpers.CreateNotecardAsset(secondLevelEmbeddedId, "Don't know where, don't know when.");
111 Assert.That(foundAssetUuids.ContainsKey(ncAssetId)); 110 m_assetService.Store(secondLevelEmbeddedAsset);
112 Assert.That(foundAssetUuids.ContainsKey(soAssetId)); 111
112 m_uuidGatherer.AddForInspection(ncAssetId);
113 m_uuidGatherer.GatherAll();
114
115// foreach (UUID key in m_uuidGatherer.GatheredUuids.Keys)
116// System.Console.WriteLine("key : {0}", key);
117
118 Assert.That(m_uuidGatherer.GatheredUuids.Count, Is.EqualTo(3));
119 Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(ncAssetId));
120 Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(embeddedId));
121 Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(secondLevelEmbeddedId));
122 }
123
124 [Test]
125 public void TestTaskItems()
126 {
127 TestHelpers.InMethod();
128// TestHelpers.EnableLogging();
129
130 UUID ownerId = TestHelpers.ParseTail(0x10);
131
132 SceneObjectGroup soL0 = SceneHelpers.CreateSceneObject(1, ownerId, "l0", 0x20);
133 SceneObjectGroup soL1 = SceneHelpers.CreateSceneObject(1, ownerId, "l1", 0x21);
134 SceneObjectGroup soL2 = SceneHelpers.CreateSceneObject(1, ownerId, "l2", 0x22);
135
136 TaskInventoryHelpers.AddScript(
137 m_assetService, soL2.RootPart, TestHelpers.ParseTail(0x33), TestHelpers.ParseTail(0x43), "l3-script", "gibberish");
138
139 TaskInventoryHelpers.AddSceneObject(
140 m_assetService, soL1.RootPart, "l2-item", TestHelpers.ParseTail(0x32), soL2, TestHelpers.ParseTail(0x42));
141 TaskInventoryHelpers.AddSceneObject(
142 m_assetService, soL0.RootPart, "l1-item", TestHelpers.ParseTail(0x31), soL1, TestHelpers.ParseTail(0x41));
143
144 m_uuidGatherer.AddForInspection(soL0);
145 m_uuidGatherer.GatherAll();
146
147// foreach (UUID key in m_uuidGatherer.GatheredUuids.Keys)
148// System.Console.WriteLine("key : {0}", key);
149
150 // We expect to see the default prim texture and the assets of the contained task items
151 Assert.That(m_uuidGatherer.GatheredUuids.Count, Is.EqualTo(4));
152 Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(new UUID(Constants.DefaultTexture)));
153 Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(TestHelpers.ParseTail(0x41)));
154 Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(TestHelpers.ParseTail(0x42)));
155 Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(TestHelpers.ParseTail(0x43)));
113 } 156 }
114 } 157 }
115} 158} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
index 67655d6..25bbd3a 100644
--- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
+++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
@@ -55,37 +55,79 @@ namespace OpenSim.Region.Framework.Scenes
55 { 55 {
56 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 56 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
57 57
58 /// <summary>
59 /// Is gathering complete?
60 /// </summary>
61 public bool Complete { get { return m_assetUuidsToInspect.Count <= 0; } }
62
63 /// <summary>
64 /// The dictionary of UUIDs gathered so far. If Complete == true then this is all the reachable UUIDs.
65 /// </summary>
66 /// <value>The gathered uuids.</value>
67 public IDictionary<UUID, sbyte> GatheredUuids { get; private set; }
68
69 /// <summary>
70 /// Gets the next UUID to inspect.
71 /// </summary>
72 /// <value>If there is no next UUID then returns null</value>
73 public UUID? NextUuidToInspect
74 {
75 get
76 {
77 if (Complete)
78 return null;
79 else
80 return m_assetUuidsToInspect.Peek();
81 }
82 }
83
58 protected IAssetService m_assetService; 84 protected IAssetService m_assetService;
59 85
60// /// <summary> 86 protected Queue<UUID> m_assetUuidsToInspect;
61// /// Used as a temporary store of an asset which represents an object. This can be a null if no appropriate 87
62// /// asset was found by the asset service. 88 /// <summary>
63// /// </summary> 89 /// Initializes a new instance of the <see cref="OpenSim.Region.Framework.Scenes.UuidGatherer"/> class.
64// private AssetBase m_requestedObjectAsset; 90 /// </summary>
65// 91 /// <remarks>In this case the collection of gathered assets will start out blank.</remarks>
66// /// <summary> 92 /// <param name="assetService">
67// /// Signal whether we are currently waiting for the asset service to deliver an asset. 93 /// Asset service.
68// /// </summary> 94 /// </param>
69// private bool m_waitingForObjectAsset; 95 public UuidGatherer(IAssetService assetService) : this(assetService, new Dictionary<UUID, sbyte>()) {}
70 96
71 public UuidGatherer(IAssetService assetService) 97 /// <summary>
98 /// Initializes a new instance of the <see cref="OpenSim.Region.Framework.Scenes.UuidGatherer"/> class.
99 /// </summary>
100 /// <param name="assetService">
101 /// Asset service.
102 /// </param>
103 /// <param name="collector">
104 /// Gathered UUIDs will be collected in this dictinaory.
105 /// It can be pre-populated if you want to stop the gatherer from analyzing assets that have already been fetched and inspected.
106 /// </param>
107 public UuidGatherer(IAssetService assetService, IDictionary<UUID, sbyte> collector)
72 { 108 {
73 m_assetService = assetService; 109 m_assetService = assetService;
110 GatheredUuids = collector;
111
112 // FIXME: Not efficient for searching, can improve.
113 m_assetUuidsToInspect = new Queue<UUID>();
74 } 114 }
75 115
76 /// <summary> 116 /// <summary>
77 /// Gather all the asset uuids associated with the asset referenced by a given uuid 117 /// Adds the asset uuid for inspection during the gathering process.
78 /// </summary> 118 /// </summary>
79 /// <remarks> 119 /// <returns><c>true</c>, if for inspection was added, <c>false</c> otherwise.</returns>
80 /// This includes both those directly associated with 120 /// <param name="uuid">UUID.</param>
81 /// it (e.g. face textures) and recursively, those of items within it's inventory (e.g. objects contained 121 public bool AddForInspection(UUID uuid)
82 /// within this object).
83 /// </remarks>
84 /// <param name="assetUuid">The uuid of the asset for which to gather referenced assets</param>
85 /// <param name="assetType">The type of the asset for the uuid given</param>
86 /// <param name="assetUuids">The assets gathered</param>
87 public void GatherAssetUuids(UUID assetUuid, sbyte assetType, IDictionary<UUID, sbyte> assetUuids)
88 { 122 {
123<<<<<<< HEAD
124 if (m_assetUuidsToInspect.Contains(uuid))
125 return false;
126
127// m_log.DebugFormat("[UUID GATHERER]: Adding asset {0} for inspection", uuid);
128
129 m_assetUuidsToInspect.Enqueue(uuid);
130=======
89 try 131 try
90 { 132 {
91 assetUuids[assetUuid] = assetType; 133 assetUuids[assetUuid] = assetType;
@@ -123,7 +165,11 @@ namespace OpenSim.Region.Framework.Scenes
123 throw; 165 throw;
124 } 166 }
125 } 167 }
168>>>>>>> avn/ubitvar
126 169
170 return true;
171 }
172
127 /// <summary> 173 /// <summary>
128 /// Gather all the asset uuids associated with a given object. 174 /// Gather all the asset uuids associated with a given object.
129 /// </summary> 175 /// </summary>
@@ -133,22 +179,18 @@ namespace OpenSim.Region.Framework.Scenes
133 /// within this object). 179 /// within this object).
134 /// </remarks> 180 /// </remarks>
135 /// <param name="sceneObject">The scene object for which to gather assets</param> 181 /// <param name="sceneObject">The scene object for which to gather assets</param>
136 /// <param name="assetUuids"> 182 public void AddForInspection(SceneObjectGroup sceneObject)
137 /// A dictionary which is populated with the asset UUIDs gathered and the type of that asset.
138 /// For assets where the type is not clear (e.g. UUIDs extracted from LSL and notecards), the type is Unknown.
139 /// </param>
140 public void GatherAssetUuids(SceneObjectGroup sceneObject, IDictionary<UUID, sbyte> assetUuids)
141 { 183 {
142// m_log.DebugFormat( 184 // m_log.DebugFormat(
143// "[ASSET GATHERER]: Getting assets for object {0}, {1}", sceneObject.Name, sceneObject.UUID); 185 // "[ASSET GATHERER]: Getting assets for object {0}, {1}", sceneObject.Name, sceneObject.UUID);
144 186
145 SceneObjectPart[] parts = sceneObject.Parts; 187 SceneObjectPart[] parts = sceneObject.Parts;
146 for (int i = 0; i < parts.Length; i++) 188 for (int i = 0; i < parts.Length; i++)
147 { 189 {
148 SceneObjectPart part = parts[i]; 190 SceneObjectPart part = parts[i];
149 191
150// m_log.DebugFormat( 192 // m_log.DebugFormat(
151// "[ARCHIVER]: Getting part {0}, {1} for object {2}", part.Name, part.UUID, sceneObject.UUID); 193 // "[ARCHIVER]: Getting part {0}, {1} for object {2}", part.Name, part.UUID, sceneObject.UUID);
152 194
153 try 195 try
154 { 196 {
@@ -157,7 +199,7 @@ namespace OpenSim.Region.Framework.Scenes
157 { 199 {
158 // Get the prim's default texture. This will be used for faces which don't have their own texture 200 // Get the prim's default texture. This will be used for faces which don't have their own texture
159 if (textureEntry.DefaultTexture != null) 201 if (textureEntry.DefaultTexture != null)
160 assetUuids[textureEntry.DefaultTexture.TextureID] = (sbyte)AssetType.Texture; 202 RecordTextureEntryAssetUuids(textureEntry.DefaultTexture);
161 203
162 if (textureEntry.FaceTextures != null) 204 if (textureEntry.FaceTextures != null)
163 { 205 {
@@ -165,20 +207,20 @@ namespace OpenSim.Region.Framework.Scenes
165 foreach (Primitive.TextureEntryFace texture in textureEntry.FaceTextures) 207 foreach (Primitive.TextureEntryFace texture in textureEntry.FaceTextures)
166 { 208 {
167 if (texture != null) 209 if (texture != null)
168 assetUuids[texture.TextureID] = (sbyte)AssetType.Texture; 210 RecordTextureEntryAssetUuids(texture);
169 } 211 }
170 } 212 }
171 } 213 }
172 214
173 // If the prim is a sculpt then preserve this information too 215 // If the prim is a sculpt then preserve this information too
174 if (part.Shape.SculptTexture != UUID.Zero) 216 if (part.Shape.SculptTexture != UUID.Zero)
175 assetUuids[part.Shape.SculptTexture] = (sbyte)AssetType.Texture; 217 GatheredUuids[part.Shape.SculptTexture] = (sbyte)AssetType.Texture;
176 218
177 if (part.Shape.ProjectionTextureUUID != UUID.Zero) 219 if (part.Shape.ProjectionTextureUUID != UUID.Zero)
178 assetUuids[part.Shape.ProjectionTextureUUID] = (sbyte)AssetType.Texture; 220 GatheredUuids[part.Shape.ProjectionTextureUUID] = (sbyte)AssetType.Texture;
179 221
180 if (part.CollisionSound != UUID.Zero) 222 if (part.CollisionSound != UUID.Zero)
181 assetUuids[part.CollisionSound] = (sbyte)AssetType.Sound; 223 GatheredUuids[part.CollisionSound] = (sbyte)AssetType.Sound;
182 224
183 if (part.ParticleSystem.Length > 0) 225 if (part.ParticleSystem.Length > 0)
184 { 226 {
@@ -186,9 +228,9 @@ namespace OpenSim.Region.Framework.Scenes
186 { 228 {
187 Primitive.ParticleSystem ps = new Primitive.ParticleSystem(part.ParticleSystem, 0); 229 Primitive.ParticleSystem ps = new Primitive.ParticleSystem(part.ParticleSystem, 0);
188 if (ps.Texture != UUID.Zero) 230 if (ps.Texture != UUID.Zero)
189 assetUuids[ps.Texture] = (sbyte)AssetType.Texture; 231 GatheredUuids[ps.Texture] = (sbyte)AssetType.Texture;
190 } 232 }
191 catch (Exception e) 233 catch (Exception)
192 { 234 {
193 m_log.WarnFormat( 235 m_log.WarnFormat(
194 "[UUID GATHERER]: Could not check particle system for part {0} {1} in object {2} {3} since it is corrupt. Continuing.", 236 "[UUID GATHERER]: Could not check particle system for part {0} {1} in object {2} {3} since it is corrupt. Continuing.",
@@ -197,27 +239,27 @@ namespace OpenSim.Region.Framework.Scenes
197 } 239 }
198 240
199 TaskInventoryDictionary taskDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone(); 241 TaskInventoryDictionary taskDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone();
200 242
201 // Now analyze this prim's inventory items to preserve all the uuids that they reference 243 // Now analyze this prim's inventory items to preserve all the uuids that they reference
202 foreach (TaskInventoryItem tii in taskDictionary.Values) 244 foreach (TaskInventoryItem tii in taskDictionary.Values)
203 { 245 {
204// m_log.DebugFormat( 246 // m_log.DebugFormat(
205// "[ARCHIVER]: Analysing item {0} asset type {1} in {2} {3}", 247 // "[ARCHIVER]: Analysing item {0} asset type {1} in {2} {3}",
206// tii.Name, tii.Type, part.Name, part.UUID); 248 // tii.Name, tii.Type, part.Name, part.UUID);
207 249
208 if (!assetUuids.ContainsKey(tii.AssetID)) 250 if (!GatheredUuids.ContainsKey(tii.AssetID))
209 GatherAssetUuids(tii.AssetID, (sbyte)tii.Type, assetUuids); 251 AddForInspection(tii.AssetID, (sbyte)tii.Type);
210 } 252 }
211 253
212 // FIXME: We need to make gathering modular but we cannot yet, since gatherers are not guaranteed 254 // FIXME: We need to make gathering modular but we cannot yet, since gatherers are not guaranteed
213 // to be called with scene objects that are in a scene (e.g. in the case of hg asset mapping and 255 // to be called with scene objects that are in a scene (e.g. in the case of hg asset mapping and
214 // inventory transfer. There needs to be a way for a module to register a method without assuming a 256 // inventory transfer. There needs to be a way for a module to register a method without assuming a
215 // Scene.EventManager is present. 257 // Scene.EventManager is present.
216// part.ParentGroup.Scene.EventManager.TriggerGatherUuids(part, assetUuids); 258 // part.ParentGroup.Scene.EventManager.TriggerGatherUuids(part, assetUuids);
217 259
218 260
219 // still needed to retrieve textures used as materials for any parts containing legacy materials stored in DynAttrs 261 // still needed to retrieve textures used as materials for any parts containing legacy materials stored in DynAttrs
220 GatherMaterialsUuids(part, assetUuids); 262 RecordMaterialsUuids(part);
221 } 263 }
222 catch (Exception e) 264 catch (Exception e)
223 { 265 {
@@ -229,27 +271,144 @@ namespace OpenSim.Region.Framework.Scenes
229 } 271 }
230 } 272 }
231 273
232// /// <summary> 274 /// <summary>
233// /// The callback made when we request the asset for an object from the asset service. 275 /// Gathers the next set of assets returned by the next uuid to get from the asset service.
234// /// </summary> 276 /// </summary>
235// private void AssetReceived(string id, Object sender, AssetBase asset) 277 /// <returns>false if gathering is already complete, true otherwise</returns>
236// { 278 public bool GatherNext()
237// lock (this) 279 {
238// { 280 if (Complete)
239// m_requestedObjectAsset = asset; 281 return false;
240// m_waitingForObjectAsset = false; 282
241// Monitor.Pulse(this); 283 UUID nextToInspect = m_assetUuidsToInspect.Dequeue();
242// } 284
243// } 285// m_log.DebugFormat("[UUID GATHERER]: Inspecting asset {0}", nextToInspect);
286
287 GetAssetUuids(nextToInspect);
288
289 return true;
290 }
291
292 /// <summary>
293 /// Gathers all remaining asset UUIDS no matter how many calls are required to the asset service.
294 /// </summary>
295 /// <returns>false if gathering is already complete, true otherwise</returns>
296 public bool GatherAll()
297 {
298 if (Complete)
299 return false;
300
301 while (GatherNext());
302
303 return true;
304 }
305
306 /// <summary>
307 /// Gather all the asset uuids associated with the asset referenced by a given uuid
308 /// </summary>
309 /// <remarks>
310 /// This includes both those directly associated with
311 /// it (e.g. face textures) and recursively, those of items within it's inventory (e.g. objects contained
312 /// within this object).
313 /// This method assumes that the asset type associated with this asset in persistent storage is correct (which
314 /// should always be the case). So with this method we always need to retrieve asset data even if the asset
315 /// is of a type which is known not to reference any other assets
316 /// </remarks>
317 /// <param name="assetUuid">The uuid of the asset for which to gather referenced assets</param>
318 private void GetAssetUuids(UUID assetUuid)
319 {
320 // avoid infinite loops
321 if (GatheredUuids.ContainsKey(assetUuid))
322 return;
323
324 try
325 {
326 AssetBase assetBase = GetAsset(assetUuid);
327
328 if (null != assetBase)
329 {
330 sbyte assetType = assetBase.Type;
331 GatheredUuids[assetUuid] = assetType;
332
333 if ((sbyte)AssetType.Bodypart == assetType || (sbyte)AssetType.Clothing == assetType)
334 {
335 RecordWearableAssetUuids(assetBase);
336 }
337 else if ((sbyte)AssetType.Gesture == assetType)
338 {
339 RecordGestureAssetUuids(assetBase);
340 }
341 else if ((sbyte)AssetType.Notecard == assetType)
342 {
343 RecordTextEmbeddedAssetUuids(assetBase);
344 }
345 else if ((sbyte)AssetType.LSLText == assetType)
346 {
347 RecordTextEmbeddedAssetUuids(assetBase);
348 }
349 else if ((sbyte)OpenSimAssetType.Material == assetType)
350 {
351 RecordMaterialAssetUuids(assetBase);
352 }
353 else if ((sbyte)AssetType.Object == assetType)
354 {
355 RecordSceneObjectAssetUuids(assetBase);
356 }
357 }
358 }
359 catch (Exception)
360 {
361 m_log.ErrorFormat("[UUID GATHERER]: Failed to gather uuids for asset id {0}", assetUuid);
362 throw;
363 }
364 }
365
366 private void AddForInspection(UUID assetUuid, sbyte assetType)
367 {
368 // Here, we want to collect uuids which require further asset fetches but mark the others as gathered
369 try
370 {
371 if ((sbyte)AssetType.Bodypart == assetType
372 || (sbyte)AssetType.Clothing == assetType
373 || (sbyte)AssetType.Gesture == assetType
374 || (sbyte)AssetType.Notecard == assetType
375 || (sbyte)AssetType.LSLText == assetType
376 || (sbyte)OpenSimAssetType.Material == assetType
377 || (sbyte)AssetType.Object == assetType)
378 {
379 AddForInspection(assetUuid);
380 }
381 else
382 {
383 GatheredUuids[assetUuid] = assetType;
384 }
385 }
386 catch (Exception)
387 {
388 m_log.ErrorFormat(
389 "[UUID GATHERER]: Failed to gather uuids for asset id {0}, type {1}",
390 assetUuid, assetType);
391 throw;
392 }
393 }
394
395 /// <summary>
396 /// Collect all the asset uuids found in one face of a Texture Entry.
397 /// </summary>
398 private void RecordTextureEntryAssetUuids(Primitive.TextureEntryFace texture)
399 {
400 GatheredUuids[texture.TextureID] = (sbyte)AssetType.Texture;
401
402 if (texture.MaterialID != UUID.Zero)
403 AddForInspection(texture.MaterialID);
404 }
244 405
245 /// <summary> 406 /// <summary>
246 /// Gather all of the texture asset UUIDs used to reference "Materials" such as normal and specular maps 407 /// Gather all of the texture asset UUIDs used to reference "Materials" such as normal and specular maps
247 /// stored in legacy format in part.DynAttrs 408 /// stored in legacy format in part.DynAttrs
248 /// </summary> 409 /// </summary>
249 /// <param name="part"></param> 410 /// <param name="part"></param>
250 /// <param name="assetUuids"></param> 411 private void RecordMaterialsUuids(SceneObjectPart part)
251 //public void GatherMaterialsUuids(SceneObjectPart part, IDictionary<UUID, AssetType> assetUuids)
252 public void GatherMaterialsUuids(SceneObjectPart part, IDictionary<UUID, sbyte> assetUuids)
253 { 412 {
254 // scan thru the dynAttrs map of this part for any textures used as materials 413 // scan thru the dynAttrs map of this part for any textures used as materials
255 OSD osdMaterials = null; 414 OSD osdMaterials = null;
@@ -285,7 +444,7 @@ namespace OpenSim.Region.Framework.Scenes
285 UUID normalMapId = mat["NormMap"].AsUUID(); 444 UUID normalMapId = mat["NormMap"].AsUUID();
286 if (normalMapId != UUID.Zero) 445 if (normalMapId != UUID.Zero)
287 { 446 {
288 assetUuids[normalMapId] = (sbyte)AssetType.Texture; 447 GatheredUuids[normalMapId] = (sbyte)AssetType.Texture;
289 //m_log.Info("[UUID Gatherer]: found normal map ID: " + normalMapId.ToString()); 448 //m_log.Info("[UUID Gatherer]: found normal map ID: " + normalMapId.ToString());
290 } 449 }
291 } 450 }
@@ -294,7 +453,7 @@ namespace OpenSim.Region.Framework.Scenes
294 UUID specularMapId = mat["SpecMap"].AsUUID(); 453 UUID specularMapId = mat["SpecMap"].AsUUID();
295 if (specularMapId != UUID.Zero) 454 if (specularMapId != UUID.Zero)
296 { 455 {
297 assetUuids[specularMapId] = (sbyte)AssetType.Texture; 456 GatheredUuids[specularMapId] = (sbyte)AssetType.Texture;
298 //m_log.Info("[UUID Gatherer]: found specular map ID: " + specularMapId.ToString()); 457 //m_log.Info("[UUID Gatherer]: found specular map ID: " + specularMapId.ToString());
299 } 458 }
300 } 459 }
@@ -310,7 +469,7 @@ namespace OpenSim.Region.Framework.Scenes
310 } 469 }
311 } 470 }
312 } 471 }
313 472
314 /// <summary> 473 /// <summary>
315 /// Get an asset synchronously, potentially using an asynchronous callback. If the 474 /// Get an asset synchronously, potentially using an asynchronous callback. If the
316 /// asynchronous callback is used, we will wait for it to complete. 475 /// asynchronous callback is used, we will wait for it to complete.
@@ -320,83 +479,45 @@ namespace OpenSim.Region.Framework.Scenes
320 protected virtual AssetBase GetAsset(UUID uuid) 479 protected virtual AssetBase GetAsset(UUID uuid)
321 { 480 {
322 return m_assetService.Get(uuid.ToString()); 481 return m_assetService.Get(uuid.ToString());
323
324 // XXX: Switching to do this synchronously where the call was async before but we always waited for it
325 // to complete anyway!
326// m_waitingForObjectAsset = true;
327// m_assetCache.Get(uuid.ToString(), this, AssetReceived);
328//
329// // The asset cache callback can either
330// //
331// // 1. Complete on the same thread (if the asset is already in the cache) or
332// // 2. Come in via a different thread (if we need to go fetch it).
333// //
334// // The code below handles both these alternatives.
335// lock (this)
336// {
337// if (m_waitingForObjectAsset)
338// {
339// Monitor.Wait(this);
340// m_waitingForObjectAsset = false;
341// }
342// }
343//
344// return m_requestedObjectAsset;
345 } 482 }
346 483
347 /// <summary> 484 /// <summary>
348 /// Record the asset uuids embedded within the given script. 485 /// Record the asset uuids embedded within the given text (e.g. a script).
349 /// </summary> 486 /// </summary>
350 /// <param name="scriptUuid"></param> 487 /// <param name="textAsset"></param>
351 /// <param name="assetUuids">Dictionary in which to record the references</param> 488 private void RecordTextEmbeddedAssetUuids(AssetBase textAsset)
352 private void GetTextEmbeddedAssetUuids(UUID embeddingAssetId, IDictionary<UUID, sbyte> assetUuids)
353 { 489 {
354// m_log.DebugFormat("[ASSET GATHERER]: Getting assets for uuid references in asset {0}", embeddingAssetId); 490 // m_log.DebugFormat("[ASSET GATHERER]: Getting assets for uuid references in asset {0}", embeddingAssetId);
355 491
356 AssetBase embeddingAsset = GetAsset(embeddingAssetId); 492 string text = Utils.BytesToString(textAsset.Data);
493// m_log.DebugFormat("[UUID GATHERER]: Text {0}", text);
494 MatchCollection uuidMatches = Util.PermissiveUUIDPattern.Matches(text);
495// m_log.DebugFormat("[UUID GATHERER]: Found {0} matches in text", uuidMatches.Count);
357 496
358 if (null != embeddingAsset) 497 foreach (Match uuidMatch in uuidMatches)
359 { 498 {
360 string script = Utils.BytesToString(embeddingAsset.Data); 499 UUID uuid = new UUID(uuidMatch.Value);
361// m_log.DebugFormat("[ARCHIVER]: Script {0}", script); 500// m_log.DebugFormat("[UUID GATHERER]: Recording {0} in text", uuid);
362 MatchCollection uuidMatches = Util.PermissiveUUIDPattern.Matches(script);
363// m_log.DebugFormat("[ARCHIVER]: Found {0} matches in text", uuidMatches.Count);
364 501
365 foreach (Match uuidMatch in uuidMatches) 502 AddForInspection(uuid);
366 {
367 UUID uuid = new UUID(uuidMatch.Value);
368// m_log.DebugFormat("[ARCHIVER]: Recording {0} in text", uuid);
369
370 // Embedded asset references (if not false positives) could be for many types of asset, so we will
371 // label these as unknown.
372 assetUuids[uuid] = (sbyte)AssetType.Unknown;
373 }
374 } 503 }
375 } 504 }
376 505
377 /// <summary> 506 /// <summary>
378 /// Record the uuids referenced by the given wearable asset 507 /// Record the uuids referenced by the given wearable asset
379 /// </summary> 508 /// </summary>
380 /// <param name="wearableAssetUuid"></param> 509 /// <param name="assetBase"></param>
381 /// <param name="assetUuids">Dictionary in which to record the references</param> 510 private void RecordWearableAssetUuids(AssetBase assetBase)
382 private void GetWearableAssetUuids(UUID wearableAssetUuid, IDictionary<UUID, sbyte> assetUuids)
383 { 511 {
384 AssetBase assetBase = GetAsset(wearableAssetUuid); 512 //m_log.Debug(new System.Text.ASCIIEncoding().GetString(bodypartAsset.Data));
513 AssetWearable wearableAsset = new AssetBodypart(assetBase.FullID, assetBase.Data);
514 wearableAsset.Decode();
385 515
386 if (null != assetBase) 516 //m_log.DebugFormat(
387 { 517 // "[ARCHIVER]: Wearable asset {0} references {1} assets", wearableAssetUuid, wearableAsset.Textures.Count);
388 //m_log.Debug(new System.Text.ASCIIEncoding().GetString(bodypartAsset.Data)); 518
389 AssetWearable wearableAsset = new AssetBodypart(wearableAssetUuid, assetBase.Data); 519 foreach (UUID uuid in wearableAsset.Textures.Values)
390 wearableAsset.Decode(); 520 GatheredUuids[uuid] = (sbyte)AssetType.Texture;
391
392 //m_log.DebugFormat(
393 // "[ARCHIVER]: Wearable asset {0} references {1} assets", wearableAssetUuid, wearableAsset.Textures.Count);
394
395 foreach (UUID uuid in wearableAsset.Textures.Values)
396 {
397 assetUuids[uuid] = (sbyte)AssetType.Texture;
398 }
399 }
400 } 521 }
401 522
402 /// <summary> 523 /// <summary>
@@ -404,93 +525,79 @@ namespace OpenSim.Region.Framework.Scenes
404 /// it (e.g. face textures) and recursively, those of items within it's inventory (e.g. objects contained 525 /// it (e.g. face textures) and recursively, those of items within it's inventory (e.g. objects contained
405 /// within this object). 526 /// within this object).
406 /// </summary> 527 /// </summary>
407 /// <param name="sceneObject"></param> 528 /// <param name="sceneObjectAsset"></param>
408 /// <param name="assetUuids"></param> 529 private void RecordSceneObjectAssetUuids(AssetBase sceneObjectAsset)
409 private void GetSceneObjectAssetUuids(UUID sceneObjectUuid, IDictionary<UUID, sbyte> assetUuids)
410 { 530 {
411 AssetBase objectAsset = GetAsset(sceneObjectUuid); 531 string xml = Utils.BytesToString(sceneObjectAsset.Data);
412 532
413 if (null != objectAsset) 533 CoalescedSceneObjects coa;
534 if (CoalescedSceneObjectsSerializer.TryFromXml(xml, out coa))
414 { 535 {
415 string xml = Utils.BytesToString(objectAsset.Data); 536 foreach (SceneObjectGroup sog in coa.Objects)
416 537 AddForInspection(sog);
417 CoalescedSceneObjects coa; 538 }
418 if (CoalescedSceneObjectsSerializer.TryFromXml(xml, out coa)) 539 else
419 { 540 {
420 foreach (SceneObjectGroup sog in coa.Objects) 541 SceneObjectGroup sog = SceneObjectSerializer.FromOriginalXmlFormat(xml);
421 GatherAssetUuids(sog, assetUuids); 542
422 } 543 if (null != sog)
423 else 544 AddForInspection(sog);
424 {
425 SceneObjectGroup sog = SceneObjectSerializer.FromOriginalXmlFormat(xml);
426
427 if (null != sog)
428 GatherAssetUuids(sog, assetUuids);
429 }
430 } 545 }
431 } 546 }
432 547
433 /// <summary> 548 /// <summary>
434 /// Get the asset uuid associated with a gesture 549 /// Get the asset uuid associated with a gesture
435 /// </summary> 550 /// </summary>
436 /// <param name="gestureUuid"></param> 551 /// <param name="gestureAsset"></param>
437 /// <param name="assetUuids"></param> 552 private void RecordGestureAssetUuids(AssetBase gestureAsset)
438 private void GetGestureAssetUuids(UUID gestureUuid, IDictionary<UUID, sbyte> assetUuids) 553 {
439 { 554 using (MemoryStream ms = new MemoryStream(gestureAsset.Data))
440 AssetBase assetBase = GetAsset(gestureUuid); 555 using (StreamReader sr = new StreamReader(ms))
441 if (null == assetBase)
442 return;
443
444 MemoryStream ms = new MemoryStream(assetBase.Data);
445 StreamReader sr = new StreamReader(ms);
446
447 sr.ReadLine(); // Unknown (Version?)
448 sr.ReadLine(); // Unknown
449 sr.ReadLine(); // Unknown
450 sr.ReadLine(); // Name
451 sr.ReadLine(); // Comment ?
452 int count = Convert.ToInt32(sr.ReadLine()); // Item count
453
454 for (int i = 0 ; i < count ; i++)
455 { 556 {
456 string type = sr.ReadLine(); 557 sr.ReadLine(); // Unknown (Version?)
457 if (type == null) 558 sr.ReadLine(); // Unknown
458 break; 559 sr.ReadLine(); // Unknown
459 string name = sr.ReadLine(); 560 sr.ReadLine(); // Name
460 if (name == null) 561 sr.ReadLine(); // Comment ?
461 break; 562 int count = Convert.ToInt32(sr.ReadLine()); // Item count
462 string id = sr.ReadLine(); 563
463 if (id == null) 564 for (int i = 0 ; i < count ; i++)
464 break; 565 {
465 string unknown = sr.ReadLine(); 566 string type = sr.ReadLine();
466 if (unknown == null) 567 if (type == null)
467 break; 568 break;
468 569 string name = sr.ReadLine();
469 // If it can be parsed as a UUID, it is an asset ID 570 if (name == null)
470 UUID uuid; 571 break;
471 if (UUID.TryParse(id, out uuid)) 572 string id = sr.ReadLine();
472 assetUuids[uuid] = (sbyte)AssetType.Animation; 573 if (id == null)
574 break;
575 string unknown = sr.ReadLine();
576 if (unknown == null)
577 break;
578
579 // If it can be parsed as a UUID, it is an asset ID
580 UUID uuid;
581 if (UUID.TryParse(id, out uuid))
582 GatheredUuids[uuid] = (sbyte)AssetType.Animation; // the asset is either an Animation or a Sound, but this distinction isn't important
583 }
473 } 584 }
474 } 585 }
475 586
476 /// <summary> 587 /// <summary>
477 /// Get the asset uuid's referenced in a material. 588 /// Get the asset uuid's referenced in a material.
478 /// </summary> 589 /// </summary>
479 private void GetMaterialAssetUuids(UUID materialUuid, IDictionary<UUID, sbyte> assetUuids) 590 private void RecordMaterialAssetUuids(AssetBase materialAsset)
480 { 591 {
481 AssetBase assetBase = GetAsset(materialUuid); 592 OSDMap mat = (OSDMap)OSDParser.DeserializeLLSDXml(materialAsset.Data);
482 if (null == assetBase)
483 return;
484
485 OSDMap mat = (OSDMap)OSDParser.DeserializeLLSDXml(assetBase.Data);
486 593
487 UUID normMap = mat["NormMap"].AsUUID(); 594 UUID normMap = mat["NormMap"].AsUUID();
488 if (normMap != UUID.Zero) 595 if (normMap != UUID.Zero)
489 assetUuids[normMap] = (sbyte)AssetType.Texture; 596 GatheredUuids[normMap] = (sbyte)AssetType.Texture;
490 597
491 UUID specMap = mat["SpecMap"].AsUUID(); 598 UUID specMap = mat["SpecMap"].AsUUID();
492 if (specMap != UUID.Zero) 599 if (specMap != UUID.Zero)
493 assetUuids[specMap] = (sbyte)AssetType.Texture; 600 GatheredUuids[specMap] = (sbyte)AssetType.Texture;
494 } 601 }
495 } 602 }
496 603
@@ -501,7 +608,10 @@ namespace OpenSim.Region.Framework.Scenes
501 protected string m_assetServerURL; 608 protected string m_assetServerURL;
502 609
503 public HGUuidGatherer(IAssetService assetService, string assetServerURL) 610 public HGUuidGatherer(IAssetService assetService, string assetServerURL)
504 : base(assetService) 611 : this(assetService, assetServerURL, new Dictionary<UUID, sbyte>()) {}
612
613 public HGUuidGatherer(IAssetService assetService, string assetServerURL, IDictionary<UUID, sbyte> collector)
614 : base(assetService, collector)
505 { 615 {
506 m_assetServerURL = assetServerURL; 616 m_assetServerURL = assetServerURL;
507 if (!m_assetServerURL.EndsWith("/") && !m_assetServerURL.EndsWith("=")) 617 if (!m_assetServerURL.EndsWith("/") && !m_assetServerURL.EndsWith("="))
@@ -518,7 +628,6 @@ namespace OpenSim.Region.Framework.Scenes
518 628
519 public AssetBase FetchAsset(UUID assetID) 629 public AssetBase FetchAsset(UUID assetID)
520 { 630 {
521
522 // Test if it's already here 631 // Test if it's already here
523 AssetBase asset = m_assetService.Get(assetID.ToString()); 632 AssetBase asset = m_assetService.Get(assetID.ToString());
524 if (asset == null) 633 if (asset == null)
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index 89e18b0..a34f6ee 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -75,7 +75,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
75 m_client = client; 75 m_client = client;
76 m_scene = scene; 76 m_scene = scene;
77 77
78 Watchdog.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false, true); 78 WorkManager.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false, true);
79 } 79 }
80 80
81 private void SendServerCommand(string command) 81 private void SendServerCommand(string command)
@@ -1455,9 +1455,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
1455 return new byte[0]; 1455 return new byte[0];
1456 } 1456 }
1457 1457
1458#pragma warning disable 0067
1458 public event ViewerEffectEventHandler OnViewerEffect; 1459 public event ViewerEffectEventHandler OnViewerEffect;
1459 public event Action<IClientAPI> OnLogout; 1460 public event Action<IClientAPI> OnLogout;
1460 public event Action<IClientAPI> OnConnectionClosed; 1461 public event Action<IClientAPI> OnConnectionClosed;
1462#pragma warning restore 0067
1461 1463
1462 public void SendBlueBoxMessage(UUID FromAvatarID, string FromAvatarName, string Message) 1464 public void SendBlueBoxMessage(UUID FromAvatarID, string FromAvatarName, string Message)
1463 { 1465 {
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs
index 9d27386..a1682d2 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
58 58
59 m_listener.Start(50); 59 m_listener.Start(50);
60 60
61 Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false, true); 61 WorkManager.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false, true);
62 m_baseScene = baseScene; 62 m_baseScene = baseScene;
63 } 63 }
64 64
diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
index ec18db0..08d0fbf 100644
--- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
+++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
@@ -487,8 +487,10 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
487 report.Append(GetColumnEntry("Type", maxTypeLength, columnPadding)); 487 report.Append(GetColumnEntry("Type", maxTypeLength, columnPadding));
488 488
489 report.AppendFormat( 489 report.AppendFormat(
490 "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}\n", 490 "{0,8} {1,8} {2,7} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7}\n",
491 "Total", 491 "Max",
492 "Target",
493 "Actual",
492 "Resend", 494 "Resend",
493 "Land", 495 "Land",
494 "Wind", 496 "Wind",
@@ -499,7 +501,9 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
499 501
500 report.AppendFormat("{0,-" + totalInfoFieldsLength + "}", ""); 502 report.AppendFormat("{0,-" + totalInfoFieldsLength + "}", "");
501 report.AppendFormat( 503 report.AppendFormat(
502 "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}", 504 "{0,8} {1,8} {2,7} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7}\n",
505 "kb/s",
506 "kb/s",
503 "kb/s", 507 "kb/s",
504 "kb/s", 508 "kb/s",
505 "kb/s", 509 "kb/s",
@@ -511,8 +515,6 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
511 515
512 report.AppendLine(); 516 report.AppendLine();
513 517
514 bool firstClient = true;
515
516 lock (m_scenes) 518 lock (m_scenes)
517 { 519 {
518 foreach (Scene scene in m_scenes.Values) 520 foreach (Scene scene in m_scenes.Values)
@@ -524,12 +526,6 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
524 { 526 {
525 LLClientView llClient = client as LLClientView; 527 LLClientView llClient = client as LLClientView;
526 528
527 if (firstClient)
528 {
529 report.AppendLine(GetServerThrottlesReport(llClient.UDPServer));
530 firstClient = false;
531 }
532
533 bool isChild = client.SceneAgent.IsChildAgent; 529 bool isChild = client.SceneAgent.IsChildAgent;
534 if (isChild && !showChildren) 530 if (isChild && !showChildren)
535 return; 531 return;
@@ -548,7 +544,11 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
548 report.Append(GetColumnEntry(isChild ? "Cd" : "Rt", maxTypeLength, columnPadding)); 544 report.Append(GetColumnEntry(isChild ? "Cd" : "Rt", maxTypeLength, columnPadding));
549 545
550 report.AppendFormat( 546 report.AppendFormat(
551 "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}", 547 "{0,8} {1,8} {2,7} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7}\n",
548 ci.maxThrottle > 0 ? ((ci.maxThrottle * 8) / 1000).ToString() : "-",
549 llUdpClient.FlowThrottle.AdaptiveEnabled
550 ? ((ci.targetThrottle * 8) / 1000).ToString()
551 : (llUdpClient.FlowThrottle.TotalDripRequest * 8 / 1000).ToString(),
552 (ci.totalThrottle * 8) / 1000, 552 (ci.totalThrottle * 8) / 1000,
553 (ci.resendThrottle * 8) / 1000, 553 (ci.resendThrottle * 8) / 1000,
554 (ci.landThrottle * 8) / 1000, 554 (ci.landThrottle * 8) / 1000,
@@ -556,9 +556,7 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
556 (ci.cloudThrottle * 8) / 1000, 556 (ci.cloudThrottle * 8) / 1000,
557 (ci.taskThrottle * 8) / 1000, 557 (ci.taskThrottle * 8) / 1000,
558 (ci.textureThrottle * 8) / 1000, 558 (ci.textureThrottle * 8) / 1000,
559 (ci.assetThrottle * 8) / 1000); 559 (ci.assetThrottle * 8) / 1000);
560
561 report.AppendLine();
562 } 560 }
563 }); 561 });
564 } 562 }
@@ -566,36 +564,6 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
566 564
567 return report.ToString(); 565 return report.ToString();
568 } 566 }
569
570 protected string GetServerThrottlesReport(LLUDPServer udpServer)
571 {
572 StringBuilder report = new StringBuilder();
573
574 int columnPadding = 2;
575 int maxNameLength = 18;
576 int maxRegionNameLength = 14;
577 int maxTypeLength = 4;
578
579 string name = "SERVER AGENT RATES";
580
581 report.Append(GetColumnEntry(name, maxNameLength, columnPadding));
582 report.Append(GetColumnEntry("-", maxRegionNameLength, columnPadding));
583 report.Append(GetColumnEntry("-", maxTypeLength, columnPadding));
584
585 ThrottleRates throttleRates = udpServer.ThrottleRates;
586 report.AppendFormat(
587 "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}",
588 (throttleRates.Total * 8) / 1000,
589 (throttleRates.Resend * 8) / 1000,
590 (throttleRates.Land * 8) / 1000,
591 (throttleRates.Wind * 8) / 1000,
592 (throttleRates.Cloud * 8) / 1000,
593 (throttleRates.Task * 8) / 1000,
594 (throttleRates.Texture * 8) / 1000,
595 (throttleRates.Asset * 8) / 1000);
596
597 return report.ToString();
598 }
599 567
600 /// <summary> 568 /// <summary>
601 /// Show client stats data 569 /// Show client stats data
@@ -637,7 +605,9 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
637 string.Format( 605 string.Format(
638 "{0} ({1:0.00}%)", 606 "{0} ({1:0.00}%)",
639 llClient.TotalAgentUpdates, 607 llClient.TotalAgentUpdates,
640 (float)cinfo.SyncRequests["AgentUpdate"] / llClient.TotalAgentUpdates * 100)); 608 cinfo.SyncRequests.ContainsKey("AgentUpdate")
609 ? (float)cinfo.SyncRequests["AgentUpdate"] / llClient.TotalAgentUpdates * 100
610 : 0));
641 } 611 }
642 }); 612 });
643 } 613 }
@@ -669,7 +639,7 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
669 aCircuit = new AgentCircuitData(); 639 aCircuit = new AgentCircuitData();
670 640
671 if (!llClient.SceneAgent.IsChildAgent) 641 if (!llClient.SceneAgent.IsChildAgent)
672 m_log.InfoFormat("[INFO]: {0} # {1} # {2}", llClient.Name, aCircuit.Viewer, aCircuit.Id0); 642 m_log.InfoFormat("[INFO]: {0} # {1} # {2}", llClient.Name, Util.GetViewerName(aCircuit), aCircuit.Id0);
673 643
674 int avg_reqs = cinfo.AsyncRequests.Values.Sum() + cinfo.GenericRequests.Values.Sum() + cinfo.SyncRequests.Values.Sum(); 644 int avg_reqs = cinfo.AsyncRequests.Values.Sum() + cinfo.GenericRequests.Values.Sum() + cinfo.SyncRequests.Values.Sum();
675 avg_reqs = avg_reqs / ((DateTime.Now - cinfo.StartedTime).Minutes + 1); 645 avg_reqs = avg_reqs / ((DateTime.Now - cinfo.StartedTime).Minutes + 1);
@@ -706,4 +676,4 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden
706 m_log.InfoFormat("[INFO]: {0,25} {1,-6}", "Total", sum); 676 m_log.InfoFormat("[INFO]: {0,25} {1,-6}", "Total", sum);
707 } 677 }
708 } 678 }
709} \ No newline at end of file 679}
diff --git a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs
index fa35f0f..2f9bb1e 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs
@@ -51,7 +51,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
51 { 51 {
52// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 52// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53 53
54 private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); 54 private List<Scene> m_scenes = new List<Scene>();
55
55// private IAvatarFactoryModule m_avatarFactory; 56// private IAvatarFactoryModule m_avatarFactory;
56 57
57 public string Name { get { return "Appearance Information Module"; } } 58 public string Name { get { return "Appearance Information Module"; } }
@@ -83,7 +84,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
83// m_log.DebugFormat("[APPEARANCE INFO MODULE]: REGION {0} REMOVED", scene.RegionInfo.RegionName); 84// m_log.DebugFormat("[APPEARANCE INFO MODULE]: REGION {0} REMOVED", scene.RegionInfo.RegionName);
84 85
85 lock (m_scenes) 86 lock (m_scenes)
86 m_scenes.Remove(scene.RegionInfo.RegionID); 87 m_scenes.Remove(scene);
87 } 88 }
88 89
89 public void RegionLoaded(Scene scene) 90 public void RegionLoaded(Scene scene)
@@ -91,7 +92,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
91// m_log.DebugFormat("[APPEARANCE INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); 92// m_log.DebugFormat("[APPEARANCE INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName);
92 93
93 lock (m_scenes) 94 lock (m_scenes)
94 m_scenes[scene.RegionInfo.RegionID] = scene; 95 m_scenes.Add(scene);
95 96
96 scene.AddCommand( 97 scene.AddCommand(
97 "Users", this, "show appearance", 98 "Users", this, "show appearance",
@@ -102,7 +103,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
102 scene.AddCommand( 103 scene.AddCommand(
103 "Users", this, "appearance show", 104 "Users", this, "appearance show",
104 "appearance show [<first-name> <last-name>]", 105 "appearance show [<first-name> <last-name>]",
105 "Show appearance information for each avatar in the simulator.", 106 "Show appearance information for avatars.",
106 "This command checks whether the simulator has all the baked textures required to display an avatar to other viewers. " 107 "This command checks whether the simulator has all the baked textures required to display an avatar to other viewers. "
107 + "\nIf not, then appearance is 'corrupt' and other avatars will continue to see it as a cloud." 108 + "\nIf not, then appearance is 'corrupt' and other avatars will continue to see it as a cloud."
108 + "\nOptionally, you can view just a particular avatar's appearance information." 109 + "\nOptionally, you can view just a particular avatar's appearance information."
@@ -132,6 +133,21 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
132 "Find out which avatar uses the given asset as a baked texture, if any.", 133 "Find out which avatar uses the given asset as a baked texture, if any.",
133 "You can specify just the beginning of the uuid, e.g. 2008a8d. A longer UUID must be in dashed format.", 134 "You can specify just the beginning of the uuid, e.g. 2008a8d. A longer UUID must be in dashed format.",
134 HandleFindAppearanceCommand); 135 HandleFindAppearanceCommand);
136
137 scene.AddCommand(
138 "Users", this, "wearables show",
139 "wearables show [<first-name> <last-name>]",
140 "Show information about wearables for avatars.",
141 "If no avatar name is given then a general summary for all avatars in the scene is shown.\n"
142 + "If an avatar name is given then specific information about current wearables is shown.",
143 HandleShowWearablesCommand);
144
145 scene.AddCommand(
146 "Users", this, "wearables check",
147 "wearables check <first-name> <last-name>",
148 "Check that the wearables of a given avatar in the scene are valid.",
149 "This currently checks that the wearable assets themselves and any assets referenced by them exist.",
150 HandleCheckWearablesCommand);
135 } 151 }
136 152
137 private void HandleSendAppearanceCommand(string module, string[] cmd) 153 private void HandleSendAppearanceCommand(string module, string[] cmd)
@@ -155,7 +171,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
155 171
156 lock (m_scenes) 172 lock (m_scenes)
157 { 173 {
158 foreach (Scene scene in m_scenes.Values) 174 foreach (Scene scene in m_scenes)
159 { 175 {
160 if (targetNameSupplied) 176 if (targetNameSupplied)
161 { 177 {
@@ -186,7 +202,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
186 } 202 }
187 } 203 }
188 204
189 protected void HandleShowAppearanceCommand(string module, string[] cmd) 205 private void HandleShowAppearanceCommand(string module, string[] cmd)
190 { 206 {
191 if (cmd.Length != 2 && cmd.Length < 4) 207 if (cmd.Length != 2 && cmd.Length < 4)
192 { 208 {
@@ -207,7 +223,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
207 223
208 lock (m_scenes) 224 lock (m_scenes)
209 { 225 {
210 foreach (Scene scene in m_scenes.Values) 226 foreach (Scene scene in m_scenes)
211 { 227 {
212 if (targetNameSupplied) 228 if (targetNameSupplied)
213 { 229 {
@@ -243,7 +259,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
243 259
244 lock (m_scenes) 260 lock (m_scenes)
245 { 261 {
246 foreach (Scene scene in m_scenes.Values) 262 foreach (Scene scene in m_scenes)
247 { 263 {
248 ScenePresence sp = scene.GetScenePresence(firstname, lastname); 264 ScenePresence sp = scene.GetScenePresence(firstname, lastname);
249 if (sp != null && !sp.IsChildAgent) 265 if (sp != null && !sp.IsChildAgent)
@@ -263,7 +279,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
263 } 279 }
264 } 280 }
265 281
266 protected void HandleFindAppearanceCommand(string module, string[] cmd) 282 private void HandleFindAppearanceCommand(string module, string[] cmd)
267 { 283 {
268 if (cmd.Length != 3) 284 if (cmd.Length != 3)
269 { 285 {
@@ -277,7 +293,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
277 293
278 lock (m_scenes) 294 lock (m_scenes)
279 { 295 {
280 foreach (Scene scene in m_scenes.Values) 296 foreach (Scene scene in m_scenes)
281 { 297 {
282 scene.ForEachRootScenePresence( 298 scene.ForEachRootScenePresence(
283 sp => 299 sp =>
@@ -304,5 +320,163 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
304 string.Join(", ", matchedAvatars.ToList().ConvertAll<string>(sp => sp.Name).ToArray())); 320 string.Join(", ", matchedAvatars.ToList().ConvertAll<string>(sp => sp.Name).ToArray()));
305 } 321 }
306 } 322 }
323
324 protected void HandleShowWearablesCommand(string module, string[] cmd)
325 {
326 if (cmd.Length != 2 && cmd.Length < 4)
327 {
328 MainConsole.Instance.OutputFormat("Usage: wearables show [<first-name> <last-name>]");
329 return;
330 }
331
332 bool targetNameSupplied = false;
333 string optionalTargetFirstName = null;
334 string optionalTargetLastName = null;
335
336 if (cmd.Length >= 4)
337 {
338 targetNameSupplied = true;
339 optionalTargetFirstName = cmd[2];
340 optionalTargetLastName = cmd[3];
341 }
342
343 StringBuilder sb = new StringBuilder();
344
345 if (targetNameSupplied)
346 {
347 lock (m_scenes)
348 {
349 foreach (Scene scene in m_scenes)
350 {
351 ScenePresence sp = scene.GetScenePresence(optionalTargetFirstName, optionalTargetLastName);
352 if (sp != null && !sp.IsChildAgent)
353 AppendWearablesDetailReport(sp, sb);
354 }
355 }
356 }
357 else
358 {
359 ConsoleDisplayTable cdt = new ConsoleDisplayTable();
360 cdt.AddColumn("Name", ConsoleDisplayUtil.UserNameSize);
361 cdt.AddColumn("Wearables", 2);
362
363 lock (m_scenes)
364 {
365 foreach (Scene scene in m_scenes)
366 {
367 scene.ForEachRootScenePresence(
368 sp =>
369 {
370 int count = 0;
371
372 for (int i = (int)WearableType.Shape; i < (int)WearableType.Physics; i++)
373 count += sp.Appearance.Wearables[i].Count;
374
375 cdt.AddRow(sp.Name, count);
376 }
377 );
378 }
379 }
380
381 sb.Append(cdt.ToString());
382 }
383
384 MainConsole.Instance.Output(sb.ToString());
385 }
386
387 private void HandleCheckWearablesCommand(string module, string[] cmd)
388 {
389 if (cmd.Length != 4)
390 {
391 MainConsole.Instance.OutputFormat("Usage: wearables check <first-name> <last-name>");
392 return;
393 }
394
395 string firstname = cmd[2];
396 string lastname = cmd[3];
397
398 StringBuilder sb = new StringBuilder();
399 UuidGatherer uuidGatherer = new UuidGatherer(m_scenes[0].AssetService);
400
401 lock (m_scenes)
402 {
403 foreach (Scene scene in m_scenes)
404 {
405 ScenePresence sp = scene.GetScenePresence(firstname, lastname);
406 if (sp != null && !sp.IsChildAgent)
407 {
408 sb.AppendFormat("Wearables checks for {0}\n\n", sp.Name);
409
410 for (int i = (int)WearableType.Shape; i < (int)WearableType.Physics; i++)
411 {
412 AvatarWearable aw = sp.Appearance.Wearables[i];
413
414 if (aw.Count > 0)
415 {
416 sb.Append(Enum.GetName(typeof(WearableType), i));
417 sb.Append("\n");
418
419 for (int j = 0; j < aw.Count; j++)
420 {
421 WearableItem wi = aw[j];
422
423 ConsoleDisplayList cdl = new ConsoleDisplayList();
424 cdl.Indent = 2;
425 cdl.AddRow("Item UUID", wi.ItemID);
426 cdl.AddRow("Assets", "");
427 sb.Append(cdl.ToString());
428
429 uuidGatherer.AddForInspection(wi.AssetID);
430 uuidGatherer.GatherAll();
431 string[] assetStrings
432 = Array.ConvertAll<UUID, string>(uuidGatherer.GatheredUuids.Keys.ToArray(), u => u.ToString());
433
434 bool[] existChecks = scene.AssetService.AssetsExist(assetStrings);
435
436 ConsoleDisplayTable cdt = new ConsoleDisplayTable();
437 cdt.Indent = 4;
438 cdt.AddColumn("Type", 10);
439 cdt.AddColumn("UUID", ConsoleDisplayUtil.UuidSize);
440 cdt.AddColumn("Found", 5);
441
442 for (int k = 0; k < existChecks.Length; k++)
443 cdt.AddRow(
444 (AssetType)uuidGatherer.GatheredUuids[new UUID(assetStrings[k])],
445 assetStrings[k], existChecks[k] ? "yes" : "no");
446
447 sb.Append(cdt.ToString());
448 sb.Append("\n");
449 }
450 }
451 }
452 }
453 }
454 }
455
456 MainConsole.Instance.Output(sb.ToString());
457 }
458
459 private void AppendWearablesDetailReport(ScenePresence sp, StringBuilder sb)
460 {
461 sb.AppendFormat("\nWearables for {0}\n", sp.Name);
462
463 ConsoleDisplayTable cdt = new ConsoleDisplayTable();
464 cdt.AddColumn("Type", 10);
465 cdt.AddColumn("Item UUID", ConsoleDisplayUtil.UuidSize);
466 cdt.AddColumn("Asset UUID", ConsoleDisplayUtil.UuidSize);
467
468 for (int i = (int)WearableType.Shape; i < (int)WearableType.Physics; i++)
469 {
470 AvatarWearable aw = sp.Appearance.Wearables[i];
471
472 for (int j = 0; j < aw.Count; j++)
473 {
474 WearableItem wi = aw[j];
475 cdt.AddRow(Enum.GetName(typeof(WearableType), i), wi.ItemID, wi.AssetID);
476 }
477 }
478
479 sb.Append(cdt.ToString());
480 }
307 } 481 }
308} \ No newline at end of file 482} \ No newline at end of file
diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs
index f5bd44d..6985371 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs
@@ -109,10 +109,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
109 109
110 internal int m_resetk = 0; 110 internal int m_resetk = 0;
111 111
112 // Working threads
113
114 private Thread m_listener = null;
115
116 private Object msyncConnect = new Object(); 112 private Object msyncConnect = new Object();
117 113
118 internal bool m_randomizeNick = true; // add random suffix 114 internal bool m_randomizeNick = true; // add random suffix
@@ -363,10 +359,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
363 359
364 m_log.InfoFormat("[IRC-Connector-{0}]: Connected to {1}:{2}", idn, m_server, m_port); 360 m_log.InfoFormat("[IRC-Connector-{0}]: Connected to {1}:{2}", idn, m_server, m_port);
365 361
366 m_listener = new Thread(new ThreadStart(ListenerRun)); 362 WorkManager.StartThread(ListenerRun, "IRCConnectionListenerThread", ThreadPriority.Normal, true, false);
367 m_listener.Name = "IRCConnectorListenerThread";
368 m_listener.IsBackground = true;
369 m_listener.Start();
370 363
371 // This is the message order recommended by RFC 2812 364 // This is the message order recommended by RFC 2812
372 if (m_password != null) 365 if (m_password != null)
@@ -510,21 +503,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
510 { 503 {
511 while (m_enabled && m_connected) 504 while (m_enabled && m_connected)
512 { 505 {
513
514 if ((inputLine = m_reader.ReadLine()) == null) 506 if ((inputLine = m_reader.ReadLine()) == null)
515 throw new Exception("Listener input socket closed"); 507 throw new Exception("Listener input socket closed");
516 508
509 Watchdog.UpdateThread();
510
517 // m_log.Info("[IRCConnector]: " + inputLine); 511 // m_log.Info("[IRCConnector]: " + inputLine);
518 512
519 if (inputLine.Contains("PRIVMSG")) 513 if (inputLine.Contains("PRIVMSG"))
520 { 514 {
521
522 Dictionary<string, string> data = ExtractMsg(inputLine); 515 Dictionary<string, string> data = ExtractMsg(inputLine);
523 516
524 // Any chat ??? 517 // Any chat ???
525 if (data != null) 518 if (data != null)
526 { 519 {
527
528 OSChatMessage c = new OSChatMessage(); 520 OSChatMessage c = new OSChatMessage();
529 c.Message = data["msg"]; 521 c.Message = data["msg"];
530 c.Type = ChatTypeEnum.Region; 522 c.Type = ChatTypeEnum.Region;
@@ -540,9 +532,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
540 c.Message = String.Format("/me {0}", c.Message.Substring(8, c.Message.Length - 9)); 532 c.Message = String.Format("/me {0}", c.Message.Substring(8, c.Message.Length - 9));
541 533
542 ChannelState.OSChat(this, c, false); 534 ChannelState.OSChat(this, c, false);
543
544 } 535 }
545
546 } 536 }
547 else 537 else
548 { 538 {
@@ -562,6 +552,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
562 552
563 if (m_enabled && (m_resetk == resetk)) 553 if (m_enabled && (m_resetk == resetk))
564 Reconnect(); 554 Reconnect();
555
556 Watchdog.RemoveThread();
565 } 557 }
566 558
567 private Regex RE = new Regex(@":(?<nick>[\w-]*)!(?<user>\S*) PRIVMSG (?<channel>\S+) :(?<msg>.*)", 559 private Regex RE = new Regex(@":(?<nick>[\w-]*)!(?<user>\S*) PRIVMSG (?<channel>\S+) :(?<msg>.*)",
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
index 2b33084..3db0781 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
@@ -65,7 +65,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
65 // Capability string prefixes 65 // Capability string prefixes
66 private static readonly string m_parcelVoiceInfoRequestPath = "0207/"; 66 private static readonly string m_parcelVoiceInfoRequestPath = "0207/";
67 private static readonly string m_provisionVoiceAccountRequestPath = "0208/"; 67 private static readonly string m_provisionVoiceAccountRequestPath = "0208/";
68 private static readonly string m_chatSessionRequestPath = "0209/"; 68 //private static readonly string m_chatSessionRequestPath = "0209/";
69 69
70 // Control info 70 // Control info
71 private static bool m_Enabled = false; 71 private static bool m_Enabled = false;
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs
index e6b14c6..f51527e 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs
@@ -92,7 +92,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice
92 // Capability strings 92 // Capability strings
93 private static readonly string m_parcelVoiceInfoRequestPath = "0107/"; 93 private static readonly string m_parcelVoiceInfoRequestPath = "0107/";
94 private static readonly string m_provisionVoiceAccountRequestPath = "0108/"; 94 private static readonly string m_provisionVoiceAccountRequestPath = "0108/";
95 private static readonly string m_chatSessionRequestPath = "0109/"; 95 //private static readonly string m_chatSessionRequestPath = "0109/";
96 96
97 // Control info, e.g. vivox server, admin user, admin password 97 // Control info, e.g. vivox server, admin user, admin password
98 private static bool m_pluginEnabled = false; 98 private static bool m_pluginEnabled = false;
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
index 2802e2f..e1b6abb 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs
@@ -55,8 +55,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
55 private IGroupsServicesConnector m_groupData = null; 55 private IGroupsServicesConnector m_groupData = null;
56 56
57 // Config Options 57 // Config Options
58 private bool m_groupMessagingEnabled = false; 58 private bool m_groupMessagingEnabled;
59 private bool m_debugEnabled = true; 59 private bool m_debugEnabled;
60 60
61 /// <summary> 61 /// <summary>
62 /// If enabled, module only tries to send group IMs to online users by querying cached presence information. 62 /// If enabled, module only tries to send group IMs to online users by querying cached presence information.
@@ -113,7 +113,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
113 if (m_messageOnlineAgentsOnly) 113 if (m_messageOnlineAgentsOnly)
114 m_usersOnlineCache = new ExpiringCache<UUID, PresenceInfo[]>(); 114 m_usersOnlineCache = new ExpiringCache<UUID, PresenceInfo[]>();
115 115
116 m_debugEnabled = groupsConfig.GetBoolean("DebugEnabled", true); 116 m_debugEnabled = groupsConfig.GetBoolean("MessagingDebugEnabled", m_debugEnabled);
117 } 117 }
118 118
119 m_log.InfoFormat( 119 m_log.InfoFormat(
@@ -127,6 +127,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
127 return; 127 return;
128 128
129 scene.RegisterModuleInterface<IGroupsMessagingModule>(this); 129 scene.RegisterModuleInterface<IGroupsMessagingModule>(this);
130
131 scene.AddCommand(
132 "Debug",
133 this,
134 "debug groups messaging verbose",
135 "debug groups messaging verbose <true|false>",
136 "This setting turns on very verbose groups messaging debugging",
137 HandleDebugGroupsMessagingVerbose);
130 } 138 }
131 139
132 public void RegionLoaded(Scene scene) 140 public void RegionLoaded(Scene scene)
@@ -218,6 +226,26 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
218 226
219 #endregion 227 #endregion
220 228
229 private void HandleDebugGroupsMessagingVerbose(object modules, string[] args)
230 {
231 if (args.Length < 5)
232 {
233 MainConsole.Instance.Output("Usage: debug groups messaging verbose <true|false>");
234 return;
235 }
236
237 bool verbose = false;
238 if (!bool.TryParse(args[4], out verbose))
239 {
240 MainConsole.Instance.Output("Usage: debug groups messaging verbose <true|false>");
241 return;
242 }
243
244 m_debugEnabled = verbose;
245
246 MainConsole.Instance.OutputFormat("{0} verbose logging set to {1}", Name, m_debugEnabled);
247 }
248
221 /// <summary> 249 /// <summary>
222 /// Not really needed, but does confirm that the group exists. 250 /// Not really needed, but does confirm that the group exists.
223 /// </summary> 251 /// </summary>
@@ -237,11 +265,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
237 return false; 265 return false;
238 } 266 }
239 } 267 }
240 268
241 public void SendMessageToGroup(GridInstantMessage im, UUID groupID) 269 public void SendMessageToGroup(GridInstantMessage im, UUID groupID)
242 { 270 {
243 List<GroupMembersData> groupMembers = m_groupData.GetGroupMembers(new UUID(im.fromAgentID), groupID); 271 SendMessageToGroup(im, groupID, new UUID(im.fromAgentID), null);
272 }
273
274 public void SendMessageToGroup(
275 GridInstantMessage im, UUID groupID, UUID sendingAgentForGroupCalls, Func<GroupMembersData, bool> sendCondition)
276 {
277 int requestStartTick = Environment.TickCount;
278
279 List<GroupMembersData> groupMembers = m_groupData.GetGroupMembers(sendingAgentForGroupCalls, groupID);
244 int groupMembersCount = groupMembers.Count; 280 int groupMembersCount = groupMembers.Count;
281 HashSet<string> attemptDeliveryUuidSet = null;
245 282
246 if (m_messageOnlineAgentsOnly) 283 if (m_messageOnlineAgentsOnly)
247 { 284 {
@@ -257,10 +294,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
257 m_usersOnlineCache.Add(groupID, onlineAgents, m_usersOnlineCacheExpirySeconds); 294 m_usersOnlineCache.Add(groupID, onlineAgents, m_usersOnlineCacheExpirySeconds);
258 } 295 }
259 296
260 HashSet<string> onlineAgentsUuidSet = new HashSet<string>(); 297 attemptDeliveryUuidSet
261 Array.ForEach<PresenceInfo>(onlineAgents, pi => onlineAgentsUuidSet.Add(pi.UserID)); 298 = new HashSet<string>(Array.ConvertAll<PresenceInfo, string>(onlineAgents, pi => pi.UserID));
299
300 //Array.ForEach<PresenceInfo>(onlineAgents, pi => attemptDeliveryUuidSet.Add(pi.UserID));
262 301
263 groupMembers = groupMembers.Where(gmd => onlineAgentsUuidSet.Contains(gmd.AgentID.ToString())).ToList(); 302 //groupMembers = groupMembers.Where(gmd => onlineAgentsUuidSet.Contains(gmd.AgentID.ToString())).ToList();
264 303
265 // if (m_debugEnabled) 304 // if (m_debugEnabled)
266// m_log.DebugFormat( 305// m_log.DebugFormat(
@@ -269,26 +308,42 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
269 } 308 }
270 else 309 else
271 { 310 {
311 attemptDeliveryUuidSet
312 = new HashSet<string>(groupMembers.ConvertAll<string>(gmd => gmd.AgentID.ToString()));
313
272 if (m_debugEnabled) 314 if (m_debugEnabled)
273 m_log.DebugFormat( 315 m_log.DebugFormat(
274 "[GROUPS-MESSAGING]: SendMessageToGroup called for group {0} with {1} visible members", 316 "[GROUPS-MESSAGING]: SendMessageToGroup called for group {0} with {1} visible members",
275 groupID, groupMembers.Count); 317 groupID, groupMembers.Count);
276 } 318 }
277
278 int requestStartTick = Environment.TickCount;
279 319
280 foreach (GroupMembersData member in groupMembers) 320 foreach (GroupMembersData member in groupMembers)
281 { 321 {
282 if (m_groupData.hasAgentDroppedGroupChatSession(member.AgentID, groupID)) 322 if (sendCondition != null)
323 {
324 if (!sendCondition(member))
325 {
326 if (m_debugEnabled)
327 m_log.DebugFormat(
328 "[GROUPS-MESSAGING]: Not sending to {0} as they do not fulfill send condition",
329 member.AgentID);
330
331 continue;
332 }
333 }
334 else if (m_groupData.hasAgentDroppedGroupChatSession(member.AgentID, groupID))
283 { 335 {
284 // Don't deliver messages to people who have dropped this session 336 // Don't deliver messages to people who have dropped this session
285 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} has dropped session, not delivering to them", member.AgentID); 337 if (m_debugEnabled)
338 m_log.DebugFormat(
339 "[GROUPS-MESSAGING]: {0} has dropped session, not delivering to them", member.AgentID);
340
286 continue; 341 continue;
287 } 342 }
288 343
289 // Copy Message 344 // Copy Message
290 GridInstantMessage msg = new GridInstantMessage(); 345 GridInstantMessage msg = new GridInstantMessage();
291 msg.imSessionID = groupID.Guid; 346 msg.imSessionID = im.imSessionID;
292 msg.fromAgentName = im.fromAgentName; 347 msg.fromAgentName = im.fromAgentName;
293 msg.message = im.message; 348 msg.message = im.message;
294 msg.dialog = im.dialog; 349 msg.dialog = im.dialog;
@@ -304,26 +359,51 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
304 359
305 msg.toAgentID = member.AgentID.Guid; 360 msg.toAgentID = member.AgentID.Guid;
306 361
307 IClientAPI client = GetActiveClient(member.AgentID); 362 if (attemptDeliveryUuidSet.Contains(member.AgentID.ToString()))
308 if (client == null)
309 { 363 {
310 // If they're not local, forward across the grid 364 IClientAPI client = GetActiveClient(member.AgentID);
311 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Delivering to {0} via Grid", member.AgentID); 365 if (client == null)
312 m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { }); 366 {
367 int startTick = Environment.TickCount;
368
369 // If they're not local, forward across the grid
370 m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { });
371
372 if (m_debugEnabled)
373 m_log.DebugFormat(
374 "[GROUPS-MESSAGING]: Delivering to {0} via grid took {1} ms",
375 member.AgentID, Environment.TickCount - startTick);
376 }
377 else
378 {
379 int startTick = Environment.TickCount;
380
381 ProcessMessageFromGroupSession(msg, client);
382
383 // Deliver locally, directly
384 if (m_debugEnabled)
385 m_log.DebugFormat(
386 "[GROUPS-MESSAGING]: Delivering to {0} locally took {1} ms",
387 member.AgentID, Environment.TickCount - startTick);
388 }
313 } 389 }
314 else 390 else
315 { 391 {
316 // Deliver locally, directly 392 int startTick = Environment.TickCount;
317 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Passing to ProcessMessageFromGroupSession to deliver to {0} locally", client.Name); 393
318 ProcessMessageFromGroupSession(msg); 394 m_msgTransferModule.HandleUndeliverableMessage(msg, delegate(bool success) { });
395
396 if (m_debugEnabled)
397 m_log.DebugFormat(
398 "[GROUPS-MESSAGING]: Handling undeliverable message for {0} took {1} ms",
399 member.AgentID, Environment.TickCount - startTick);
319 } 400 }
320 } 401 }
321 402
322 // Temporary for assessing how long it still takes to send messages to large online groups. 403 if (m_debugEnabled)
323 if (m_messageOnlineAgentsOnly)
324 m_log.DebugFormat( 404 m_log.DebugFormat(
325 "[GROUPS-MESSAGING]: SendMessageToGroup for group {0} with {1} visible members, {2} online took {3}ms", 405 "[GROUPS-MESSAGING]: Total SendMessageToGroup for group {0} with {1} members, {2} candidates for delivery took {3} ms",
326 groupID, groupMembersCount, groupMembers.Count(), Environment.TickCount - requestStartTick); 406 groupID, groupMembersCount, attemptDeliveryUuidSet.Count(), Environment.TickCount - requestStartTick);
327 } 407 }
328 408
329 #region SimGridEventHandlers 409 #region SimGridEventHandlers
@@ -348,7 +428,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
348 // Any other message type will not be delivered to a client by the 428 // Any other message type will not be delivered to a client by the
349 // Instant Message Module 429 // Instant Message Module
350 430
351
352 if (m_debugEnabled) 431 if (m_debugEnabled)
353 { 432 {
354 m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 433 m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
@@ -362,13 +441,35 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
362 || (msg.dialog == (byte)InstantMessageDialog.SessionAdd) 441 || (msg.dialog == (byte)InstantMessageDialog.SessionAdd)
363 || (msg.dialog == (byte)InstantMessageDialog.SessionDrop))) 442 || (msg.dialog == (byte)InstantMessageDialog.SessionDrop)))
364 { 443 {
365 ProcessMessageFromGroupSession(msg); 444 IClientAPI client = null;
445
446 if (msg.dialog == (byte)InstantMessageDialog.SessionSend)
447 {
448 client = GetActiveClient(new UUID(msg.toAgentID));
449
450 if (client != null)
451 {
452 if (m_debugEnabled)
453 m_log.DebugFormat("[GROUPS-MESSAGING]: Delivering to {0} locally", client.Name);
454 }
455 else
456 {
457 m_log.WarnFormat("[GROUPS-MESSAGING]: Received a message over the grid for a client that isn't here: {0}", msg.toAgentID);
458
459 return;
460 }
461 }
462
463 ProcessMessageFromGroupSession(msg, client);
366 } 464 }
367 } 465 }
368 466
369 private void ProcessMessageFromGroupSession(GridInstantMessage msg) 467 private void ProcessMessageFromGroupSession(GridInstantMessage msg, IClientAPI client)
370 { 468 {
371 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Session message from {0} going to agent {1}", msg.fromAgentName, msg.toAgentID); 469 if (m_debugEnabled)
470 m_log.DebugFormat(
471 "[GROUPS-MESSAGING]: Session message from {0} going to agent {1}, sessionID {2}, type {3}",
472 msg.fromAgentName, msg.toAgentID, msg.imSessionID, (InstantMessageDialog)msg.dialog);
372 473
373 UUID AgentID = new UUID(msg.fromAgentID); 474 UUID AgentID = new UUID(msg.fromAgentID);
374 UUID GroupID = new UUID(msg.imSessionID); 475 UUID GroupID = new UUID(msg.imSessionID);
@@ -392,74 +493,62 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
392 // Add them to the session for now, and Invite them 493 // Add them to the session for now, and Invite them
393 m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID); 494 m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID);
394 495
395 UUID toAgentID = new UUID(msg.toAgentID); 496 GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null);
396 IClientAPI activeClient = GetActiveClient(toAgentID); 497 if (groupInfo != null)
397 if (activeClient != null)
398 { 498 {
399 GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null); 499 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Sending chatterbox invite instant message");
400 if (groupInfo != null) 500
401 { 501 // Force? open the group session dialog???
402 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Sending chatterbox invite instant message"); 502 // and simultanously deliver the message, so we don't need to do a seperate client.SendInstantMessage(msg);
403 503 IEventQueue eq = client.Scene.RequestModuleInterface<IEventQueue>();
404 // Force? open the group session dialog??? 504 eq.ChatterboxInvitation(
405 // and simultanously deliver the message, so we don't need to do a seperate client.SendInstantMessage(msg); 505 GroupID
406 IEventQueue eq = activeClient.Scene.RequestModuleInterface<IEventQueue>(); 506 , groupInfo.GroupName
407 eq.ChatterboxInvitation( 507 , new UUID(msg.fromAgentID)
408 GroupID 508 , msg.message
409 , groupInfo.GroupName 509 , new UUID(msg.toAgentID)
410 , new UUID(msg.fromAgentID) 510 , msg.fromAgentName
411 , msg.message 511 , msg.dialog
412 , new UUID(msg.toAgentID) 512 , msg.timestamp
413 , msg.fromAgentName 513 , msg.offline == 1
414 , msg.dialog 514 , (int)msg.ParentEstateID
415 , msg.timestamp 515 , msg.Position
416 , msg.offline == 1 516 , 1
417 , (int)msg.ParentEstateID 517 , new UUID(msg.imSessionID)
418 , msg.Position 518 , msg.fromGroup
419 , 1 519 , Utils.StringToBytes(groupInfo.GroupName)
420 , new UUID(msg.imSessionID) 520 );
421 , msg.fromGroup 521
422 , Utils.StringToBytes(groupInfo.GroupName) 522 eq.ChatterBoxSessionAgentListUpdates(
423 ); 523 new UUID(GroupID)
424 524 , new UUID(msg.fromAgentID)
425 eq.ChatterBoxSessionAgentListUpdates( 525 , new UUID(msg.toAgentID)
426 new UUID(GroupID) 526 , false //canVoiceChat
427 , new UUID(msg.fromAgentID) 527 , false //isModerator
428 , new UUID(msg.toAgentID) 528 , false //text mute
429 , false //canVoiceChat 529 );
430 , false //isModerator
431 , false //text mute
432 );
433 }
434 } 530 }
531
532 break;
435 } 533 }
436 else if (!m_groupData.hasAgentDroppedGroupChatSession(AgentID, GroupID)) 534 else if (!m_groupData.hasAgentDroppedGroupChatSession(AgentID, GroupID))
437 { 535 {
438 // User hasn't dropped, so they're in the session, 536 // User hasn't dropped, so they're in the session,
439 // maybe we should deliver it. 537 // maybe we should deliver it.
440 IClientAPI client = GetActiveClient(new UUID(msg.toAgentID)); 538 client.SendInstantMessage(msg);
441 if (client != null)
442 {
443 // Deliver locally, directly
444 if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Delivering to {0} locally", client.Name);
445 client.SendInstantMessage(msg);
446 }
447 else
448 {
449 m_log.WarnFormat("[GROUPS-MESSAGING]: Received a message over the grid for a client that isn't here: {0}", msg.toAgentID);
450 }
451 } 539 }
540
452 break; 541 break;
453 542
454 default: 543 default:
455 m_log.WarnFormat("[GROUPS-MESSAGING]: I don't know how to proccess a {0} message.", ((InstantMessageDialog)msg.dialog).ToString()); 544 client.SendInstantMessage(msg);
456 break; 545
546 break;;
457 } 547 }
458 } 548 }
459 549
460 #endregion 550 #endregion
461 551
462
463 #region ClientEvents 552 #region ClientEvents
464 private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im) 553 private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im)
465 { 554 {
@@ -548,15 +637,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
548 // Don't log any normal IMs (privacy!) 637 // Don't log any normal IMs (privacy!)
549 if (m_debugEnabled && im.dialog != (byte)InstantMessageDialog.MessageFromAgent) 638 if (m_debugEnabled && im.dialog != (byte)InstantMessageDialog.MessageFromAgent)
550 { 639 {
551 m_log.WarnFormat("[GROUPS-MESSAGING]: IM: fromGroup({0})", im.fromGroup ? "True" : "False"); 640 m_log.DebugFormat("[GROUPS-MESSAGING]: IM: fromGroup({0})", im.fromGroup ? "True" : "False");
552 m_log.WarnFormat("[GROUPS-MESSAGING]: IM: Dialog({0})", ((InstantMessageDialog)im.dialog).ToString()); 641 m_log.DebugFormat("[GROUPS-MESSAGING]: IM: Dialog({0})", (InstantMessageDialog)im.dialog);
553 m_log.WarnFormat("[GROUPS-MESSAGING]: IM: fromAgentID({0})", im.fromAgentID.ToString()); 642 m_log.DebugFormat("[GROUPS-MESSAGING]: IM: fromAgentID({0})", im.fromAgentID);
554 m_log.WarnFormat("[GROUPS-MESSAGING]: IM: fromAgentName({0})", im.fromAgentName.ToString()); 643 m_log.DebugFormat("[GROUPS-MESSAGING]: IM: fromAgentName({0})", im.fromAgentName);
555 m_log.WarnFormat("[GROUPS-MESSAGING]: IM: imSessionID({0})", im.imSessionID.ToString()); 644 m_log.DebugFormat("[GROUPS-MESSAGING]: IM: imSessionID({0})", im.imSessionID);
556 m_log.WarnFormat("[GROUPS-MESSAGING]: IM: message({0})", im.message.ToString()); 645 m_log.DebugFormat("[GROUPS-MESSAGING]: IM: message({0})", im.message);
557 m_log.WarnFormat("[GROUPS-MESSAGING]: IM: offline({0})", im.offline.ToString()); 646 m_log.DebugFormat("[GROUPS-MESSAGING]: IM: offline({0})", im.offline);
558 m_log.WarnFormat("[GROUPS-MESSAGING]: IM: toAgentID({0})", im.toAgentID.ToString()); 647 m_log.DebugFormat("[GROUPS-MESSAGING]: IM: toAgentID({0})", im.toAgentID);
559 m_log.WarnFormat("[GROUPS-MESSAGING]: IM: binaryBucket({0})", OpenMetaverse.Utils.BytesToHexString(im.binaryBucket, "BinaryBucket")); 648 m_log.DebugFormat("[GROUPS-MESSAGING]: IM: binaryBucket({0})", OpenMetaverse.Utils.BytesToHexString(im.binaryBucket, "BinaryBucket"));
560 } 649 }
561 } 650 }
562 651
@@ -567,7 +656,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
567 /// </summary> 656 /// </summary>
568 private IClientAPI GetActiveClient(UUID agentID) 657 private IClientAPI GetActiveClient(UUID agentID)
569 { 658 {
570 if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Looking for local client {0}", agentID); 659 if (m_debugEnabled)
660 m_log.DebugFormat("[GROUPS-MESSAGING]: Looking for local client {0}", agentID);
571 661
572 IClientAPI child = null; 662 IClientAPI child = null;
573 663
@@ -579,12 +669,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
579 { 669 {
580 if (!sp.IsChildAgent) 670 if (!sp.IsChildAgent)
581 { 671 {
582 if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Found root agent for client : {0}", sp.ControllingClient.Name); 672 if (m_debugEnabled)
673 m_log.DebugFormat("[GROUPS-MESSAGING]: Found root agent for client : {0}", sp.ControllingClient.Name);
674
583 return sp.ControllingClient; 675 return sp.ControllingClient;
584 } 676 }
585 else 677 else
586 { 678 {
587 if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Found child agent for client : {0}", sp.ControllingClient.Name); 679 if (m_debugEnabled)
680 m_log.DebugFormat("[GROUPS-MESSAGING]: Found child agent for client : {0}", sp.ControllingClient.Name);
681
588 child = sp.ControllingClient; 682 child = sp.ControllingClient;
589 } 683 }
590 } 684 }
@@ -593,12 +687,15 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
593 // If we didn't find a root, then just return whichever child we found, or null if none 687 // If we didn't find a root, then just return whichever child we found, or null if none
594 if (child == null) 688 if (child == null)
595 { 689 {
596 if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Could not find local client for agent : {0}", agentID); 690 if (m_debugEnabled)
691 m_log.DebugFormat("[GROUPS-MESSAGING]: Could not find local client for agent : {0}", agentID);
597 } 692 }
598 else 693 else
599 { 694 {
600 if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Returning child agent for client : {0}", child.Name); 695 if (m_debugEnabled)
696 m_log.DebugFormat("[GROUPS-MESSAGING]: Returning child agent for client : {0}", child.Name);
601 } 697 }
698
602 return child; 699 return child;
603 } 700 }
604 701
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
index 2764465..0512e48 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
@@ -77,9 +77,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
77 77
78 private List<Scene> m_sceneList = new List<Scene>(); 78 private List<Scene> m_sceneList = new List<Scene>();
79 79
80 private IMessageTransferModule m_msgTransferModule = null; 80 private IMessageTransferModule m_msgTransferModule;
81
82 private IGroupsMessagingModule m_groupsMessagingModule;
81 83
82 private IGroupsServicesConnector m_groupData = null; 84 private IGroupsServicesConnector m_groupData;
83 85
84 // Configuration settings 86 // Configuration settings
85 private bool m_groupsEnabled = false; 87 private bool m_groupsEnabled = false;
@@ -185,10 +187,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
185 if (m_msgTransferModule == null) 187 if (m_msgTransferModule == null)
186 { 188 {
187 m_groupsEnabled = false; 189 m_groupsEnabled = false;
188 m_log.Warn("[GROUPS]: Could not get MessageTransferModule"); 190 m_log.Warn("[GROUPS]: Could not get IMessageTransferModule");
189 } 191 }
190 } 192 }
191 193
194 if (m_groupsMessagingModule == null)
195 {
196 m_groupsMessagingModule = scene.RequestModuleInterface<IGroupsMessagingModule>();
197
198 // No message transfer module, no notices, group invites, rejects, ejects, etc
199 if (m_groupsMessagingModule == null)
200 m_log.Warn("[GROUPS]: Could not get IGroupsMessagingModule");
201 }
202
192 lock (m_sceneList) 203 lock (m_sceneList)
193 { 204 {
194 m_sceneList.Add(scene); 205 m_sceneList.Add(scene);
@@ -363,7 +374,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
363 374
364 private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im) 375 private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im)
365 { 376 {
366 if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 377 if (m_debugEnabled)
378 m_log.DebugFormat(
379 "[GROUPS]: {0} called for {1}, message type {2}",
380 System.Reflection.MethodBase.GetCurrentMethod().Name, remoteClient.Name, (InstantMessageDialog)im.dialog);
367 381
368 // Group invitations 382 // Group invitations
369 if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline)) 383 if ((im.dialog == (byte)InstantMessageDialog.GroupInvitationAccept) || (im.dialog == (byte)InstantMessageDialog.GroupInvitationDecline))
@@ -514,31 +528,38 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
514 OnNewGroupNotice(GroupID, NoticeID); 528 OnNewGroupNotice(GroupID, NoticeID);
515 } 529 }
516 530
517 // Send notice out to everyone that wants notices 531 if (m_debugEnabled)
518 foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetRequestingAgentID(remoteClient), GroupID))
519 { 532 {
520 if (m_debugEnabled) 533 foreach (GroupMembersData member in m_groupData.GetGroupMembers(GetRequestingAgentID(remoteClient), GroupID))
521 { 534 {
522 UserAccount targetUser = m_sceneList[0].UserAccountService.GetUserAccount(remoteClient.Scene.RegionInfo.ScopeID, member.AgentID); 535 if (m_debugEnabled)
523 if (targetUser != null)
524 { 536 {
525 m_log.DebugFormat("[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", NoticeID, targetUser.FirstName + " " + targetUser.LastName, member.AcceptNotices); 537 UserAccount targetUser
526 } 538 = m_sceneList[0].UserAccountService.GetUserAccount(
527 else 539 remoteClient.Scene.RegionInfo.ScopeID, member.AgentID);
528 { 540
529 m_log.DebugFormat("[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", NoticeID, member.AgentID, member.AcceptNotices); 541 if (targetUser != null)
542 {
543 m_log.DebugFormat(
544 "[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})",
545 NoticeID, targetUser.FirstName + " " + targetUser.LastName, member.AcceptNotices);
546 }
547 else
548 {
549 m_log.DebugFormat(
550 "[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})",
551 NoticeID, member.AgentID, member.AcceptNotices);
552 }
530 } 553 }
531 } 554 }
555 }
532 556
533 if (member.AcceptNotices) 557 GridInstantMessage msg
534 { 558 = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice);
535 // Build notice IM
536 GridInstantMessage msg = CreateGroupNoticeIM(UUID.Zero, NoticeID, (byte)OpenMetaverse.InstantMessageDialog.GroupNotice);
537 559
538 msg.toAgentID = member.AgentID.Guid; 560 if (m_groupsMessagingModule != null)
539 OutgoingInstantMessage(msg, member.AgentID); 561 m_groupsMessagingModule.SendMessageToGroup(
540 } 562 msg, GroupID, remoteClient.AgentId, gmd => gmd.AcceptNotices);
541 }
542 } 563 }
543 } 564 }
544 565
@@ -550,6 +571,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
550 571
551 UUID noticeID = new UUID(im.imSessionID); 572 UUID noticeID = new UUID(im.imSessionID);
552 573
574 if (m_debugEnabled)
575 m_log.DebugFormat("[GROUPS]: Requesting notice {0} for {1}", noticeID, remoteClient.AgentId);
576
553 GroupNoticeInfo notice = m_groupData.GetGroupNotice(GetRequestingAgentID(remoteClient), noticeID); 577 GroupNoticeInfo notice = m_groupData.GetGroupNotice(GetRequestingAgentID(remoteClient), noticeID);
554 if (notice != null) 578 if (notice != null)
555 { 579 {
@@ -559,17 +583,25 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
559 if (m_debugEnabled) 583 if (m_debugEnabled)
560 m_log.DebugFormat("[Groups]: Giving inventory from {0} to {1}", giver, remoteClient.AgentId); 584 m_log.DebugFormat("[Groups]: Giving inventory from {0} to {1}", giver, remoteClient.AgentId);
561 585
586 string message;
562 InventoryItemBase itemCopy = ((Scene)(remoteClient.Scene)).GiveInventoryItem(remoteClient.AgentId, 587 InventoryItemBase itemCopy = ((Scene)(remoteClient.Scene)).GiveInventoryItem(remoteClient.AgentId,
563 giver, attachmentUUID); 588 giver, attachmentUUID, out message);
564 589
565 if (itemCopy == null) 590 if (itemCopy == null)
566 { 591 {
567 remoteClient.SendAgentAlertMessage("Can't find item to give. Nothing given.", false); 592 remoteClient.SendAgentAlertMessage(message, false);
568 return; 593 return;
569 } 594 }
570 595
571 remoteClient.SendInventoryItemCreateUpdate(itemCopy, 0); 596 remoteClient.SendInventoryItemCreateUpdate(itemCopy, 0);
572 } 597 }
598 else
599 {
600 if (m_debugEnabled)
601 m_log.DebugFormat(
602 "[GROUPS]: Could not find notice {0} for {1} on GroupNoticeInventoryAccepted.",
603 noticeID, remoteClient.AgentId);
604 }
573 } 605 }
574 606
575 // Interop, received special 210 code for ejecting a group member 607 // Interop, received special 210 code for ejecting a group member
@@ -1366,7 +1398,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1366 presence.Grouptitle = Title; 1398 presence.Grouptitle = Title;
1367 1399
1368 if (! presence.IsChildAgent) 1400 if (! presence.IsChildAgent)
1369 presence.SendAvatarDataToAllAgents(); 1401 presence.SendAvatarDataToAllClients();
1370 } 1402 }
1371 } 1403 }
1372 } 1404 }
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs
index 26d2597..e03e71d 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic;
30using System.Net; 31using System.Net;
31using System.Reflection; 32using System.Reflection;
32using Nini.Config; 33using Nini.Config;
@@ -40,11 +41,11 @@ using OpenSim.Framework.Communications;
40using OpenSim.Framework.Servers; 41using OpenSim.Framework.Servers;
41using OpenSim.Framework.Servers.HttpServer; 42using OpenSim.Framework.Servers.HttpServer;
42using OpenSim.Region.ClientStack.Linden; 43using OpenSim.Region.ClientStack.Linden;
44using OpenSim.Region.CoreModules.Avatar.InstantMessage;
43using OpenSim.Region.CoreModules.Framework; 45using OpenSim.Region.CoreModules.Framework;
44using OpenSim.Region.Framework.Scenes; 46using OpenSim.Region.Framework.Scenes;
45using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups; 47using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups;
46using OpenSim.Tests.Common; 48using OpenSim.Tests.Common;
47using OpenSim.Tests.Common.Mock;
48 49
49namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests 50namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests
50{ 51{
@@ -118,5 +119,150 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests
118 119
119 // TODO: More checking of more actual event data. 120 // TODO: More checking of more actual event data.
120 } 121 }
122
123 [Test]
124 public void TestSendGroupNotice()
125 {
126 TestHelpers.InMethod();
127// TestHelpers.EnableLogging();
128
129 TestScene scene = new SceneHelpers().SetupScene();
130
131 MessageTransferModule mtm = new MessageTransferModule();
132 GroupsModule gm = new GroupsModule();
133 GroupsMessagingModule gmm = new GroupsMessagingModule();
134 MockGroupsServicesConnector mgsc = new MockGroupsServicesConnector();
135
136 IConfigSource configSource = new IniConfigSource();
137
138 {
139 IConfig config = configSource.AddConfig("Messaging");
140 config.Set("MessageTransferModule", mtm.Name);
141 }
142
143 {
144 IConfig config = configSource.AddConfig("Groups");
145 config.Set("Enabled", true);
146 config.Set("Module", gm.Name);
147 config.Set("DebugEnabled", true);
148 config.Set("MessagingModule", gmm.Name);
149 config.Set("MessagingEnabled", true);
150 }
151
152 SceneHelpers.SetupSceneModules(scene, configSource, mgsc, mtm, gm, gmm);
153
154 UUID userId = TestHelpers.ParseTail(0x1);
155 string subjectText = "newman";
156 string messageText = "Hello";
157 string combinedSubjectMessage = string.Format("{0}|{1}", subjectText, messageText);
158
159 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
160 TestClient tc = (TestClient)sp.ControllingClient;
161
162 UUID groupID = gm.CreateGroup(tc, "group1", null, true, UUID.Zero, 0, true, true, true);
163 gm.JoinGroupRequest(tc, groupID);
164
165 // Create a second user who doesn't want to receive notices
166 ScenePresence sp2 = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x2));
167 TestClient tc2 = (TestClient)sp2.ControllingClient;
168 gm.JoinGroupRequest(tc2, groupID);
169 gm.SetGroupAcceptNotices(tc2, groupID, false, true);
170
171 List<GridInstantMessage> spReceivedMessages = new List<GridInstantMessage>();
172 tc.OnReceivedInstantMessage += im => spReceivedMessages.Add(im);
173
174 List<GridInstantMessage> sp2ReceivedMessages = new List<GridInstantMessage>();
175 tc2.OnReceivedInstantMessage += im => sp2ReceivedMessages.Add(im);
176
177 GridInstantMessage noticeIm = new GridInstantMessage();
178 noticeIm.fromAgentID = userId.Guid;
179 noticeIm.toAgentID = groupID.Guid;
180 noticeIm.message = combinedSubjectMessage;
181 noticeIm.dialog = (byte)InstantMessageDialog.GroupNotice;
182
183 tc.HandleImprovedInstantMessage(noticeIm);
184
185 Assert.That(spReceivedMessages.Count, Is.EqualTo(1));
186 Assert.That(spReceivedMessages[0].message, Is.EqualTo(combinedSubjectMessage));
187
188 List<GroupNoticeData> notices = mgsc.GetGroupNotices(UUID.Zero, groupID);
189 Assert.AreEqual(1, notices.Count);
190
191 // OpenSimulator (possibly also SL) transport the notice ID as the session ID!
192 Assert.AreEqual(notices[0].NoticeID.Guid, spReceivedMessages[0].imSessionID);
193
194 Assert.That(sp2ReceivedMessages.Count, Is.EqualTo(0));
195 }
196
197 /// <summary>
198 /// Run test with the MessageOnlineUsersOnly flag set.
199 /// </summary>
200 [Test]
201 public void TestSendGroupNoticeOnlineOnly()
202 {
203 TestHelpers.InMethod();
204 // TestHelpers.EnableLogging();
205
206 TestScene scene = new SceneHelpers().SetupScene();
207
208 MessageTransferModule mtm = new MessageTransferModule();
209 GroupsModule gm = new GroupsModule();
210 GroupsMessagingModule gmm = new GroupsMessagingModule();
211
212 IConfigSource configSource = new IniConfigSource();
213
214 {
215 IConfig config = configSource.AddConfig("Messaging");
216 config.Set("MessageTransferModule", mtm.Name);
217 }
218
219 {
220 IConfig config = configSource.AddConfig("Groups");
221 config.Set("Enabled", true);
222 config.Set("Module", gm.Name);
223 config.Set("DebugEnabled", true);
224 config.Set("MessagingModule", gmm.Name);
225 config.Set("MessagingEnabled", true);
226 config.Set("MessageOnlineUsersOnly", true);
227 }
228
229 SceneHelpers.SetupSceneModules(scene, configSource, new MockGroupsServicesConnector(), mtm, gm, gmm);
230
231 UUID userId = TestHelpers.ParseTail(0x1);
232 string subjectText = "newman";
233 string messageText = "Hello";
234 string combinedSubjectMessage = string.Format("{0}|{1}", subjectText, messageText);
235
236 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
237 TestClient tc = (TestClient)sp.ControllingClient;
238
239 UUID groupID = gm.CreateGroup(tc, "group1", null, true, UUID.Zero, 0, true, true, true);
240 gm.JoinGroupRequest(tc, groupID);
241
242 // Create a second user who doesn't want to receive notices
243 ScenePresence sp2 = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x2));
244 TestClient tc2 = (TestClient)sp2.ControllingClient;
245 gm.JoinGroupRequest(tc2, groupID);
246 gm.SetGroupAcceptNotices(tc2, groupID, false, true);
247
248 List<GridInstantMessage> spReceivedMessages = new List<GridInstantMessage>();
249 tc.OnReceivedInstantMessage += im => spReceivedMessages.Add(im);
250
251 List<GridInstantMessage> sp2ReceivedMessages = new List<GridInstantMessage>();
252 tc2.OnReceivedInstantMessage += im => sp2ReceivedMessages.Add(im);
253
254 GridInstantMessage noticeIm = new GridInstantMessage();
255 noticeIm.fromAgentID = userId.Guid;
256 noticeIm.toAgentID = groupID.Guid;
257 noticeIm.message = combinedSubjectMessage;
258 noticeIm.dialog = (byte)InstantMessageDialog.GroupNotice;
259
260 tc.HandleImprovedInstantMessage(noticeIm);
261
262 Assert.That(spReceivedMessages.Count, Is.EqualTo(1));
263 Assert.That(spReceivedMessages[0].message, Is.EqualTo(combinedSubjectMessage));
264
265 Assert.That(sp2ReceivedMessages.Count, Is.EqualTo(0));
266 }
121 } 267 }
122} \ No newline at end of file 268} \ No newline at end of file
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
index e28d0c2..a040f43 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
@@ -1012,7 +1012,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1012 Hashtable respData = (Hashtable)resp.Value; 1012 Hashtable respData = (Hashtable)resp.Value;
1013 if (respData.Contains("error") && !respData.Contains("succeed")) 1013 if (respData.Contains("error") && !respData.Contains("succeed"))
1014 { 1014 {
1015 LogRespDataToConsoleError(respData); 1015 LogRespDataToConsoleError(requestingAgentID, function, param, respData);
1016 } 1016 }
1017 1017
1018 return respData; 1018 return respData;
@@ -1040,20 +1040,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1040 return error; 1040 return error;
1041 } 1041 }
1042 1042
1043 private void LogRespDataToConsoleError(Hashtable respData) 1043 private void LogRespDataToConsoleError(UUID requestingAgentID, string function, Hashtable param, Hashtable respData)
1044 { 1044 {
1045 m_log.Error("[XMLRPC-GROUPS-CONNECTOR]: Error:"); 1045 m_log.ErrorFormat(
1046 1046 "[XMLRPC-GROUPS-CONNECTOR]: Error when calling {0} for {1} with params {2}. Response params are {3}",
1047 foreach (string key in respData.Keys) 1047 function, requestingAgentID, Util.PrettyFormatToSingleLine(param), Util.PrettyFormatToSingleLine(respData));
1048 {
1049 m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: Key: {0}", key);
1050
1051 string[] lines = respData[key].ToString().Split(new char[] { '\n' });
1052 foreach (string line in lines)
1053 {
1054 m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0}", line);
1055 }
1056 }
1057 } 1048 }
1058 1049
1059 /// <summary> 1050 /// <summary>
diff --git a/OpenSim/Region/OptionalModules/Example/BareBonesNonShared/BareBonesNonSharedModule.cs b/OpenSim/Region/OptionalModules/Example/BareBonesNonShared/BareBonesNonSharedModule.cs
index 0615036..bbf7168 100644
--- a/OpenSim/Region/OptionalModules/Example/BareBonesNonShared/BareBonesNonSharedModule.cs
+++ b/OpenSim/Region/OptionalModules/Example/BareBonesNonShared/BareBonesNonSharedModule.cs
@@ -37,7 +37,7 @@ using OpenSim.Region.Framework.Scenes;
37// specify its assembly. Otherwise, the region modules in the assembly will not be picked up when OpenSimulator scans 37// specify its assembly. Otherwise, the region modules in the assembly will not be picked up when OpenSimulator scans
38// the available DLLs 38// the available DLLs
39//[assembly: Addin("MyModule", "1.0")] 39//[assembly: Addin("MyModule", "1.0")]
40//[assembly: AddinDependency("OpenSim", "0.5")] 40//[assembly: AddinDependency("OpenSim", "0.8.1")]
41 41
42namespace OpenSim.Region.OptionalModules.Example.BareBonesNonShared 42namespace OpenSim.Region.OptionalModules.Example.BareBonesNonShared
43{ 43{
diff --git a/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs b/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs
index 811a263..46fea3e 100644
--- a/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs
+++ b/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs
@@ -37,7 +37,7 @@ using OpenSim.Region.Framework.Scenes;
37// specify its assembly. Otherwise, the region modules in the assembly will not be picked up when OpenSimulator scans 37// specify its assembly. Otherwise, the region modules in the assembly will not be picked up when OpenSimulator scans
38// the available DLLs 38// the available DLLs
39//[assembly: Addin("MyModule", "1.0")] 39//[assembly: Addin("MyModule", "1.0")]
40//[assembly: AddinDependency("OpenSim", "0.5")] 40//[assembly: AddinDependency("OpenSim", "0.8.1")]
41 41
42namespace OpenSim.Region.OptionalModules.Example.BareBonesShared 42namespace OpenSim.Region.OptionalModules.Example.BareBonesShared
43{ 43{
diff --git a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs
index afb788b..e95889d 100644
--- a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs
+++ b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs
@@ -50,7 +50,7 @@ using Ionic.Zlib;
50// specify its assembly. Otherwise, the region modules in the assembly will not be picked up when OpenSimulator scans 50// specify its assembly. Otherwise, the region modules in the assembly will not be picked up when OpenSimulator scans
51// the available DLLs 51// the available DLLs
52//[assembly: Addin("MaterialsModule", "1.0")] 52//[assembly: Addin("MaterialsModule", "1.0")]
53//[assembly: AddinDependency("OpenSim", "0.5")] 53//[assembly: AddinDependency("OpenSim", "0.8.1")]
54 54
55namespace OpenSim.Region.OptionalModules.Materials 55namespace OpenSim.Region.OptionalModules.Materials
56{ 56{
@@ -65,20 +65,23 @@ namespace OpenSim.Region.OptionalModules.Materials
65 65
66 private Scene m_scene = null; 66 private Scene m_scene = null;
67 private bool m_enabled = false; 67 private bool m_enabled = false;
68 private int m_maxMaterialsPerTransaction = 50;
68 69
69 public Dictionary<UUID, OSDMap> m_regionMaterials = new Dictionary<UUID, OSDMap>(); 70 public Dictionary<UUID, OSDMap> m_regionMaterials = new Dictionary<UUID, OSDMap>();
70 71
71 public void Initialise(IConfigSource source) 72 public void Initialise(IConfigSource source)
72 { 73 {
73 IConfig config = source.Configs["Materials"]; 74 m_enabled = true; // default is enabled
74 if (config == null)
75 return;
76 75
77 m_enabled = config.GetBoolean("enable_materials", true); 76 IConfig config = source.Configs["Materials"];
78 if (!m_enabled) 77 if (config != null)
79 return; 78 {
79 m_enabled = config.GetBoolean("enable_materials", m_enabled);
80 m_maxMaterialsPerTransaction = config.GetInt("MaxMaterialsPerTransaction", m_maxMaterialsPerTransaction);
81 }
80 82
81 m_log.DebugFormat("[Materials]: Initialized"); 83 if (m_enabled)
84 m_log.DebugFormat("[Materials]: Initialized");
82 } 85 }
83 86
84 public void Close() 87 public void Close()
@@ -146,6 +149,16 @@ namespace OpenSim.Region.OptionalModules.Materials
146 149
147 public void RegionLoaded(Scene scene) 150 public void RegionLoaded(Scene scene)
148 { 151 {
152 if (!m_enabled) return;
153
154 ISimulatorFeaturesModule featuresModule = scene.RequestModuleInterface<ISimulatorFeaturesModule>();
155 if (featuresModule != null)
156 featuresModule.OnSimulatorFeaturesRequest += OnSimulatorFeaturesRequest;
157 }
158
159 private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features)
160 {
161 features["MaxMaterialsPerTransaction"] = m_maxMaterialsPerTransaction;
149 } 162 }
150 163
151 /// <summary> 164 /// <summary>
@@ -216,7 +229,12 @@ namespace OpenSim.Region.OptionalModules.Materials
216 229
217 GetLegacyStoredMaterialsInPart(part); 230 GetLegacyStoredMaterialsInPart(part);
218 231
219 GetStoredMaterialInFace(part, te.DefaultTexture); 232 if (te.DefaultTexture != null)
233 GetStoredMaterialInFace(part, te.DefaultTexture);
234 else
235 m_log.WarnFormat(
236 "[Materials]: Default texture for part {0} (part of object {1}) in {2} unexpectedly null. Ignoring.",
237 part.Name, part.ParentGroup.Name, m_scene.Name);
220 238
221 foreach (Primitive.TextureEntryFace face in te.FaceTextures) 239 foreach (Primitive.TextureEntryFace face in te.FaceTextures)
222 { 240 {
diff --git a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
index 0bf23f1..d3c46c9 100644
--- a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
+++ b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
@@ -26,8 +26,9 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Reflection;
30using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Linq;
31using System.Reflection;
31using log4net; 32using log4net;
32using Mono.Addins; 33using Mono.Addins;
33using Nini.Config; 34using Nini.Config;
@@ -57,12 +58,10 @@ namespace OpenSim.Region.OptionalModules
57 58
58 public void Initialise(IConfigSource config) 59 public void Initialise(IConfigSource config)
59 { 60 {
60 //IConfig myConfig = config.Configs["Startup"];
61
62 string permissionModules = Util.GetConfigVarFromSections<string>(config, "permissionmodules", 61 string permissionModules = Util.GetConfigVarFromSections<string>(config, "permissionmodules",
63 new string[] { "Startup", "Permissions" }, "DefaultPermissionsModule"); 62 new string[] { "Startup", "Permissions" }, "DefaultPermissionsModule");
64 63
65 List<string> modules=new List<string>(permissionModules.Split(',')); 64 List<string> modules = new List<string>(permissionModules.Split(',').Select(m => m.Trim()));
66 65
67 if(!modules.Contains("PrimLimitsModule")) 66 if(!modules.Contains("PrimLimitsModule"))
68 return; 67 return;
@@ -103,20 +102,34 @@ namespace OpenSim.Region.OptionalModules
103 public void RegionLoaded(Scene scene) 102 public void RegionLoaded(Scene scene)
104 { 103 {
105 m_dialogModule = scene.RequestModuleInterface<IDialogModule>(); 104 m_dialogModule = scene.RequestModuleInterface<IDialogModule>();
106 } 105 }
107 106
108 private bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene) 107 private bool CanRezObject(int objectCount, UUID ownerID, Vector3 objectPosition, Scene scene)
109 { 108 {
110 ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y); 109 ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
111 int usedPrims = lo.PrimCounts.Total;
112 int simulatorCapacity = lo.GetSimulatorMaxPrimCount();
113 110
114 if (objectCount + usedPrims > simulatorCapacity) 111 string response = DoCommonChecks(objectCount, ownerID, lo, scene);
112
113 if (response != null)
115 { 114 {
116 m_dialogModule.SendAlertToUser(owner, "Unable to rez object because the parcel is too full"); 115 m_dialogModule.SendAlertToUser(ownerID, response);
117 return false; 116 return false;
118 } 117 }
118 return true;
119 }
119 120
121 //OnDuplicateObject
122 private bool CanDuplicateObject(int objectCount, UUID objectID, UUID ownerID, Scene scene, Vector3 objectPosition)
123 {
124 ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
125
126 string response = DoCommonChecks(objectCount, ownerID, lo, scene);
127
128 if (response != null)
129 {
130 m_dialogModule.SendAlertToUser(ownerID, response);
131 return false;
132 }
120 return true; 133 return true;
121 } 134 }
122 135
@@ -140,6 +153,14 @@ namespace OpenSim.Region.OptionalModules
140 153
141 ILandObject newParcel = scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y); 154 ILandObject newParcel = scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y);
142 155
156<<<<<<< HEAD
157 // newParcel will be null only if it outside of our current region. If this is the case, then the
158 // receiving permissions will perform the check.
159 if (newParcel == null)
160 return true;
161
162 // The prim hasn't crossed a region boundary so we don't need to worry
163=======
143 if (newParcel == null) 164 if (newParcel == null)
144 return true; 165 return true;
145 166
@@ -147,6 +168,7 @@ namespace OpenSim.Region.OptionalModules
147 ILandObject oldParcel = scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y); 168 ILandObject oldParcel = scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y);
148 169
149 // The prim hasn't crossed a region boundry so we don't need to worry 170 // The prim hasn't crossed a region boundry so we don't need to worry
171>>>>>>> avn/ubitvar
150 // about prim counts here 172 // about prim counts here
151 if(oldParcel != null && oldParcel.Equals(newParcel)) 173 if(oldParcel != null && oldParcel.Equals(newParcel))
152 { 174 {
@@ -158,30 +180,53 @@ namespace OpenSim.Region.OptionalModules
158 int simulatorCapacity = newParcel.GetSimulatorMaxPrimCount(); 180 int simulatorCapacity = newParcel.GetSimulatorMaxPrimCount();
159 181
160 // TODO: Add Special Case here for temporary prims 182 // TODO: Add Special Case here for temporary prims
161 183
162 if(objectCount + usedPrims > simulatorCapacity) 184 string response = DoCommonChecks(objectCount, obj.OwnerID, newParcel, scene);
185
186 if (response != null)
163 { 187 {
164 m_dialogModule.SendAlertToUser(obj.OwnerID, "Unable to move object because the destination parcel is too full"); 188 m_dialogModule.SendAlertToUser(obj.OwnerID, response);
165 return false; 189 return false;
166 } 190 }
167
168 return true; 191 return true;
169 } 192 }
170 193
171 //OnDuplicateObject 194 private string DoCommonChecks(int objectCount, UUID ownerID, ILandObject lo, Scene scene)
172 private bool CanDuplicateObject(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition)
173 { 195 {
174 ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y); 196 string response = null;
175 int usedPrims = lo.PrimCounts.Total;
176 int simulatorCapacity = lo.GetSimulatorMaxPrimCount();
177 197
178 if(objectCount + usedPrims > simulatorCapacity) 198 int simulatorCapacity = lo.GetSimulatorMaxPrimCount();
199 if ((objectCount + lo.PrimCounts.Total) > simulatorCapacity)
179 { 200 {
180 m_dialogModule.SendAlertToUser(owner, "Unable to duplicate object because the parcel is too full"); 201 response = "Unable to rez object because the parcel is too full";
181 return false;
182 } 202 }
183 203 else
184 return true; 204 {
205 int maxPrimsPerUser = scene.RegionInfo.MaxPrimsPerUser;
206 if (maxPrimsPerUser >= 0)
207 {
208 // per-user prim limit is set
209 if (ownerID != lo.LandData.OwnerID || lo.LandData.IsGroupOwned)
210 {
211 // caller is not the sole Parcel owner
212 EstateSettings estateSettings = scene.RegionInfo.EstateSettings;
213 if (ownerID != estateSettings.EstateOwner)
214 {
215 // caller is NOT the Estate owner
216 List<UUID> mgrs = new List<UUID>(estateSettings.EstateManagers);
217 if (!mgrs.Contains(ownerID))
218 {
219 // caller is not an Estate Manager
220 if ((lo.PrimCounts.Users[ownerID] + objectCount) > maxPrimsPerUser)
221 {
222 response = "Unable to rez object because you have reached your limit";
223 }
224 }
225 }
226 }
227 }
228 }
229 return response;
185 } 230 }
186 } 231 }
187} 232}
diff --git a/OpenSim/Region/OptionalModules/Properties/AssemblyInfo.cs b/OpenSim/Region/OptionalModules/Properties/AssemblyInfo.cs
index ba0b578..f8ad958 100644
--- a/OpenSim/Region/OptionalModules/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/OptionalModules/Properties/AssemblyInfo.cs
@@ -30,8 +30,8 @@ using Mono.Addins;
30// Build Number 30// Build Number
31// Revision 31// Revision
32// 32//
33[assembly: AssemblyVersion("0.8.0.*")] 33[assembly: AssemblyVersion("0.8.2.*")]
34 34
35 35
36[assembly: Addin("OpenSim.Region.OptionalModules", "0.1")] 36[assembly: Addin("OpenSim.Region.OptionalModules", OpenSim.VersionInfo.VersionNumber)]
37[assembly: AddinDependency("OpenSim", "0.5")] 37[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)]
diff --git a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs
index 9daf9d7..ff4afbf 100755
--- a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs
@@ -66,6 +66,7 @@ public class ExtendedPhysics : INonSharedRegionModule
66 public const string PhysFunctChangeLinkType = "BulletSim.ChangeLinkType"; 66 public const string PhysFunctChangeLinkType = "BulletSim.ChangeLinkType";
67 public const string PhysFunctGetLinkType = "BulletSim.GetLinkType"; 67 public const string PhysFunctGetLinkType = "BulletSim.GetLinkType";
68 public const string PhysFunctChangeLinkParams = "BulletSim.ChangeLinkParams"; 68 public const string PhysFunctChangeLinkParams = "BulletSim.ChangeLinkParams";
69 public const string PhysFunctAxisLockLimits = "BulletSim.AxisLockLimits";
69 70
70 // ============================================================= 71 // =============================================================
71 72
@@ -176,6 +177,71 @@ public class ExtendedPhysics : INonSharedRegionModule
176 return ret; 177 return ret;
177 } 178 }
178 179
180 // Code for specifying params.
181 // The choice if 14700 is arbitrary and only serves to catch parameter code misuse.
182 [ScriptConstant]
183 public const int PHYS_AXIS_LOCK_LINEAR = 14700;
184 [ScriptConstant]
185 public const int PHYS_AXIS_LOCK_LINEAR_X = 14701;
186 [ScriptConstant]
187 public const int PHYS_AXIS_LIMIT_LINEAR_X = 14702;
188 [ScriptConstant]
189 public const int PHYS_AXIS_LOCK_LINEAR_Y = 14703;
190 [ScriptConstant]
191 public const int PHYS_AXIS_LIMIT_LINEAR_Y = 14704;
192 [ScriptConstant]
193 public const int PHYS_AXIS_LOCK_LINEAR_Z = 14705;
194 [ScriptConstant]
195 public const int PHYS_AXIS_LIMIT_LINEAR_Z = 14706;
196 [ScriptConstant]
197 public const int PHYS_AXIS_LOCK_ANGULAR = 14707;
198 [ScriptConstant]
199 public const int PHYS_AXIS_LOCK_ANGULAR_X = 14708;
200 [ScriptConstant]
201 public const int PHYS_AXIS_LIMIT_ANGULAR_X = 14709;
202 [ScriptConstant]
203 public const int PHYS_AXIS_LOCK_ANGULAR_Y = 14710;
204 [ScriptConstant]
205 public const int PHYS_AXIS_LIMIT_ANGULAR_Y = 14711;
206 [ScriptConstant]
207 public const int PHYS_AXIS_LOCK_ANGULAR_Z = 14712;
208 [ScriptConstant]
209 public const int PHYS_AXIS_LIMIT_ANGULAR_Z = 14713;
210 [ScriptConstant]
211 public const int PHYS_AXIS_UNLOCK_LINEAR = 14714;
212 [ScriptConstant]
213 public const int PHYS_AXIS_UNLOCK_LINEAR_X = 14715;
214 [ScriptConstant]
215 public const int PHYS_AXIS_UNLOCK_LINEAR_Y = 14716;
216 [ScriptConstant]
217 public const int PHYS_AXIS_UNLOCK_LINEAR_Z = 14717;
218 [ScriptConstant]
219 public const int PHYS_AXIS_UNLOCK_ANGULAR = 14718;
220 [ScriptConstant]
221 public const int PHYS_AXIS_UNLOCK_ANGULAR_X = 14719;
222 [ScriptConstant]
223 public const int PHYS_AXIS_UNLOCK_ANGULAR_Y = 14720;
224 [ScriptConstant]
225 public const int PHYS_AXIS_UNLOCK_ANGULAR_Z = 14721;
226 [ScriptConstant]
227 public const int PHYS_AXIS_UNLOCK = 14722;
228 // physAxisLockLimits()
229 [ScriptInvocation]
230 public int physAxisLock(UUID hostID, UUID scriptID, object[] parms)
231 {
232 int ret = -1;
233 if (!Enabled) return ret;
234
235 PhysicsActor rootPhysActor;
236 if (GetRootPhysActor(hostID, out rootPhysActor))
237 {
238 object[] parms2 = AddToBeginningOfArray(rootPhysActor, null, parms);
239 ret = MakeIntError(rootPhysActor.Extension(PhysFunctAxisLockLimits, parms2));
240 }
241
242 return ret;
243 }
244
179 [ScriptConstant] 245 [ScriptConstant]
180 public const int PHYS_LINKSET_TYPE_CONSTRAINT = 0; 246 public const int PHYS_LINKSET_TYPE_CONSTRAINT = 0;
181 [ScriptConstant] 247 [ScriptConstant]
@@ -187,7 +253,6 @@ public class ExtendedPhysics : INonSharedRegionModule
187 public int physSetLinksetType(UUID hostID, UUID scriptID, int linksetType) 253 public int physSetLinksetType(UUID hostID, UUID scriptID, int linksetType)
188 { 254 {
189 int ret = -1; 255 int ret = -1;
190
191 if (!Enabled) return ret; 256 if (!Enabled) return ret;
192 257
193 // The part that is requesting the change. 258 // The part that is requesting the change.
@@ -259,34 +324,11 @@ public class ExtendedPhysics : INonSharedRegionModule
259 int ret = -1; 324 int ret = -1;
260 if (!Enabled) return ret; 325 if (!Enabled) return ret;
261 326
262 // The part that is requesting the change. 327 PhysicsActor rootPhysActor;
263 SceneObjectPart requestingPart = BaseScene.GetSceneObjectPart(hostID); 328 if (GetRootPhysActor(hostID, out rootPhysActor))
264
265 if (requestingPart != null)
266 { 329 {
267 // The type is is always on the root of a linkset. 330 object[] parms2 = { rootPhysActor, null };
268 SceneObjectGroup containingGroup = requestingPart.ParentGroup; 331 ret = MakeIntError(rootPhysActor.Extension(PhysFunctGetLinksetType, parms2));
269 SceneObjectPart rootPart = containingGroup.RootPart;
270
271 if (rootPart != null)
272 {
273 PhysicsActor rootPhysActor = rootPart.PhysActor;
274 if (rootPhysActor != null)
275 {
276 object[] parms2 = { rootPhysActor, null };
277 ret = MakeIntError(rootPhysActor.Extension(PhysFunctGetLinksetType, parms2));
278 }
279 else
280 {
281 m_log.WarnFormat("{0} physGetLinksetType: root part does not have a physics actor. rootName={1}, hostID={2}",
282 LogHeader, rootPart.Name, hostID);
283 }
284 }
285 else
286 {
287 m_log.WarnFormat("{0} physGetLinksetType: root part does not exist. RequestingPartName={1}, hostID={2}",
288 LogHeader, requestingPart.Name, hostID);
289 }
290 } 332 }
291 else 333 else
292 { 334 {
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs
index e498c6a..c38bb3e 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs
@@ -276,7 +276,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
276 { 276 {
277 ovalue = OSDParser.DeserializeJson(value); 277 ovalue = OSDParser.DeserializeJson(value);
278 } 278 }
279 catch (Exception e) 279 catch (Exception)
280 { 280 {
281 if (value.StartsWith("'") && value.EndsWith("'")) 281 if (value.StartsWith("'") && value.EndsWith("'"))
282 { 282 {
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs
index b502a55..26044f0 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs
@@ -262,7 +262,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
262 { 262 {
263 map = new JsonStore(value); 263 map = new JsonStore(value);
264 } 264 }
265 catch (Exception e) 265 catch (Exception)
266 { 266 {
267 m_log.ErrorFormat("[JsonStore]: Unable to initialize store from {0}", value); 267 m_log.ErrorFormat("[JsonStore]: Unable to initialize store from {0}", value);
268 return false; 268 return false;
@@ -285,8 +285,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
285 285
286 lock (m_JsonValueStore) 286 lock (m_JsonValueStore)
287 return m_JsonValueStore.Remove(storeID); 287 return m_JsonValueStore.Remove(storeID);
288
289 return true;
290 } 288 }
291 289
292 // ----------------------------------------------------------------- 290 // -----------------------------------------------------------------
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
index 9fbfb66..edf51a2 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
@@ -320,10 +320,25 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
320 /// </summary> 320 /// </summary>
321 // ----------------------------------------------------------------- 321 // -----------------------------------------------------------------
322 [ScriptInvocation] 322 [ScriptInvocation]
323 public UUID JsonRezAtRoot(UUID hostID, UUID scriptID, string item, Vector3 pos, Vector3 vel, Quaternion rot, string param)
324 {
325 UUID reqID = UUID.Random();
326 Util.FireAndForget(
327 o => DoJsonRezObject(hostID, scriptID, reqID, item, pos, vel, rot, param), null, "JsonStoreScriptModule.DoJsonRezObject");
328 return reqID;
329 }
330
331 // -----------------------------------------------------------------
332 /// <summary>
333 ///
334 /// </summary>
335 // -----------------------------------------------------------------
336 [ScriptInvocation]
323 public UUID JsonReadNotecard(UUID hostID, UUID scriptID, UUID storeID, string path, string notecardIdentifier) 337 public UUID JsonReadNotecard(UUID hostID, UUID scriptID, UUID storeID, string path, string notecardIdentifier)
324 { 338 {
325 UUID reqID = UUID.Random(); 339 UUID reqID = UUID.Random();
326 Util.FireAndForget(o => DoJsonReadNotecard(reqID, hostID, scriptID, storeID, path, notecardIdentifier)); 340 Util.FireAndForget(
341 o => DoJsonReadNotecard(reqID, hostID, scriptID, storeID, path, notecardIdentifier), null, "JsonStoreScriptModule.JsonReadNotecard");
327 return reqID; 342 return reqID;
328 } 343 }
329 344
@@ -336,7 +351,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
336 public UUID JsonWriteNotecard(UUID hostID, UUID scriptID, UUID storeID, string path, string name) 351 public UUID JsonWriteNotecard(UUID hostID, UUID scriptID, UUID storeID, string path, string name)
337 { 352 {
338 UUID reqID = UUID.Random(); 353 UUID reqID = UUID.Random();
339 Util.FireAndForget(delegate(object o) { DoJsonWriteNotecard(reqID,hostID,scriptID,storeID,path,name); }); 354 Util.FireAndForget(
355 o => DoJsonWriteNotecard(reqID,hostID,scriptID,storeID,path,name), null, "JsonStoreScriptModule.DoJsonWriteNotecard");
340 return reqID; 356 return reqID;
341 } 357 }
342 358
@@ -451,7 +467,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
451 public UUID JsonTakeValue(UUID hostID, UUID scriptID, UUID storeID, string path) 467 public UUID JsonTakeValue(UUID hostID, UUID scriptID, UUID storeID, string path)
452 { 468 {
453 UUID reqID = UUID.Random(); 469 UUID reqID = UUID.Random();
454 Util.FireAndForget(delegate(object o) { DoJsonTakeValue(scriptID,reqID,storeID,path,false); }); 470 Util.FireAndForget(
471 o => DoJsonTakeValue(scriptID,reqID,storeID,path,false), null, "JsonStoreScriptModule.DoJsonTakeValue");
455 return reqID; 472 return reqID;
456 } 473 }
457 474
@@ -459,7 +476,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
459 public UUID JsonTakeValueJson(UUID hostID, UUID scriptID, UUID storeID, string path) 476 public UUID JsonTakeValueJson(UUID hostID, UUID scriptID, UUID storeID, string path)
460 { 477 {
461 UUID reqID = UUID.Random(); 478 UUID reqID = UUID.Random();
462 Util.FireAndForget(delegate(object o) { DoJsonTakeValue(scriptID,reqID,storeID,path,true); }); 479 Util.FireAndForget(
480 o => DoJsonTakeValue(scriptID,reqID,storeID,path,true), null, "JsonStoreScriptModule.DoJsonTakeValueJson");
463 return reqID; 481 return reqID;
464 } 482 }
465 483
@@ -472,7 +490,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
472 public UUID JsonReadValue(UUID hostID, UUID scriptID, UUID storeID, string path) 490 public UUID JsonReadValue(UUID hostID, UUID scriptID, UUID storeID, string path)
473 { 491 {
474 UUID reqID = UUID.Random(); 492 UUID reqID = UUID.Random();
475 Util.FireAndForget(delegate(object o) { DoJsonReadValue(scriptID,reqID,storeID,path,false); }); 493 Util.FireAndForget(
494 o => DoJsonReadValue(scriptID,reqID,storeID,path,false), null, "JsonStoreScriptModule.DoJsonReadValue");
476 return reqID; 495 return reqID;
477 } 496 }
478 497
@@ -480,7 +499,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
480 public UUID JsonReadValueJson(UUID hostID, UUID scriptID, UUID storeID, string path) 499 public UUID JsonReadValueJson(UUID hostID, UUID scriptID, UUID storeID, string path)
481 { 500 {
482 UUID reqID = UUID.Random(); 501 UUID reqID = UUID.Random();
483 Util.FireAndForget(delegate(object o) { DoJsonReadValue(scriptID,reqID,storeID,path,true); }); 502 Util.FireAndForget(
503 o => DoJsonReadValue(scriptID,reqID,storeID,path,true), null, "JsonStoreScriptModule.DoJsonReadValueJson");
484 return reqID; 504 return reqID;
485 } 505 }
486 506
@@ -575,11 +595,15 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
575 595
576 try 596 try
577 { 597 {
578 string jsondata = SLUtil.ParseNotecardToString(Encoding.UTF8.GetString(a.Data)); 598 string jsondata = SLUtil.ParseNotecardToString(a.Data);
579 int result = m_store.SetValue(storeID, path, jsondata,true) ? 1 : 0; 599 int result = m_store.SetValue(storeID, path, jsondata,true) ? 1 : 0;
580 m_comms.DispatchReply(scriptID, result, "", reqID.ToString()); 600 m_comms.DispatchReply(scriptID, result, "", reqID.ToString());
581 return; 601 return;
582 } 602 }
603 catch(SLUtil.NotANotecardFormatException e)
604 {
605 m_log.WarnFormat("[JsonStoreScripts]: Notecard parsing failed; assetId {0} at line number {1}", assetID.ToString(), e.lineNumber);
606 }
583 catch (Exception e) 607 catch (Exception e)
584 { 608 {
585 m_log.WarnFormat("[JsonStoreScripts]: Json parsing failed; {0}", e.Message); 609 m_log.WarnFormat("[JsonStoreScripts]: Json parsing failed; {0}", e.Message);
@@ -682,5 +706,103 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
682 return path; 706 return path;
683 } 707 }
684 708
709 // -----------------------------------------------------------------
710 /// <summary>
711 ///
712 /// </summary>
713 // -----------------------------------------------------------------
714 private void DoJsonRezObject(UUID hostID, UUID scriptID, UUID reqID, string name, Vector3 pos, Vector3 vel, Quaternion rot, string param)
715 {
716 if (Double.IsNaN(rot.X) || Double.IsNaN(rot.Y) || Double.IsNaN(rot.Z) || Double.IsNaN(rot.W))
717 {
718 GenerateRuntimeError("Invalid rez rotation");
719 return;
720 }
721
722 SceneObjectGroup host = m_scene.GetSceneObjectGroup(hostID);
723 if (host == null)
724 {
725 GenerateRuntimeError(String.Format("Unable to find rezzing host '{0}'",hostID));
726 return;
727 }
728
729 // hpos = host.RootPart.GetWorldPosition()
730 // float dist = (float)llVecDist(hpos, pos);
731 // if (dist > m_ScriptDistanceFactor * 10.0f)
732 // return;
733
734 TaskInventoryItem item = host.RootPart.Inventory.GetInventoryItem(name);
735 if (item == null)
736 {
737 GenerateRuntimeError(String.Format("Unable to find object to rez '{0}'",name));
738 return;
739 }
740
741 if (item.InvType != (int)InventoryType.Object)
742 {
743 GenerateRuntimeError("Can't create requested object; object is missing from database");
744 return;
745 }
746
747 List<SceneObjectGroup> objlist;
748 List<Vector3> veclist;
749
750 bool success = host.RootPart.Inventory.GetRezReadySceneObjects(item, out objlist, out veclist);
751 if (! success)
752 {
753 GenerateRuntimeError("Failed to create object");
754 return;
755 }
756
757 int totalPrims = 0;
758 foreach (SceneObjectGroup group in objlist)
759 totalPrims += group.PrimCount;
760
761 if (! m_scene.Permissions.CanRezObject(totalPrims, item.OwnerID, pos))
762 {
763 GenerateRuntimeError("Not allowed to create the object");
764 return;
765 }
766
767 if (! m_scene.Permissions.BypassPermissions())
768 {
769 if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
770 host.RootPart.Inventory.RemoveInventoryItem(item.ItemID);
771 }
772
773 for (int i = 0; i < objlist.Count; i++)
774 {
775 SceneObjectGroup group = objlist[i];
776 Vector3 curpos = pos + veclist[i];
777
778 if (group.IsAttachment == false && group.RootPart.Shape.State != 0)
779 {
780 group.RootPart.AttachedPos = group.AbsolutePosition;
781 group.RootPart.Shape.LastAttachPoint = (byte)group.AttachmentPoint;
782 }
783
784 group.FromPartID = host.RootPart.UUID;
785 m_scene.AddNewSceneObject(group, true, curpos, rot, vel);
786
787 UUID storeID = group.UUID;
788 if (! m_store.CreateStore(param, ref storeID))
789 {
790 GenerateRuntimeError("Unable to create jsonstore for new object");
791 continue;
792 }
793
794 // We can only call this after adding the scene object, since the scene object references the scene
795 // to find out if scripts should be activated at all.
796 group.RootPart.SetDieAtEdge(true);
797 group.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 3);
798 group.ResumeScripts();
799
800 group.ScheduleGroupForFullUpdate();
801
802 // send the reply back to the host object, use the integer param to indicate the number
803 // of remaining objects
804 m_comms.DispatchReply(scriptID, objlist.Count-i-1, group.RootPart.UUID.ToString(), reqID.ToString());
805 }
806 }
685 } 807 }
686} 808}
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
index bfa9937..99a7076 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
@@ -40,7 +40,6 @@ using OpenSim.Region.ScriptEngine.Shared;
40using OpenSim.Region.ScriptEngine.Shared.Api; 40using OpenSim.Region.ScriptEngine.Shared.Api;
41using OpenSim.Services.Interfaces; 41using OpenSim.Services.Interfaces;
42using OpenSim.Tests.Common; 42using OpenSim.Tests.Common;
43using OpenSim.Tests.Common.Mock;
44 43
45namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests 44namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
46{ 45{
@@ -465,13 +464,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
465 Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_VALUE)); 464 Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_VALUE));
466 } 465 }
467 466
468 // Test for non-existant path 467 // Test for non-existent path
469 { 468 {
470 int result = (int)InvokeOp("JsonGetNodeType", storeId, "foo"); 469 int result = (int)InvokeOp("JsonGetNodeType", storeId, "foo");
471 Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_UNDEF)); 470 Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_UNDEF));
472 } 471 }
473 472
474 // Test for non-existant store 473 // Test for non-existent store
475 { 474 {
476 UUID fakeStoreId = TestHelpers.ParseTail(0x500); 475 UUID fakeStoreId = TestHelpers.ParseTail(0x500);
477 int result = (int)InvokeOp("JsonGetNodeType", fakeStoreId, "."); 476 int result = (int)InvokeOp("JsonGetNodeType", fakeStoreId, ".");
@@ -898,4 +897,4 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
898 897
899 public object DummyTestMethod(object o1, object o2, object o3, object o4, object o5) { return null; } 898 public object DummyTestMethod(object o1, object o2, object o3, object o4, object o5) { return null; }
900 } 899 }
901} \ No newline at end of file 900}
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
index 6fb28e2..4bafe2f 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
@@ -180,6 +180,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
180 /// * Internet 180 /// * Internet
181 /// * Everything 181 /// * Everything
182 /// </remarks> 182 /// </remarks>
183#pragma warning disable 0618
183 public static AppDomain CreateRestrictedDomain(string permissionSetName, string appDomainName) 184 public static AppDomain CreateRestrictedDomain(string permissionSetName, string appDomainName)
184 { 185 {
185 if (permissionSetName == null) 186 if (permissionSetName == null)
@@ -240,6 +241,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
240 241
241 return restrictedDomain; 242 return restrictedDomain;
242 } 243 }
244#pragma warning restore 0618
243 245
244 246
245 void EventManager_OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource) 247 void EventManager_OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource)
diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
index 296ab87..870c0bb 100644
--- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
@@ -105,8 +105,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
105 m_scene.LoginLock = true; 105 m_scene.LoginLock = true;
106 m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue; 106 m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue;
107 107
108 // Warn level because the region cannot be used while logins are disabled 108 // This should always show up to the user but should not trigger warn/errors as these messages are
109 m_log.WarnFormat("[RegionReady]: Region {0} - LOGINS DISABLED DURING INITIALIZATION.", m_scene.Name); 109 // expected and are not simulator problems. Ideally, there would be a status level in log4net but
110 // failing that, we will print out to console instead.
111 MainConsole.Instance.OutputFormat("Region {0} - LOGINS DISABLED DURING INITIALIZATION.", m_scene.Name);
110 112
111 if (m_uri != string.Empty) 113 if (m_uri != string.Empty)
112 { 114 {
@@ -304,7 +306,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
304 finally 306 finally
305 { 307 {
306 if (os != null) 308 if (os != null)
307 os.Close(); 309 os.Dispose();
308 } 310 }
309 } 311 }
310 } 312 }
diff --git a/OpenSim/Region/OptionalModules/ViewerSupport/CameraOnlyModeModule.cs b/OpenSim/Region/OptionalModules/ViewerSupport/CameraOnlyModeModule.cs
new file mode 100644
index 0000000..7ae4223
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/ViewerSupport/CameraOnlyModeModule.cs
@@ -0,0 +1,176 @@
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
28using System;
29using System.IO;
30using System.Reflection;
31using System.Text;
32using System.Collections.Generic;
33using System.Threading;
34
35using OpenMetaverse;
36using OpenMetaverse.StructuredData;
37using OpenSim;
38using OpenSim.Region;
39using OpenSim.Region.Framework;
40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Framework;
43//using OpenSim.Framework.Capabilities;
44using OpenSim.Framework.Servers;
45using OpenSim.Framework.Servers.HttpServer;
46using Nini.Config;
47using log4net;
48using Mono.Addins;
49using OSDMap = OpenMetaverse.StructuredData.OSDMap;
50using TeleportFlags = OpenSim.Framework.Constants.TeleportFlags;
51
52namespace OpenSim.Region.OptionalModules.ViewerSupport
53{
54 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "CameraOnlyMode")]
55 public class CameraOnlyModeModule : INonSharedRegionModule
56 {
57 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
58
59 private Scene m_scene;
60 private SimulatorFeaturesHelper m_Helper;
61 private bool m_Enabled;
62 private int m_UserLevel;
63
64 public string Name
65 {
66 get { return "CameraOnlyModeModule"; }
67 }
68
69 public Type ReplaceableInterface
70 {
71 get { return null; }
72 }
73
74 public void Initialise(IConfigSource config)
75 {
76 IConfig moduleConfig = config.Configs["CameraOnlyModeModule"];
77 if (moduleConfig != null)
78 {
79 m_Enabled = moduleConfig.GetBoolean("enabled", false);
80 if (m_Enabled)
81 {
82 m_UserLevel = moduleConfig.GetInt("UserLevel", 0);
83 m_log.Info("[CAMERA-ONLY MODE]: CameraOnlyModeModule enabled");
84 }
85
86 }
87 }
88
89 public void Close()
90 {
91 }
92
93 public void AddRegion(Scene scene)
94 {
95 if (m_Enabled)
96 {
97 m_scene = scene;
98 //m_scene.EventManager.OnMakeRootAgent += (OnMakeRootAgent);
99 }
100 }
101
102 //private void OnMakeRootAgent(ScenePresence obj)
103 //{
104 // throw new NotImplementedException();
105 //}
106
107 public void RegionLoaded(Scene scene)
108 {
109 if (m_Enabled)
110 {
111 IEntityTransferModule et = m_scene.RequestModuleInterface<IEntityTransferModule>();
112 m_Helper = new SimulatorFeaturesHelper(scene, et);
113
114 ISimulatorFeaturesModule featuresModule = m_scene.RequestModuleInterface<ISimulatorFeaturesModule>();
115 if (featuresModule != null)
116 featuresModule.OnSimulatorFeaturesRequest += OnSimulatorFeaturesRequest;
117 }
118 }
119
120 public void RemoveRegion(Scene scene)
121 {
122 }
123
124 private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features)
125 {
126 m_log.DebugFormat("[CAMERA-ONLY MODE]: OnSimulatorFeaturesRequest in {0}", m_scene.RegionInfo.RegionName);
127 if (m_Helper.ShouldSend(agentID) && m_Helper.UserLevel(agentID) <= m_UserLevel)
128 {
129 OSDMap extrasMap;
130 if (features.ContainsKey("OpenSimExtras"))
131 {
132 extrasMap = (OSDMap)features["OpenSimExtras"];
133 }
134 else
135 {
136 extrasMap = new OSDMap();
137 features["OpenSimExtras"] = extrasMap;
138 }
139 extrasMap["camera-only-mode"] = OSDMap.FromString("true");
140 m_log.DebugFormat("[CAMERA-ONLY MODE]: Sent in {0}", m_scene.RegionInfo.RegionName);
141
142 // Detaching attachments doesn't work for HG visitors,
143 // so I'm giving that up.
144 //Util.FireAndForget(delegate { DetachAttachments(agentID); });
145 }
146 else
147 m_log.DebugFormat("[CAMERA-ONLY MODE]: NOT Sending camera-only-mode in {0}", m_scene.RegionInfo.RegionName);
148 }
149
150 private void DetachAttachments(UUID agentID)
151 {
152 ScenePresence sp = m_scene.GetScenePresence(agentID);
153 if ((sp.TeleportFlags & TeleportFlags.ViaLogin) != 0)
154 // Wait a little, cos there's weird stuff going on at login related to
155 // the Current Outfit Folder
156 Thread.Sleep(8000);
157
158 if (sp != null && m_scene.AttachmentsModule != null)
159 {
160 List<SceneObjectGroup> attachs = sp.GetAttachments();
161 if (attachs != null && attachs.Count > 0)
162 {
163 foreach (SceneObjectGroup sog in attachs)
164 {
165 m_log.DebugFormat("[CAMERA-ONLY MODE]: Forcibly detaching attach {0} from {1} in {2}",
166 sog.Name, sp.Name, m_scene.RegionInfo.RegionName);
167
168 m_scene.AttachmentsModule.DetachSingleAttachmentToInv(sp, sog);
169 }
170 }
171 }
172 }
173
174 }
175
176}
diff --git a/OpenSim/Region/OptionalModules/ViewerSupport/DynamicMenuModule.cs b/OpenSim/Region/OptionalModules/ViewerSupport/DynamicMenuModule.cs
index 3b3b300..fcf5e91 100644
--- a/OpenSim/Region/OptionalModules/ViewerSupport/DynamicMenuModule.cs
+++ b/OpenSim/Region/OptionalModules/ViewerSupport/DynamicMenuModule.cs
@@ -276,7 +276,8 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport
276 for (int i = 0 ; i < selection.Count ; i++) 276 for (int i = 0 ; i < selection.Count ; i++)
277 sel.Add(selection[i].AsUInteger()); 277 sel.Add(selection[i].AsUInteger());
278 278
279 Util.FireAndForget(x => { m_module.HandleMenuSelection(action, m_agentID, sel); }); 279 Util.FireAndForget(
280 x => { m_module.HandleMenuSelection(action, m_agentID, sel); }, null, "DynamicMenuModule.HandleMenuSelection");
280 281
281 Encoding encoding = Encoding.UTF8; 282 Encoding encoding = Encoding.UTF8;
282 return encoding.GetBytes(OSDParser.SerializeLLSDXmlString(new OSD())); 283 return encoding.GetBytes(OSDParser.SerializeLLSDXmlString(new OSD()));
diff --git a/OpenSim/Region/OptionalModules/ViewerSupport/GodNamesModule.cs b/OpenSim/Region/OptionalModules/ViewerSupport/GodNamesModule.cs
new file mode 100644
index 0000000..e0537a4
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/ViewerSupport/GodNamesModule.cs
@@ -0,0 +1,144 @@
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
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using log4net;
32using Mono.Addins;
33using Nini.Config;
34using OpenMetaverse;
35using OpenMetaverse.StructuredData;
36using OpenSim.Framework;
37using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes;
39
40namespace OpenSim.Region.OptionalModules.ViewerSupport
41{
42 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GodNamesModule")]
43 public class GodNamesModule : ISharedRegionModule
44 {
45 // Infrastructure
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47
48 // Configuration
49 private static bool m_enabled = false;
50 private static List<String> m_lastNames = new List<String>();
51 private static List<String> m_fullNames = new List<String>();
52
53 public void Initialise(IConfigSource config)
54 {
55 IConfig moduleConfig = config.Configs["GodNames"];
56
57 if (moduleConfig == null) {
58 return;
59 }
60
61 if (!moduleConfig.GetBoolean("Enabled", false)) {
62 m_log.Info("[GODNAMES]: Addon is disabled");
63 return;
64 }
65
66 m_log.Info("[GODNAMES]: Enabled");
67 m_enabled = true;
68 string conf_str = moduleConfig.GetString("FullNames", String.Empty);
69 foreach (string strl in conf_str.Split(',')) {
70 string strlan = strl.Trim(" \t".ToCharArray());
71 m_log.DebugFormat("[GODNAMES]: Adding {0} as a God name", strlan);
72 m_fullNames.Add(strlan);
73 }
74
75 conf_str = moduleConfig.GetString("Surnames", String.Empty);
76 foreach (string strl in conf_str.Split(',')) {
77 string strlan = strl.Trim(" \t".ToCharArray());
78 m_log.DebugFormat("[GODNAMES]: Adding {0} as a God last name", strlan);
79 m_lastNames.Add(strlan);
80 }
81 }
82
83 public void AddRegion(Scene scene) {
84 /*no op*/
85 }
86
87 public void RemoveRegion(Scene scene) {
88 /*no op*/
89 }
90
91 public void PostInitialise() {
92 /*no op*/
93 }
94
95 public void Close() {
96 /*no op*/
97 }
98
99 public Type ReplaceableInterface {
100 get { return null; }
101 }
102
103 public string Name {
104 get { return "Godnames"; }
105 }
106
107 public bool IsSharedModule {
108 get { return true; }
109 }
110
111 public virtual void RegionLoaded(Scene scene)
112 {
113 if (!m_enabled)
114 return;
115
116 ISimulatorFeaturesModule featuresModule = scene.RequestModuleInterface<ISimulatorFeaturesModule>();
117
118 if (featuresModule != null)
119 featuresModule.OnSimulatorFeaturesRequest += OnSimulatorFeaturesRequest;
120
121 }
122
123 private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features)
124 {
125 OSD namesmap = new OSDMap();
126 if (features.ContainsKey("god_names"))
127 namesmap = features["god_names"];
128 else
129 features["god_names"] = namesmap;
130
131 OSDArray fnames = new OSDArray();
132 foreach (string name in m_fullNames) {
133 fnames.Add(name);
134 }
135 ((OSDMap)namesmap)["full_names"] = fnames;
136
137 OSDArray lnames = new OSDArray();
138 foreach (string name in m_lastNames) {
139 lnames.Add(name);
140 }
141 ((OSDMap)namesmap)["last_names"] = lnames;
142 }
143 }
144}
diff --git a/OpenSim/Region/OptionalModules/ViewerSupport/SimulatorFeaturesHelper.cs b/OpenSim/Region/OptionalModules/ViewerSupport/SimulatorFeaturesHelper.cs
new file mode 100644
index 0000000..2661522
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/ViewerSupport/SimulatorFeaturesHelper.cs
@@ -0,0 +1,171 @@
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
28using System;
29using System.IO;
30using System.Reflection;
31using System.Text;
32using System.Collections.Generic;
33using System.Threading;
34
35using OpenMetaverse;
36using OpenMetaverse.StructuredData;
37using OpenSim;
38using OpenSim.Region;
39using OpenSim.Region.Framework;
40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Framework;
43using OpenSim.Services.Interfaces;
44//using OpenSim.Framework.Capabilities;
45using Nini.Config;
46using log4net;
47using OSDMap = OpenMetaverse.StructuredData.OSDMap;
48using TeleportFlags = OpenSim.Framework.Constants.TeleportFlags;
49
50namespace OpenSim.Region.OptionalModules.ViewerSupport
51{
52 public class SimulatorFeaturesHelper
53 {
54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55
56 private IEntityTransferModule m_TransferModule;
57 private Scene m_scene;
58
59 private struct RegionSend {
60 public UUID region;
61 public bool send;
62 };
63 // Using a static cache so that we don't have to perform the time-consuming tests
64 // in ShouldSend on Extra SimFeatures that go on the same response but come from
65 // different modules.
66 // This cached is indexed on the agentID and maps to a list of regions
67 private static ExpiringCache<UUID, List<RegionSend>> m_Cache = new ExpiringCache<UUID, List<RegionSend>>();
68 private const double TIMEOUT = 1.0; // time in cache
69
70 public SimulatorFeaturesHelper(Scene scene, IEntityTransferModule et)
71 {
72 m_scene = scene;
73 m_TransferModule = et;
74 }
75
76 public bool ShouldSend(UUID agentID)
77 {
78 List<RegionSend> rsendlist;
79 RegionSend rsend;
80 if (m_Cache.TryGetValue(agentID, out rsendlist))
81 {
82 rsend = rsendlist.Find(r => r.region == m_scene.RegionInfo.RegionID);
83 if (rsend.region != UUID.Zero) // Found it
84 {
85 return rsend.send;
86 }
87 }
88
89 // Relatively complex logic for deciding whether to send the extra SimFeature or not.
90 // This is because the viewer calls this cap to all sims that it knows about,
91 // including the departing sims and non-neighbors (those that are cached).
92 rsend.region = m_scene.RegionInfo.RegionID;
93 rsend.send = false;
94 IClientAPI client = null;
95 int counter = 200;
96
97 // Let's wait a little to see if we get a client here
98 while (!m_scene.TryGetClient(agentID, out client) && counter-- > 0)
99 Thread.Sleep(50);
100
101 if (client != null)
102 {
103 ScenePresence sp = WaitGetScenePresence(agentID);
104
105 if (sp != null)
106 {
107 // On the receiving region, the call to this cap may arrive before
108 // the agent is root. Make sure we only proceed from here when the agent
109 // has been made root
110 counter = 200;
111 while ((sp.IsInTransit || sp.IsChildAgent) && counter-- > 0)
112 {
113 Thread.Sleep(50);
114 }
115
116 // The viewer calls this cap on the departing sims too. Make sure
117 // that we only proceed after the agent is not in transit anymore.
118 // The agent must be root and not going anywhere
119 if (!sp.IsChildAgent && !m_TransferModule.IsInTransit(agentID))
120 rsend.send = true;
121
122 }
123 }
124 //else
125 // m_log.DebugFormat("[XXX]: client is null");
126
127
128 if (rsendlist == null)
129 {
130 rsendlist = new List<RegionSend>();
131 m_Cache.AddOrUpdate(agentID, rsendlist, TIMEOUT);
132 }
133 rsendlist.Add(rsend);
134
135 return rsend.send;
136 }
137
138 public int UserLevel(UUID agentID)
139 {
140 int level = 0;
141 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, agentID);
142 if (account != null)
143 level = account.UserLevel;
144
145 return level;
146 }
147
148 protected virtual ScenePresence WaitGetScenePresence(UUID agentID)
149 {
150 int ntimes = 20;
151 ScenePresence sp = null;
152 while ((sp = m_scene.GetScenePresence(agentID)) == null && (ntimes-- > 0))
153 Thread.Sleep(1000);
154
155 if (sp == null)
156 m_log.WarnFormat(
157 "[XXX]: Did not find presence with id {0} in {1} before timeout",
158 agentID, m_scene.RegionInfo.RegionName);
159 else
160 {
161 ntimes = 10;
162 while (sp.IsInTransit && (ntimes-- > 0))
163 Thread.Sleep(1000);
164 }
165
166 return sp;
167 }
168
169 }
170
171}
diff --git a/OpenSim/Region/OptionalModules/ViewerSupport/SpecialUIModule.cs b/OpenSim/Region/OptionalModules/ViewerSupport/SpecialUIModule.cs
new file mode 100644
index 0000000..3fe922d
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/ViewerSupport/SpecialUIModule.cs
@@ -0,0 +1,165 @@
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
28using System;
29using System.IO;
30using System.Reflection;
31using System.Text;
32using System.Collections.Generic;
33using System.Threading;
34using OpenMetaverse;
35using OpenMetaverse.StructuredData;
36using OpenSim;
37using OpenSim.Region;
38using OpenSim.Region.Framework;
39using OpenSim.Region.Framework.Scenes;
40using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Framework;
42//using OpenSim.Framework.Capabilities;
43using OpenSim.Framework.Servers;
44using OpenSim.Framework.Servers.HttpServer;
45using Nini.Config;
46using log4net;
47using Mono.Addins;
48using OSDMap = OpenMetaverse.StructuredData.OSDMap;
49using TeleportFlags = OpenSim.Framework.Constants.TeleportFlags;
50
51namespace OpenSim.Region.OptionalModules.ViewerSupport
52{
53 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SpecialUI")]
54 public class SpecialUIModule : INonSharedRegionModule
55 {
56 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
57 private const string VIEWER_SUPPORT_DIR = "ViewerSupport";
58
59 private Scene m_scene;
60 private SimulatorFeaturesHelper m_Helper;
61 private bool m_Enabled;
62 private int m_UserLevel;
63
64 public string Name
65 {
66 get { return "SpecialUIModule"; }
67 }
68
69 public Type ReplaceableInterface
70 {
71 get { return null; }
72 }
73
74 public void Initialise(IConfigSource config)
75 {
76 IConfig moduleConfig = config.Configs["SpecialUIModule"];
77 if (moduleConfig != null)
78 {
79 m_Enabled = moduleConfig.GetBoolean("enabled", false);
80 if (m_Enabled)
81 {
82 m_UserLevel = moduleConfig.GetInt("UserLevel", 0);
83 m_log.Info("[SPECIAL UI]: SpecialUIModule enabled");
84 }
85
86 }
87 }
88
89 public void Close()
90 {
91 }
92
93 public void AddRegion(Scene scene)
94 {
95 if (m_Enabled)
96 {
97 m_scene = scene;
98 }
99 }
100
101 public void RegionLoaded(Scene scene)
102 {
103 if (m_Enabled)
104 {
105 IEntityTransferModule et = m_scene.RequestModuleInterface<IEntityTransferModule>();
106 m_Helper = new SimulatorFeaturesHelper(scene, et);
107
108 ISimulatorFeaturesModule featuresModule = m_scene.RequestModuleInterface<ISimulatorFeaturesModule>();
109 if (featuresModule != null)
110 featuresModule.OnSimulatorFeaturesRequest += OnSimulatorFeaturesRequest;
111 }
112 }
113
114 public void RemoveRegion(Scene scene)
115 {
116 }
117
118 private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features)
119 {
120 m_log.DebugFormat("[SPECIAL UI]: OnSimulatorFeaturesRequest in {0}", m_scene.RegionInfo.RegionName);
121 if (m_Helper.ShouldSend(agentID) && m_Helper.UserLevel(agentID) <= m_UserLevel)
122 {
123 OSDMap extrasMap;
124 OSDMap specialUI = new OSDMap();
125 using (StreamReader s = new StreamReader(Path.Combine(VIEWER_SUPPORT_DIR, "panel_toolbar.xml")))
126 {
127 if (features.ContainsKey("OpenSimExtras"))
128 extrasMap = (OSDMap)features["OpenSimExtras"];
129 else
130 {
131 extrasMap = new OSDMap();
132 features["OpenSimExtras"] = extrasMap;
133 }
134
135 specialUI["toolbar"] = OSDMap.FromString(s.ReadToEnd());
136 extrasMap["special-ui"] = specialUI;
137 }
138 m_log.DebugFormat("[SPECIAL UI]: Sending panel_toolbar.xml in {0}", m_scene.RegionInfo.RegionName);
139
140 if (Directory.Exists(Path.Combine(VIEWER_SUPPORT_DIR, "Floaters")))
141 {
142 OSDMap floaters = new OSDMap();
143 uint n = 0;
144 foreach (String name in Directory.GetFiles(Path.Combine(VIEWER_SUPPORT_DIR, "Floaters"), "*.xml"))
145 {
146 using (StreamReader s = new StreamReader(name))
147 {
148 string simple_name = Path.GetFileNameWithoutExtension(name);
149 OSDMap floater = new OSDMap();
150 floaters[simple_name] = OSDMap.FromString(s.ReadToEnd());
151 n++;
152 }
153 }
154 specialUI["floaters"] = floaters;
155 m_log.DebugFormat("[SPECIAL UI]: Sending {0} floaters", n);
156 }
157 }
158 else
159 m_log.DebugFormat("[SPECIAL UI]: NOT Sending panel_toolbar.xml in {0}", m_scene.RegionInfo.RegionName);
160
161 }
162
163 }
164
165}
diff --git a/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs b/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs
index 1d35c54..ceb3332 100644
--- a/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs
+++ b/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs
@@ -76,6 +76,10 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
76 /// AutoBackupBusyCheck: True/False. Default: True. 76 /// AutoBackupBusyCheck: True/False. Default: True.
77 /// If True, we will only take an auto-backup if a set of conditions are met. 77 /// If True, we will only take an auto-backup if a set of conditions are met.
78 /// These conditions are heuristics to try and avoid taking a backup when the sim is busy. 78 /// These conditions are heuristics to try and avoid taking a backup when the sim is busy.
79 /// AutoBackupSkipAssets
80 /// If true, assets are not saved to the oar file. Considerably reduces impact on simulator when backing up. Intended for when assets db is backed up separately
81 /// AutoBackupKeepFilesForDays
82 /// Backup files older than this value (in days) are deleted during the current backup process, 0 will disable this and keep all backup files indefinitely
79 /// AutoBackupScript: String. Default: not specified (disabled). 83 /// AutoBackupScript: String. Default: not specified (disabled).
80 /// File path to an executable script or binary to run when an automatic backup is taken. 84 /// File path to an executable script or binary to run when an automatic backup is taken.
81 /// The file should really be (Windows) an .exe or .bat, or (Linux/Mac) a shell script or binary. 85 /// The file should really be (Windows) an .exe or .bat, or (Linux/Mac) a shell script or binary.
@@ -111,6 +115,9 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
111 115
112 private delegate T DefaultGetter<T>(string settingName, T defaultValue); 116 private delegate T DefaultGetter<T>(string settingName, T defaultValue);
113 private bool m_enabled; 117 private bool m_enabled;
118 private ICommandConsole m_console;
119 private List<Scene> m_Scenes = new List<Scene> ();
120
114 121
115 /// <summary> 122 /// <summary>
116 /// Whether the shared module should be enabled at all. NOT the same as m_Enabled in AutoBackupModuleState! 123 /// Whether the shared module should be enabled at all. NOT the same as m_Enabled in AutoBackupModuleState!
@@ -202,8 +209,20 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
202 /// Currently a no-op for AutoBackup because we have to wait for region to be fully loaded. 209 /// Currently a no-op for AutoBackup because we have to wait for region to be fully loaded.
203 /// </summary> 210 /// </summary>
204 /// <param name="scene"></param> 211 /// <param name="scene"></param>
205 void IRegionModuleBase.AddRegion(Scene scene) 212 void IRegionModuleBase.AddRegion (Scene scene)
206 { 213 {
214 if (!this.m_enabled) {
215 return;
216 }
217 lock (m_Scenes) {
218 m_Scenes.Add (scene);
219 }
220 m_console = MainConsole.Instance;
221
222 m_console.Commands.AddCommand (
223 "AutoBackup", false, "dobackup",
224 "dobackup",
225 "do backup.", DoBackup);
207 } 226 }
208 227
209 /// <summary> 228 /// <summary>
@@ -216,7 +235,7 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
216 { 235 {
217 return; 236 return;
218 } 237 }
219 238 m_Scenes.Remove (scene);
220 if (this.m_states.ContainsKey(scene)) 239 if (this.m_states.ContainsKey(scene))
221 { 240 {
222 AutoBackupModuleState abms = this.m_states[scene]; 241 AutoBackupModuleState abms = this.m_states[scene];
@@ -258,6 +277,8 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
258 AutoBackupModuleState abms = this.ParseConfig(scene, false); 277 AutoBackupModuleState abms = this.ParseConfig(scene, false);
259 m_log.Debug("[AUTO BACKUP]: Config for " + scene.RegionInfo.RegionName); 278 m_log.Debug("[AUTO BACKUP]: Config for " + scene.RegionInfo.RegionName);
260 m_log.Debug((abms == null ? "DEFAULT" : abms.ToString())); 279 m_log.Debug((abms == null ? "DEFAULT" : abms.ToString()));
280
281 m_states.Add(scene, abms);
261 } 282 }
262 283
263 /// <summary> 284 /// <summary>
@@ -269,6 +290,28 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
269 290
270 #endregion 291 #endregion
271 292
293 private void DoBackup (string module, string[] args)
294 {
295 if (args.Length != 2) {
296 MainConsole.Instance.OutputFormat ("Usage: dobackup <regionname>");
297 return;
298 }
299 bool found = false;
300 string name = args [1];
301 lock (m_Scenes) {
302 foreach (Scene s in m_Scenes) {
303 string test = s.Name.ToString ();
304 if (test == name) {
305 found = true;
306 DoRegionBackup (s);
307 }
308 }
309 if (!found) {
310 MainConsole.Instance.OutputFormat ("No such region {0}. Nothing to backup", name);
311 }
312 }
313 }
314
272 /// <summary> 315 /// <summary>
273 /// Set up internal state for a given scene. Fairly complex code. 316 /// Set up internal state for a given scene. Fairly complex code.
274 /// When this method returns, we've started auto-backup timers, put members in Dictionaries, and created a State object for this scene. 317 /// When this method returns, we've started auto-backup timers, put members in Dictionaries, and created a State object for this scene.
@@ -334,7 +377,7 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
334 double interval = 377 double interval =
335 this.ResolveDouble("AutoBackupInterval", this.m_defaultState.IntervalMinutes, 378 this.ResolveDouble("AutoBackupInterval", this.m_defaultState.IntervalMinutes,
336 config, regionConfig) * 60000.0; 379 config, regionConfig) * 60000.0;
337 if (state == null && interval != this.m_defaultState.IntervalMinutes*60000.0) 380 if (state == null && interval != this.m_defaultState.IntervalMinutes * 60000.0)
338 { 381 {
339 state = new AutoBackupModuleState(); 382 state = new AutoBackupModuleState();
340 } 383 }
@@ -412,6 +455,32 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
412 state.BusyCheck = tmpBusyCheck; 455 state.BusyCheck = tmpBusyCheck;
413 } 456 }
414 457
458 // Included Option To Skip Assets
459 bool tmpSkipAssets = ResolveBoolean("AutoBackupSkipAssets",
460 this.m_defaultState.SkipAssets, config, regionConfig);
461 if (state == null && tmpSkipAssets != this.m_defaultState.SkipAssets)
462 {
463 state = new AutoBackupModuleState();
464 }
465
466 if (state != null)
467 {
468 state.SkipAssets = tmpSkipAssets;
469 }
470
471 // How long to keep backup files in days, 0 Disables this feature
472 int tmpKeepFilesForDays = ResolveInt("AutoBackupKeepFilesForDays",
473 this.m_defaultState.KeepFilesForDays, config, regionConfig);
474 if (state == null && tmpKeepFilesForDays != this.m_defaultState.KeepFilesForDays)
475 {
476 state = new AutoBackupModuleState();
477 }
478
479 if (state != null)
480 {
481 state.KeepFilesForDays = tmpKeepFilesForDays;
482 }
483
415 // Set file naming algorithm 484 // Set file naming algorithm
416 string stmpNamingType = ResolveString("AutoBackupNaming", 485 string stmpNamingType = ResolveString("AutoBackupNaming",
417 this.m_defaultState.NamingType.ToString(), config, regionConfig); 486 this.m_defaultState.NamingType.ToString(), config, regionConfig);
@@ -480,7 +549,7 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
480 catch (Exception e) 549 catch (Exception e)
481 { 550 {
482 m_log.Warn( 551 m_log.Warn(
483 "BAD NEWS. You won't be able to save backups to directory " + 552 "[AUTO BACKUP]: BAD NEWS. You won't be able to save backups to directory " +
484 state.BackupDir + 553 state.BackupDir +
485 " because it doesn't exist or there's a permissions issue with it. Here's the exception.", 554 " because it doesn't exist or there's a permissions issue with it. Here's the exception.",
486 e); 555 e);
@@ -488,6 +557,9 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
488 } 557 }
489 } 558 }
490 559
560 if(state == null)
561 return m_defaultState;
562
491 return state; 563 return state;
492 } 564 }
493 565
@@ -594,7 +666,7 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
594 bool heuristicsPassed = false; 666 bool heuristicsPassed = false;
595 if (!this.m_timerMap.ContainsKey((Timer) sender)) 667 if (!this.m_timerMap.ContainsKey((Timer) sender))
596 { 668 {
597 m_log.Debug("Code-up error: timerMap doesn't contain timer " + sender); 669 m_log.Debug("[AUTO BACKUP]: Code-up error: timerMap doesn't contain timer " + sender);
598 } 670 }
599 671
600 List<IScene> tmap = this.m_timerMap[(Timer) sender]; 672 List<IScene> tmap = this.m_timerMap[(Timer) sender];
@@ -630,6 +702,9 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
630 } 702 }
631 this.DoRegionBackup(scene); 703 this.DoRegionBackup(scene);
632 } 704 }
705
706 // Remove Old Backups
707 this.RemoveOldFiles(state);
633 } 708 }
634 } 709 }
635 } 710 }
@@ -640,7 +715,7 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
640 /// <param name="scene"></param> 715 /// <param name="scene"></param>
641 private void DoRegionBackup(IScene scene) 716 private void DoRegionBackup(IScene scene)
642 { 717 {
643 if (scene.RegionStatus != RegionStatus.Up) 718 if (!scene.Ready)
644 { 719 {
645 // We won't backup a region that isn't operating normally. 720 // We won't backup a region that isn't operating normally.
646 m_log.Warn("[AUTO BACKUP]: Not backing up region " + scene.RegionInfo.RegionName + 721 m_log.Warn("[AUTO BACKUP]: Not backing up region " + scene.RegionInfo.RegionName +
@@ -662,7 +737,41 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
662 m_pendingSaves.Add(guid, scene); 737 m_pendingSaves.Add(guid, scene);
663 state.LiveRequests.Add(guid, savePath); 738 state.LiveRequests.Add(guid, savePath);
664 ((Scene) scene).EventManager.OnOarFileSaved += new EventManager.OarFileSaved(EventManager_OnOarFileSaved); 739 ((Scene) scene).EventManager.OnOarFileSaved += new EventManager.OarFileSaved(EventManager_OnOarFileSaved);
665 iram.ArchiveRegion(savePath, guid, null); 740
741 m_log.Info("[AUTO BACKUP]: Backing up region " + scene.RegionInfo.RegionName);
742
743 // Must pass options, even if dictionary is empty!
744 Dictionary<string, object> options = new Dictionary<string, object>();
745
746 if (state.SkipAssets)
747 options["noassets"] = true;
748
749 iram.ArchiveRegion(savePath, guid, options);
750 }
751
752 // For the given state, remove backup files older than the states KeepFilesForDays property
753 private void RemoveOldFiles(AutoBackupModuleState state)
754 {
755 // 0 Means Disabled, Keep Files Indefinitely
756 if (state.KeepFilesForDays > 0)
757 {
758 string[] files = Directory.GetFiles(state.BackupDir, "*.oar");
759 DateTime CuttOffDate = DateTime.Now.AddDays(0 - state.KeepFilesForDays);
760
761 foreach (string file in files)
762 {
763 try
764 {
765 FileInfo fi = new FileInfo(file);
766 if (fi.CreationTime < CuttOffDate)
767 fi.Delete();
768 }
769 catch (Exception Ex)
770 {
771 m_log.Error("[AUTO BACKUP]: Error deleting old backup file '" + file + "': " + Ex.Message);
772 }
773 }
774 }
666 } 775 }
667 776
668 /// <summary> 777 /// <summary>
diff --git a/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModuleState.cs b/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModuleState.cs
index f9e118b..ce7c368 100644
--- a/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModuleState.cs
+++ b/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModuleState.cs
@@ -45,9 +45,11 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
45 this.Enabled = false; 45 this.Enabled = false;
46 this.BackupDir = "."; 46 this.BackupDir = ".";
47 this.BusyCheck = true; 47 this.BusyCheck = true;
48 this.SkipAssets = false;
48 this.Timer = null; 49 this.Timer = null;
49 this.NamingType = NamingType.Time; 50 this.NamingType = NamingType.Time;
50 this.Script = null; 51 this.Script = null;
52 this.KeepFilesForDays = 0;
51 } 53 }
52 54
53 public Dictionary<Guid, string> LiveRequests 55 public Dictionary<Guid, string> LiveRequests
@@ -91,6 +93,12 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
91 set; 93 set;
92 } 94 }
93 95
96 public bool SkipAssets
97 {
98 get;
99 set;
100 }
101
94 public string Script 102 public string Script
95 { 103 {
96 get; 104 get;
@@ -109,6 +117,12 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
109 set; 117 set;
110 } 118 }
111 119
120 public int KeepFilesForDays
121 {
122 get;
123 set;
124 }
125
112 public new string ToString() 126 public new string ToString()
113 { 127 {
114 string retval = ""; 128 string retval = "";
diff --git a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs
index bcb21d0..8565f5a 100644
--- a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs
+++ b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs
@@ -103,7 +103,9 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
103 103
104 #region IMoneyModule Members 104 #region IMoneyModule Members
105 105
106#pragma warning disable 0067
106 public event ObjectPaid OnObjectPaid; 107 public event ObjectPaid OnObjectPaid;
108#pragma warning restore 0067
107 109
108 public int UploadCharge 110 public int UploadCharge
109 { 111 {
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index dcd2a52..dc1ea95 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -61,7 +61,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC
61 private readonly string m_firstname; 61 private readonly string m_firstname;
62 private readonly string m_lastname; 62 private readonly string m_lastname;
63 private readonly Vector3 m_startPos; 63 private readonly Vector3 m_startPos;
64<<<<<<< HEAD
65 private readonly UUID m_uuid;
66=======
64 private UUID m_uuid = UUID.Random(); 67 private UUID m_uuid = UUID.Random();
68>>>>>>> avn/ubitvar
65 private readonly Scene m_scene; 69 private readonly Scene m_scene;
66 private readonly UUID m_ownerID; 70 private readonly UUID m_ownerID;
67 71
@@ -73,6 +77,19 @@ namespace OpenSim.Region.OptionalModules.World.NPC
73 m_firstname = firstname; 77 m_firstname = firstname;
74 m_lastname = lastname; 78 m_lastname = lastname;
75 m_startPos = position; 79 m_startPos = position;
80 m_uuid = UUID.Random();
81 m_scene = scene;
82 m_ownerID = ownerID;
83 SenseAsAgent = senseAsAgent;
84 }
85
86 public NPCAvatar(
87 string firstname, string lastname, UUID agentID, Vector3 position, UUID ownerID, bool senseAsAgent, Scene scene)
88 {
89 m_firstname = firstname;
90 m_lastname = lastname;
91 m_startPos = position;
92 m_uuid = agentID;
76 m_scene = scene; 93 m_scene = scene;
77 m_ownerID = ownerID; 94 m_ownerID = ownerID;
78 SenseAsAgent = senseAsAgent; 95 SenseAsAgent = senseAsAgent;
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index 226608a..2977195 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -140,8 +140,30 @@ namespace OpenSim.Region.OptionalModules.World.NPC
140 Vector3 position, UUID owner, bool senseAsAgent, Scene scene, 140 Vector3 position, UUID owner, bool senseAsAgent, Scene scene,
141 AvatarAppearance appearance) 141 AvatarAppearance appearance)
142 { 142 {
143 NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position, 143 return CreateNPC(firstname, lastname, position, UUID.Zero, owner, senseAsAgent, scene, appearance);
144 owner, senseAsAgent, scene); 144 }
145
146 public UUID CreateNPC(string firstname, string lastname,
147 Vector3 position, UUID agentID, UUID owner, bool senseAsAgent, Scene scene,
148 AvatarAppearance appearance)
149 {
150 NPCAvatar npcAvatar = null;
151
152 try
153 {
154 if (agentID == UUID.Zero)
155 npcAvatar = new NPCAvatar(firstname, lastname, position,
156 owner, senseAsAgent, scene);
157 else
158 npcAvatar = new NPCAvatar(firstname, lastname, agentID, position,
159 owner, senseAsAgent, scene);
160 }
161 catch (Exception e)
162 {
163 m_log.Info("[NPC MODULE]: exception creating NPC avatar: " + e.ToString());
164 return UUID.Zero;
165 }
166
145 npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, 167 npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0,
146 int.MaxValue); 168 int.MaxValue);
147 169
@@ -155,8 +177,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
155 acd.lastname = lastname; 177 acd.lastname = lastname;
156 acd.ServiceURLs = new Dictionary<string, object>(); 178 acd.ServiceURLs = new Dictionary<string, object>();
157 179
158 AvatarAppearance npcAppearance = new AvatarAppearance(appearance, 180 AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true);
159 true);
160 acd.Appearance = npcAppearance; 181 acd.Appearance = npcAppearance;
161 182
162 /* 183 /*
@@ -207,6 +228,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC
207 ScenePresence sp; 228 ScenePresence sp;
208 if (scene.TryGetScenePresence(agentID, out sp)) 229 if (scene.TryGetScenePresence(agentID, out sp))
209 { 230 {
231 if (sp.IsSatOnObject || sp.SitGround)
232 return false;
233
210// m_log.DebugFormat( 234// m_log.DebugFormat(
211// "[NPC MODULE]: Moving {0} to {1} in {2}, noFly {3}, landAtTarget {4}", 235// "[NPC MODULE]: Moving {0} to {1} in {2}, noFly {3}, landAtTarget {4}",
212// sp.Name, pos, scene.RegionInfo.RegionName, 236// sp.Name, pos, scene.RegionInfo.RegionName,
@@ -368,26 +392,30 @@ namespace OpenSim.Region.OptionalModules.World.NPC
368 392
369 public bool DeleteNPC(UUID agentID, Scene scene) 393 public bool DeleteNPC(UUID agentID, Scene scene)
370 { 394 {
395 bool doRemove = false;
396 NPCAvatar av;
371 lock (m_avatars) 397 lock (m_avatars)
372 { 398 {
373 NPCAvatar av;
374 if (m_avatars.TryGetValue(agentID, out av)) 399 if (m_avatars.TryGetValue(agentID, out av))
375 { 400 {
376 /* 401 /*
377 m_log.DebugFormat("[NPC MODULE]: Found {0} {1} to remove", 402 m_log.DebugFormat("[NPC MODULE]: Found {0} {1} to remove",
378 agentID, av.Name); 403 agentID, av.Name);
379 */ 404 */
405 doRemove = true;
406 }
407 }
380 408
381 scene.CloseAgent(agentID, false); 409 if (doRemove)
382 410 {
411 scene.CloseAgent(agentID, false);
412 lock (m_avatars)
413 {
383 m_avatars.Remove(agentID); 414 m_avatars.Remove(agentID);
384
385 /*
386 m_log.DebugFormat("[NPC MODULE]: Removed NPC {0} {1}",
387 agentID, av.Name);
388 */
389 return true;
390 } 415 }
416 m_log.DebugFormat("[NPC MODULE]: Removed NPC {0} {1}",
417 agentID, av.Name);
418 return true;
391 } 419 }
392 /* 420 /*
393 m_log.DebugFormat("[NPC MODULE]: Could not find {0} to remove", 421 m_log.DebugFormat("[NPC MODULE]: Could not find {0} to remove",
@@ -417,12 +445,24 @@ namespace OpenSim.Region.OptionalModules.World.NPC
417 /// <summary> 445 /// <summary>
418 /// Check if the caller has permission to manipulate the given NPC. 446 /// Check if the caller has permission to manipulate the given NPC.
419 /// </summary> 447 /// </summary>
448 /// <remarks>
449 /// A caller has permission if
450 /// * The caller UUID given is UUID.Zero.
451 /// * The avatar is unowned (owner is UUID.Zero).
452 /// * The avatar is owned and the owner and callerID match.
453 /// * The avatar is owned and the callerID matches its agentID.
454 /// </remarks>
420 /// <param name="av"></param> 455 /// <param name="av"></param>
421 /// <param name="callerID"></param> 456 /// <param name="callerID"></param>
422 /// <returns>true if they do, false if they don't.</returns> 457 /// <returns>true if they do, false if they don't.</returns>
423 private bool CheckPermissions(NPCAvatar av, UUID callerID) 458 private bool CheckPermissions(NPCAvatar av, UUID callerID)
424 { 459 {
460<<<<<<< HEAD
461 return callerID == UUID.Zero || av.OwnerID == UUID.Zero ||
462 av.OwnerID == callerID || av.AgentId == callerID;
463=======
425 return callerID == UUID.Zero || av.OwnerID == UUID.Zero || av.OwnerID == callerID || av.AgentId == callerID; 464 return callerID == UUID.Zero || av.OwnerID == UUID.Zero || av.OwnerID == callerID || av.AgentId == callerID;
465>>>>>>> avn/ubitvar
426 } 466 }
427 } 467 }
428} 468}
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
index 14eb25b..2345e38 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
@@ -43,7 +43,6 @@ using OpenSim.Region.Framework.Interfaces;
43using OpenSim.Region.Framework.Scenes; 43using OpenSim.Region.Framework.Scenes;
44using OpenSim.Services.AvatarService; 44using OpenSim.Services.AvatarService;
45using OpenSim.Tests.Common; 45using OpenSim.Tests.Common;
46using OpenSim.Tests.Common.Mock;
47 46
48namespace OpenSim.Region.OptionalModules.World.NPC.Tests 47namespace OpenSim.Region.OptionalModules.World.NPC.Tests
49{ 48{
@@ -71,11 +70,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
71 Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod; 70 Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
72 } 71 }
73 72
74 [SetUp] 73 public void SetUpScene()
75 public void Init()
76 { 74 {
77 base.SetUp(); 75 SetUpScene(256, 256);
76 }
78 77
78 public void SetUpScene(uint sizeX, uint sizeY)
79 {
79 IConfigSource config = new IniConfigSource(); 80 IConfigSource config = new IniConfigSource();
80 config.AddConfig("NPC"); 81 config.AddConfig("NPC");
81 config.Configs["NPC"].Set("Enabled", "true"); 82 config.Configs["NPC"].Set("Enabled", "true");
@@ -87,7 +88,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
87 m_attMod = new AttachmentsModule(); 88 m_attMod = new AttachmentsModule();
88 m_npcMod = new NPCModule(); 89 m_npcMod = new NPCModule();
89 90
90 m_scene = new SceneHelpers().SetupScene(); 91 m_scene = new SceneHelpers().SetupScene("test scene", UUID.Random(), 1000, 1000, sizeX, sizeY, config);
91 SceneHelpers.SetupSceneModules(m_scene, config, m_afMod, m_umMod, m_attMod, m_npcMod, new BasicInventoryAccessModule()); 92 SceneHelpers.SetupSceneModules(m_scene, config, m_afMod, m_umMod, m_attMod, m_npcMod, new BasicInventoryAccessModule());
92 } 93 }
93 94
@@ -97,6 +98,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
97 TestHelpers.InMethod(); 98 TestHelpers.InMethod();
98// log4net.Config.XmlConfigurator.Configure(); 99// log4net.Config.XmlConfigurator.Configure();
99 100
101 SetUpScene();
102
100 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); 103 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
101// ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); 104// ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId);
102 105
@@ -133,6 +136,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
133 TestHelpers.InMethod(); 136 TestHelpers.InMethod();
134// log4net.Config.XmlConfigurator.Configure(); 137// log4net.Config.XmlConfigurator.Configure();
135 138
139 SetUpScene();
140
136 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); 141 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
137// ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); 142// ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId);
138 143
@@ -157,6 +162,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
157 TestHelpers.InMethod(); 162 TestHelpers.InMethod();
158// TestHelpers.EnableLogging(); 163// TestHelpers.EnableLogging();
159 164
165 SetUpScene();
166
160 UUID userId = TestHelpers.ParseTail(0x1); 167 UUID userId = TestHelpers.ParseTail(0x1);
161 UserAccountHelpers.CreateUserWithInventory(m_scene, userId); 168 UserAccountHelpers.CreateUserWithInventory(m_scene, userId);
162 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); 169 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
@@ -191,11 +198,66 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
191 } 198 }
192 199
193 [Test] 200 [Test]
201 public void TestCreateWithMultiAttachments()
202 {
203 TestHelpers.InMethod();
204// TestHelpers.EnableLogging();
205
206 SetUpScene();
207// m_attMod.DebugLevel = 1;
208
209 UUID userId = TestHelpers.ParseTail(0x1);
210 UserAccountHelpers.CreateUserWithInventory(m_scene, userId);
211 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
212
213 InventoryItemBase att1Item
214 = UserInventoryHelpers.CreateInventoryItem(
215 m_scene, "att1", TestHelpers.ParseTail(0x2), TestHelpers.ParseTail(0x3), sp.UUID, InventoryType.Object);
216 InventoryItemBase att2Item
217 = UserInventoryHelpers.CreateInventoryItem(
218 m_scene, "att2", TestHelpers.ParseTail(0x12), TestHelpers.ParseTail(0x13), sp.UUID, InventoryType.Object);
219
220 m_attMod.RezSingleAttachmentFromInventory(sp, att1Item.ID, (uint)AttachmentPoint.Chest);
221 m_attMod.RezSingleAttachmentFromInventory(sp, att2Item.ID, (uint)AttachmentPoint.Chest | 0x80);
222
223 UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance);
224
225 ScenePresence npc = m_scene.GetScenePresence(npcId);
226
227 // Check scene presence status
228 Assert.That(npc.HasAttachments(), Is.True);
229 List<SceneObjectGroup> attachments = npc.GetAttachments();
230 Assert.That(attachments.Count, Is.EqualTo(2));
231
232 // Just for now, we won't test the name since this is (wrongly) the asset part name rather than the item
233 // name. TODO: Do need to fix ultimately since the item may be renamed before being passed on to an NPC.
234// Assert.That(attSo.Name, Is.EqualTo(attName));
235
236 TestAttachedObject(attachments[0], AttachmentPoint.Chest, npc.UUID);
237 TestAttachedObject(attachments[1], AttachmentPoint.Chest, npc.UUID);
238
239 // Attached objects on the same point must have different FromItemIDs to be shown to other avatars, at least
240 // on Singularity 1.8.5. Otherwise, only one (the first ObjectUpdate sent) appears.
241 Assert.AreNotEqual(attachments[0].FromItemID, attachments[1].FromItemID);
242 }
243
244 private void TestAttachedObject(SceneObjectGroup attSo, AttachmentPoint attPoint, UUID ownerId)
245 {
246 Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)attPoint));
247 Assert.That(attSo.IsAttachment);
248 Assert.That(attSo.UsesPhysics, Is.False);
249 Assert.That(attSo.IsTemporary, Is.False);
250 Assert.That(attSo.OwnerID, Is.EqualTo(ownerId));
251 }
252
253 [Test]
194 public void TestLoadAppearance() 254 public void TestLoadAppearance()
195 { 255 {
196 TestHelpers.InMethod(); 256 TestHelpers.InMethod();
197// log4net.Config.XmlConfigurator.Configure(); 257// log4net.Config.XmlConfigurator.Configure();
198 258
259 SetUpScene();
260
199 UUID userId = TestHelpers.ParseTail(0x1); 261 UUID userId = TestHelpers.ParseTail(0x1);
200 UserAccountHelpers.CreateUserWithInventory(m_scene, userId); 262 UserAccountHelpers.CreateUserWithInventory(m_scene, userId);
201 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); 263 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
@@ -237,7 +299,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
237 public void TestMove() 299 public void TestMove()
238 { 300 {
239 TestHelpers.InMethod(); 301 TestHelpers.InMethod();
240// log4net.Config.XmlConfigurator.Configure(); 302// TestHelpers.EnableLogging();
303
304 SetUpScene();
241 305
242 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); 306 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
243// ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); 307// ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId);
@@ -303,11 +367,64 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
303 } 367 }
304 368
305 [Test] 369 [Test]
370 public void TestMoveInVarRegion()
371 {
372 TestHelpers.InMethod();
373// TestHelpers.EnableLogging();
374
375 SetUpScene(512, 512);
376
377 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
378// ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId);
379
380 Vector3 startPos = new Vector3(128, 246, 30);
381 UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance);
382
383 ScenePresence npc = m_scene.GetScenePresence(npcId);
384 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
385
386 // For now, we'll make the scene presence fly to simplify this test, but this needs to change.
387 npc.Flying = true;
388
389 m_scene.Update(1);
390 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
391
392 Vector3 targetPos = startPos + new Vector3(0, 20, 0);
393 m_npcMod.MoveToTarget(npc.UUID, m_scene, targetPos, false, false, false);
394
395 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
396 //Assert.That(npc.Rotation, Is.EqualTo(new Quaternion(0, 0, 0.7071068f, 0.7071068f)));
397 Assert.That(
398 npc.Rotation, new QuaternionToleranceConstraint(new Quaternion(0, 0, 0.7071068f, 0.7071068f), 0.000001));
399
400 m_scene.Update(1);
401
402 // We should really check the exact figure.
403 Assert.That(npc.AbsolutePosition.X, Is.EqualTo(startPos.X));
404 Assert.That(npc.AbsolutePosition.Y, Is.GreaterThan(startPos.Y));
405 Assert.That(npc.AbsolutePosition.Z, Is.EqualTo(startPos.Z));
406 Assert.That(npc.AbsolutePosition.Z, Is.LessThan(targetPos.X));
407
408 for (int i = 0; i < 20; i++)
409 {
410 m_scene.Update(1);
411// Console.WriteLine("pos: {0}", npc.AbsolutePosition);
412 }
413
414 double distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos);
415 Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on first move");
416 Assert.That(npc.AbsolutePosition, Is.EqualTo(targetPos));
417 Assert.That(npc.AgentControlFlags, Is.EqualTo((uint)AgentManager.ControlFlags.NONE));
418 }
419
420 [Test]
306 public void TestSitAndStandWithSitTarget() 421 public void TestSitAndStandWithSitTarget()
307 { 422 {
308 TestHelpers.InMethod(); 423 TestHelpers.InMethod();
309// log4net.Config.XmlConfigurator.Configure(); 424// log4net.Config.XmlConfigurator.Configure();
310 425
426 SetUpScene();
427
311 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); 428 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
312 429
313 Vector3 startPos = new Vector3(128, 128, 30); 430 Vector3 startPos = new Vector3(128, 128, 30);
@@ -337,6 +454,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
337 TestHelpers.InMethod(); 454 TestHelpers.InMethod();
338// TestHelpers.EnableLogging(); 455// TestHelpers.EnableLogging();
339 456
457 SetUpScene();
458
340 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); 459 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
341 460
342 // FIXME: To get this to work for now, we are going to place the npc right next to the target so that 461 // FIXME: To get this to work for now, we are going to place the npc right next to the target so that
diff --git a/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs b/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs
index 6cbccc0..a26d145 100644
--- a/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs
+++ b/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using System.Linq; 30using System.Linq;
31using System.Reflection; 31using System.Reflection;
32using System.Text; 32using System.Text;
33using System.Threading;
33using log4net; 34using log4net;
34using Mono.Addins; 35using Mono.Addins;
35using Nini.Config; 36using Nini.Config;
@@ -93,28 +94,44 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
93 "Debug", this, "debug scene get", 94 "Debug", this, "debug scene get",
94 "debug scene get", 95 "debug scene get",
95 "List current scene options.", 96 "List current scene options.",
96 "If active is false then main scene update and maintenance loops are suspended.\n" 97 "active - if false then main scene update and maintenance loops are suspended.\n"
97 + "If animations is true then extra animations debug information is logged.\n" 98 + "animations - if true then extra animations debug information is logged.\n"
98 + "If collisions is false then collisions with other objects are turned off.\n" 99 + "appear-refresh - if true then appearance is resent to other avatars every 60 seconds.\n"
99 + "If pbackup is false then periodic scene backup is turned off.\n" 100 + "child-repri - how far an avatar must move in meters before we update the position of its child agents in neighbouring regions.\n"
100 + "If physics is false then all physics objects are non-physical.\n" 101 + "client-pos-upd - the tolerance before clients are updated with new rotation information for an avatar.\n"
101 + "If scripting is false then no scripting operations happen.\n" 102 + "client-rot-upd - the tolerance before clients are updated with new rotation information for an avatar.\n"
102 + "If teleport is true then some extra teleport debug information is logged.\n" 103 + "client-vel-upd - the tolerance before clients are updated with new velocity information for an avatar.\n"
103 + "If updates is true then any frame which exceeds double the maximum desired frame time is logged.", 104 + "root-upd-per - if greater than 1, terse updates are only sent to root agents other than the originator on every n updates.\n"
105 + "child-upd-per - if greater than 1, terse updates are only sent to child agents on every n updates.\n"
106 + "collisions - if false then collisions with other objects are turned off.\n"
107 + "pbackup - if false then periodic scene backup is turned off.\n"
108 + "physics - if false then all physics objects are non-physical.\n"
109 + "scripting - if false then no scripting operations happen.\n"
110 + "teleport - if true then some extra teleport debug information is logged.\n"
111 + "update-on-timer - If true then the scene is updated via a timer. If false then a thread with sleep is used.\n"
112 + "updates - if true then any frame which exceeds double the maximum desired frame time is logged.",
104 HandleDebugSceneGetCommand); 113 HandleDebugSceneGetCommand);
105 114
106 scene.AddCommand( 115 scene.AddCommand(
107 "Debug", this, "debug scene set", 116 "Debug", this, "debug scene set",
108 "debug scene set active|collisions|pbackup|physics|scripting|teleport|updates true|false", 117 "debug scene set <param> <value>",
109 "Turn on scene debugging options.", 118 "Turn on scene debugging options.",
110 "If active is false then main scene update and maintenance loops are suspended.\n" 119 "active - if false then main scene update and maintenance loops are suspended.\n"
111 + "If animations is true then extra animations debug information is logged.\n" 120 + "animations - if true then extra animations debug information is logged.\n"
112 + "If collisions is false then collisions with other objects are turned off.\n" 121 + "appear-refresh - if true then appearance is resent to other avatars every 60 seconds.\n"
113 + "If pbackup is false then periodic scene backup is turned off.\n" 122 + "child-repri - how far an avatar must move in meters before we update the position of its child agents in neighbouring regions.\n"
114 + "If physics is false then all physics objects are non-physical.\n" 123 + "client-pos-upd - the tolerance before clients are updated with new rotation information for an avatar.\n"
115 + "If scripting is false then no scripting operations happen.\n" 124 + "client-rot-upd - the tolerance before clients are updated with new rotation information for an avatar.\n"
116 + "If teleport is true then some extra teleport debug information is logged.\n" 125 + "client-vel-upd - the tolerance before clients are updated with new velocity information for an avatar.\n"
117 + "If updates is true then any frame which exceeds double the maximum desired frame time is logged.", 126 + "root-upd-per - if greater than 1, terse updates are only sent to root agents other than the originator on every n updates.\n"
127 + "child-upd-per - if greater than 1, terse updates are only sent to child agents on every n updates.\n"
128 + "collisions - if false then collisions with other objects are turned off.\n"
129 + "pbackup - if false then periodic scene backup is turned off.\n"
130 + "physics - if false then all physics objects are non-physical.\n"
131 + "scripting - if false then no scripting operations happen.\n"
132 + "teleport - if true then some extra teleport debug information is logged.\n"
133 + "update-on-timer - If true then the scene is updated via a timer. If false then a thread with sleep is used.\n"
134 + "updates - if true then any frame which exceeds double the maximum desired frame time is logged.",
118 HandleDebugSceneSetCommand); 135 HandleDebugSceneSetCommand);
119 } 136 }
120 137
@@ -138,10 +155,18 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
138 ConsoleDisplayList cdl = new ConsoleDisplayList(); 155 ConsoleDisplayList cdl = new ConsoleDisplayList();
139 cdl.AddRow("active", m_scene.Active); 156 cdl.AddRow("active", m_scene.Active);
140 cdl.AddRow("animations", m_scene.DebugAnimations); 157 cdl.AddRow("animations", m_scene.DebugAnimations);
158 cdl.AddRow("appear-refresh", m_scene.SendPeriodicAppearanceUpdates);
159 cdl.AddRow("child-repri", m_scene.ChildReprioritizationDistance);
160 cdl.AddRow("client-pos-upd", m_scene.RootPositionUpdateTolerance);
161 cdl.AddRow("client-rot-upd", m_scene.RootRotationUpdateTolerance);
162 cdl.AddRow("client-vel-upd", m_scene.RootVelocityUpdateTolerance);
163 cdl.AddRow("root-upd-per", m_scene.RootTerseUpdatePeriod);
164 cdl.AddRow("child-upd-per", m_scene.ChildTerseUpdatePeriod);
141 cdl.AddRow("pbackup", m_scene.PeriodicBackup); 165 cdl.AddRow("pbackup", m_scene.PeriodicBackup);
142 cdl.AddRow("physics", m_scene.PhysicsEnabled); 166 cdl.AddRow("physics", m_scene.PhysicsEnabled);
143 cdl.AddRow("scripting", m_scene.ScriptsEnabled); 167 cdl.AddRow("scripting", m_scene.ScriptsEnabled);
144 cdl.AddRow("teleport", m_scene.DebugTeleporting); 168 cdl.AddRow("teleport", m_scene.DebugTeleporting);
169 cdl.AddRow("update-on-timer", m_scene.UpdateOnTimer);
145 cdl.AddRow("updates", m_scene.DebugUpdates); 170 cdl.AddRow("updates", m_scene.DebugUpdates);
146 171
147 MainConsole.Instance.OutputFormat("Scene {0} options:", m_scene.Name); 172 MainConsole.Instance.OutputFormat("Scene {0} options:", m_scene.Name);
@@ -163,8 +188,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
163 } 188 }
164 else 189 else
165 { 190 {
166 MainConsole.Instance.Output( 191 MainConsole.Instance.Output("Usage: debug scene set <param> <value>");
167 "Usage: debug scene set active|collisions|pbackup|physics|scripting|teleport|updates true|false");
168 } 192 }
169 } 193 }
170 194
@@ -186,6 +210,69 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
186 m_scene.DebugAnimations = active; 210 m_scene.DebugAnimations = active;
187 } 211 }
188 212
213 if (options.ContainsKey("appear-refresh"))
214 {
215 bool newValue;
216
217 // FIXME: This can only come from the console at the moment but might not always be true.
218 if (ConsoleUtil.TryParseConsoleBool(MainConsole.Instance, options["appear-refresh"], out newValue))
219 m_scene.SendPeriodicAppearanceUpdates = newValue;
220 }
221
222 if (options.ContainsKey("child-repri"))
223 {
224 double newValue;
225
226 // FIXME: This can only come from the console at the moment but might not always be true.
227 if (ConsoleUtil.TryParseConsoleDouble(MainConsole.Instance, options["child-repri"], out newValue))
228 m_scene.ChildReprioritizationDistance = newValue;
229 }
230
231 if (options.ContainsKey("client-pos-upd"))
232 {
233 float newValue;
234
235 // FIXME: This can only come from the console at the moment but might not always be true.
236 if (ConsoleUtil.TryParseConsoleFloat(MainConsole.Instance, options["client-pos-upd"], out newValue))
237 m_scene.RootPositionUpdateTolerance = newValue;
238 }
239
240 if (options.ContainsKey("client-rot-upd"))
241 {
242 float newValue;
243
244 // FIXME: This can only come from the console at the moment but might not always be true.
245 if (ConsoleUtil.TryParseConsoleFloat(MainConsole.Instance, options["client-rot-upd"], out newValue))
246 m_scene.RootRotationUpdateTolerance = newValue;
247 }
248
249 if (options.ContainsKey("client-vel-upd"))
250 {
251 float newValue;
252
253 // FIXME: This can only come from the console at the moment but might not always be true.
254 if (ConsoleUtil.TryParseConsoleFloat(MainConsole.Instance, options["client-vel-upd"], out newValue))
255 m_scene.RootVelocityUpdateTolerance = newValue;
256 }
257
258 if (options.ContainsKey("root-upd-per"))
259 {
260 int newValue;
261
262 // FIXME: This can only come from the console at the moment but might not always be true.
263 if (ConsoleUtil.TryParseConsoleNaturalInt(MainConsole.Instance, options["root-upd-per"], out newValue))
264 m_scene.RootTerseUpdatePeriod = newValue;
265 }
266
267 if (options.ContainsKey("child-upd-per"))
268 {
269 int newValue;
270
271 // FIXME: This can only come from the console at the moment but might not always be true.
272 if (ConsoleUtil.TryParseConsoleNaturalInt(MainConsole.Instance, options["child-upd-per"], out newValue))
273 m_scene.ChildTerseUpdatePeriod = newValue;
274 }
275
189 if (options.ContainsKey("pbackup")) 276 if (options.ContainsKey("pbackup"))
190 { 277 {
191 bool active; 278 bool active;
@@ -221,6 +308,21 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
221 m_scene.DebugTeleporting = enableTeleportDebugging; 308 m_scene.DebugTeleporting = enableTeleportDebugging;
222 } 309 }
223 310
311 if (options.ContainsKey("update-on-timer"))
312 {
313 bool enableUpdateOnTimer;
314 if (bool.TryParse(options["update-on-timer"], out enableUpdateOnTimer))
315 {
316 m_scene.UpdateOnTimer = enableUpdateOnTimer;
317 m_scene.Active = false;
318
319 while (m_scene.IsRunning)
320 Thread.Sleep(20);
321
322 m_scene.Active = true;
323 }
324 }
325
224 if (options.ContainsKey("updates")) 326 if (options.ContainsKey("updates"))
225 { 327 {
226 bool enableUpdateDebugging; 328 bool enableUpdateDebugging;
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs
index ffcb01e..7d054dd 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs
@@ -55,4 +55,4 @@ using System.Runtime.InteropServices;
55// You can specify all values by your own or you can build default build and revision 55// You can specify all values by your own or you can build default build and revision
56// numbers with the '*' character (the default): 56// numbers with the '*' character (the default):
57 57
58[assembly : AssemblyVersion("0.8.0.*")] 58[assembly : AssemblyVersion("0.8.2.*")]
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
index 0d17e0e..43fba7b 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
@@ -36,8 +36,6 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
36{ 36{
37 public class BasicActor : PhysicsActor 37 public class BasicActor : PhysicsActor
38 { 38 {
39 private Vector3 _size;
40
41 public BasicActor(Vector3 size) 39 public BasicActor(Vector3 size)
42 { 40 {
43 Size = size; 41 Size = size;
@@ -240,6 +238,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
240 238
241 public override bool PIDActive 239 public override bool PIDActive
242 { 240 {
241 get { return false; }
243 set { return; } 242 set { return; }
244 } 243 }
245 244
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs
index 47d7df3..dfe4c19 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs
@@ -251,6 +251,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
251 251
252 public override bool PIDActive 252 public override bool PIDActive
253 { 253 {
254 get { return false; }
254 set { return; } 255 set { return; }
255 } 256 }
256 257
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
index 8e40561..06a205e 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
@@ -80,10 +80,11 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
80 return prim; 80 return prim;
81 } 81 }
82 82
83 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) 83 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying)
84 { 84 {
85 BasicActor act = new BasicActor(size); 85 BasicActor act = new BasicActor(size);
86 act.Position = position; 86 act.Position = position;
87 act.Velocity = velocity;
87 act.Flying = isFlying; 88 act.Flying = isFlying;
88 _actors.Add(act); 89 _actors.Add(act);
89 return act; 90 return act;
@@ -147,6 +148,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
147 terrainHeight = _heightMap[(int)actor.Position.Y * (int)m_regionExtent.Y + (int)actor.Position.X]; 148 terrainHeight = _heightMap[(int)actor.Position.Y * (int)m_regionExtent.Y + (int)actor.Position.X];
148 149
149 float height = terrainHeight + actor.Size.Z; 150 float height = terrainHeight + actor.Size.Z;
151// Console.WriteLine("height {0}, actorPosition {1}", height, actorPosition);
150 152
151 if (actor.Flying) 153 if (actor.Flying)
152 { 154 {
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs
index 17ebed2..741f8db 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs
@@ -658,7 +658,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
658 IndexedVector3 frame2v = new IndexedVector3(pframe2.X, pframe2.Y, pframe2.Z); 658 IndexedVector3 frame2v = new IndexedVector3(pframe2.X, pframe2.Y, pframe2.Z);
659 IndexedQuaternion frame2rot = new IndexedQuaternion(pframe2rot.X, pframe2rot.Y, pframe2rot.Z, pframe2rot.W); 659 IndexedQuaternion frame2rot = new IndexedQuaternion(pframe2rot.X, pframe2rot.Y, pframe2rot.Z, pframe2rot.W);
660 IndexedMatrix frame2 = IndexedMatrix.CreateFromQuaternion(frame2rot); 660 IndexedMatrix frame2 = IndexedMatrix.CreateFromQuaternion(frame2rot);
661 frame2._origin = frame1v; 661 frame2._origin = frame2v;
662 constraint.SetFrames(ref frame1, ref frame2); 662 constraint.SetFrames(ref frame1, ref frame2);
663 return true; 663 return true;
664 } 664 }
@@ -1311,7 +1311,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
1311 /* TODO */ 1311 /* TODO */
1312 ConfigurationParameters[] configparms = new ConfigurationParameters[1]; 1312 ConfigurationParameters[] configparms = new ConfigurationParameters[1];
1313 configparms[0] = parms; 1313 configparms[0] = parms;
1314 Vector3 worldExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight); 1314 Vector3 worldExtent = maxPosition;
1315 m_maxCollisions = maxCollisions; 1315 m_maxCollisions = maxCollisions;
1316 m_maxUpdatesPerFrame = maxUpdates; 1316 m_maxUpdatesPerFrame = maxUpdates;
1317 specialCollisionObjects = new Dictionary<uint, GhostObject>(); 1317 specialCollisionObjects = new Dictionary<uint, GhostObject>();
@@ -2255,7 +2255,6 @@ private sealed class BulletConstraintXNA : BulletConstraint
2255 world.LastCollisionDesc = 0; 2255 world.LastCollisionDesc = 0;
2256 world.LastEntityProperty = 0; 2256 world.LastEntityProperty = 0;
2257 numSimSteps = world.StepSimulation(timeStep, m_maxSubSteps, m_fixedTimeStep); 2257 numSimSteps = world.StepSimulation(timeStep, m_maxSubSteps, m_fixedTimeStep);
2258 int updates = 0;
2259 2258
2260 PersistentManifold contactManifold; 2259 PersistentManifold contactManifold;
2261 CollisionObject objA; 2260 CollisionObject objA;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs
index 1bcf879..bde4557 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using System.Linq; 30using System.Linq;
31using System.Text; 31using System.Text;
32 32
33using OpenSim.Framework;
33using OpenSim.Region.Physics.Manager; 34using OpenSim.Region.Physics.Manager;
34 35
35using OMV = OpenMetaverse; 36using OMV = OpenMetaverse;
@@ -70,8 +71,7 @@ public class BSActorAvatarMove : BSActor
70 public override void Dispose() 71 public override void Dispose()
71 { 72 {
72 base.SetEnabled(false); 73 base.SetEnabled(false);
73 // Now that turned off, remove any state we have in the scene. 74 DeactivateAvatarMove();
74 Refresh();
75 } 75 }
76 76
77 // Called when physical parameters (properties set in Bullet) need to be re-applied. 77 // Called when physical parameters (properties set in Bullet) need to be re-applied.
@@ -109,6 +109,10 @@ public class BSActorAvatarMove : BSActor
109 { 109 {
110 if (m_velocityMotor != null) 110 if (m_velocityMotor != null)
111 { 111 {
112// if (targ == OMV.Vector3.Zero)
113// Util.PrintCallStack();
114//
115// Console.WriteLine("SetVelocityAndTarget, {0} {1}", vel, targ);
112 m_velocityMotor.Reset(); 116 m_velocityMotor.Reset();
113 m_velocityMotor.SetTarget(targ); 117 m_velocityMotor.SetTarget(targ);
114 m_velocityMotor.SetCurrent(vel); 118 m_velocityMotor.SetCurrent(vel);
@@ -205,6 +209,17 @@ public class BSActorAvatarMove : BSActor
205 // Flying and not colliding and velocity nearly zero. 209 // Flying and not colliding and velocity nearly zero.
206 m_controllingPrim.ZeroMotion(true /* inTaintTime */); 210 m_controllingPrim.ZeroMotion(true /* inTaintTime */);
207 } 211 }
212 else
213 {
214 //We are falling but are not touching any keys make sure not falling too fast
215 if (m_controllingPrim.RawVelocity.Z < BSParam.AvatarTerminalVelocity)
216 {
217
218 OMV.Vector3 slowingForce = new OMV.Vector3(0f, 0f, BSParam.AvatarTerminalVelocity - m_controllingPrim.RawVelocity.Z) * m_controllingPrim.Mass;
219 m_physicsScene.PE.ApplyCentralImpulse(m_controllingPrim.PhysBody, slowingForce);
220 }
221
222 }
208 } 223 }
209 224
210 m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,taint,stopping,target={1},colliding={2}", 225 m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,taint,stopping,target={1},colliding={2}",
@@ -227,7 +242,6 @@ public class BSActorAvatarMove : BSActor
227 stepVelocity.Z = m_controllingPrim.RawVelocity.Z; 242 stepVelocity.Z = m_controllingPrim.RawVelocity.Z;
228 } 243 }
229 244
230
231 // Colliding and not flying with an upward force. The avatar must be trying to jump. 245 // Colliding and not flying with an upward force. The avatar must be trying to jump.
232 if (!m_controllingPrim.Flying && m_controllingPrim.IsColliding && stepVelocity.Z > 0) 246 if (!m_controllingPrim.Flying && m_controllingPrim.IsColliding && stepVelocity.Z > 0)
233 { 247 {
@@ -253,12 +267,34 @@ public class BSActorAvatarMove : BSActor
253 } 267 }
254 else 268 else
255 { 269 {
256 // Since we're not affected by anything, whatever vertical motion the avatar has, continue that. 270
257 stepVelocity.Z = m_controllingPrim.RawVelocity.Z; 271 // Since we're not affected by anything, the avatar must be falling and we do not want that to be too fast.
272 if (m_controllingPrim.RawVelocity.Z < BSParam.AvatarTerminalVelocity)
273 {
274
275 stepVelocity.Z = BSParam.AvatarTerminalVelocity;
276 }
277 else
278 {
279 stepVelocity.Z = m_controllingPrim.RawVelocity.Z;
280 }
258 } 281 }
259 // DetailLog("{0},BSCharacter.MoveMotor,taint,overrideStepZWithWorldZ,stepVel={1}", LocalID, stepVelocity); 282 // DetailLog("{0},BSCharacter.MoveMotor,taint,overrideStepZWithWorldZ,stepVel={1}", LocalID, stepVelocity);
260 } 283 }
261 284
285 //Alicia: Maintain minimum height when flying.
286 // SL has a flying effect that keeps the avatar flying above the ground by some margin
287 if (m_controllingPrim.Flying)
288 {
289 float hover_height = m_physicsScene.TerrainManager.GetTerrainHeightAtXYZ(m_controllingPrim.RawPosition)
290 + BSParam.AvatarFlyingGroundMargin;
291
292 if( m_controllingPrim.Position.Z < hover_height)
293 {
294 stepVelocity.Z += BSParam.AvatarFlyingGroundUpForce;
295 }
296 }
297
262 // 'stepVelocity' is now the speed we'd like the avatar to move in. Turn that into an instantanous force. 298 // 'stepVelocity' is now the speed we'd like the avatar to move in. Turn that into an instantanous force.
263 OMV.Vector3 moveForce = (stepVelocity - m_controllingPrim.RawVelocity) * m_controllingPrim.Mass; 299 OMV.Vector3 moveForce = (stepVelocity - m_controllingPrim.RawVelocity) * m_controllingPrim.Mass;
264 300
@@ -304,7 +340,7 @@ public class BSActorAvatarMove : BSActor
304 // float nearFeetHeightMin = m_controllingPrim.RawPosition.Z - (m_controllingPrim.Size.Z / 2f) + 0.05f; 340 // float nearFeetHeightMin = m_controllingPrim.RawPosition.Z - (m_controllingPrim.Size.Z / 2f) + 0.05f;
305 // Note: there is a problem with the computation of the capsule height. Thus RawPosition is off 341 // Note: there is a problem with the computation of the capsule height. Thus RawPosition is off
306 // from the height. Revisit size and this computation when height is scaled properly. 342 // from the height. Revisit size and this computation when height is scaled properly.
307 float nearFeetHeightMin = m_controllingPrim.RawPosition.Z - (m_controllingPrim.Size.Z / 2f) - 0.05f; 343 float nearFeetHeightMin = m_controllingPrim.RawPosition.Z - (m_controllingPrim.Size.Z / 2f) - BSParam.AvatarStepGroundFudge;
308 float nearFeetHeightMax = nearFeetHeightMin + BSParam.AvatarStepHeight; 344 float nearFeetHeightMax = nearFeetHeightMin + BSParam.AvatarStepHeight;
309 345
310 // Look for a collision point that is near the character's feet and is oriented the same as the charactor is. 346 // Look for a collision point that is near the character's feet and is oriented the same as the charactor is.
@@ -326,15 +362,25 @@ public class BSActorAvatarMove : BSActor
326 if (touchPosition.Z >= nearFeetHeightMin && touchPosition.Z <= nearFeetHeightMax) 362 if (touchPosition.Z >= nearFeetHeightMin && touchPosition.Z <= nearFeetHeightMax)
327 { 363 {
328 // This contact is within the 'near the feet' range. 364 // This contact is within the 'near the feet' range.
329 // The normal should be our contact point to the object so it is pointing away 365 // The step is presumed to be more or less vertical. Thus the Z component should
330 // thus the difference between our facing orientation and the normal should be small. 366 // be nearly horizontal.
331 OMV.Vector3 directionFacing = OMV.Vector3.UnitX * m_controllingPrim.RawOrientation; 367 OMV.Vector3 directionFacing = OMV.Vector3.UnitX * m_controllingPrim.RawOrientation;
332 OMV.Vector3 touchNormal = OMV.Vector3.Normalize(kvp.Value.SurfaceNormal); 368 OMV.Vector3 touchNormal = OMV.Vector3.Normalize(kvp.Value.SurfaceNormal);
333 float diff = Math.Abs(OMV.Vector3.Distance(directionFacing, touchNormal)); 369 const float PIOver2 = 1.571f; // Used to make unit vector axis into approx radian angles
334 if (diff < BSParam.AvatarStepApproachFactor) 370 // m_physicsScene.DetailLog("{0},BSCharacter.WalkUpStairs,avNormal={1},colNormal={2},diff={3}",
371 // m_controllingPrim.LocalID, directionFacing, touchNormal,
372 // Math.Abs(OMV.Vector3.Distance(directionFacing, touchNormal)) );
373 if ((Math.Abs(directionFacing.Z) * PIOver2) < BSParam.AvatarStepAngle
374 && (Math.Abs(touchNormal.Z) * PIOver2) < BSParam.AvatarStepAngle)
335 { 375 {
336 if (highestTouchPosition.Z < touchPosition.Z) 376 // The normal should be our contact point to the object so it is pointing away
337 highestTouchPosition = touchPosition; 377 // thus the difference between our facing orientation and the normal should be small.
378 float diff = Math.Abs(OMV.Vector3.Distance(directionFacing, touchNormal));
379 if (diff < BSParam.AvatarStepApproachFactor)
380 {
381 if (highestTouchPosition.Z < touchPosition.Z)
382 highestTouchPosition = touchPosition;
383 }
338 } 384 }
339 } 385 }
340 } 386 }
@@ -399,8 +445,8 @@ public class BSActorAvatarMove : BSActor
399 m_controllingPrim.ForcePosition = m_controllingPrim.RawPosition + displacement; 445 m_controllingPrim.ForcePosition = m_controllingPrim.RawPosition + displacement;
400 } 446 }
401 } 447 }
402 m_physicsScene.DetailLog("{0},BSCharacter.WalkUpStairs.ComputeStairCorrection,disp={1},force={2}", 448 m_physicsScene.DetailLog("{0},BSCharacter.WalkUpStairs.ComputeStairCorrection,stepUp={1},isp={2},force={3}",
403 m_controllingPrim.LocalID, displacement, ret); 449 m_controllingPrim.LocalID, stepUp, displacement, ret);
404 450
405 } 451 }
406 return ret; 452 return ret;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorHover.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorHover.cs
index 8a79809..e54c27b 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSActorHover.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSActorHover.cs
@@ -58,6 +58,7 @@ public class BSActorHover : BSActor
58 public override void Dispose() 58 public override void Dispose()
59 { 59 {
60 Enabled = false; 60 Enabled = false;
61 DeactivateHover();
61 } 62 }
62 63
63 // Called when physical parameters (properties set in Bullet) need to be re-applied. 64 // Called when physical parameters (properties set in Bullet) need to be re-applied.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorLockAxis.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorLockAxis.cs
index 8b0fdeb..3b3c161 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSActorLockAxis.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSActorLockAxis.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -36,13 +36,20 @@ namespace OpenSim.Region.Physics.BulletSPlugin
36{ 36{
37public class BSActorLockAxis : BSActor 37public class BSActorLockAxis : BSActor
38{ 38{
39 BSConstraint LockAxisConstraint = null; 39 private BSConstraint LockAxisConstraint = null;
40 private bool HaveRegisteredForBeforeStepCallback = false;
41
42 // The lock access flags (which axises were locked) when the contraint was built.
43 // Used to see if locking has changed since when the constraint was built.
44 OMV.Vector3 LockAxisLinearFlags;
45 OMV.Vector3 LockAxisAngularFlags;
40 46
41 public BSActorLockAxis(BSScene physicsScene, BSPhysObject pObj, string actorName) 47 public BSActorLockAxis(BSScene physicsScene, BSPhysObject pObj, string actorName)
42 : base(physicsScene, pObj, actorName) 48 : base(physicsScene, pObj, actorName)
43 { 49 {
44 m_physicsScene.DetailLog("{0},BSActorLockAxis,constructor", m_controllingPrim.LocalID); 50 m_physicsScene.DetailLog("{0},BSActorLockAxis,constructor", m_controllingPrim.LocalID);
45 LockAxisConstraint = null; 51 LockAxisConstraint = null;
52 HaveRegisteredForBeforeStepCallback = false;
46 } 53 }
47 54
48 // BSActor.isActive 55 // BSActor.isActive
@@ -55,6 +62,8 @@ public class BSActorLockAxis : BSActor
55 // BSActor.Dispose() 62 // BSActor.Dispose()
56 public override void Dispose() 63 public override void Dispose()
57 { 64 {
65 Enabled = false;
66 UnRegisterForBeforeStepCallback();
58 RemoveAxisLockConstraint(); 67 RemoveAxisLockConstraint();
59 } 68 }
60 69
@@ -63,22 +72,28 @@ public class BSActorLockAxis : BSActor
63 // BSActor.Refresh() 72 // BSActor.Refresh()
64 public override void Refresh() 73 public override void Refresh()
65 { 74 {
66 m_physicsScene.DetailLog("{0},BSActorLockAxis,refresh,lockedAxis={1},enabled={2},pActive={3}", 75 // Since the axis logging is done with a constraint, Refresh() time is good for
67 m_controllingPrim.LocalID, m_controllingPrim.LockedAngularAxis, Enabled, m_controllingPrim.IsPhysicallyActive); 76 // changing parameters but this needs to wait until the prim/linkset is physically
77 // constructed. Therefore, the constraint itself is placed at pre-step time.
78
68 // If all the axis are free, we don't need to exist 79 // If all the axis are free, we don't need to exist
69 if (m_controllingPrim.LockedAngularAxis == m_controllingPrim.LockedAxisFree) 80 // Refresh() only turns off. Enabling is done by InitializeAxisActor()
81 // whenever parameters are changed.
82 // This leaves 'enable' free to turn off an actor when it is not wanted to run.
83 if (m_controllingPrim.LockedAngularAxis == m_controllingPrim.LockedAxisFree
84 && m_controllingPrim.LockedLinearAxis == m_controllingPrim.LockedAxisFree)
70 { 85 {
71 Enabled = false; 86 Enabled = false;
72 } 87 }
73 88
74 // If the object is physically active, add the axis locking constraint
75 if (isActive) 89 if (isActive)
76 { 90 {
77 AddAxisLockConstraint(); 91 RegisterForBeforeStepCallback();
78 } 92 }
79 else 93 else
80 { 94 {
81 RemoveAxisLockConstraint(); 95 RemoveDependencies();
96 UnRegisterForBeforeStepCallback();
82 } 97 }
83 } 98 }
84 99
@@ -88,18 +103,56 @@ public class BSActorLockAxis : BSActor
88 // BSActor.RemoveDependencies() 103 // BSActor.RemoveDependencies()
89 public override void RemoveDependencies() 104 public override void RemoveDependencies()
90 { 105 {
91 if (LockAxisConstraint != null) 106 RemoveAxisLockConstraint();
107 }
108
109 private void RegisterForBeforeStepCallback()
110 {
111 if (!HaveRegisteredForBeforeStepCallback)
92 { 112 {
93 // If a constraint is set up, remove it from the physical scene 113 m_physicsScene.BeforeStep += PhysicsScene_BeforeStep;
94 RemoveAxisLockConstraint(); 114 HaveRegisteredForBeforeStepCallback = true;
95 // Schedule a call before the next simulation step to restore the constraint. 115 }
96 m_physicsScene.PostTaintObject("BSActorLockAxis:" + ActorName, m_controllingPrim.LocalID, delegate() 116 }
117
118 private void UnRegisterForBeforeStepCallback()
119 {
120 if (HaveRegisteredForBeforeStepCallback)
121 {
122 m_physicsScene.BeforeStep -= PhysicsScene_BeforeStep;
123 HaveRegisteredForBeforeStepCallback = false;
124 }
125 }
126
127 private void PhysicsScene_BeforeStep(float timestep)
128 {
129 // If all the axis are free, we don't need to exist
130 if (m_controllingPrim.LockedAngularAxis == m_controllingPrim.LockedAxisFree
131 && m_controllingPrim.LockedLinearAxis == m_controllingPrim.LockedAxisFree)
132 {
133 Enabled = false;
134 }
135
136 // If the object is physically active, add the axis locking constraint
137 if (isActive)
138 {
139 // Check to see if the locking parameters have changed
140 if (m_controllingPrim.LockedLinearAxis != this.LockAxisLinearFlags
141 || m_controllingPrim.LockedAngularAxis != this.LockAxisAngularFlags)
97 { 142 {
98 Refresh(); 143 // The locking has changed. Remove the old constraint and build a new one
99 }); 144 RemoveAxisLockConstraint();
145 }
146
147 AddAxisLockConstraint();
148 }
149 else
150 {
151 RemoveAxisLockConstraint();
100 } 152 }
101 } 153 }
102 154
155 // Note that this relies on being called at TaintTime
103 private void AddAxisLockConstraint() 156 private void AddAxisLockConstraint()
104 { 157 {
105 if (LockAxisConstraint == null) 158 if (LockAxisConstraint == null)
@@ -118,64 +171,43 @@ public class BSActorLockAxis : BSActor
118 LockAxisConstraint = axisConstrainer; 171 LockAxisConstraint = axisConstrainer;
119 m_physicsScene.Constraints.AddConstraint(LockAxisConstraint); 172 m_physicsScene.Constraints.AddConstraint(LockAxisConstraint);
120 173
174 // Remember the clocking being inforced so we can notice if they have changed
175 LockAxisLinearFlags = m_controllingPrim.LockedLinearAxis;
176 LockAxisAngularFlags = m_controllingPrim.LockedAngularAxis;
177
121 // The constraint is tied to the world and oriented to the prim. 178 // The constraint is tied to the world and oriented to the prim.
122 179
123 // Free to move linearly in the region 180 if (!axisConstrainer.SetLinearLimits(m_controllingPrim.LockedLinearAxisLow, m_controllingPrim.LockedLinearAxisHigh))
124 OMV.Vector3 linearLow = OMV.Vector3.Zero;
125 OMV.Vector3 linearHigh = m_physicsScene.TerrainManager.DefaultRegionSize;
126 if (m_controllingPrim.LockedLinearAxis.X != BSPhysObject.FreeAxis)
127 { 181 {
128 linearLow.X = m_controllingPrim.RawPosition.X; 182 m_physicsScene.DetailLog("{0},BSActorLockAxis.AddAxisLockConstraint,failedSetLinearLimits",
129 linearHigh.X = m_controllingPrim.RawPosition.X; 183 m_controllingPrim.LocalID);
130 } 184 }
131 if (m_controllingPrim.LockedLinearAxis.Y != BSPhysObject.FreeAxis)
132 {
133 linearLow.Y = m_controllingPrim.RawPosition.Y;
134 linearHigh.Y = m_controllingPrim.RawPosition.Y;
135 }
136 if (m_controllingPrim.LockedLinearAxis.Z != BSPhysObject.FreeAxis)
137 {
138 linearLow.Z = m_controllingPrim.RawPosition.Z;
139 linearHigh.Z = m_controllingPrim.RawPosition.Z;
140 }
141 axisConstrainer.SetLinearLimits(linearLow, linearHigh);
142 185
143 // Angular with some axis locked 186 if (!axisConstrainer.SetAngularLimits(m_controllingPrim.LockedAngularAxisLow, m_controllingPrim.LockedAngularAxisHigh))
144 float fPI = (float)Math.PI;
145 OMV.Vector3 angularLow = new OMV.Vector3(-fPI, -fPI, -fPI);
146 OMV.Vector3 angularHigh = new OMV.Vector3(fPI, fPI, fPI);
147 if (m_controllingPrim.LockedAngularAxis.X != BSPhysObject.FreeAxis)
148 {
149 angularLow.X = 0f;
150 angularHigh.X = 0f;
151 }
152 if (m_controllingPrim.LockedAngularAxis.Y != BSPhysObject.FreeAxis)
153 { 187 {
154 angularLow.Y = 0f; 188 m_physicsScene.DetailLog("{0},BSActorLockAxis.AddAxisLockConstraint,failedSetAngularLimits",
155 angularHigh.Y = 0f; 189 m_controllingPrim.LocalID);
156 }
157 if (m_controllingPrim.LockedAngularAxis.Z != BSPhysObject.FreeAxis)
158 {
159 angularLow.Z = 0f;
160 angularHigh.Z = 0f;
161 }
162 if (!axisConstrainer.SetAngularLimits(angularLow, angularHigh))
163 {
164 m_physicsScene.DetailLog("{0},BSActorLockAxis.AddAxisLockConstraint,failedSetAngularLimits", m_controllingPrim.LocalID);
165 } 190 }
166 191
167 m_physicsScene.DetailLog("{0},BSActorLockAxis.AddAxisLockConstraint,create,linLow={1},linHi={2},angLow={3},angHi={4}", 192 m_physicsScene.DetailLog("{0},BSActorLockAxis.AddAxisLockConstraint,create,linLow={1},linHi={2},angLow={3},angHi={4}",
168 m_controllingPrim.LocalID, linearLow, linearHigh, angularLow, angularHigh); 193 m_controllingPrim.LocalID,
194 m_controllingPrim.LockedLinearAxisLow,
195 m_controllingPrim.LockedLinearAxisHigh,
196 m_controllingPrim.LockedAngularAxisLow,
197 m_controllingPrim.LockedAngularAxisHigh);
169 198
170 // Constants from one of the posts mentioned above and used in Bullet's ConstraintDemo. 199 // Constants from one of the posts mentioned above and used in Bullet's ConstraintDemo.
171 axisConstrainer.TranslationalLimitMotor(true /* enable */, 5.0f, 0.1f); 200 axisConstrainer.TranslationalLimitMotor(true /* enable */, 5.0f, 0.1f);
172 201
173 axisConstrainer.RecomputeConstraintVariables(m_controllingPrim.RawMass); 202 axisConstrainer.RecomputeConstraintVariables(m_controllingPrim.RawMass);
203
204 RegisterForBeforeStepCallback();
174 } 205 }
175 } 206 }
176 207
177 private void RemoveAxisLockConstraint() 208 private void RemoveAxisLockConstraint()
178 { 209 {
210 UnRegisterForBeforeStepCallback();
179 if (LockAxisConstraint != null) 211 if (LockAxisConstraint != null)
180 { 212 {
181 m_physicsScene.Constraints.RemoveAndDestroyConstraint(LockAxisConstraint); 213 m_physicsScene.Constraints.RemoveAndDestroyConstraint(LockAxisConstraint);
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorMoveToTarget.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorMoveToTarget.cs
index bdf4bc0..1145006 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSActorMoveToTarget.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSActorMoveToTarget.cs
@@ -59,6 +59,7 @@ public class BSActorMoveToTarget : BSActor
59 public override void Dispose() 59 public override void Dispose()
60 { 60 {
61 Enabled = false; 61 Enabled = false;
62 DeactivateMoveToTarget();
62 } 63 }
63 64
64 // Called when physical parameters (properties set in Bullet) need to be re-applied. 65 // Called when physical parameters (properties set in Bullet) need to be re-applied.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorSetForce.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorSetForce.cs
index 96fa0b6..4e81363 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSActorSetForce.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSActorSetForce.cs
@@ -58,6 +58,7 @@ public class BSActorSetForce : BSActor
58 public override void Dispose() 58 public override void Dispose()
59 { 59 {
60 Enabled = false; 60 Enabled = false;
61 DeactivateSetForce();
61 } 62 }
62 63
63 // Called when physical parameters (properties set in Bullet) need to be re-applied. 64 // Called when physical parameters (properties set in Bullet) need to be re-applied.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorSetTorque.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorSetTorque.cs
index 65098e1..79e1d38 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSActorSetTorque.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSActorSetTorque.cs
@@ -58,6 +58,7 @@ public class BSActorSetTorque : BSActor
58 public override void Dispose() 58 public override void Dispose()
59 { 59 {
60 Enabled = false; 60 Enabled = false;
61 DeactivateSetTorque();
61 } 62 }
62 63
63 // Called when physical parameters (properties set in Bullet) need to be re-applied. 64 // Called when physical parameters (properties set in Bullet) need to be re-applied.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs
index e0ccc50..7f45e2c 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs
@@ -32,12 +32,10 @@ namespace OpenSim.Region.Physics.BulletSPlugin
32{ 32{
33public class BSActorCollection 33public class BSActorCollection
34{ 34{
35 private BSScene m_physicsScene { get; set; }
36 private Dictionary<string, BSActor> m_actors; 35 private Dictionary<string, BSActor> m_actors;
37 36
38 public BSActorCollection(BSScene physicsScene) 37 public BSActorCollection()
39 { 38 {
40 m_physicsScene = physicsScene;
41 m_actors = new Dictionary<string, BSActor>(); 39 m_actors = new Dictionary<string, BSActor>();
42 } 40 }
43 public void Add(string name, BSActor actor) 41 public void Add(string name, BSActor actor)
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
index be6f152..8491c0f 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
@@ -43,9 +43,11 @@ public enum ConstraintType : int
43 SLIDER_CONSTRAINT_TYPE, 43 SLIDER_CONSTRAINT_TYPE,
44 CONTACT_CONSTRAINT_TYPE, 44 CONTACT_CONSTRAINT_TYPE,
45 D6_SPRING_CONSTRAINT_TYPE, 45 D6_SPRING_CONSTRAINT_TYPE,
46 GEAR_CONSTRAINT_TYPE, // added in Bullet 2.82
47 FIXED_CONSTRAINT_TYPE, // added in Bullet 2.82
46 MAX_CONSTRAINT_TYPE, // last type defined by Bullet 48 MAX_CONSTRAINT_TYPE, // last type defined by Bullet
47 // 49 //
48 FIXED_CONSTRAINT_TYPE = 1234 // BulletSim constraint that is fixed and unmoving 50 BS_FIXED_CONSTRAINT_TYPE = 1234 // BulletSim constraint that is fixed and unmoving
49} 51}
50 52
51// =============================================================================== 53// ===============================================================================
@@ -209,6 +211,21 @@ public struct HACDParams
209 public float addNeighboursDistPoints; // false 211 public float addNeighboursDistPoints; // false
210 public float addFacesPoints; // false 212 public float addFacesPoints; // false
211 public float shouldAdjustCollisionMargin; // false 213 public float shouldAdjustCollisionMargin; // false
214 // VHACD
215 public float whichHACD; // zero if Bullet HACD, non-zero says VHACD
216 // http://kmamou.blogspot.ca/2014/12/v-hacd-20-parameters-description.html
217 public float vHACDresolution; // 100,000 max number of voxels generated during voxelization stage
218 public float vHACDdepth; // 20 max number of clipping stages
219 public float vHACDconcavity; // 0.0025 maximum concavity
220 public float vHACDplaneDownsampling; // 4 granularity of search for best clipping plane
221 public float vHACDconvexHullDownsampling; // 4 precision of hull gen process
222 public float vHACDalpha; // 0.05 bias toward clipping along symmetry planes
223 public float vHACDbeta; // 0.05 bias toward clipping along revolution axis
224 public float vHACDgamma; // 0.00125 max concavity when merging
225 public float vHACDpca; // 0 on/off normalizing mesh before decomp
226 public float vHACDmode; // 0 0:voxel based, 1: tetrahedron based
227 public float vHACDmaxNumVerticesPerCH; // 64 max triangles per convex hull
228 public float vHACDminVolumePerCH; // 0.0001 sampling of generated convex hulls
212} 229}
213 230
214// The states a bullet collision object can have 231// The states a bullet collision object can have
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index fc18960..9c3f160 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -61,18 +61,31 @@ public sealed class BSCharacter : BSPhysObject
61 private const string AvatarMoveActorName = "BSCharacter.AvatarMove"; 61 private const string AvatarMoveActorName = "BSCharacter.AvatarMove";
62 62
63 private OMV.Vector3 _PIDTarget; 63 private OMV.Vector3 _PIDTarget;
64 private bool _usePID;
65 private float _PIDTau; 64 private float _PIDTau;
66 65
67 public BSCharacter(uint localID, String avName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size, bool isFlying) 66// public override OMV.Vector3 RawVelocity
67// { get { return base.RawVelocity; }
68// set {
69// if (value != base.RawVelocity)
70// Util.PrintCallStack();
71// Console.WriteLine("Set rawvel to {0}", value);
72// base.RawVelocity = value; }
73// }
74
75 // Avatars are always complete (in the physics engine sense)
76 public override bool IsIncomplete { get { return false; } }
77
78 public BSCharacter(
79 uint localID, String avName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 vel, OMV.Vector3 size, bool isFlying)
80
68 : base(parent_scene, localID, avName, "BSCharacter") 81 : base(parent_scene, localID, avName, "BSCharacter")
69 { 82 {
70 _physicsActorType = (int)ActorTypes.Agent; 83 _physicsActorType = (int)ActorTypes.Agent;
71 RawPosition = pos; 84 RawPosition = pos;
72 85
73 _flying = isFlying; 86 _flying = isFlying;
74 RawOrientation = OMV.Quaternion.Identity; 87 RawOrientation = OMV.Quaternion.Identity;
75 RawVelocity = OMV.Vector3.Zero; 88 RawVelocity = vel;
76 _buoyancy = ComputeBuoyancyFromFlying(isFlying); 89 _buoyancy = ComputeBuoyancyFromFlying(isFlying);
77 Friction = BSParam.AvatarStandingFriction; 90 Friction = BSParam.AvatarStandingFriction;
78 Density = BSParam.AvatarDensity; 91 Density = BSParam.AvatarDensity;
@@ -89,13 +102,15 @@ public sealed class BSCharacter : BSPhysObject
89 // set _avatarVolume and _mass based on capsule size, _density and Scale 102 // set _avatarVolume and _mass based on capsule size, _density and Scale
90 ComputeAvatarVolumeAndMass(); 103 ComputeAvatarVolumeAndMass();
91 104
92 DetailLog("{0},BSCharacter.create,call,size={1},scale={2},density={3},volume={4},mass={5},pos={6}", 105 DetailLog(
93 LocalID, _size, Scale, Density, _avatarVolume, RawMass, pos); 106 "{0},BSCharacter.create,call,size={1},scale={2},density={3},volume={4},mass={5},pos={6},vel={7}",
107 LocalID, _size, Scale, Density, _avatarVolume, RawMass, pos, vel);
94 108
95 // do actual creation in taint time 109 // do actual creation in taint time
96 PhysScene.TaintedObject(LocalID, "BSCharacter.create", delegate() 110 PhysScene.TaintedObject(LocalID, "BSCharacter.create", delegate()
97 { 111 {
98 DetailLog("{0},BSCharacter.create,taint", LocalID); 112 DetailLog("{0},BSCharacter.create,taint", LocalID);
113
99 // New body and shape into PhysBody and PhysShape 114 // New body and shape into PhysBody and PhysShape
100 PhysScene.Shapes.GetBodyAndShape(true, PhysScene.World, this); 115 PhysScene.Shapes.GetBodyAndShape(true, PhysScene.World, this);
101 116
@@ -134,7 +149,6 @@ public sealed class BSCharacter : BSPhysObject
134 { 149 {
135 PhysScene.PE.RemoveObjectFromWorld(PhysScene.World, PhysBody); 150 PhysScene.PE.RemoveObjectFromWorld(PhysScene.World, PhysBody);
136 151
137 ZeroMotion(true);
138 ForcePosition = RawPosition; 152 ForcePosition = RawPosition;
139 153
140 // Set the velocity 154 // Set the velocity
@@ -142,6 +156,7 @@ public sealed class BSCharacter : BSPhysObject
142 m_moveActor.SetVelocityAndTarget(RawVelocity, RawVelocity, false); 156 m_moveActor.SetVelocityAndTarget(RawVelocity, RawVelocity, false);
143 157
144 ForceVelocity = RawVelocity; 158 ForceVelocity = RawVelocity;
159 TargetVelocity = RawVelocity;
145 160
146 // This will enable or disable the flying buoyancy of the avatar. 161 // This will enable or disable the flying buoyancy of the avatar.
147 // Needs to be reset especially when an avatar is recreated after crossing a region boundry. 162 // Needs to be reset especially when an avatar is recreated after crossing a region boundry.
@@ -174,15 +189,19 @@ public sealed class BSCharacter : BSPhysObject
174 PhysScene.PE.UpdateSingleAabb(PhysScene.World, PhysBody); 189 PhysScene.PE.UpdateSingleAabb(PhysScene.World, PhysBody);
175 190
176 // Do this after the object has been added to the world 191 // Do this after the object has been added to the world
177 PhysBody.collisionType = CollisionType.Avatar; 192 if (BSParam.AvatarToAvatarCollisionsByDefault)
193 PhysBody.collisionType = CollisionType.Avatar;
194 else
195 PhysBody.collisionType = CollisionType.PhantomToOthersAvatar;
196
178 PhysBody.ApplyCollisionMask(PhysScene); 197 PhysBody.ApplyCollisionMask(PhysScene);
179 } 198 }
180 199
181
182 public override void RequestPhysicsterseUpdate() 200 public override void RequestPhysicsterseUpdate()
183 { 201 {
184 base.RequestPhysicsterseUpdate(); 202 base.RequestPhysicsterseUpdate();
185 } 203 }
204
186 // No one calls this method so I don't know what it could possibly mean 205 // No one calls this method so I don't know what it could possibly mean
187 public override bool Stopped { get { return false; } } 206 public override bool Stopped { get { return false; } }
188 207
@@ -263,6 +282,7 @@ public sealed class BSCharacter : BSPhysObject
263 PhysScene.PE.ClearAllForces(PhysBody); 282 PhysScene.PE.ClearAllForces(PhysBody);
264 }); 283 });
265 } 284 }
285
266 public override void ZeroAngularMotion(bool inTaintTime) 286 public override void ZeroAngularMotion(bool inTaintTime)
267 { 287 {
268 _rotationalVelocity = OMV.Vector3.Zero; 288 _rotationalVelocity = OMV.Vector3.Zero;
@@ -426,7 +446,7 @@ public sealed class BSCharacter : BSPhysObject
426 m_targetVelocity = value; 446 m_targetVelocity = value;
427 OMV.Vector3 targetVel = value; 447 OMV.Vector3 targetVel = value;
428 if (_setAlwaysRun && !_flying) 448 if (_setAlwaysRun && !_flying)
429 targetVel *= new OMV.Vector3(BSParam.AvatarAlwaysRunFactor, BSParam.AvatarAlwaysRunFactor, 0f); 449 targetVel *= new OMV.Vector3(BSParam.AvatarAlwaysRunFactor, BSParam.AvatarAlwaysRunFactor, 1f);
430 450
431 if (m_moveActor != null) 451 if (m_moveActor != null)
432 m_moveActor.SetVelocityAndTarget(RawVelocity, targetVel, false /* inTaintTime */); 452 m_moveActor.SetVelocityAndTarget(RawVelocity, targetVel, false /* inTaintTime */);
@@ -437,32 +457,40 @@ public sealed class BSCharacter : BSPhysObject
437 get { return RawVelocity; } 457 get { return RawVelocity; }
438 set { 458 set {
439 RawVelocity = value; 459 RawVelocity = value;
440 // m_log.DebugFormat("{0}: set velocity = {1}", LogHeader, RawVelocity); 460 OMV.Vector3 vel = RawVelocity;
461
462 DetailLog("{0}: set Velocity = {1}", LocalID, value);
463
441 PhysScene.TaintedObject(LocalID, "BSCharacter.setVelocity", delegate() 464 PhysScene.TaintedObject(LocalID, "BSCharacter.setVelocity", delegate()
442 { 465 {
443 if (m_moveActor != null) 466 if (m_moveActor != null)
444 m_moveActor.SetVelocityAndTarget(RawVelocity, RawVelocity, true /* inTaintTime */); 467 m_moveActor.SetVelocityAndTarget(vel, vel, true /* inTaintTime */);
445 468
446 DetailLog("{0},BSCharacter.setVelocity,taint,vel={1}", LocalID, RawVelocity); 469 DetailLog("{0},BSCharacter.setVelocity,taint,vel={1}", LocalID, vel);
447 ForceVelocity = RawVelocity; 470 ForceVelocity = vel;
448 }); 471 });
449 } 472 }
450 } 473 }
474
451 public override OMV.Vector3 ForceVelocity { 475 public override OMV.Vector3 ForceVelocity {
452 get { return RawVelocity; } 476 get { return RawVelocity; }
453 set { 477 set {
454 PhysScene.AssertInTaintTime("BSCharacter.ForceVelocity"); 478 PhysScene.AssertInTaintTime("BSCharacter.ForceVelocity");
479// Util.PrintCallStack();
480 DetailLog("{0}: set ForceVelocity = {1}", LocalID, value);
455 481
456 RawVelocity = value; 482 RawVelocity = value;
457 PhysScene.PE.SetLinearVelocity(PhysBody, RawVelocity); 483 PhysScene.PE.SetLinearVelocity(PhysBody, RawVelocity);
458 PhysScene.PE.Activate(PhysBody, true); 484 PhysScene.PE.Activate(PhysBody, true);
459 } 485 }
460 } 486 }
487
461 public override OMV.Vector3 Torque { 488 public override OMV.Vector3 Torque {
462 get { return RawTorque; } 489 get { return RawTorque; }
463 set { RawTorque = value; 490 set { RawTorque = value;
464 } 491 }
465 } 492 }
493
466 public override float CollisionScore { 494 public override float CollisionScore {
467 get { return _collisionScore; } 495 get { return _collisionScore; }
468 set { _collisionScore = value; 496 set { _collisionScore = value;
@@ -614,9 +642,9 @@ public sealed class BSCharacter : BSPhysObject
614 public override OMV.Vector3 PIDTarget { 642 public override OMV.Vector3 PIDTarget {
615 set { _PIDTarget = value; } 643 set { _PIDTarget = value; }
616 } 644 }
617 public override bool PIDActive { 645
618 set { _usePID = value; } 646 public override bool PIDActive { get; set; }
619 } 647
620 public override float PIDTau { 648 public override float PIDTau {
621 set { _PIDTau = value; } 649 set { _PIDTau = value; }
622 } 650 }
@@ -657,7 +685,7 @@ public sealed class BSCharacter : BSPhysObject
657 685
658 private OMV.Vector3 ComputeAvatarScale(OMV.Vector3 size) 686 private OMV.Vector3 ComputeAvatarScale(OMV.Vector3 size)
659 { 687 {
660 OMV.Vector3 newScale; 688 OMV.Vector3 newScale = size;
661 689
662 // Bullet's capsule total height is the "passed height + radius * 2"; 690 // Bullet's capsule total height is the "passed height + radius * 2";
663 // The base capsule is 1 unit in diameter and 2 units in height (passed radius=0.5, passed height = 1) 691 // The base capsule is 1 unit in diameter and 2 units in height (passed radius=0.5, passed height = 1)
@@ -670,8 +698,6 @@ public sealed class BSCharacter : BSPhysObject
670 // for a asymmetrical capsule, other parts of the code presume it is cylindrical. 698 // for a asymmetrical capsule, other parts of the code presume it is cylindrical.
671 699
672 // Scale is multiplier of radius with one of "0.5" 700 // Scale is multiplier of radius with one of "0.5"
673 newScale.X = size.X / 2f;
674 newScale.Y = size.Y / 2f;
675 701
676 float heightAdjust = BSParam.AvatarHeightMidFudge; 702 float heightAdjust = BSParam.AvatarHeightMidFudge;
677 if (BSParam.AvatarHeightLowFudge != 0f || BSParam.AvatarHeightHighFudge != 0f) 703 if (BSParam.AvatarHeightLowFudge != 0f || BSParam.AvatarHeightHighFudge != 0f)
@@ -692,8 +718,17 @@ public sealed class BSCharacter : BSPhysObject
692 heightAdjust += ((midHeightOffset) / (AVATAR_HI - AVATAR_MID)) * BSParam.AvatarHeightHighFudge; 718 heightAdjust += ((midHeightOffset) / (AVATAR_HI - AVATAR_MID)) * BSParam.AvatarHeightHighFudge;
693 } 719 }
694 } 720 }
695 // The total scale height is the central cylindar plus the caps on the two ends. 721 if (BSParam.AvatarShape == BSShapeCollection.AvatarShapeCapsule)
696 newScale.Z = (size.Z + (Math.Min(size.X, size.Y) * 2) + heightAdjust) / 2f; 722 {
723 newScale.X = size.X / 2f;
724 newScale.Y = size.Y / 2f;
725 // The total scale height is the central cylindar plus the caps on the two ends.
726 newScale.Z = (size.Z + (Math.Min(size.X, size.Y) * 2) + heightAdjust) / 2f;
727 }
728 else
729 {
730 newScale.Z = size.Z + heightAdjust;
731 }
697 // m_log.DebugFormat("{0} ComputeAvatarScale: size={1},adj={2},scale={3}", LogHeader, size, heightAdjust, newScale); 732 // m_log.DebugFormat("{0} ComputeAvatarScale: size={1},adj={2},scale={3}", LogHeader, size, heightAdjust, newScale);
698 733
699 // If smaller than the endcaps, just fake like we're almost that small 734 // If smaller than the endcaps, just fake like we're almost that small
@@ -737,7 +772,18 @@ public sealed class BSCharacter : BSPhysObject
737 // and will send agent updates to the clients if velocity changes by more than 772 // and will send agent updates to the clients if velocity changes by more than
738 // 0.001m/s. Bullet introduces a lot of jitter in the velocity which causes many 773 // 0.001m/s. Bullet introduces a lot of jitter in the velocity which causes many
739 // extra updates. 774 // extra updates.
740 if (!entprop.Velocity.ApproxEquals(RawVelocity, 0.1f)) 775 //
776 // XXX: Contrary to the above comment, setting an update threshold here above 0.4 actually introduces jitter to
777 // avatar movement rather than removes it. The larger the threshold, the bigger the jitter.
778 // This is most noticeable in level flight and can be seen with
779 // the "show updates" option in a viewer. With an update threshold, the RawVelocity cycles between a lower
780 // bound and an upper bound, where the difference between the two is enough to trigger a large delta v update
781 // and subsequently trigger an update in ScenePresence.SendTerseUpdateToAllClients(). The cause of this cycle (feedback?)
782 // has not yet been identified.
783 //
784 // If there is a threshold below 0.4 or no threshold check at all (as in ODE), then RawVelocity stays constant and extra
785 // updates are not triggered in ScenePresence.SendTerseUpdateToAllClients().
786// if (!entprop.Velocity.ApproxEquals(RawVelocity, 0.1f))
741 RawVelocity = entprop.Velocity; 787 RawVelocity = entprop.Velocity;
742 788
743 _acceleration = entprop.Acceleration; 789 _acceleration = entprop.Acceleration;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index 7b98f9d..c6d6331 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -42,7 +42,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin
42{ 42{
43 public sealed class BSDynamics : BSActor 43 public sealed class BSDynamics : BSActor
44 { 44 {
45#pragma warning disable 414
45 private static string LogHeader = "[BULLETSIM VEHICLE]"; 46 private static string LogHeader = "[BULLETSIM VEHICLE]";
47#pragma warning restore 414
46 48
47 // the prim this dynamic controller belongs to 49 // the prim this dynamic controller belongs to
48 private BSPrimLinkable ControllingPrim { get; set; } 50 private BSPrimLinkable ControllingPrim { get; set; }
@@ -74,8 +76,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin
74 private Vector3 m_linearMotorOffset = Vector3.Zero; // the point of force can be offset from the center 76 private Vector3 m_linearMotorOffset = Vector3.Zero; // the point of force can be offset from the center
75 private Vector3 m_linearMotorDirectionLASTSET = Vector3.Zero; // velocity requested by LSL 77 private Vector3 m_linearMotorDirectionLASTSET = Vector3.Zero; // velocity requested by LSL
76 private Vector3 m_linearFrictionTimescale = Vector3.Zero; 78 private Vector3 m_linearFrictionTimescale = Vector3.Zero;
77 private float m_linearMotorDecayTimescale = 0; 79 private float m_linearMotorDecayTimescale = 1;
78 private float m_linearMotorTimescale = 0; 80 private float m_linearMotorTimescale = 1;
79 private Vector3 m_lastLinearVelocityVector = Vector3.Zero; 81 private Vector3 m_lastLinearVelocityVector = Vector3.Zero;
80 private Vector3 m_lastPositionVector = Vector3.Zero; 82 private Vector3 m_lastPositionVector = Vector3.Zero;
81 // private bool m_LinearMotorSetLastFrame = false; 83 // private bool m_LinearMotorSetLastFrame = false;
@@ -86,8 +88,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin
86 private Vector3 m_angularMotorDirection = Vector3.Zero; // angular velocity requested by LSL motor 88 private Vector3 m_angularMotorDirection = Vector3.Zero; // angular velocity requested by LSL motor
87 // private int m_angularMotorApply = 0; // application frame counter 89 // private int m_angularMotorApply = 0; // application frame counter
88 private Vector3 m_angularMotorVelocity = Vector3.Zero; // current angular motor velocity 90 private Vector3 m_angularMotorVelocity = Vector3.Zero; // current angular motor velocity
89 private float m_angularMotorTimescale = 0; // motor angular velocity ramp up rate 91 private float m_angularMotorTimescale = 1; // motor angular velocity ramp up rate
90 private float m_angularMotorDecayTimescale = 0; // motor angular velocity decay rate 92 private float m_angularMotorDecayTimescale = 1; // motor angular velocity decay rate
91 private Vector3 m_angularFrictionTimescale = Vector3.Zero; // body angular velocity decay rate 93 private Vector3 m_angularFrictionTimescale = Vector3.Zero; // body angular velocity decay rate
92 private Vector3 m_lastAngularVelocity = Vector3.Zero; 94 private Vector3 m_lastAngularVelocity = Vector3.Zero;
93 private Vector3 m_lastVertAttractor = Vector3.Zero; // what VA was last applied to body 95 private Vector3 m_lastVertAttractor = Vector3.Zero; // what VA was last applied to body
@@ -101,7 +103,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
101 103
102 //Banking properties 104 //Banking properties
103 private float m_bankingEfficiency = 0; 105 private float m_bankingEfficiency = 0;
104 private float m_bankingMix = 0; 106 private float m_bankingMix = 1;
105 private float m_bankingTimescale = 0; 107 private float m_bankingTimescale = 0;
106 108
107 //Hover and Buoyancy properties 109 //Hover and Buoyancy properties
@@ -122,8 +124,12 @@ namespace OpenSim.Region.Physics.BulletSPlugin
122 private float m_verticalAttractionTimescale = 510f; 124 private float m_verticalAttractionTimescale = 510f;
123 125
124 // Just some recomputed constants: 126 // Just some recomputed constants:
127#pragma warning disable 414
128 static readonly float TwoPI = ((float)Math.PI) * 2f;
129 static readonly float FourPI = ((float)Math.PI) * 4f;
125 static readonly float PIOverFour = ((float)Math.PI) / 4f; 130 static readonly float PIOverFour = ((float)Math.PI) / 4f;
126 static readonly float PIOverTwo = ((float)Math.PI) / 2f; 131 static readonly float PIOverTwo = ((float)Math.PI) / 2f;
132#pragma warning restore 414
127 133
128 public BSDynamics(BSScene myScene, BSPrim myPrim, string actorName) 134 public BSDynamics(BSScene myScene, BSPrim myPrim, string actorName)
129 : base(myScene, myPrim, actorName) 135 : base(myScene, myPrim, actorName)
@@ -155,56 +161,58 @@ namespace OpenSim.Region.Physics.BulletSPlugin
155 public void ProcessFloatVehicleParam(Vehicle pParam, float pValue) 161 public void ProcessFloatVehicleParam(Vehicle pParam, float pValue)
156 { 162 {
157 VDetailLog("{0},ProcessFloatVehicleParam,param={1},val={2}", ControllingPrim.LocalID, pParam, pValue); 163 VDetailLog("{0},ProcessFloatVehicleParam,param={1},val={2}", ControllingPrim.LocalID, pParam, pValue);
164 float clampTemp;
165
158 switch (pParam) 166 switch (pParam)
159 { 167 {
160 case Vehicle.ANGULAR_DEFLECTION_EFFICIENCY: 168 case Vehicle.ANGULAR_DEFLECTION_EFFICIENCY:
161 m_angularDeflectionEfficiency = ClampInRange(0f, pValue, 1f); 169 m_angularDeflectionEfficiency = ClampInRange(0f, pValue, 1f);
162 break; 170 break;
163 case Vehicle.ANGULAR_DEFLECTION_TIMESCALE: 171 case Vehicle.ANGULAR_DEFLECTION_TIMESCALE:
164 m_angularDeflectionTimescale = Math.Max(pValue, 0.01f); 172 m_angularDeflectionTimescale = ClampInRange(0.25f, pValue, 120);
165 break; 173 break;
166 case Vehicle.ANGULAR_MOTOR_DECAY_TIMESCALE: 174 case Vehicle.ANGULAR_MOTOR_DECAY_TIMESCALE:
167 m_angularMotorDecayTimescale = ClampInRange(0.01f, pValue, 120); 175 m_angularMotorDecayTimescale = ClampInRange(0.25f, pValue, 120);
168 m_angularMotor.TargetValueDecayTimeScale = m_angularMotorDecayTimescale; 176 m_angularMotor.TargetValueDecayTimeScale = m_angularMotorDecayTimescale;
169 break; 177 break;
170 case Vehicle.ANGULAR_MOTOR_TIMESCALE: 178 case Vehicle.ANGULAR_MOTOR_TIMESCALE:
171 m_angularMotorTimescale = Math.Max(pValue, 0.01f); 179 m_angularMotorTimescale = ClampInRange(0.25f, pValue, 120);
172 m_angularMotor.TimeScale = m_angularMotorTimescale; 180 m_angularMotor.TimeScale = m_angularMotorTimescale;
173 break; 181 break;
174 case Vehicle.BANKING_EFFICIENCY: 182 case Vehicle.BANKING_EFFICIENCY:
175 m_bankingEfficiency = ClampInRange(-1f, pValue, 1f); 183 m_bankingEfficiency = ClampInRange(-1f, pValue, 1f);
176 break; 184 break;
177 case Vehicle.BANKING_MIX: 185 case Vehicle.BANKING_MIX:
178 m_bankingMix = Math.Max(pValue, 0.01f); 186 m_bankingMix = ClampInRange(0.01f, pValue, 1);
179 break; 187 break;
180 case Vehicle.BANKING_TIMESCALE: 188 case Vehicle.BANKING_TIMESCALE:
181 m_bankingTimescale = Math.Max(pValue, 0.01f); 189 m_bankingTimescale = ClampInRange(0.25f, pValue, 120);
182 break; 190 break;
183 case Vehicle.BUOYANCY: 191 case Vehicle.BUOYANCY:
184 m_VehicleBuoyancy = ClampInRange(-1f, pValue, 1f); 192 m_VehicleBuoyancy = ClampInRange(-1f, pValue, 1f);
185 m_VehicleGravity = ControllingPrim.ComputeGravity(m_VehicleBuoyancy); 193 m_VehicleGravity = ControllingPrim.ComputeGravity(m_VehicleBuoyancy);
186 break; 194 break;
187 case Vehicle.HOVER_EFFICIENCY: 195 case Vehicle.HOVER_EFFICIENCY:
188 m_VhoverEfficiency = ClampInRange(0f, pValue, 1f); 196 m_VhoverEfficiency = ClampInRange(0.01f, pValue, 1f);
189 break; 197 break;
190 case Vehicle.HOVER_HEIGHT: 198 case Vehicle.HOVER_HEIGHT:
191 m_VhoverHeight = pValue; 199 m_VhoverHeight = ClampInRange(0f, pValue, 1000000f);
192 break; 200 break;
193 case Vehicle.HOVER_TIMESCALE: 201 case Vehicle.HOVER_TIMESCALE:
194 m_VhoverTimescale = Math.Max(pValue, 0.01f); 202 m_VhoverTimescale = ClampInRange(0.01f, pValue, 120);
195 break; 203 break;
196 case Vehicle.LINEAR_DEFLECTION_EFFICIENCY: 204 case Vehicle.LINEAR_DEFLECTION_EFFICIENCY:
197 m_linearDeflectionEfficiency = ClampInRange(0f, pValue, 1f); 205 m_linearDeflectionEfficiency = ClampInRange(0f, pValue, 1f);
198 break; 206 break;
199 case Vehicle.LINEAR_DEFLECTION_TIMESCALE: 207 case Vehicle.LINEAR_DEFLECTION_TIMESCALE:
200 m_linearDeflectionTimescale = Math.Max(pValue, 0.01f); 208 m_linearDeflectionTimescale = ClampInRange(0.01f, pValue, 120);
201 break; 209 break;
202 case Vehicle.LINEAR_MOTOR_DECAY_TIMESCALE: 210 case Vehicle.LINEAR_MOTOR_DECAY_TIMESCALE:
203 m_linearMotorDecayTimescale = ClampInRange(0.01f, pValue, 120); 211 m_linearMotorDecayTimescale = ClampInRange(0.01f, pValue, 120);
204 m_linearMotor.TargetValueDecayTimeScale = m_linearMotorDecayTimescale; 212 m_linearMotor.TargetValueDecayTimeScale = m_linearMotorDecayTimescale;
205 break; 213 break;
206 case Vehicle.LINEAR_MOTOR_TIMESCALE: 214 case Vehicle.LINEAR_MOTOR_TIMESCALE:
207 m_linearMotorTimescale = Math.Max(pValue, 0.01f); 215 m_linearMotorTimescale = ClampInRange(0.01f, pValue, 120);
208 m_linearMotor.TimeScale = m_linearMotorTimescale; 216 m_linearMotor.TimeScale = m_linearMotorTimescale;
209 break; 217 break;
210 case Vehicle.VERTICAL_ATTRACTION_EFFICIENCY: 218 case Vehicle.VERTICAL_ATTRACTION_EFFICIENCY:
@@ -212,30 +220,35 @@ namespace OpenSim.Region.Physics.BulletSPlugin
212 m_verticalAttractionMotor.Efficiency = m_verticalAttractionEfficiency; 220 m_verticalAttractionMotor.Efficiency = m_verticalAttractionEfficiency;
213 break; 221 break;
214 case Vehicle.VERTICAL_ATTRACTION_TIMESCALE: 222 case Vehicle.VERTICAL_ATTRACTION_TIMESCALE:
215 m_verticalAttractionTimescale = Math.Max(pValue, 0.01f); 223 m_verticalAttractionTimescale = ClampInRange(0.01f, pValue, 120);
216 m_verticalAttractionMotor.TimeScale = m_verticalAttractionTimescale; 224 m_verticalAttractionMotor.TimeScale = m_verticalAttractionTimescale;
217 break; 225 break;
218 226
219 // These are vector properties but the engine lets you use a single float value to 227 // These are vector properties but the engine lets you use a single float value to
220 // set all of the components to the same value 228 // set all of the components to the same value
221 case Vehicle.ANGULAR_FRICTION_TIMESCALE: 229 case Vehicle.ANGULAR_FRICTION_TIMESCALE:
222 m_angularFrictionTimescale = new Vector3(pValue, pValue, pValue); 230 clampTemp = ClampInRange(0.01f, pValue, 120);
231 m_angularFrictionTimescale = new Vector3(clampTemp, clampTemp, clampTemp);
223 break; 232 break;
224 case Vehicle.ANGULAR_MOTOR_DIRECTION: 233 case Vehicle.ANGULAR_MOTOR_DIRECTION:
225 m_angularMotorDirection = new Vector3(pValue, pValue, pValue); 234 clampTemp = ClampInRange(-TwoPI, pValue, TwoPI);
235 m_angularMotorDirection = new Vector3(clampTemp, clampTemp, clampTemp);
226 m_angularMotor.Zero(); 236 m_angularMotor.Zero();
227 m_angularMotor.SetTarget(m_angularMotorDirection); 237 m_angularMotor.SetTarget(m_angularMotorDirection);
228 break; 238 break;
229 case Vehicle.LINEAR_FRICTION_TIMESCALE: 239 case Vehicle.LINEAR_FRICTION_TIMESCALE:
230 m_linearFrictionTimescale = new Vector3(pValue, pValue, pValue); 240 clampTemp = ClampInRange(0.01f, pValue, 120);
241 m_linearFrictionTimescale = new Vector3(clampTemp, clampTemp, clampTemp);
231 break; 242 break;
232 case Vehicle.LINEAR_MOTOR_DIRECTION: 243 case Vehicle.LINEAR_MOTOR_DIRECTION:
233 m_linearMotorDirection = new Vector3(pValue, pValue, pValue); 244 clampTemp = ClampInRange(-BSParam.MaxLinearVelocity, pValue, BSParam.MaxLinearVelocity);
234 m_linearMotorDirectionLASTSET = new Vector3(pValue, pValue, pValue); 245 m_linearMotorDirection = new Vector3(clampTemp, clampTemp, clampTemp);
246 m_linearMotorDirectionLASTSET = new Vector3(clampTemp, clampTemp, clampTemp);
235 m_linearMotor.SetTarget(m_linearMotorDirection); 247 m_linearMotor.SetTarget(m_linearMotorDirection);
236 break; 248 break;
237 case Vehicle.LINEAR_MOTOR_OFFSET: 249 case Vehicle.LINEAR_MOTOR_OFFSET:
238 m_linearMotorOffset = new Vector3(pValue, pValue, pValue); 250 clampTemp = ClampInRange(-1000, pValue, 1000);
251 m_linearMotorOffset = new Vector3(clampTemp, clampTemp, clampTemp);
239 break; 252 break;
240 253
241 } 254 }
@@ -247,29 +260,46 @@ namespace OpenSim.Region.Physics.BulletSPlugin
247 switch (pParam) 260 switch (pParam)
248 { 261 {
249 case Vehicle.ANGULAR_FRICTION_TIMESCALE: 262 case Vehicle.ANGULAR_FRICTION_TIMESCALE:
263 pValue.X = ClampInRange(0.25f, pValue.X, 120);
264 pValue.Y = ClampInRange(0.25f, pValue.Y, 120);
265 pValue.Z = ClampInRange(0.25f, pValue.Z, 120);
250 m_angularFrictionTimescale = new Vector3(pValue.X, pValue.Y, pValue.Z); 266 m_angularFrictionTimescale = new Vector3(pValue.X, pValue.Y, pValue.Z);
251 break; 267 break;
252 case Vehicle.ANGULAR_MOTOR_DIRECTION: 268 case Vehicle.ANGULAR_MOTOR_DIRECTION:
253 // Limit requested angular speed to 2 rps= 4 pi rads/sec 269 // Limit requested angular speed to 2 rps= 4 pi rads/sec
254 pValue.X = ClampInRange(-12.56f, pValue.X, 12.56f); 270 pValue.X = ClampInRange(-FourPI, pValue.X, FourPI);
255 pValue.Y = ClampInRange(-12.56f, pValue.Y, 12.56f); 271 pValue.Y = ClampInRange(-FourPI, pValue.Y, FourPI);
256 pValue.Z = ClampInRange(-12.56f, pValue.Z, 12.56f); 272 pValue.Z = ClampInRange(-FourPI, pValue.Z, FourPI);
257 m_angularMotorDirection = new Vector3(pValue.X, pValue.Y, pValue.Z); 273 m_angularMotorDirection = new Vector3(pValue.X, pValue.Y, pValue.Z);
258 m_angularMotor.Zero(); 274 m_angularMotor.Zero();
259 m_angularMotor.SetTarget(m_angularMotorDirection); 275 m_angularMotor.SetTarget(m_angularMotorDirection);
260 break; 276 break;
261 case Vehicle.LINEAR_FRICTION_TIMESCALE: 277 case Vehicle.LINEAR_FRICTION_TIMESCALE:
278 pValue.X = ClampInRange(0.25f, pValue.X, 120);
279 pValue.Y = ClampInRange(0.25f, pValue.Y, 120);
280 pValue.Z = ClampInRange(0.25f, pValue.Z, 120);
262 m_linearFrictionTimescale = new Vector3(pValue.X, pValue.Y, pValue.Z); 281 m_linearFrictionTimescale = new Vector3(pValue.X, pValue.Y, pValue.Z);
263 break; 282 break;
264 case Vehicle.LINEAR_MOTOR_DIRECTION: 283 case Vehicle.LINEAR_MOTOR_DIRECTION:
284 pValue.X = ClampInRange(-BSParam.MaxLinearVelocity, pValue.X, BSParam.MaxLinearVelocity);
285 pValue.Y = ClampInRange(-BSParam.MaxLinearVelocity, pValue.Y, BSParam.MaxLinearVelocity);
286 pValue.Z = ClampInRange(-BSParam.MaxLinearVelocity, pValue.Z, BSParam.MaxLinearVelocity);
265 m_linearMotorDirection = new Vector3(pValue.X, pValue.Y, pValue.Z); 287 m_linearMotorDirection = new Vector3(pValue.X, pValue.Y, pValue.Z);
266 m_linearMotorDirectionLASTSET = new Vector3(pValue.X, pValue.Y, pValue.Z); 288 m_linearMotorDirectionLASTSET = new Vector3(pValue.X, pValue.Y, pValue.Z);
267 m_linearMotor.SetTarget(m_linearMotorDirection); 289 m_linearMotor.SetTarget(m_linearMotorDirection);
268 break; 290 break;
269 case Vehicle.LINEAR_MOTOR_OFFSET: 291 case Vehicle.LINEAR_MOTOR_OFFSET:
292 // Not sure the correct range to limit this variable
293 pValue.X = ClampInRange(-1000, pValue.X, 1000);
294 pValue.Y = ClampInRange(-1000, pValue.Y, 1000);
295 pValue.Z = ClampInRange(-1000, pValue.Z, 1000);
270 m_linearMotorOffset = new Vector3(pValue.X, pValue.Y, pValue.Z); 296 m_linearMotorOffset = new Vector3(pValue.X, pValue.Y, pValue.Z);
271 break; 297 break;
272 case Vehicle.BLOCK_EXIT: 298 case Vehicle.BLOCK_EXIT:
299 // Not sure the correct range to limit this variable
300 pValue.X = ClampInRange(-10000, pValue.X, 10000);
301 pValue.Y = ClampInRange(-10000, pValue.Y, 10000);
302 pValue.Z = ClampInRange(-10000, pValue.Z, 10000);
273 m_BlockingEndPoint = new Vector3(pValue.X, pValue.Y, pValue.Z); 303 m_BlockingEndPoint = new Vector3(pValue.X, pValue.Y, pValue.Z);
274 break; 304 break;
275 } 305 }
@@ -915,7 +945,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
915 { 945 {
916 get 946 get
917 { 947 {
918 return VehicleVelocity * Quaternion.Inverse(Quaternion.Normalize(VehicleOrientation)); 948 return VehicleVelocity * Quaternion.Inverse(Quaternion.Normalize(VehicleFrameOrientation));
919 } 949 }
920 } 950 }
921 951
@@ -926,6 +956,13 @@ namespace OpenSim.Region.Physics.BulletSPlugin
926 return VehicleForwardVelocity.X; 956 return VehicleForwardVelocity.X;
927 } 957 }
928 } 958 }
959 private Quaternion VehicleFrameOrientation
960 {
961 get
962 {
963 return VehicleOrientation * m_referenceFrame;
964 }
965 }
929 966
930 #endregion // Known vehicle value functions 967 #endregion // Known vehicle value functions
931 968
@@ -1011,8 +1048,13 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1011 VDetailLog("{0}, MoveLinear,clampMax,origVelW={1},lenSq={2},maxVelSq={3},,newVelW={4}", 1048 VDetailLog("{0}, MoveLinear,clampMax,origVelW={1},lenSq={2},maxVelSq={3},,newVelW={4}",
1012 ControllingPrim.LocalID, origVelW, newVelocityLengthSq, BSParam.VehicleMaxLinearVelocitySquared, VehicleVelocity); 1049 ControllingPrim.LocalID, origVelW, newVelocityLengthSq, BSParam.VehicleMaxLinearVelocitySquared, VehicleVelocity);
1013 } 1050 }
1014 else if (newVelocityLengthSq < 0.001f) 1051 else if (newVelocityLengthSq < BSParam.VehicleMinLinearVelocitySquared)
1052 {
1053 Vector3 origVelW = VehicleVelocity; // DEBUG DEBUG
1054 VDetailLog("{0}, MoveLinear,clampMin,origVelW={1},lenSq={2}",
1055 ControllingPrim.LocalID, origVelW, newVelocityLengthSq);
1015 VehicleVelocity = Vector3.Zero; 1056 VehicleVelocity = Vector3.Zero;
1057 }
1016 1058
1017 VDetailLog("{0}, MoveLinear,done,isColl={1},newVel={2}", ControllingPrim.LocalID, ControllingPrim.HasSomeCollision, VehicleVelocity ); 1059 VDetailLog("{0}, MoveLinear,done,isColl={1},newVel={2}", ControllingPrim.LocalID, ControllingPrim.HasSomeCollision, VehicleVelocity );
1018 1060
@@ -1030,7 +1072,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1030 linearMotorCorrectionV -= (currentVelV * frictionFactorV); 1072 linearMotorCorrectionV -= (currentVelV * frictionFactorV);
1031 1073
1032 // Motor is vehicle coordinates. Rotate it to world coordinates 1074 // Motor is vehicle coordinates. Rotate it to world coordinates
1033 Vector3 linearMotorVelocityW = linearMotorCorrectionV * VehicleOrientation; 1075 Vector3 linearMotorVelocityW = linearMotorCorrectionV * VehicleFrameOrientation;
1034 1076
1035 // If we're a ground vehicle, don't add any upward Z movement 1077 // If we're a ground vehicle, don't add any upward Z movement
1036 if ((m_flags & VehicleFlag.LIMIT_MOTOR_UP) != 0) 1078 if ((m_flags & VehicleFlag.LIMIT_MOTOR_UP) != 0)
@@ -1072,7 +1114,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1072 linearDeflectionV *= new Vector3(1, -1, -1); 1114 linearDeflectionV *= new Vector3(1, -1, -1);
1073 1115
1074 // Correction is vehicle relative. Convert to world coordinates. 1116 // Correction is vehicle relative. Convert to world coordinates.
1075 Vector3 linearDeflectionW = linearDeflectionV * VehicleOrientation; 1117 Vector3 linearDeflectionW = linearDeflectionV * VehicleFrameOrientation;
1076 1118
1077 // Optionally, if not colliding, don't effect world downward velocity. Let falling things fall. 1119 // Optionally, if not colliding, don't effect world downward velocity. Let falling things fall.
1078 if (BSParam.VehicleLinearDeflectionNotCollidingNoZ && !m_controllingPrim.HasSomeCollision) 1120 if (BSParam.VehicleLinearDeflectionNotCollidingNoZ && !m_controllingPrim.HasSomeCollision)
@@ -1106,7 +1148,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1106 { 1148 {
1107 // m_VhoverEfficiency: 0=bouncy, 1=totally damped 1149 // m_VhoverEfficiency: 0=bouncy, 1=totally damped
1108 // m_VhoverTimescale: time to achieve height 1150 // m_VhoverTimescale: time to achieve height
1109 if ((m_flags & (VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | VehicleFlag.HOVER_GLOBAL_HEIGHT)) != 0) 1151 if ((m_flags & (VehicleFlag.HOVER_WATER_ONLY | VehicleFlag.HOVER_TERRAIN_ONLY | VehicleFlag.HOVER_GLOBAL_HEIGHT)) != 0 && (m_VhoverHeight > 0) && (m_VhoverTimescale < 300))
1110 { 1152 {
1111 // We should hover, get the target height 1153 // We should hover, get the target height
1112 if ((m_flags & VehicleFlag.HOVER_WATER_ONLY) != 0) 1154 if ((m_flags & VehicleFlag.HOVER_WATER_ONLY) != 0)
@@ -1368,7 +1410,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1368 { 1410 {
1369 // The user wants this many radians per second angular change? 1411 // The user wants this many radians per second angular change?
1370 Vector3 origVehicleRotationalVelocity = VehicleRotationalVelocity; // DEBUG DEBUG 1412 Vector3 origVehicleRotationalVelocity = VehicleRotationalVelocity; // DEBUG DEBUG
1371 Vector3 currentAngularV = VehicleRotationalVelocity * Quaternion.Inverse(VehicleOrientation); 1413 Vector3 currentAngularV = VehicleRotationalVelocity * Quaternion.Inverse(VehicleFrameOrientation);
1372 Vector3 angularMotorContributionV = m_angularMotor.Step(pTimestep, currentAngularV); 1414 Vector3 angularMotorContributionV = m_angularMotor.Step(pTimestep, currentAngularV);
1373 1415
1374 // ================================================================== 1416 // ==================================================================
@@ -1389,7 +1431,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1389 Vector3 frictionFactorW = ComputeFrictionFactor(m_angularFrictionTimescale, pTimestep); 1431 Vector3 frictionFactorW = ComputeFrictionFactor(m_angularFrictionTimescale, pTimestep);
1390 angularMotorContributionV -= (currentAngularV * frictionFactorW); 1432 angularMotorContributionV -= (currentAngularV * frictionFactorW);
1391 1433
1392 Vector3 angularMotorContributionW = angularMotorContributionV * VehicleOrientation; 1434 Vector3 angularMotorContributionW = angularMotorContributionV * VehicleFrameOrientation;
1393 VehicleRotationalVelocity += angularMotorContributionW; 1435 VehicleRotationalVelocity += angularMotorContributionW;
1394 1436
1395 VDetailLog("{0}, MoveAngular,angularTurning,curAngVelV={1},origVehRotVel={2},vehRotVel={3},frictFact={4}, angContribV={5},angContribW={6}", 1437 VDetailLog("{0}, MoveAngular,angularTurning,curAngVelV={1},origVehRotVel={2},vehRotVel={3},frictFact={4}, angContribV={5},angContribW={6}",
@@ -1410,7 +1452,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1410 // If vertical attaction timescale is reasonable 1452 // If vertical attaction timescale is reasonable
1411 if (BSParam.VehicleEnableAngularVerticalAttraction && m_verticalAttractionTimescale < m_verticalAttractionCutoff) 1453 if (BSParam.VehicleEnableAngularVerticalAttraction && m_verticalAttractionTimescale < m_verticalAttractionCutoff)
1412 { 1454 {
1413 Vector3 vehicleUpAxis = Vector3.UnitZ * VehicleOrientation; 1455 Vector3 vehicleUpAxis = Vector3.UnitZ * VehicleFrameOrientation;
1414 switch (BSParam.VehicleAngularVerticalAttractionAlgorithm) 1456 switch (BSParam.VehicleAngularVerticalAttractionAlgorithm)
1415 { 1457 {
1416 case 0: 1458 case 0:
@@ -1429,6 +1471,12 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1429 // This is only half the distance to the target so it will take 2 seconds to complete the turn. 1471 // This is only half the distance to the target so it will take 2 seconds to complete the turn.
1430 Vector3 torqueVector = Vector3.Cross(predictedUp, Vector3.UnitZ); 1472 Vector3 torqueVector = Vector3.Cross(predictedUp, Vector3.UnitZ);
1431 1473
1474 if ((m_flags & VehicleFlag.LIMIT_ROLL_ONLY) != 0)
1475 {
1476 Vector3 vehicleForwardAxis = Vector3.UnitX * VehicleFrameOrientation;
1477 torqueVector = ProjectVector(torqueVector, vehicleForwardAxis);
1478 }
1479
1432 // Scale vector by our timescale since it is an acceleration it is r/s^2 or radians a timescale squared 1480 // Scale vector by our timescale since it is an acceleration it is r/s^2 or radians a timescale squared
1433 Vector3 vertContributionV = torqueVector * verticalAttractionSpeed * verticalAttractionSpeed; 1481 Vector3 vertContributionV = torqueVector * verticalAttractionSpeed * verticalAttractionSpeed;
1434 1482
@@ -1450,13 +1498,13 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1450 1498
1451 // Create a rotation that is only the vehicle's rotation around Z 1499 // Create a rotation that is only the vehicle's rotation around Z
1452 Vector3 currentEulerW = Vector3.Zero; 1500 Vector3 currentEulerW = Vector3.Zero;
1453 VehicleOrientation.GetEulerAngles(out currentEulerW.X, out currentEulerW.Y, out currentEulerW.Z); 1501 VehicleFrameOrientation.GetEulerAngles(out currentEulerW.X, out currentEulerW.Y, out currentEulerW.Z);
1454 Quaternion justZOrientation = Quaternion.CreateFromAxisAngle(Vector3.UnitZ, currentEulerW.Z); 1502 Quaternion justZOrientation = Quaternion.CreateFromAxisAngle(Vector3.UnitZ, currentEulerW.Z);
1455 1503
1456 // Create the axis that is perpendicular to the up vector and the rotated up vector. 1504 // Create the axis that is perpendicular to the up vector and the rotated up vector.
1457 Vector3 differenceAxisW = Vector3.Cross(Vector3.UnitZ * justZOrientation, Vector3.UnitZ * VehicleOrientation); 1505 Vector3 differenceAxisW = Vector3.Cross(Vector3.UnitZ * justZOrientation, Vector3.UnitZ * VehicleFrameOrientation);
1458 // Compute the angle between those to vectors. 1506 // Compute the angle between those to vectors.
1459 double differenceAngle = Math.Acos((double)Vector3.Dot(Vector3.UnitZ, Vector3.Normalize(Vector3.UnitZ * VehicleOrientation))); 1507 double differenceAngle = Math.Acos((double)Vector3.Dot(Vector3.UnitZ, Vector3.Normalize(Vector3.UnitZ * VehicleFrameOrientation)));
1460 // 'differenceAngle' is the angle to rotate and 'differenceAxis' is the plane to rotate in to get the vehicle vertical 1508 // 'differenceAngle' is the angle to rotate and 'differenceAxis' is the plane to rotate in to get the vehicle vertical
1461 1509
1462 // Reduce the change by the time period it is to change in. Timestep is handled when velocity is applied. 1510 // Reduce the change by the time period it is to change in. Timestep is handled when velocity is applied.
@@ -1489,7 +1537,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1489 Vector3 origRotVelW = VehicleRotationalVelocity; // DEBUG DEBUG 1537 Vector3 origRotVelW = VehicleRotationalVelocity; // DEBUG DEBUG
1490 1538
1491 // Take a vector pointing up and convert it from world to vehicle relative coords. 1539 // Take a vector pointing up and convert it from world to vehicle relative coords.
1492 Vector3 verticalError = Vector3.Normalize(Vector3.UnitZ * VehicleOrientation); 1540 Vector3 verticalError = Vector3.Normalize(Vector3.UnitZ * VehicleFrameOrientation);
1493 1541
1494 // If vertical attraction correction is needed, the vector that was pointing up (UnitZ) 1542 // If vertical attraction correction is needed, the vector that was pointing up (UnitZ)
1495 // is now: 1543 // is now:
@@ -1520,7 +1568,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1520 vertContributionV /= m_verticalAttractionTimescale; 1568 vertContributionV /= m_verticalAttractionTimescale;
1521 1569
1522 // Rotate the vehicle rotation to the world coordinates. 1570 // Rotate the vehicle rotation to the world coordinates.
1523 VehicleRotationalVelocity += (vertContributionV * VehicleOrientation); 1571 VehicleRotationalVelocity += (vertContributionV * VehicleFrameOrientation);
1524 1572
1525 VDetailLog("{0}, MoveAngular,verticalAttraction,,upAxis={1},origRotVW={2},vertError={3},unscaledV={4},eff={5},ts={6},vertContribV={7}", 1573 VDetailLog("{0}, MoveAngular,verticalAttraction,,upAxis={1},origRotVW={2},vertError={3},unscaledV={4},eff={5},ts={6},vertContribV={7}",
1526 ControllingPrim.LocalID, 1574 ControllingPrim.LocalID,
@@ -1561,7 +1609,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1561 movingDirection *= Math.Sign(VehicleForwardSpeed); 1609 movingDirection *= Math.Sign(VehicleForwardSpeed);
1562 1610
1563 // The direction the vehicle is pointing 1611 // The direction the vehicle is pointing
1564 Vector3 pointingDirection = Vector3.UnitX * VehicleOrientation; 1612 Vector3 pointingDirection = Vector3.UnitX * VehicleFrameOrientation;
1565 //Predict where the Vehicle will be pointing after AngularVelocity change is applied. This will keep 1613 //Predict where the Vehicle will be pointing after AngularVelocity change is applied. This will keep
1566 // from overshooting and allow this correction to merge with the Vertical Attraction peacefully. 1614 // from overshooting and allow this correction to merge with the Vertical Attraction peacefully.
1567 Vector3 predictedPointingDirection = pointingDirection * Quaternion.CreateFromAxisAngle(VehicleRotationalVelocity, 0f); 1615 Vector3 predictedPointingDirection = pointingDirection * Quaternion.CreateFromAxisAngle(VehicleRotationalVelocity, 0f);
@@ -1586,7 +1634,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1586 deflectContributionV = (-deflectionError) * ClampInRange(0, m_angularDeflectionEfficiency/m_angularDeflectionTimescale,1f); 1634 deflectContributionV = (-deflectionError) * ClampInRange(0, m_angularDeflectionEfficiency/m_angularDeflectionTimescale,1f);
1587 //deflectContributionV /= m_angularDeflectionTimescale; 1635 //deflectContributionV /= m_angularDeflectionTimescale;
1588 1636
1589 // VehicleRotationalVelocity += deflectContributionV * VehicleOrientation;
1590 VehicleRotationalVelocity += deflectContributionV; 1637 VehicleRotationalVelocity += deflectContributionV;
1591 VDetailLog("{0}, MoveAngular,Deflection,movingDir={1},pointingDir={2},deflectError={3},ret={4}", 1638 VDetailLog("{0}, MoveAngular,Deflection,movingDir={1},pointingDir={2},deflectError={3},ret={4}",
1592 ControllingPrim.LocalID, movingDirection, pointingDirection, deflectionError, deflectContributionV); 1639 ControllingPrim.LocalID, movingDirection, pointingDirection, deflectionError, deflectContributionV);
@@ -1635,7 +1682,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1635 // Rotate a UnitZ vector (pointing up) to how the vehicle is oriented. 1682 // Rotate a UnitZ vector (pointing up) to how the vehicle is oriented.
1636 // As the vehicle rolls to the right or left, the Y value will increase from 1683 // As the vehicle rolls to the right or left, the Y value will increase from
1637 // zero (straight up) to 1 or -1 (full tilt right or left) 1684 // zero (straight up) to 1 or -1 (full tilt right or left)
1638 Vector3 rollComponents = Vector3.UnitZ * VehicleOrientation; 1685 Vector3 rollComponents = Vector3.UnitZ * VehicleFrameOrientation;
1639 1686
1640 // Figure out the yaw value for this much roll. 1687 // Figure out the yaw value for this much roll.
1641 float yawAngle = m_angularMotorDirection.X * m_bankingEfficiency; 1688 float yawAngle = m_angularMotorDirection.X * m_bankingEfficiency;
@@ -1644,7 +1691,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1644 1691
1645 // TODO: the banking effect should not go to infinity but what to limit it to? 1692 // TODO: the banking effect should not go to infinity but what to limit it to?
1646 // And what should happen when this is being added to a user defined yaw that is already PI*4? 1693 // And what should happen when this is being added to a user defined yaw that is already PI*4?
1647 mixedYawAngle = ClampInRange(-12, mixedYawAngle, 12); 1694 mixedYawAngle = ClampInRange(-FourPI, mixedYawAngle, FourPI);
1648 1695
1649 // Build the force vector to change rotation from what it is to what it should be 1696 // Build the force vector to change rotation from what it is to what it should be
1650 bankingContributionV.Z = -mixedYawAngle; 1697 bankingContributionV.Z = -mixedYawAngle;
@@ -1652,7 +1699,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1652 // Don't do it all at once. Fudge because 1 second is too fast with most user defined roll as PI*4. 1699 // Don't do it all at once. Fudge because 1 second is too fast with most user defined roll as PI*4.
1653 bankingContributionV /= m_bankingTimescale * BSParam.VehicleAngularBankingTimescaleFudge; 1700 bankingContributionV /= m_bankingTimescale * BSParam.VehicleAngularBankingTimescaleFudge;
1654 1701
1655 //VehicleRotationalVelocity += bankingContributionV * VehicleOrientation;
1656 VehicleRotationalVelocity += bankingContributionV; 1702 VehicleRotationalVelocity += bankingContributionV;
1657 1703
1658 1704
@@ -1730,6 +1776,14 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1730 1776
1731 } 1777 }
1732 1778
1779 //Given a Vector and a unit vector will return the amount of the vector is on the same axis as the unit.
1780 private Vector3 ProjectVector(Vector3 vector, Vector3 onNormal)
1781 {
1782 float vectorDot = Vector3.Dot(vector, onNormal);
1783 return onNormal * vectorDot;
1784
1785 }
1786
1733 private float ClampInRange(float low, float val, float high) 1787 private float ClampInRange(float low, float val, float high)
1734 { 1788 {
1735 return Math.Max(low, Math.Min(val, high)); 1789 return Math.Max(low, Math.Min(val, high));
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
index 77f69a5..87eba33 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -128,6 +128,7 @@ public abstract class BSLinkset
128 m_children = new Dictionary<BSPrimLinkable, BSLinkInfo>(); 128 m_children = new Dictionary<BSPrimLinkable, BSLinkInfo>();
129 LinksetMass = parent.RawMass; 129 LinksetMass = parent.RawMass;
130 Rebuilding = false; 130 Rebuilding = false;
131 RebuildScheduled = false;
131 132
132 parent.ClearDisplacement(); 133 parent.ClearDisplacement();
133 } 134 }
@@ -297,8 +298,16 @@ public abstract class BSLinkset
297 298
298 // Flag denoting the linkset is in the process of being rebuilt. 299 // Flag denoting the linkset is in the process of being rebuilt.
299 // Used to know not the schedule a rebuild in the middle of a rebuild. 300 // Used to know not the schedule a rebuild in the middle of a rebuild.
301 // Because of potential update calls that could want to schedule another rebuild.
300 protected bool Rebuilding { get; set; } 302 protected bool Rebuilding { get; set; }
301 303
304 // Flag saying a linkset rebuild has been scheduled.
305 // This is turned on when the rebuild is requested and turned off when
306 // the rebuild is complete. Used to limit modifications to the
307 // linkset parameters while the linkset is in an intermediate state.
308 // Protected by a "lock(m_linsetActivityLock)" on the BSLinkset object
309 public bool RebuildScheduled { get; protected set; }
310
302 // The object is going dynamic (physical). Do any setup necessary 311 // The object is going dynamic (physical). Do any setup necessary
303 // for a dynamic linkset. 312 // for a dynamic linkset.
304 // Only the state of the passed object can be modified. The rest of the linkset 313 // Only the state of the passed object can be modified. The rest of the linkset
@@ -307,6 +316,23 @@ public abstract class BSLinkset
307 // Called at taint-time! 316 // Called at taint-time!
308 public abstract bool MakeDynamic(BSPrimLinkable child); 317 public abstract bool MakeDynamic(BSPrimLinkable child);
309 318
319 public virtual bool AllPartsComplete
320 {
321 get {
322 bool ret = true;
323 this.ForEachMember((member) =>
324 {
325 if ((!member.IsInitialized) || member.IsIncomplete || member.PrimAssetState == BSPhysObject.PrimAssetCondition.Waiting)
326 {
327 ret = false;
328 return true; // exit loop
329 }
330 return false; // continue loop
331 });
332 return ret;
333 }
334 }
335
310 // The object is going static (non-physical). Do any setup necessary 336 // The object is going static (non-physical). Do any setup necessary
311 // for a static linkset. 337 // for a static linkset.
312 // Return 'true' if any properties updated on the passed object. 338 // Return 'true' if any properties updated on the passed object.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
index 8f12189..cae9efa 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
@@ -37,7 +37,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin
37 37
38public sealed class BSLinksetCompound : BSLinkset 38public sealed class BSLinksetCompound : BSLinkset
39{ 39{
40#pragma warning disable 414
40 private static string LogHeader = "[BULLETSIM LINKSET COMPOUND]"; 41 private static string LogHeader = "[BULLETSIM LINKSET COMPOUND]";
42#pragma warning restore 414
41 43
42 public BSLinksetCompound(BSScene scene, BSPrimLinkable parent) 44 public BSLinksetCompound(BSScene scene, BSPrimLinkable parent)
43 : base(scene, parent) 45 : base(scene, parent)
@@ -98,22 +100,43 @@ public sealed class BSLinksetCompound : BSLinkset
98 // Schedule a refresh to happen after all the other taint processing. 100 // Schedule a refresh to happen after all the other taint processing.
99 private void ScheduleRebuild(BSPrimLinkable requestor) 101 private void ScheduleRebuild(BSPrimLinkable requestor)
100 { 102 {
101 DetailLog("{0},BSLinksetCompound.ScheduleRebuild,,rebuilding={1},hasChildren={2},actuallyScheduling={3}",
102 requestor.LocalID, Rebuilding, HasAnyChildren, (!Rebuilding && HasAnyChildren));
103
104 // When rebuilding, it is possible to set properties that would normally require a rebuild. 103 // When rebuilding, it is possible to set properties that would normally require a rebuild.
105 // If already rebuilding, don't request another rebuild. 104 // If already rebuilding, don't request another rebuild.
106 // If a linkset with just a root prim (simple non-linked prim) don't bother rebuilding. 105 // If a linkset with just a root prim (simple non-linked prim) don't bother rebuilding.
107 if (!Rebuilding && HasAnyChildren) 106 lock (m_linksetActivityLock)
108 { 107 {
109 m_physicsScene.PostTaintObject("BSLinksetCompound.ScheduleRebuild", LinksetRoot.LocalID, delegate() 108 if (!RebuildScheduled && !Rebuilding && HasAnyChildren)
110 { 109 {
111 if (HasAnyChildren) 110 InternalScheduleRebuild(requestor);
112 RecomputeLinksetCompound(); 111 }
113 });
114 } 112 }
115 } 113 }
116 114
115 // Must be called with m_linksetActivityLock or race conditions will haunt you.
116 private void InternalScheduleRebuild(BSPrimLinkable requestor)
117 {
118 DetailLog("{0},BSLinksetCompound.InternalScheduleRebuild,,rebuilding={1},hasChildren={2}",
119 requestor.LocalID, Rebuilding, HasAnyChildren);
120 RebuildScheduled = true;
121 m_physicsScene.PostTaintObject("BSLinksetCompound.ScheduleRebuild", LinksetRoot.LocalID, delegate()
122 {
123 if (HasAnyChildren)
124 {
125 if (this.AllPartsComplete)
126 {
127 RecomputeLinksetCompound();
128 }
129 else
130 {
131 DetailLog("{0},BSLinksetCompound.InternalScheduleRebuild,,rescheduling because not all children complete",
132 requestor.LocalID);
133 InternalScheduleRebuild(requestor);
134 }
135 }
136 RebuildScheduled = false;
137 });
138 }
139
117 // The object is going dynamic (physical). Do any setup necessary for a dynamic linkset. 140 // The object is going dynamic (physical). Do any setup necessary for a dynamic linkset.
118 // Only the state of the passed object can be modified. The rest of the linkset 141 // Only the state of the passed object can be modified. The rest of the linkset
119 // has not yet been fully constructed. 142 // has not yet been fully constructed.
@@ -178,7 +201,10 @@ public sealed class BSLinksetCompound : BSLinkset
178 if ((whichUpdated & ~(UpdatedProperties.Position | UpdatedProperties.Orientation)) == 0) 201 if ((whichUpdated & ~(UpdatedProperties.Position | UpdatedProperties.Orientation)) == 0)
179 { 202 {
180 // Find the physical instance of the child 203 // Find the physical instance of the child
181 if (LinksetRoot.PhysShape.HasPhysicalShape && m_physicsScene.PE.IsCompound(LinksetRoot.PhysShape.physShapeInfo)) 204 if (!RebuildScheduled // if rebuilding, let the rebuild do it
205 && !LinksetRoot.IsIncomplete // if waiting for assets or whatever, don't change
206 && LinksetRoot.PhysShape.HasPhysicalShape // there must be a physical shape assigned
207 && m_physicsScene.PE.IsCompound(LinksetRoot.PhysShape.physShapeInfo))
182 { 208 {
183 // It is possible that the linkset is still under construction and the child is not yet 209 // It is possible that the linkset is still under construction and the child is not yet
184 // inserted into the compound shape. A rebuild of the linkset in a pre-step action will 210 // inserted into the compound shape. A rebuild of the linkset in a pre-step action will
@@ -369,23 +395,47 @@ public sealed class BSLinksetCompound : BSLinkset
369 // Get a reference to the shape of the child for adding of that shape to the linkset compound shape 395 // Get a reference to the shape of the child for adding of that shape to the linkset compound shape
370 BSShape childShape = cPrim.PhysShape.GetReference(m_physicsScene, cPrim); 396 BSShape childShape = cPrim.PhysShape.GetReference(m_physicsScene, cPrim);
371 397
372 // Offset the child shape from the center-of-mass and rotate it to vehicle relative. 398 // Offset the child shape from the center-of-mass and rotate it to root relative.
373 OMV.Vector3 offsetPos = (cPrim.RawPosition - origRootPosition) * invRootOrientation - centerDisplacementV; 399 OMV.Vector3 offsetPos = (cPrim.RawPosition - origRootPosition) * invRootOrientation - centerDisplacementV;
374 OMV.Quaternion offsetRot = OMV.Quaternion.Normalize(cPrim.RawOrientation) * invRootOrientation; 400 OMV.Quaternion offsetRot = OMV.Quaternion.Normalize(cPrim.RawOrientation) * invRootOrientation;
375 401
376 // Add the child shape to the compound shape being built 402 // Add the child shape to the compound shape being built
377 m_physicsScene.PE.AddChildShapeToCompoundShape(linksetShape.physShapeInfo, childShape.physShapeInfo, offsetPos, offsetRot); 403 if (childShape.physShapeInfo.HasPhysicalShape)
378 DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,addChild,indx={1},cShape={2},offPos={3},offRot={4}", 404 {
379 LinksetRoot.LocalID, cPrim.LinksetChildIndex, childShape, offsetPos, offsetRot); 405 m_physicsScene.PE.AddChildShapeToCompoundShape(linksetShape.physShapeInfo, childShape.physShapeInfo, offsetPos, offsetRot);
406 DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,addChild,indx={1},cShape={2},offPos={3},offRot={4}",
407 LinksetRoot.LocalID, cPrim.LinksetChildIndex, childShape, offsetPos, offsetRot);
380 408
381 // Since we are borrowing the shape of the child, disable the origional child body 409 // Since we are borrowing the shape of the child, disable the origional child body
382 if (!IsRoot(cPrim)) 410 if (!IsRoot(cPrim))
411 {
412 m_physicsScene.PE.AddToCollisionFlags(cPrim.PhysBody, CollisionFlags.CF_NO_CONTACT_RESPONSE);
413 m_physicsScene.PE.ForceActivationState(cPrim.PhysBody, ActivationState.DISABLE_SIMULATION);
414 // We don't want collisions from the old linkset children.
415 m_physicsScene.PE.RemoveFromCollisionFlags(cPrim.PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
416 cPrim.PhysBody.collisionType = CollisionType.LinksetChild;
417 }
418 }
419 else
383 { 420 {
384 m_physicsScene.PE.AddToCollisionFlags(cPrim.PhysBody, CollisionFlags.CF_NO_CONTACT_RESPONSE); 421 // The linkset must be in an intermediate state where all the children have not yet
385 m_physicsScene.PE.ForceActivationState(cPrim.PhysBody, ActivationState.DISABLE_SIMULATION); 422 // been constructed. This sometimes happens on startup when everything is getting
386 // We don't want collisions from the old linkset children. 423 // built and some shapes have to wait for assets to be read in.
387 m_physicsScene.PE.RemoveFromCollisionFlags(cPrim.PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); 424 // Just skip this linkset for the moment and cause the shape to be rebuilt next tick.
388 cPrim.PhysBody.collisionType = CollisionType.LinksetChild; 425 // One problem might be that the shape is broken somehow and it never becomes completely
426 // available. This might cause the rebuild to happen over and over.
427 InternalScheduleRebuild(LinksetRoot);
428 DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,addChildWithNoShape,indx={1},cShape={2},offPos={3},offRot={4}",
429 LinksetRoot.LocalID, cPrim.LinksetChildIndex, childShape, offsetPos, offsetRot);
430 // Output an annoying warning. It should only happen once but if it keeps coming out,
431 // the user knows there is something wrong and will report it.
432 m_physicsScene.Logger.WarnFormat("{0} Linkset rebuild warning. If this happens more than one or two times, please report in Mantis 7191", LogHeader);
433 m_physicsScene.Logger.WarnFormat("{0} pName={1}, childIdx={2}, shape={3}",
434 LogHeader, LinksetRoot.Name, cPrim.LinksetChildIndex, childShape);
435
436 // This causes the loop to bail on building the rest of this linkset.
437 // The rebuild operation will fix it up next tick or declare the object unbuildable.
438 return true;
389 } 439 }
390 440
391 return false; // 'false' says to move onto the next child in the list 441 return false; // 'false' says to move onto the next child in the list
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
index aaf92c8..4384cdc 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
@@ -78,7 +78,7 @@ public sealed class BSLinksetConstraints : BSLinkset
78 public override void ResetLink() 78 public override void ResetLink()
79 { 79 {
80 // constraintType = ConstraintType.D6_CONSTRAINT_TYPE; 80 // constraintType = ConstraintType.D6_CONSTRAINT_TYPE;
81 constraintType = ConstraintType.FIXED_CONSTRAINT_TYPE; 81 constraintType = ConstraintType.BS_FIXED_CONSTRAINT_TYPE;
82 linearLimitLow = OMV.Vector3.Zero; 82 linearLimitLow = OMV.Vector3.Zero;
83 linearLimitHigh = OMV.Vector3.Zero; 83 linearLimitHigh = OMV.Vector3.Zero;
84 angularLimitLow = OMV.Vector3.Zero; 84 angularLimitLow = OMV.Vector3.Zero;
@@ -115,7 +115,7 @@ public sealed class BSLinksetConstraints : BSLinkset
115 member.PhysScene.DetailLog("{0},BSLinkInfoConstraint.SetLinkParameters,type={1}", member.LocalID, constraintType); 115 member.PhysScene.DetailLog("{0},BSLinkInfoConstraint.SetLinkParameters,type={1}", member.LocalID, constraintType);
116 switch (constraintType) 116 switch (constraintType)
117 { 117 {
118 case ConstraintType.FIXED_CONSTRAINT_TYPE: 118 case ConstraintType.BS_FIXED_CONSTRAINT_TYPE:
119 case ConstraintType.D6_CONSTRAINT_TYPE: 119 case ConstraintType.D6_CONSTRAINT_TYPE:
120 BSConstraint6Dof constrain6dof = constrain as BSConstraint6Dof; 120 BSConstraint6Dof constrain6dof = constrain as BSConstraint6Dof;
121 if (constrain6dof != null) 121 if (constrain6dof != null)
@@ -179,7 +179,7 @@ public sealed class BSLinksetConstraints : BSLinkset
179 public override bool ShouldUpdateChildProperties() 179 public override bool ShouldUpdateChildProperties()
180 { 180 {
181 bool ret = true; 181 bool ret = true;
182 if (constraintType == ConstraintType.FIXED_CONSTRAINT_TYPE) 182 if (constraintType == ConstraintType.BS_FIXED_CONSTRAINT_TYPE)
183 ret = false; 183 ret = false;
184 184
185 return ret; 185 return ret;
@@ -212,20 +212,28 @@ public sealed class BSLinksetConstraints : BSLinkset
212 // When rebuilding, it is possible to set properties that would normally require a rebuild. 212 // When rebuilding, it is possible to set properties that would normally require a rebuild.
213 // If already rebuilding, don't request another rebuild. 213 // If already rebuilding, don't request another rebuild.
214 // If a linkset with just a root prim (simple non-linked prim) don't bother rebuilding. 214 // If a linkset with just a root prim (simple non-linked prim) don't bother rebuilding.
215 if (!Rebuilding && HasAnyChildren) 215 lock (this)
216 { 216 {
217 // Queue to happen after all the other taint processing 217 if (!RebuildScheduled)
218 m_physicsScene.PostTaintObject("BSLinksetContraints.Refresh", requestor.LocalID, delegate()
219 { 218 {
220 if (HasAnyChildren) 219 if (!Rebuilding && HasAnyChildren)
221 { 220 {
222 // Constraints that have not been changed are not rebuild but make sure 221 RebuildScheduled = true;
223 // the constraint of the requestor is rebuilt. 222 // Queue to happen after all the other taint processing
224 PhysicallyUnlinkAChildFromRoot(LinksetRoot, requestor); 223 m_physicsScene.PostTaintObject("BSLinksetContraints.Refresh", requestor.LocalID, delegate()
225 // Rebuild the linkset and all its constraints. 224 {
226 RecomputeLinksetConstraints(); 225 if (HasAnyChildren)
226 {
227 // Constraints that have not been changed are not rebuild but make sure
228 // the constraint of the requestor is rebuilt.
229 PhysicallyUnlinkAChildFromRoot(LinksetRoot, requestor);
230 // Rebuild the linkset and all its constraints.
231 RecomputeLinksetConstraints();
232 }
233 RebuildScheduled = false;
234 });
227 } 235 }
228 }); 236 }
229 } 237 }
230 } 238 }
231 239
@@ -363,7 +371,7 @@ public sealed class BSLinksetConstraints : BSLinkset
363 371
364 switch (linkInfo.constraintType) 372 switch (linkInfo.constraintType)
365 { 373 {
366 case ConstraintType.FIXED_CONSTRAINT_TYPE: 374 case ConstraintType.BS_FIXED_CONSTRAINT_TYPE:
367 case ConstraintType.D6_CONSTRAINT_TYPE: 375 case ConstraintType.D6_CONSTRAINT_TYPE:
368 // Relative position normalized to the root prim 376 // Relative position normalized to the root prim
369 // Essentually a vector pointing from center of rootPrim to center of li.member 377 // Essentually a vector pointing from center of rootPrim to center of li.member
@@ -536,7 +544,7 @@ public sealed class BSLinksetConstraints : BSLinkset
536 { 544 {
537 int requestedType = (int)pParams[2]; 545 int requestedType = (int)pParams[2];
538 DetailLog("{0},BSLinksetConstraint.ChangeLinkType,requestedType={1}", LinksetRoot.LocalID, requestedType); 546 DetailLog("{0},BSLinksetConstraint.ChangeLinkType,requestedType={1}", LinksetRoot.LocalID, requestedType);
539 if (requestedType == (int)ConstraintType.FIXED_CONSTRAINT_TYPE 547 if (requestedType == (int)ConstraintType.BS_FIXED_CONSTRAINT_TYPE
540 || requestedType == (int)ConstraintType.D6_CONSTRAINT_TYPE 548 || requestedType == (int)ConstraintType.D6_CONSTRAINT_TYPE
541 || requestedType == (int)ConstraintType.D6_SPRING_CONSTRAINT_TYPE 549 || requestedType == (int)ConstraintType.D6_SPRING_CONSTRAINT_TYPE
542 || requestedType == (int)ConstraintType.HINGE_CONSTRAINT_TYPE 550 || requestedType == (int)ConstraintType.HINGE_CONSTRAINT_TYPE
@@ -646,7 +654,7 @@ public sealed class BSLinksetConstraints : BSLinkset
646 case ExtendedPhysics.PHYS_PARAM_LINK_TYPE: 654 case ExtendedPhysics.PHYS_PARAM_LINK_TYPE:
647 valueInt = (int)pParams[opIndex + 1]; 655 valueInt = (int)pParams[opIndex + 1];
648 ConstraintType valueType = (ConstraintType)valueInt; 656 ConstraintType valueType = (ConstraintType)valueInt;
649 if (valueType == ConstraintType.FIXED_CONSTRAINT_TYPE 657 if (valueType == ConstraintType.BS_FIXED_CONSTRAINT_TYPE
650 || valueType == ConstraintType.D6_CONSTRAINT_TYPE 658 || valueType == ConstraintType.D6_CONSTRAINT_TYPE
651 || valueType == ConstraintType.D6_SPRING_CONSTRAINT_TYPE 659 || valueType == ConstraintType.D6_SPRING_CONSTRAINT_TYPE
652 || valueType == ConstraintType.HINGE_CONSTRAINT_TYPE 660 || valueType == ConstraintType.HINGE_CONSTRAINT_TYPE
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
index 834228e..6d46fe6 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
@@ -54,6 +54,14 @@ public static class BSParam
54 // =================== 54 // ===================
55 // From: 55 // From:
56 56
57 /// <summary>
58 /// Set whether physics is active or not.
59 /// </summary>
60 /// <remarks>
61 /// Can be enabled and disabled to start and stop physics.
62 /// </remarks>
63 public static bool Active { get; private set; }
64
57 public static bool UseSeparatePhysicsThread { get; private set; } 65 public static bool UseSeparatePhysicsThread { get; private set; }
58 public static float PhysicsTimeStep { get; private set; } 66 public static float PhysicsTimeStep { get; private set; }
59 67
@@ -97,6 +105,7 @@ public static class BSParam
97 105
98 public static float TerrainImplementation { get; set; } 106 public static float TerrainImplementation { get; set; }
99 public static int TerrainMeshMagnification { get; private set; } 107 public static int TerrainMeshMagnification { get; private set; }
108 public static float TerrainGroundPlane { get; private set; }
100 public static float TerrainFriction { get; private set; } 109 public static float TerrainFriction { get; private set; }
101 public static float TerrainHitFraction { get; private set; } 110 public static float TerrainHitFraction { get; private set; }
102 public static float TerrainRestitution { get; private set; } 111 public static float TerrainRestitution { get; private set; }
@@ -123,22 +132,29 @@ public static class BSParam
123 public static float PhysicsUnmanLoggingFrames { get; private set; } 132 public static float PhysicsUnmanLoggingFrames { get; private set; }
124 133
125 // Avatar parameters 134 // Avatar parameters
135 public static bool AvatarToAvatarCollisionsByDefault { get; private set; }
126 public static float AvatarFriction { get; private set; } 136 public static float AvatarFriction { get; private set; }
127 public static float AvatarStandingFriction { get; private set; } 137 public static float AvatarStandingFriction { get; private set; }
128 public static float AvatarAlwaysRunFactor { get; private set; } 138 public static float AvatarAlwaysRunFactor { get; private set; }
129 public static float AvatarDensity { get; private set; } 139 public static float AvatarDensity { get; private set; }
130 public static float AvatarRestitution { get; private set; } 140 public static float AvatarRestitution { get; private set; }
141 public static int AvatarShape { get; private set; }
131 public static float AvatarCapsuleWidth { get; private set; } 142 public static float AvatarCapsuleWidth { get; private set; }
132 public static float AvatarCapsuleDepth { get; private set; } 143 public static float AvatarCapsuleDepth { get; private set; }
133 public static float AvatarCapsuleHeight { get; private set; } 144 public static float AvatarCapsuleHeight { get; private set; }
134 public static float AvatarHeightLowFudge { get; private set; } 145 public static float AvatarHeightLowFudge { get; private set; }
135 public static float AvatarHeightMidFudge { get; private set; } 146 public static float AvatarHeightMidFudge { get; private set; }
136 public static float AvatarHeightHighFudge { get; private set; } 147 public static float AvatarHeightHighFudge { get; private set; }
148 public static float AvatarFlyingGroundMargin { get; private set; }
149 public static float AvatarFlyingGroundUpForce { get; private set; }
150 public static float AvatarTerminalVelocity { get; private set; }
137 public static float AvatarContactProcessingThreshold { get; private set; } 151 public static float AvatarContactProcessingThreshold { get; private set; }
138 public static float AvatarStopZeroThreshold { get; private set; } 152 public static float AvatarStopZeroThreshold { get; private set; }
139 public static int AvatarJumpFrames { get; private set; } 153 public static int AvatarJumpFrames { get; private set; }
140 public static float AvatarBelowGroundUpCorrectionMeters { get; private set; } 154 public static float AvatarBelowGroundUpCorrectionMeters { get; private set; }
141 public static float AvatarStepHeight { get; private set; } 155 public static float AvatarStepHeight { get; private set; }
156 public static float AvatarStepAngle { get; private set; }
157 public static float AvatarStepGroundFudge { get; private set; }
142 public static float AvatarStepApproachFactor { get; private set; } 158 public static float AvatarStepApproachFactor { get; private set; }
143 public static float AvatarStepForceFactor { get; private set; } 159 public static float AvatarStepForceFactor { get; private set; }
144 public static float AvatarStepUpCorrectionFactor { get; private set; } 160 public static float AvatarStepUpCorrectionFactor { get; private set; }
@@ -147,6 +163,8 @@ public static class BSParam
147 // Vehicle parameters 163 // Vehicle parameters
148 public static float VehicleMaxLinearVelocity { get; private set; } 164 public static float VehicleMaxLinearVelocity { get; private set; }
149 public static float VehicleMaxLinearVelocitySquared { get; private set; } 165 public static float VehicleMaxLinearVelocitySquared { get; private set; }
166 public static float VehicleMinLinearVelocity { get; private set; }
167 public static float VehicleMinLinearVelocitySquared { get; private set; }
150 public static float VehicleMaxAngularVelocity { get; private set; } 168 public static float VehicleMaxAngularVelocity { get; private set; }
151 public static float VehicleMaxAngularVelocitySq { get; private set; } 169 public static float VehicleMaxAngularVelocitySq { get; private set; }
152 public static float VehicleAngularDamping { get; private set; } 170 public static float VehicleAngularDamping { get; private set; }
@@ -165,6 +183,7 @@ public static class BSParam
165 public static bool VehicleEnableAngularBanking { get; private set; } 183 public static bool VehicleEnableAngularBanking { get; private set; }
166 184
167 // Convex Hulls 185 // Convex Hulls
186 // Parameters for convex hull routine that ships with Bullet
168 public static int CSHullMaxDepthSplit { get; private set; } 187 public static int CSHullMaxDepthSplit { get; private set; }
169 public static int CSHullMaxDepthSplitForSimpleShapes { get; private set; } 188 public static int CSHullMaxDepthSplitForSimpleShapes { get; private set; }
170 public static float CSHullConcavityThresholdPercent { get; private set; } 189 public static float CSHullConcavityThresholdPercent { get; private set; }
@@ -180,6 +199,22 @@ public static class BSParam
180 public static bool BHullAddNeighboursDistPoints { get; private set; } // false 199 public static bool BHullAddNeighboursDistPoints { get; private set; } // false
181 public static bool BHullAddFacesPoints { get; private set; } // false 200 public static bool BHullAddFacesPoints { get; private set; } // false
182 public static bool BHullShouldAdjustCollisionMargin { get; private set; } // false 201 public static bool BHullShouldAdjustCollisionMargin { get; private set; } // false
202 public static float WhichHACD { get; private set; } // zero if Bullet HACD, non-zero says VHACD
203 // Parameters for VHACD 2.0: http://code.google.com/p/v-hacd
204 // To enable, set both ShouldUseBulletHACD=true and WhichHACD=1
205 // http://kmamou.blogspot.ca/2014/12/v-hacd-20-parameters-description.html
206 public static float VHACDresolution { get; private set; } // 100,000 max number of voxels generated during voxelization stage
207 public static float VHACDdepth { get; private set; } // 20 max number of clipping stages
208 public static float VHACDconcavity { get; private set; } // 0.0025 maximum concavity
209 public static float VHACDplaneDownsampling { get; private set; } // 4 granularity of search for best clipping plane
210 public static float VHACDconvexHullDownsampling { get; private set; } // 4 precision of hull gen process
211 public static float VHACDalpha { get; private set; } // 0.05 bias toward clipping along symmetry planes
212 public static float VHACDbeta { get; private set; } // 0.05 bias toward clipping along revolution axis
213 public static float VHACDgamma { get; private set; } // 0.00125 max concavity when merging
214 public static float VHACDpca { get; private set; } // 0 on/off normalizing mesh before decomp
215 public static float VHACDmode { get; private set; } // 0 0:voxel based, 1: tetrahedron based
216 public static float VHACDmaxNumVerticesPerCH { get; private set; } // 64 max triangles per convex hull
217 public static float VHACDminVolumePerCH { get; private set; } // 0.0001 sampling of generated convex hulls
183 218
184 // Linkset implementation parameters 219 // Linkset implementation parameters
185 public static float LinksetImplementation { get; private set; } 220 public static float LinksetImplementation { get; private set; }
@@ -366,6 +401,8 @@ public static class BSParam
366 // v = value (appropriate type) 401 // v = value (appropriate type)
367 private static ParameterDefnBase[] ParameterDefinitions = 402 private static ParameterDefnBase[] ParameterDefinitions =
368 { 403 {
404 new ParameterDefn<bool>("Active", "If 'true', false then physics is not active",
405 false ),
369 new ParameterDefn<bool>("UseSeparatePhysicsThread", "If 'true', the physics engine runs independent from the simulator heartbeat", 406 new ParameterDefn<bool>("UseSeparatePhysicsThread", "If 'true', the physics engine runs independent from the simulator heartbeat",
370 false ), 407 false ),
371 new ParameterDefn<float>("PhysicsTimeStep", "If separate thread, seconds to simulate each interval", 408 new ParameterDefn<float>("PhysicsTimeStep", "If separate thread, seconds to simulate each interval",
@@ -538,9 +575,11 @@ public static class BSParam
538 (s,o) => { s.PE.SetContactProcessingThreshold(o.PhysBody, ContactProcessingThreshold); } ), 575 (s,o) => { s.PE.SetContactProcessingThreshold(o.PhysBody, ContactProcessingThreshold); } ),
539 576
540 new ParameterDefn<float>("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)", 577 new ParameterDefn<float>("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)",
541 (float)BSTerrainPhys.TerrainImplementation.Mesh ), 578 (float)BSTerrainPhys.TerrainImplementation.Heightmap ),
542 new ParameterDefn<int>("TerrainMeshMagnification", "Number of times the 256x256 heightmap is multiplied to create the terrain mesh" , 579 new ParameterDefn<int>("TerrainMeshMagnification", "Number of times the 256x256 heightmap is multiplied to create the terrain mesh" ,
543 2 ), 580 2 ),
581 new ParameterDefn<float>("TerrainGroundPlane", "Altitude of ground plane used to keep things from falling to infinity" ,
582 -500.0f ),
544 new ParameterDefn<float>("TerrainFriction", "Factor to reduce movement against terrain surface" , 583 new ParameterDefn<float>("TerrainFriction", "Factor to reduce movement against terrain surface" ,
545 0.3f ), 584 0.3f ),
546 new ParameterDefn<float>("TerrainHitFraction", "Distance to measure hit collisions" , 585 new ParameterDefn<float>("TerrainHitFraction", "Distance to measure hit collisions" ,
@@ -550,8 +589,10 @@ public static class BSParam
550 new ParameterDefn<float>("TerrainContactProcessingThreshold", "Distance from terrain to stop processing collisions" , 589 new ParameterDefn<float>("TerrainContactProcessingThreshold", "Distance from terrain to stop processing collisions" ,
551 0.0f ), 590 0.0f ),
552 new ParameterDefn<float>("TerrainCollisionMargin", "Margin where collision checking starts" , 591 new ParameterDefn<float>("TerrainCollisionMargin", "Margin where collision checking starts" ,
553 0.08f ), 592 0.04f ),
554 593
594 new ParameterDefn<bool>("AvatarToAvatarCollisionsByDefault", "Should avatars collide with other avatars by default?",
595 true),
555 new ParameterDefn<float>("AvatarFriction", "Factor to reduce movement against an avatar. Changed on avatar recreation.", 596 new ParameterDefn<float>("AvatarFriction", "Factor to reduce movement against an avatar. Changed on avatar recreation.",
556 0.2f ), 597 0.2f ),
557 new ParameterDefn<float>("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.", 598 new ParameterDefn<float>("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.",
@@ -563,6 +604,8 @@ public static class BSParam
563 3500f) , // 3.5 * 100 604 3500f) , // 3.5 * 100
564 new ParameterDefn<float>("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", 605 new ParameterDefn<float>("AvatarRestitution", "Bouncyness. Changed on avatar recreation.",
565 0f ), 606 0f ),
607 new ParameterDefn<int>("AvatarShape", "Code for avatar physical shape: 0:capsule, 1:cube, 2:ovoid, 2:mesh",
608 BSShapeCollection.AvatarShapeCube ) ,
566 new ParameterDefn<float>("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule", 609 new ParameterDefn<float>("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule",
567 0.6f ) , 610 0.6f ) ,
568 new ParameterDefn<float>("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule", 611 new ParameterDefn<float>("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule",
@@ -570,11 +613,17 @@ public static class BSParam
570 new ParameterDefn<float>("AvatarCapsuleHeight", "Default height of space around avatar", 613 new ParameterDefn<float>("AvatarCapsuleHeight", "Default height of space around avatar",
571 1.5f ), 614 1.5f ),
572 new ParameterDefn<float>("AvatarHeightLowFudge", "A fudge factor to make small avatars stand on the ground", 615 new ParameterDefn<float>("AvatarHeightLowFudge", "A fudge factor to make small avatars stand on the ground",
573 -0.2f ), 616 0f ),
574 new ParameterDefn<float>("AvatarHeightMidFudge", "A fudge distance to adjust average sized avatars to be standing on ground", 617 new ParameterDefn<float>("AvatarHeightMidFudge", "A fudge distance to adjust average sized avatars to be standing on ground",
575 0.1f ), 618 0f ),
576 new ParameterDefn<float>("AvatarHeightHighFudge", "A fudge factor to make tall avatars stand on the ground", 619 new ParameterDefn<float>("AvatarHeightHighFudge", "A fudge factor to make tall avatars stand on the ground",
577 0.1f ), 620 0f ),
621 new ParameterDefn<float>("AvatarFlyingGroundMargin", "Meters avatar is kept above the ground when flying",
622 5f ),
623 new ParameterDefn<float>("AvatarFlyingGroundUpForce", "Upward force applied to the avatar to keep it at flying ground margin",
624 2.0f ),
625 new ParameterDefn<float>("AvatarTerminalVelocity", "Terminal Velocity of falling avatar",
626 -54.0f ),
578 new ParameterDefn<float>("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", 627 new ParameterDefn<float>("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions",
579 0.1f ), 628 0.1f ),
580 new ParameterDefn<float>("AvatarStopZeroThreshold", "Movement velocity below which avatar is assumed to be stopped", 629 new ParameterDefn<float>("AvatarStopZeroThreshold", "Movement velocity below which avatar is assumed to be stopped",
@@ -584,20 +633,28 @@ public static class BSParam
584 new ParameterDefn<int>("AvatarJumpFrames", "Number of frames to allow jump forces. Changes jump height.", 633 new ParameterDefn<int>("AvatarJumpFrames", "Number of frames to allow jump forces. Changes jump height.",
585 4 ), 634 4 ),
586 new ParameterDefn<float>("AvatarStepHeight", "Height of a step obstacle to consider step correction", 635 new ParameterDefn<float>("AvatarStepHeight", "Height of a step obstacle to consider step correction",
587 0.6f ) , 636 0.999f ) ,
637 new ParameterDefn<float>("AvatarStepAngle", "The angle (in radians) for a vertical surface to be considered a step",
638 0.3f ) ,
639 new ParameterDefn<float>("AvatarStepGroundFudge", "Fudge factor subtracted from avatar base when comparing collision height",
640 0.1f ) ,
588 new ParameterDefn<float>("AvatarStepApproachFactor", "Factor to control angle of approach to step (0=straight on)", 641 new ParameterDefn<float>("AvatarStepApproachFactor", "Factor to control angle of approach to step (0=straight on)",
589 0.6f ), 642 2f ),
590 new ParameterDefn<float>("AvatarStepForceFactor", "Controls the amount of force up applied to step up onto a step", 643 new ParameterDefn<float>("AvatarStepForceFactor", "Controls the amount of force up applied to step up onto a step",
591 1.0f ), 644 0f ),
592 new ParameterDefn<float>("AvatarStepUpCorrectionFactor", "Multiplied by height of step collision to create up movement at step", 645 new ParameterDefn<float>("AvatarStepUpCorrectionFactor", "Multiplied by height of step collision to create up movement at step",
593 1.0f ), 646 0.8f ),
594 new ParameterDefn<int>("AvatarStepSmoothingSteps", "Number of frames after a step collision that we continue walking up stairs", 647 new ParameterDefn<int>("AvatarStepSmoothingSteps", "Number of frames after a step collision that we continue walking up stairs",
595 2 ), 648 1 ),
596 649
597 new ParameterDefn<float>("VehicleMaxLinearVelocity", "Maximum velocity magnitude that can be assigned to a vehicle", 650 new ParameterDefn<float>("VehicleMaxLinearVelocity", "Maximum velocity magnitude that can be assigned to a vehicle",
598 1000.0f, 651 1000.0f,
599 (s) => { return (float)VehicleMaxLinearVelocity; }, 652 (s) => { return (float)VehicleMaxLinearVelocity; },
600 (s,v) => { VehicleMaxLinearVelocity = v; VehicleMaxLinearVelocitySquared = v * v; } ), 653 (s,v) => { VehicleMaxLinearVelocity = v; VehicleMaxLinearVelocitySquared = v * v; } ),
654 new ParameterDefn<float>("VehicleMinLinearVelocity", "Maximum velocity magnitude that can be assigned to a vehicle",
655 0.001f,
656 (s) => { return (float)VehicleMinLinearVelocity; },
657 (s,v) => { VehicleMinLinearVelocity = v; VehicleMinLinearVelocitySquared = v * v; } ),
601 new ParameterDefn<float>("VehicleMaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to a vehicle", 658 new ParameterDefn<float>("VehicleMaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to a vehicle",
602 12.0f, 659 12.0f,
603 (s) => { return (float)VehicleMaxAngularVelocity; }, 660 (s) => { return (float)VehicleMaxAngularVelocity; },
@@ -709,6 +766,33 @@ public static class BSParam
709 new ParameterDefn<bool>("BHullShouldAdjustCollisionMargin", "Bullet impl: whether to shrink resulting hulls to account for collision margin", 766 new ParameterDefn<bool>("BHullShouldAdjustCollisionMargin", "Bullet impl: whether to shrink resulting hulls to account for collision margin",
710 false ), 767 false ),
711 768
769 new ParameterDefn<float>("WhichHACD", "zero if Bullet HACD, non-zero says VHACD",
770 0f ),
771 new ParameterDefn<float>("VHACDresolution", "max number of voxels generated during voxelization stage",
772 100000f ),
773 new ParameterDefn<float>("VHACDdepth", "max number of clipping stages",
774 20f ),
775 new ParameterDefn<float>("VHACDconcavity", "maximum concavity",
776 0.0025f ),
777 new ParameterDefn<float>("VHACDplaneDownsampling", "granularity of search for best clipping plane",
778 4f ),
779 new ParameterDefn<float>("VHACDconvexHullDownsampling", "precision of hull gen process",
780 4f ),
781 new ParameterDefn<float>("VHACDalpha", "bias toward clipping along symmetry planes",
782 0.05f ),
783 new ParameterDefn<float>("VHACDbeta", "bias toward clipping along revolution axis",
784 0.05f ),
785 new ParameterDefn<float>("VHACDgamma", "max concavity when merging",
786 0.00125f ),
787 new ParameterDefn<float>("VHACDpca", "on/off normalizing mesh before decomp",
788 0f ),
789 new ParameterDefn<float>("VHACDmode", "0:voxel based, 1: tetrahedron based",
790 0f ),
791 new ParameterDefn<float>("VHACDmaxNumVerticesPerCH", "max triangles per convex hull",
792 64f ),
793 new ParameterDefn<float>("VHACDminVolumePerCH", "sampling of generated convex hulls",
794 0.0001f ),
795
712 new ParameterDefn<float>("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)", 796 new ParameterDefn<float>("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)",
713 (float)BSLinkset.LinksetImplementation.Compound ), 797 (float)BSLinkset.LinksetImplementation.Compound ),
714 new ParameterDefn<bool>("LinksetOffsetCenterOfMass", "If 'true', compute linkset center-of-mass and offset linkset position to account for same", 798 new ParameterDefn<bool>("LinksetOffsetCenterOfMass", "If 'true', compute linkset center-of-mass and offset linkset position to account for same",
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
index f89b376..90da7a6 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
@@ -80,28 +80,27 @@ public abstract class BSPhysObject : PhysicsActor
80 Name = name; // PhysicsActor also has the name of the object. Someday consolidate. 80 Name = name; // PhysicsActor also has the name of the object. Someday consolidate.
81 TypeName = typeName; 81 TypeName = typeName;
82 82
83 // The collection of things that push me around 83 // Oddity if object is destroyed and recreated very quickly it could still have the old body.
84 PhysicalActors = new BSActorCollection(PhysScene); 84 if (!PhysBody.HasPhysicalBody)
85 PhysBody = new BulletBody(localID);
85 86
86 // Initialize variables kept in base. 87 // Clean out anything that might be in the physical actor list.
87 GravModifier = 1.0f; 88 // Again, a workaround for destroying and recreating an object very quickly.
88 Gravity = new OMV.Vector3(0f, 0f, BSParam.Gravity); 89 PhysicalActors.Dispose();
89 HoverActive = false;
90
91 // We don't have any physical representation yet.
92 PhysBody = new BulletBody(localID);
93 PhysShape = new BSShapeNull();
94 90
95 UserSetCenterOfMassDisplacement = null; 91 UserSetCenterOfMassDisplacement = null;
96 92
97 PrimAssetState = PrimAssetCondition.Unknown; 93 PrimAssetState = PrimAssetCondition.Unknown;
98 94
95 // Initialize variables kept in base.
96 // Beware that these cause taints to be queued whch can cause race conditions on startup.
97 GravModifier = 1.0f;
98 Gravity = new OMV.Vector3(0f, 0f, BSParam.Gravity);
99 HoverActive = false;
100
99 // Default material type. Also sets Friction, Restitution and Density. 101 // Default material type. Also sets Friction, Restitution and Density.
100 SetMaterial((int)MaterialAttributes.Material.Wood); 102 SetMaterial((int)MaterialAttributes.Material.Wood);
101 103
102 CollisionCollection = new CollisionEventUpdate();
103 CollisionsLastReported = CollisionCollection;
104 CollisionsLastTick = new CollisionEventUpdate();
105 CollisionsLastTickStep = -1; 104 CollisionsLastTickStep = -1;
106 105
107 SubscribedEventsMs = 0; 106 SubscribedEventsMs = 0;
@@ -136,6 +135,15 @@ public abstract class BSPhysObject : PhysicsActor
136 // This mostly prevents property updates and collisions until the object is completely here. 135 // This mostly prevents property updates and collisions until the object is completely here.
137 public bool IsInitialized { get; protected set; } 136 public bool IsInitialized { get; protected set; }
138 137
138 // Set to 'true' if an object (mesh/linkset/sculpty) is not completely constructed.
139 // This test is used to prevent some updates to the object when it only partially exists.
140 // There are several reasons and object might be incomplete:
141 // Its underlying mesh/sculpty is an asset which must be fetched from the asset store
142 // It is a linkset who is being added to or removed from
143 // It is changing state (static to physical, for instance) which requires rebuilding
144 // This is a computed value based on the underlying physical object construction
145 abstract public bool IsIncomplete { get; }
146
139 // Return the object mass without calculating it or having side effects 147 // Return the object mass without calculating it or having side effects
140 public abstract float RawMass { get; } 148 public abstract float RawMass { get; }
141 // Set the raw mass but also update physical mass properties (inertia, ...) 149 // Set the raw mass but also update physical mass properties (inertia, ...)
@@ -148,9 +156,9 @@ public abstract class BSPhysObject : PhysicsActor
148 public OMV.Vector3 Inertia { get; set; } 156 public OMV.Vector3 Inertia { get; set; }
149 157
150 // Reference to the physical body (btCollisionObject) of this object 158 // Reference to the physical body (btCollisionObject) of this object
151 public BulletBody PhysBody; 159 public BulletBody PhysBody = new BulletBody(0);
152 // Reference to the physical shape (btCollisionShape) of this object 160 // Reference to the physical shape (btCollisionShape) of this object
153 public BSShape PhysShape; 161 public BSShape PhysShape = new BSShapeNull();
154 162
155 // The physical representation of the prim might require an asset fetch. 163 // The physical representation of the prim might require an asset fetch.
156 // The asset state is first 'Unknown' then 'Waiting' then either 'Failed' or 'Fetched'. 164 // The asset state is first 'Unknown' then 'Waiting' then either 'Failed' or 'Fetched'.
@@ -159,6 +167,11 @@ public abstract class BSPhysObject : PhysicsActor
159 Unknown, Waiting, FailedAssetFetch, FailedMeshing, Fetched 167 Unknown, Waiting, FailedAssetFetch, FailedMeshing, Fetched
160 } 168 }
161 public PrimAssetCondition PrimAssetState { get; set; } 169 public PrimAssetCondition PrimAssetState { get; set; }
170 public virtual bool AssetFailed()
171 {
172 return ( (this.PrimAssetState == PrimAssetCondition.FailedAssetFetch)
173 || (this.PrimAssetState == PrimAssetCondition.FailedMeshing) );
174 }
162 175
163 // The objects base shape information. Null if not a prim type shape. 176 // The objects base shape information. Null if not a prim type shape.
164 public PrimitiveBaseShape BaseShape { get; protected set; } 177 public PrimitiveBaseShape BaseShape { get; protected set; }
@@ -223,7 +236,7 @@ public abstract class BSPhysObject : PhysicsActor
223 public virtual OMV.Quaternion RawOrientation { get; set; } 236 public virtual OMV.Quaternion RawOrientation { get; set; }
224 public abstract OMV.Quaternion ForceOrientation { get; set; } 237 public abstract OMV.Quaternion ForceOrientation { get; set; }
225 238
226 public OMV.Vector3 RawVelocity { get; set; } 239 public virtual OMV.Vector3 RawVelocity { get; set; }
227 public abstract OMV.Vector3 ForceVelocity { get; set; } 240 public abstract OMV.Vector3 ForceVelocity { get; set; }
228 241
229 public OMV.Vector3 RawForce { get; set; } 242 public OMV.Vector3 RawForce { get; set; }
@@ -241,7 +254,12 @@ public abstract class BSPhysObject : PhysicsActor
241 254
242 public virtual bool ForceBodyShapeRebuild(bool inTaintTime) { return false; } 255 public virtual bool ForceBodyShapeRebuild(bool inTaintTime) { return false; }
243 256
244 public override bool PIDActive { set { MoveToTargetActive = value; } } 257 public override bool PIDActive
258 {
259 get { return MoveToTargetActive; }
260 set { MoveToTargetActive = value; }
261 }
262
245 public override OMV.Vector3 PIDTarget { set { MoveToTargetTarget = value; } } 263 public override OMV.Vector3 PIDTarget { set { MoveToTargetTarget = value; } }
246 public override float PIDTau { set { MoveToTargetTau = value; } } 264 public override float PIDTau { set { MoveToTargetTau = value; } }
247 265
@@ -290,11 +308,20 @@ public abstract class BSPhysObject : PhysicsActor
290 // Note this is a displacement from the root's coordinates. Zero means use the root prim as center-of-mass. 308 // Note this is a displacement from the root's coordinates. Zero means use the root prim as center-of-mass.
291 public OMV.Vector3? UserSetCenterOfMassDisplacement { get; set; } 309 public OMV.Vector3? UserSetCenterOfMassDisplacement { get; set; }
292 310
293 public OMV.Vector3 LockedLinearAxis { get; set; } // zero means locked. one means free. 311 public OMV.Vector3 LockedLinearAxis; // zero means locked. one means free.
294 public OMV.Vector3 LockedAngularAxis { get; set; } // zero means locked. one means free. 312 public OMV.Vector3 LockedAngularAxis; // zero means locked. one means free.
295 public const float FreeAxis = 1f; 313 public const float FreeAxis = 1f;
314 public const float LockedAxis = 0f;
296 public readonly OMV.Vector3 LockedAxisFree = new OMV.Vector3(FreeAxis, FreeAxis, FreeAxis); // All axis are free 315 public readonly OMV.Vector3 LockedAxisFree = new OMV.Vector3(FreeAxis, FreeAxis, FreeAxis); // All axis are free
297 316
317 // If an axis is locked (flagged above) then the limits of that axis are specified here.
318 // Linear axis limits are relative to the object's starting coordinates.
319 // Angular limits are limited to -PI to +PI
320 public OMV.Vector3 LockedLinearAxisLow;
321 public OMV.Vector3 LockedLinearAxisHigh;
322 public OMV.Vector3 LockedAngularAxisLow;
323 public OMV.Vector3 LockedAngularAxisHigh;
324
298 // Enable physical actions. Bullet will keep sleeping non-moving physical objects so 325 // Enable physical actions. Bullet will keep sleeping non-moving physical objects so
299 // they need waking up when parameters are changed. 326 // they need waking up when parameters are changed.
300 // Called in taint-time!! 327 // Called in taint-time!!
@@ -416,12 +443,12 @@ public abstract class BSPhysObject : PhysicsActor
416 } 443 }
417 444
418 // The collisions that have been collected for the next collision reporting (throttled by subscription) 445 // The collisions that have been collected for the next collision reporting (throttled by subscription)
419 protected CollisionEventUpdate CollisionCollection; 446 protected CollisionEventUpdate CollisionCollection = new CollisionEventUpdate();
420 // This is the collision collection last reported to the Simulator. 447 // This is the collision collection last reported to the Simulator.
421 public CollisionEventUpdate CollisionsLastReported; 448 public CollisionEventUpdate CollisionsLastReported = new CollisionEventUpdate();
422 // Remember the collisions recorded in the last tick for fancy collision checking 449 // Remember the collisions recorded in the last tick for fancy collision checking
423 // (like a BSCharacter walking up stairs). 450 // (like a BSCharacter walking up stairs).
424 public CollisionEventUpdate CollisionsLastTick; 451 public CollisionEventUpdate CollisionsLastTick = new CollisionEventUpdate();
425 private long CollisionsLastTickStep = -1; 452 private long CollisionsLastTickStep = -1;
426 453
427 // The simulation step is telling this object about a collision. 454 // The simulation step is telling this object about a collision.
@@ -462,8 +489,11 @@ public abstract class BSPhysObject : PhysicsActor
462 489
463 // If someone has subscribed for collision events log the collision so it will be reported up 490 // If someone has subscribed for collision events log the collision so it will be reported up
464 if (SubscribedEvents()) { 491 if (SubscribedEvents()) {
465 CollisionCollection.AddCollider(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth)); 492 lock (PhysScene.CollisionLock)
466 DetailLog("{0},{1}.Collison.AddCollider,call,with={2},point={3},normal={4},depth={5},colliderMoving={6}", 493 {
494 CollisionCollection.AddCollider(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth));
495 }
496 DetailLog("{0},{1}.Collision.AddCollider,call,with={2},point={3},normal={4},depth={5},colliderMoving={6}",
467 LocalID, TypeName, collidingWith, contactPoint, contactNormal, pentrationDepth, ColliderIsMoving); 497 LocalID, TypeName, collidingWith, contactPoint, contactNormal, pentrationDepth, ColliderIsMoving);
468 498
469 ret = true; 499 ret = true;
@@ -474,12 +504,14 @@ public abstract class BSPhysObject : PhysicsActor
474 // Send the collected collisions into the simulator. 504 // Send the collected collisions into the simulator.
475 // Called at taint time from within the Step() function thus no locking problems 505 // Called at taint time from within the Step() function thus no locking problems
476 // with CollisionCollection and ObjectsWithNoMoreCollisions. 506 // with CollisionCollection and ObjectsWithNoMoreCollisions.
507 // Called with BSScene.CollisionLock locked to protect the collision lists.
477 // Return 'true' if there were some actual collisions passed up 508 // Return 'true' if there were some actual collisions passed up
478 public virtual bool SendCollisions() 509 public virtual bool SendCollisions()
479 { 510 {
480 bool ret = true; 511 bool ret = true;
481 512
482 // If the 'no collision' call, force it to happen right now so quick collision_end 513 // If no collisions this call but there were collisions last call, force the collision
514 // event to be happen right now so quick collision_end.
483 bool force = (CollisionCollection.Count == 0 && CollisionsLastReported.Count != 0); 515 bool force = (CollisionCollection.Count == 0 && CollisionsLastReported.Count != 0);
484 516
485 // throttle the collisions to the number of milliseconds specified in the subscription 517 // throttle the collisions to the number of milliseconds specified in the subscription
@@ -562,7 +594,7 @@ public abstract class BSPhysObject : PhysicsActor
562 594
563 #region Per Simulation Step actions 595 #region Per Simulation Step actions
564 596
565 public BSActorCollection PhysicalActors; 597 public BSActorCollection PhysicalActors = new BSActorCollection();
566 598
567 // When an update to the physical properties happens, this event is fired to let 599 // When an update to the physical properties happens, this event is fired to let
568 // different actors to modify the update before it is passed around 600 // different actors to modify the update before it is passed around
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 15b7090..a00991f 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -34,6 +34,7 @@ using OMV = OpenMetaverse;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Region.Physics.Manager; 35using OpenSim.Region.Physics.Manager;
36using OpenSim.Region.Physics.ConvexDecompositionDotNet; 36using OpenSim.Region.Physics.ConvexDecompositionDotNet;
37using OpenSim.Region.OptionalModules.Scripting; // for ExtendedPhysics
37 38
38namespace OpenSim.Region.Physics.BulletSPlugin 39namespace OpenSim.Region.Physics.BulletSPlugin
39{ 40{
@@ -95,11 +96,9 @@ public class BSPrim : BSPhysObject
95 _isPhysical = pisPhysical; 96 _isPhysical = pisPhysical;
96 _isVolumeDetect = false; 97 _isVolumeDetect = false;
97 98
98 // Add a dynamic vehicle to our set of actors that can move this prim.
99 // PhysicalActors.Add(VehicleActorName, new BSDynamics(PhysScene, this, VehicleActorName));
100
101 _mass = CalculateMass(); 99 _mass = CalculateMass();
102 100
101 DetailLog("{0},BSPrim.constructor,pbs={1}", LocalID, BSScene.PrimitiveBaseShapeToString(pbs));
103 // DetailLog("{0},BSPrim.constructor,call", LocalID); 102 // DetailLog("{0},BSPrim.constructor,call", LocalID);
104 // do the actual object creation at taint time 103 // do the actual object creation at taint time
105 PhysScene.TaintedObject(LocalID, "BSPrim.create", delegate() 104 PhysScene.TaintedObject(LocalID, "BSPrim.create", delegate()
@@ -141,6 +140,18 @@ public class BSPrim : BSPhysObject
141 public override bool Stopped { 140 public override bool Stopped {
142 get { return false; } 141 get { return false; }
143 } 142 }
143
144 public override bool IsIncomplete {
145 get {
146 return ShapeRebuildScheduled;
147 }
148 }
149
150 // 'true' if this object's shape is in need of a rebuild and a rebuild has been queued.
151 // The prim is still available but its underlying shape will change soon.
152 // This is protected by a 'lock(this)'.
153 public bool ShapeRebuildScheduled { get; protected set; }
154
144 public override OMV.Vector3 Size { 155 public override OMV.Vector3 Size {
145 get { return _size; } 156 get { return _size; }
146 set { 157 set {
@@ -155,17 +166,42 @@ public class BSPrim : BSPhysObject
155 public override PrimitiveBaseShape Shape { 166 public override PrimitiveBaseShape Shape {
156 set { 167 set {
157 BaseShape = value; 168 BaseShape = value;
169 DetailLog("{0},BSPrim.changeShape,pbs={1}", LocalID, BSScene.PrimitiveBaseShapeToString(BaseShape));
158 PrimAssetState = PrimAssetCondition.Unknown; 170 PrimAssetState = PrimAssetCondition.Unknown;
159 ForceBodyShapeRebuild(false); 171 ForceBodyShapeRebuild(false);
160 } 172 }
161 } 173 }
174 // Cause the body and shape of the prim to be rebuilt if necessary.
175 // If there are no changes required, this is quick and does not make changes to the prim.
176 // If rebuilding is necessary (like changing from static to physical), that will happen.
177 // The 'ShapeRebuildScheduled' tells any checker that the body/shape may change shortly.
178 // The return parameter is not used by anyone.
162 public override bool ForceBodyShapeRebuild(bool inTaintTime) 179 public override bool ForceBodyShapeRebuild(bool inTaintTime)
163 { 180 {
164 PhysScene.TaintedObject(inTaintTime, LocalID, "BSPrim.ForceBodyShapeRebuild", delegate() 181 if (inTaintTime)
165 { 182 {
183 // If called in taint time, do the operation immediately
166 _mass = CalculateMass(); // changing the shape changes the mass 184 _mass = CalculateMass(); // changing the shape changes the mass
167 CreateGeomAndObject(true); 185 CreateGeomAndObject(true);
168 }); 186 }
187 else
188 {
189 lock (this)
190 {
191 // If a rebuild is not already in the queue
192 if (!ShapeRebuildScheduled)
193 {
194 // Remember that a rebuild is queued -- this is used to flag an incomplete object
195 ShapeRebuildScheduled = true;
196 PhysScene.TaintedObject(LocalID, "BSPrim.ForceBodyShapeRebuild", delegate()
197 {
198 _mass = CalculateMass(); // changing the shape changes the mass
199 CreateGeomAndObject(true);
200 ShapeRebuildScheduled = false;
201 });
202 }
203 }
204 }
169 return true; 205 return true;
170 } 206 }
171 public override bool Grabbed { 207 public override bool Grabbed {
@@ -249,23 +285,21 @@ public class BSPrim : BSPhysObject
249 { 285 {
250 DetailLog("{0},BSPrim.LockAngularMotion,call,axis={1}", LocalID, axis); 286 DetailLog("{0},BSPrim.LockAngularMotion,call,axis={1}", LocalID, axis);
251 287
252 // "1" means free, "0" means locked 288 ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_UNLOCK_ANGULAR, 0f, 0f);
253 OMV.Vector3 locking = LockedAxisFree; 289 if (axis.X != 1)
254 if (axis.X != 1) locking.X = 0f;
255 if (axis.Y != 1) locking.Y = 0f;
256 if (axis.Z != 1) locking.Z = 0f;
257 LockedAngularAxis = locking;
258
259 EnableActor(LockedAngularAxis != LockedAxisFree, LockedAxisActorName, delegate()
260 { 290 {
261 return new BSActorLockAxis(PhysScene, this, LockedAxisActorName); 291 ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR_X, 0f, 0f);
262 }); 292 }
263 293 if (axis.Y != 1)
264 // Update parameters so the new actor's Refresh() action is called at the right time.
265 PhysScene.TaintedObject(LocalID, "BSPrim.LockAngularMotion", delegate()
266 { 294 {
267 UpdatePhysicalParameters(); 295 ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR_Y, 0f, 0f);
268 }); 296 }
297 if (axis.Z != 1)
298 {
299 ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR_Z, 0f, 0f);
300 }
301
302 InitializeAxisActor();
269 303
270 return; 304 return;
271 } 305 }
@@ -376,18 +410,19 @@ public class BSPrim : BSPhysObject
376 { 410 {
377 bool ret = false; 411 bool ret = false;
378 412
379 uint wayOutThere = Constants.RegionSize * Constants.RegionSize; 413 int wayOverThere = -1000;
414 int wayOutThere = 10000;
380 // There have been instances of objects getting thrown way out of bounds and crashing 415 // There have been instances of objects getting thrown way out of bounds and crashing
381 // the border crossing code. 416 // the border crossing code.
382 if ( RawPosition.X < -Constants.RegionSize || RawPosition.X > wayOutThere 417 if ( RawPosition.X < wayOverThere || RawPosition.X > wayOutThere
383 || RawPosition.Y < -Constants.RegionSize || RawPosition.Y > wayOutThere 418 || RawPosition.Y < wayOverThere || RawPosition.X > wayOutThere
384 || RawPosition.Z < -Constants.RegionSize || RawPosition.Z > wayOutThere) 419 || RawPosition.Z < wayOverThere || RawPosition.X > wayOutThere)
385 { 420 {
386 RawPosition = new OMV.Vector3(10, 10, 50); 421 RawPosition = new OMV.Vector3(10, 10, 50);
387 ZeroMotion(inTaintTime); 422 ZeroMotion(inTaintTime);
388 ret = true; 423 ret = true;
389 } 424 }
390 if (RawVelocity.LengthSquared() > BSParam.MaxLinearVelocity) 425 if (RawVelocity.LengthSquared() > BSParam.MaxLinearVelocitySquared)
391 { 426 {
392 RawVelocity = Util.ClampV(RawVelocity, BSParam.MaxLinearVelocity); 427 RawVelocity = Util.ClampV(RawVelocity, BSParam.MaxLinearVelocity);
393 ret = true; 428 ret = true;
@@ -496,6 +531,12 @@ public class BSPrim : BSPhysObject
496 { 531 {
497 return new BSActorSetForce(PhysScene, this, SetForceActorName); 532 return new BSActorSetForce(PhysScene, this, SetForceActorName);
498 }); 533 });
534
535 // Call update so actor Refresh() is called to start things off
536 PhysScene.TaintedObject(LocalID, "BSPrim.setForce", delegate()
537 {
538 UpdatePhysicalParameters();
539 });
499 } 540 }
500 } 541 }
501 542
@@ -729,6 +770,12 @@ public class BSPrim : BSPhysObject
729 return new BSActorSetTorque(PhysScene, this, SetTorqueActorName); 770 return new BSActorSetTorque(PhysScene, this, SetTorqueActorName);
730 }); 771 });
731 DetailLog("{0},BSPrim.SetTorque,call,torque={1}", LocalID, RawTorque); 772 DetailLog("{0},BSPrim.SetTorque,call,torque={1}", LocalID, RawTorque);
773
774 // Call update so actor Refresh() is called to start things off
775 PhysScene.TaintedObject(LocalID, "BSPrim.setTorque", delegate()
776 {
777 UpdatePhysicalParameters();
778 });
732 } 779 }
733 } 780 }
734 public override OMV.Vector3 Acceleration { 781 public override OMV.Vector3 Acceleration {
@@ -1086,13 +1133,27 @@ public class BSPrim : BSPhysObject
1086 } 1133 }
1087 } 1134 }
1088 1135
1089 public override bool PIDActive { 1136 public override bool PIDActive
1090 set { 1137 {
1091 base.MoveToTargetActive = value; 1138 get
1139 {
1140 return MoveToTargetActive;
1141 }
1142
1143 set
1144 {
1145 MoveToTargetActive = value;
1146
1092 EnableActor(MoveToTargetActive, MoveToTargetActorName, delegate() 1147 EnableActor(MoveToTargetActive, MoveToTargetActorName, delegate()
1093 { 1148 {
1094 return new BSActorMoveToTarget(PhysScene, this, MoveToTargetActorName); 1149 return new BSActorMoveToTarget(PhysScene, this, MoveToTargetActorName);
1095 }); 1150 });
1151
1152 // Call update so actor Refresh() is called to start things off
1153 PhysScene.TaintedObject(LocalID, "BSPrim.PIDActive", delegate()
1154 {
1155 UpdatePhysicalParameters();
1156 });
1096 } 1157 }
1097 } 1158 }
1098 1159
@@ -1119,6 +1180,12 @@ public class BSPrim : BSPhysObject
1119 { 1180 {
1120 return new BSActorHover(PhysScene, this, HoverActorName); 1181 return new BSActorHover(PhysScene, this, HoverActorName);
1121 }); 1182 });
1183
1184 // Call update so actor Refresh() is called to start things off
1185 PhysScene.TaintedObject(LocalID, "BSPrim.PIDHoverActive", delegate()
1186 {
1187 UpdatePhysicalParameters();
1188 });
1122 } 1189 }
1123 } 1190 }
1124 1191
@@ -1556,12 +1623,232 @@ public class BSPrim : BSPhysObject
1556 object ret = null; 1623 object ret = null;
1557 switch (pFunct) 1624 switch (pFunct)
1558 { 1625 {
1626 case ExtendedPhysics.PhysFunctAxisLockLimits:
1627 ret = SetAxisLockLimitsExtension(pParams);
1628 break;
1559 default: 1629 default:
1560 ret = base.Extension(pFunct, pParams); 1630 ret = base.Extension(pFunct, pParams);
1561 break; 1631 break;
1562 } 1632 }
1563 return ret; 1633 return ret;
1564 } 1634 }
1635
1636 private void InitializeAxisActor()
1637 {
1638 EnableActor(LockedAngularAxis != LockedAxisFree || LockedLinearAxis != LockedAxisFree,
1639 LockedAxisActorName, delegate()
1640 {
1641 return new BSActorLockAxis(PhysScene, this, LockedAxisActorName);
1642 });
1643
1644 // Update parameters so the new actor's Refresh() action is called at the right time.
1645 PhysScene.TaintedObject(LocalID, "BSPrim.LockAxis", delegate()
1646 {
1647 UpdatePhysicalParameters();
1648 });
1649 }
1650
1651 // Passed an array of an array of parameters, set the axis locking.
1652 // This expects an int (PHYS_AXIS_*) followed by none or two limit floats
1653 // followed by another int and floats, etc.
1654 private object SetAxisLockLimitsExtension(object[] pParams)
1655 {
1656 DetailLog("{0} SetAxisLockLimitsExtension. parmlen={1}", LocalID, pParams.GetLength(0));
1657 object ret = null;
1658 try
1659 {
1660 if (pParams.GetLength(0) > 1)
1661 {
1662 int index = 2;
1663 while (index < pParams.GetLength(0))
1664 {
1665 var funct = pParams[index];
1666 DetailLog("{0} SetAxisLockLimitsExtension. op={1}, index={2}", LocalID, funct, index);
1667 if (funct is Int32 || funct is Int64)
1668 {
1669 switch ((int)funct)
1670 {
1671 // Those that take no parameters
1672 case ExtendedPhysics.PHYS_AXIS_LOCK_LINEAR:
1673 case ExtendedPhysics.PHYS_AXIS_LOCK_LINEAR_X:
1674 case ExtendedPhysics.PHYS_AXIS_LOCK_LINEAR_Y:
1675 case ExtendedPhysics.PHYS_AXIS_LOCK_LINEAR_Z:
1676 case ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR:
1677 case ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR_X:
1678 case ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR_Y:
1679 case ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR_Z:
1680 case ExtendedPhysics.PHYS_AXIS_UNLOCK_LINEAR:
1681 case ExtendedPhysics.PHYS_AXIS_UNLOCK_LINEAR_X:
1682 case ExtendedPhysics.PHYS_AXIS_UNLOCK_LINEAR_Y:
1683 case ExtendedPhysics.PHYS_AXIS_UNLOCK_LINEAR_Z:
1684 case ExtendedPhysics.PHYS_AXIS_UNLOCK_ANGULAR:
1685 case ExtendedPhysics.PHYS_AXIS_UNLOCK_ANGULAR_X:
1686 case ExtendedPhysics.PHYS_AXIS_UNLOCK_ANGULAR_Y:
1687 case ExtendedPhysics.PHYS_AXIS_UNLOCK_ANGULAR_Z:
1688 case ExtendedPhysics.PHYS_AXIS_UNLOCK:
1689 ApplyAxisLimits((int)funct, 0f, 0f);
1690 index += 1;
1691 break;
1692 // Those that take two parameters (the limits)
1693 case ExtendedPhysics.PHYS_AXIS_LIMIT_LINEAR_X:
1694 case ExtendedPhysics.PHYS_AXIS_LIMIT_LINEAR_Y:
1695 case ExtendedPhysics.PHYS_AXIS_LIMIT_LINEAR_Z:
1696 case ExtendedPhysics.PHYS_AXIS_LIMIT_ANGULAR_X:
1697 case ExtendedPhysics.PHYS_AXIS_LIMIT_ANGULAR_Y:
1698 case ExtendedPhysics.PHYS_AXIS_LIMIT_ANGULAR_Z:
1699 ApplyAxisLimits((int)funct, (float)pParams[index + 1], (float)pParams[index + 2]);
1700 index += 3;
1701 break;
1702 default:
1703 m_log.WarnFormat("{0} SetSxisLockLimitsExtension. Unknown op={1}", LogHeader, funct);
1704 index += 1;
1705 break;
1706 }
1707 }
1708 }
1709 InitializeAxisActor();
1710 ret = (object)index;
1711 }
1712 }
1713 catch (Exception e)
1714 {
1715 m_log.WarnFormat("{0} SetSxisLockLimitsExtension exception in object {1}: {2}", LogHeader, this.Name, e);
1716 ret = null;
1717 }
1718 return ret; // not implemented yet
1719 }
1720
1721 // Set the locking parameters.
1722 // If an axis is locked, the limits for the axis are set to zero,
1723 // If the axis is being constrained, the high and low value are passed and set.
1724 // When done here, LockedXXXAxis flags are set and LockedXXXAxixLow/High are set to the range.
1725 protected void ApplyAxisLimits(int funct, float low, float high)
1726 {
1727 DetailLog("{0} ApplyAxisLimits. op={1}, low={2}, high={3}", LocalID, funct, low, high);
1728 float linearMax = 23000f;
1729 float angularMax = (float)Math.PI;
1730
1731 switch (funct)
1732 {
1733 case ExtendedPhysics.PHYS_AXIS_LOCK_LINEAR:
1734 this.LockedLinearAxis = new OMV.Vector3(LockedAxis, LockedAxis, LockedAxis);
1735 this.LockedLinearAxisLow = OMV.Vector3.Zero;
1736 this.LockedLinearAxisHigh = OMV.Vector3.Zero;
1737 break;
1738 case ExtendedPhysics.PHYS_AXIS_LOCK_LINEAR_X:
1739 this.LockedLinearAxis.X = LockedAxis;
1740 this.LockedLinearAxisLow.X = 0f;
1741 this.LockedLinearAxisHigh.X = 0f;
1742 break;
1743 case ExtendedPhysics.PHYS_AXIS_LIMIT_LINEAR_X:
1744 this.LockedLinearAxis.X = LockedAxis;
1745 this.LockedLinearAxisLow.X = Util.Clip(low, -linearMax, linearMax);
1746 this.LockedLinearAxisHigh.X = Util.Clip(high, -linearMax, linearMax);
1747 break;
1748 case ExtendedPhysics.PHYS_AXIS_LOCK_LINEAR_Y:
1749 this.LockedLinearAxis.Y = LockedAxis;
1750 this.LockedLinearAxisLow.Y = 0f;
1751 this.LockedLinearAxisHigh.Y = 0f;
1752 break;
1753 case ExtendedPhysics.PHYS_AXIS_LIMIT_LINEAR_Y:
1754 this.LockedLinearAxis.Y = LockedAxis;
1755 this.LockedLinearAxisLow.Y = Util.Clip(low, -linearMax, linearMax);
1756 this.LockedLinearAxisHigh.Y = Util.Clip(high, -linearMax, linearMax);
1757 break;
1758 case ExtendedPhysics.PHYS_AXIS_LOCK_LINEAR_Z:
1759 this.LockedLinearAxis.Z = LockedAxis;
1760 this.LockedLinearAxisLow.Z = 0f;
1761 this.LockedLinearAxisHigh.Z = 0f;
1762 break;
1763 case ExtendedPhysics.PHYS_AXIS_LIMIT_LINEAR_Z:
1764 this.LockedLinearAxis.Z = LockedAxis;
1765 this.LockedLinearAxisLow.Z = Util.Clip(low, -linearMax, linearMax);
1766 this.LockedLinearAxisHigh.Z = Util.Clip(high, -linearMax, linearMax);
1767 break;
1768 case ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR:
1769 this.LockedAngularAxis = new OMV.Vector3(LockedAxis, LockedAxis, LockedAxis);
1770 this.LockedAngularAxisLow = OMV.Vector3.Zero;
1771 this.LockedAngularAxisHigh = OMV.Vector3.Zero;
1772 break;
1773 case ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR_X:
1774 this.LockedAngularAxis.X = LockedAxis;
1775 this.LockedAngularAxisLow.X = 0;
1776 this.LockedAngularAxisHigh.X = 0;
1777 break;
1778 case ExtendedPhysics.PHYS_AXIS_LIMIT_ANGULAR_X:
1779 this.LockedAngularAxis.X = LockedAxis;
1780 this.LockedAngularAxisLow.X = Util.Clip(low, -angularMax, angularMax);
1781 this.LockedAngularAxisHigh.X = Util.Clip(high, -angularMax, angularMax);
1782 break;
1783 case ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR_Y:
1784 this.LockedAngularAxis.Y = LockedAxis;
1785 this.LockedAngularAxisLow.Y = 0;
1786 this.LockedAngularAxisHigh.Y = 0;
1787 break;
1788 case ExtendedPhysics.PHYS_AXIS_LIMIT_ANGULAR_Y:
1789 this.LockedAngularAxis.Y = LockedAxis;
1790 this.LockedAngularAxisLow.Y = Util.Clip(low, -angularMax, angularMax);
1791 this.LockedAngularAxisHigh.Y = Util.Clip(high, -angularMax, angularMax);
1792 break;
1793 case ExtendedPhysics.PHYS_AXIS_LOCK_ANGULAR_Z:
1794 this.LockedAngularAxis.Z = LockedAxis;
1795 this.LockedAngularAxisLow.Z = 0;
1796 this.LockedAngularAxisHigh.Z = 0;
1797 break;
1798 case ExtendedPhysics.PHYS_AXIS_LIMIT_ANGULAR_Z:
1799 this.LockedAngularAxis.Z = LockedAxis;
1800 this.LockedAngularAxisLow.Z = Util.Clip(low, -angularMax, angularMax);
1801 this.LockedAngularAxisHigh.Z = Util.Clip(high, -angularMax, angularMax);
1802 break;
1803 case ExtendedPhysics.PHYS_AXIS_UNLOCK_LINEAR:
1804 this.LockedLinearAxis = LockedAxisFree;
1805 this.LockedLinearAxisLow = new OMV.Vector3(-linearMax, -linearMax, -linearMax);
1806 this.LockedLinearAxisHigh = new OMV.Vector3(linearMax, linearMax, linearMax);
1807 break;
1808 case ExtendedPhysics.PHYS_AXIS_UNLOCK_LINEAR_X:
1809 this.LockedLinearAxis.X = FreeAxis;
1810 this.LockedLinearAxisLow.X = -linearMax;
1811 this.LockedLinearAxisHigh.X = linearMax;
1812 break;
1813 case ExtendedPhysics.PHYS_AXIS_UNLOCK_LINEAR_Y:
1814 this.LockedLinearAxis.Y = FreeAxis;
1815 this.LockedLinearAxisLow.Y = -linearMax;
1816 this.LockedLinearAxisHigh.Y = linearMax;
1817 break;
1818 case ExtendedPhysics.PHYS_AXIS_UNLOCK_LINEAR_Z:
1819 this.LockedLinearAxis.Z = FreeAxis;
1820 this.LockedLinearAxisLow.Z = -linearMax;
1821 this.LockedLinearAxisHigh.Z = linearMax;
1822 break;
1823 case ExtendedPhysics.PHYS_AXIS_UNLOCK_ANGULAR:
1824 this.LockedAngularAxis = LockedAxisFree;
1825 this.LockedAngularAxisLow = new OMV.Vector3(-angularMax, -angularMax, -angularMax);
1826 this.LockedAngularAxisHigh = new OMV.Vector3(angularMax, angularMax, angularMax);
1827 break;
1828 case ExtendedPhysics.PHYS_AXIS_UNLOCK_ANGULAR_X:
1829 this.LockedAngularAxis.X = FreeAxis;
1830 this.LockedAngularAxisLow.X = -angularMax;
1831 this.LockedAngularAxisHigh.X = angularMax;
1832 break;
1833 case ExtendedPhysics.PHYS_AXIS_UNLOCK_ANGULAR_Y:
1834 this.LockedAngularAxis.Y = FreeAxis;
1835 this.LockedAngularAxisLow.Y = -angularMax;
1836 this.LockedAngularAxisHigh.Y = angularMax;
1837 break;
1838 case ExtendedPhysics.PHYS_AXIS_UNLOCK_ANGULAR_Z:
1839 this.LockedAngularAxis.Z = FreeAxis;
1840 this.LockedAngularAxisLow.Z = -angularMax;
1841 this.LockedAngularAxisHigh.Z = angularMax;
1842 break;
1843 case ExtendedPhysics.PHYS_AXIS_UNLOCK:
1844 ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_UNLOCK_LINEAR, 0f, 0f);
1845 ApplyAxisLimits(ExtendedPhysics.PHYS_AXIS_UNLOCK_ANGULAR, 0f, 0f);
1846 break;
1847 default:
1848 break;
1849 }
1850 return;
1851 }
1565 #endregion // Extension 1852 #endregion // Extension
1566 1853
1567 // The physics engine says that properties have updated. Update same and inform 1854 // The physics engine says that properties have updated. Update same and inform
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs
index 126b146..430d645 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs
@@ -42,7 +42,9 @@ public class BSPrimLinkable : BSPrimDisplaced
42 // operations necessary for keeping the linkset created and, additionally, this 42 // operations necessary for keeping the linkset created and, additionally, this
43 // calls the linkset implementation for its creation and management. 43 // calls the linkset implementation for its creation and management.
44 44
45#pragma warning disable 414
45 private static readonly string LogHeader = "[BULLETS PRIMLINKABLE]"; 46 private static readonly string LogHeader = "[BULLETS PRIMLINKABLE]";
47#pragma warning restore 414
46 48
47 // This adds the overrides for link() and delink() so the prim is linkable. 49 // This adds the overrides for link() and delink() so the prim is linkable.
48 50
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index b3dfa41..8a19944 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -32,6 +32,7 @@ using System.Runtime.InteropServices;
32using System.Text; 32using System.Text;
33using System.Threading; 33using System.Threading;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Monitoring;
35using OpenSim.Region.Framework; 36using OpenSim.Region.Framework;
36using OpenSim.Region.CoreModules; 37using OpenSim.Region.CoreModules;
37using Logging = OpenSim.Region.CoreModules.Framework.Statistics.Logging; 38using Logging = OpenSim.Region.CoreModules.Framework.Statistics.Logging;
@@ -75,7 +76,8 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
75 76
76 // Keep track of all the avatars so we can send them a collision event 77 // Keep track of all the avatars so we can send them a collision event
77 // every tick so OpenSim will update its animation. 78 // every tick so OpenSim will update its animation.
78 private HashSet<BSPhysObject> m_avatars = new HashSet<BSPhysObject>(); 79 private HashSet<BSPhysObject> AvatarsInScene = new HashSet<BSPhysObject>();
80 private Object AvatarsInSceneLock = new Object();
79 81
80 // let my minuions use my logger 82 // let my minuions use my logger
81 public ILog Logger { get { return m_log; } } 83 public ILog Logger { get { return m_log; } }
@@ -88,7 +90,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
88 public BSConstraintCollection Constraints { get; private set; } 90 public BSConstraintCollection Constraints { get; private set; }
89 91
90 // Simulation parameters 92 // Simulation parameters
91 internal float m_physicsStepTime; // if running independently, the interval simulated by default 93 //internal float m_physicsStepTime; // if running independently, the interval simulated by default
92 94
93 internal int m_maxSubSteps; 95 internal int m_maxSubSteps;
94 internal float m_fixedTimeStep; 96 internal float m_fixedTimeStep;
@@ -129,6 +131,11 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
129 internal int m_maxUpdatesPerFrame; 131 internal int m_maxUpdatesPerFrame;
130 internal EntityProperties[] m_updateArray; 132 internal EntityProperties[] m_updateArray;
131 133
134 /// <summary>
135 /// Used to control physics simulation timing if Bullet is running on its own thread.
136 /// </summary>
137 private ManualResetEvent m_updateWaitEvent;
138
132 public const uint TERRAIN_ID = 0; // OpenSim senses terrain with a localID of zero 139 public const uint TERRAIN_ID = 0; // OpenSim senses terrain with a localID of zero
133 public const uint GROUNDPLANE_ID = 1; 140 public const uint GROUNDPLANE_ID = 1;
134 public const uint CHILDTERRAIN_ID = 2; // Terrain allocated based on our mega-prim childre start here 141 public const uint CHILDTERRAIN_ID = 2; // Terrain allocated based on our mega-prim childre start here
@@ -208,8 +215,17 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
208 Name = EngineType + "/" + RegionName; 215 Name = EngineType + "/" + RegionName;
209 } 216 }
210 217
218 // Old version of initialization that assumes legacy sized regions (256x256)
211 public override void Initialise(IMesher meshmerizer, IConfigSource config) 219 public override void Initialise(IMesher meshmerizer, IConfigSource config)
212 { 220 {
221 m_log.ErrorFormat("{0} WARNING WARNING WARNING! BulletSim initialized without region extent specification. Terrain will be messed up.");
222 Vector3 regionExtent = new Vector3( Constants.RegionSize, Constants.RegionSize, Constants.RegionSize);
223 Initialise(meshmerizer, config, regionExtent);
224
225 }
226
227 public override void Initialise(IMesher meshmerizer, IConfigSource config, Vector3 regionExtent)
228 {
213 mesher = meshmerizer; 229 mesher = meshmerizer;
214 _taintOperations = new List<TaintCallbackEntry>(); 230 _taintOperations = new List<TaintCallbackEntry>();
215 _postTaintOperations = new Dictionary<string, TaintCallbackEntry>(); 231 _postTaintOperations = new Dictionary<string, TaintCallbackEntry>();
@@ -226,6 +242,14 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
226 // Set default values for physics parameters plus any overrides from the ini file 242 // Set default values for physics parameters plus any overrides from the ini file
227 GetInitialParameterValues(config); 243 GetInitialParameterValues(config);
228 244
245 // Force some parameters to values depending on other configurations
246 // Only use heightmap terrain implementation if terrain larger than legacy size
247 if ((uint)regionExtent.X > Constants.RegionSize || (uint)regionExtent.Y > Constants.RegionSize)
248 {
249 m_log.WarnFormat("{0} Forcing terrain implementation to heightmap for large region", LogHeader);
250 BSParam.TerrainImplementation = (float)BSTerrainPhys.TerrainImplementation.Heightmap;
251 }
252
229 // Get the connection to the physics engine (could be native or one of many DLLs) 253 // Get the connection to the physics engine (could be native or one of many DLLs)
230 PE = SelectUnderlyingBulletEngine(BulletEngineName); 254 PE = SelectUnderlyingBulletEngine(BulletEngineName);
231 255
@@ -250,13 +274,13 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
250 // a child in a mega-region. 274 // a child in a mega-region.
251 // Bullet actually doesn't care about the extents of the simulated 275 // Bullet actually doesn't care about the extents of the simulated
252 // area. It tracks active objects no matter where they are. 276 // area. It tracks active objects no matter where they are.
253 Vector3 worldExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight); 277 Vector3 worldExtent = regionExtent;
254 278
255 World = PE.Initialize(worldExtent, Params, m_maxCollisionsPerFrame, ref m_collisionArray, m_maxUpdatesPerFrame, ref m_updateArray); 279 World = PE.Initialize(worldExtent, Params, m_maxCollisionsPerFrame, ref m_collisionArray, m_maxUpdatesPerFrame, ref m_updateArray);
256 280
257 Constraints = new BSConstraintCollection(World); 281 Constraints = new BSConstraintCollection(World);
258 282
259 TerrainManager = new BSTerrainManager(this); 283 TerrainManager = new BSTerrainManager(this, worldExtent);
260 TerrainManager.CreateInitialGroundPlaneAndTerrain(); 284 TerrainManager.CreateInitialGroundPlaneAndTerrain();
261 285
262 // Put some informational messages into the log file. 286 // Put some informational messages into the log file.
@@ -269,9 +293,13 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
269 if (BSParam.UseSeparatePhysicsThread) 293 if (BSParam.UseSeparatePhysicsThread)
270 { 294 {
271 // The physics simulation should happen independently of the heartbeat loop 295 // The physics simulation should happen independently of the heartbeat loop
272 m_physicsThread = new Thread(BulletSPluginPhysicsThread); 296 m_physicsThread
273 m_physicsThread.Name = BulletEngineName; 297 = WorkManager.StartThread(
274 m_physicsThread.Start(); 298 BulletSPluginPhysicsThread,
299 string.Format("{0} ({1})", BulletEngineName, RegionName),
300 ThreadPriority.Normal,
301 true,
302 true);
275 } 303 }
276 } 304 }
277 305
@@ -381,7 +409,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
381 409
382 if (ret == null) 410 if (ret == null)
383 { 411 {
384 m_log.ErrorFormat("{0) COULD NOT SELECT BULLET ENGINE: '[BulletSim]PhysicsEngine' must be either 'BulletUnmanaged-*' or 'BulletXNA-*'", LogHeader); 412 m_log.ErrorFormat("{0} COULD NOT SELECT BULLET ENGINE: '[BulletSim]PhysicsEngine' must be either 'BulletUnmanaged-*' or 'BulletXNA-*'", LogHeader);
385 } 413 }
386 else 414 else
387 { 415 {
@@ -398,11 +426,14 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
398 // make sure no stepping happens while we're deleting stuff 426 // make sure no stepping happens while we're deleting stuff
399 m_initialized = false; 427 m_initialized = false;
400 428
401 foreach (KeyValuePair<uint, BSPhysObject> kvp in PhysObjects) 429 lock (PhysObjects)
402 { 430 {
403 kvp.Value.Destroy(); 431 foreach (KeyValuePair<uint, BSPhysObject> kvp in PhysObjects)
432 {
433 kvp.Value.Destroy();
434 }
435 PhysObjects.Clear();
404 } 436 }
405 PhysObjects.Clear();
406 437
407 // Now that the prims are all cleaned up, there should be no constraints left 438 // Now that the prims are all cleaned up, there should be no constraints left
408 if (Constraints != null) 439 if (Constraints != null)
@@ -434,27 +465,27 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
434 465
435 #region Prim and Avatar addition and removal 466 #region Prim and Avatar addition and removal
436 467
437 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) 468 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying)
438 { 469 {
439 m_log.ErrorFormat("{0}: CALL TO AddAvatar in BSScene. NOT IMPLEMENTED", LogHeader); 470 m_log.ErrorFormat("{0}: CALL TO AddAvatar in BSScene. NOT IMPLEMENTED", LogHeader);
440 return null; 471 return null;
441 } 472 }
442 473
443 public override PhysicsActor AddAvatar(uint localID, string avName, Vector3 position, Vector3 size, bool isFlying) 474 public override PhysicsActor AddAvatar(uint localID, string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying)
444 { 475 {
445 // m_log.DebugFormat("{0}: AddAvatar: {1}", LogHeader, avName); 476 // m_log.DebugFormat("{0}: AddAvatar: {1}", LogHeader, avName);
446 477
447 if (!m_initialized) return null; 478 if (!m_initialized) return null;
448 479
449 BSCharacter actor = new BSCharacter(localID, avName, this, position, size, isFlying); 480 BSCharacter actor = new BSCharacter(localID, avName, this, position, velocity, size, isFlying);
450 lock (PhysObjects) 481 lock (PhysObjects)
451 PhysObjects.Add(localID, actor); 482 PhysObjects.Add(localID, actor);
452 483
453 // TODO: Remove kludge someday. 484 // TODO: Remove kludge someday.
454 // We must generate a collision for avatars whether they collide or not. 485 // We must generate a collision for avatars whether they collide or not.
455 // This is required by OpenSim to update avatar animations, etc. 486 // This is required by OpenSim to update avatar animations, etc.
456 lock (m_avatars) 487 lock (AvatarsInSceneLock)
457 m_avatars.Add(actor); 488 AvatarsInScene.Add(actor);
458 489
459 return actor; 490 return actor;
460 } 491 }
@@ -473,8 +504,8 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
473 lock (PhysObjects) 504 lock (PhysObjects)
474 PhysObjects.Remove(bsactor.LocalID); 505 PhysObjects.Remove(bsactor.LocalID);
475 // Remove kludge someday 506 // Remove kludge someday
476 lock (m_avatars) 507 lock (AvatarsInSceneLock)
477 m_avatars.Remove(bsactor); 508 AvatarsInScene.Remove(bsactor);
478 } 509 }
479 catch (Exception e) 510 catch (Exception e)
480 { 511 {
@@ -622,15 +653,18 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
622 { 653 {
623 if (collidersCount > 0) 654 if (collidersCount > 0)
624 { 655 {
625 for (int ii = 0; ii < collidersCount; ii++) 656 lock (PhysObjects)
626 { 657 {
627 uint cA = m_collisionArray[ii].aID; 658 for (int ii = 0; ii < collidersCount; ii++)
628 uint cB = m_collisionArray[ii].bID; 659 {
629 Vector3 point = m_collisionArray[ii].point; 660 uint cA = m_collisionArray[ii].aID;
630 Vector3 normal = m_collisionArray[ii].normal; 661 uint cB = m_collisionArray[ii].bID;
631 float penetration = m_collisionArray[ii].penetration; 662 Vector3 point = m_collisionArray[ii].point;
632 SendCollision(cA, cB, point, normal, penetration); 663 Vector3 normal = m_collisionArray[ii].normal;
633 SendCollision(cB, cA, point, -normal, penetration); 664 float penetration = m_collisionArray[ii].penetration;
665 SendCollision(cA, cB, point, normal, penetration);
666 SendCollision(cB, cA, point, -normal, penetration);
667 }
634 } 668 }
635 } 669 }
636 } 670 }
@@ -641,14 +675,17 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
641 { 675 {
642 if (updatedEntityCount > 0) 676 if (updatedEntityCount > 0)
643 { 677 {
644 for (int ii = 0; ii < updatedEntityCount; ii++) 678 lock (PhysObjects)
645 { 679 {
646 EntityProperties entprop = m_updateArray[ii]; 680 for (int ii = 0; ii < updatedEntityCount; ii++)
647 BSPhysObject pobj;
648 if (PhysObjects.TryGetValue(entprop.ID, out pobj))
649 { 681 {
650 if (pobj.IsInitialized) 682 EntityProperties entprop = m_updateArray[ii];
651 pobj.UpdateProperties(entprop); 683 BSPhysObject pobj;
684 if (PhysObjects.TryGetValue(entprop.ID, out pobj))
685 {
686 if (pobj.IsInitialized)
687 pobj.UpdateProperties(entprop);
688 }
652 } 689 }
653 } 690 }
654 } 691 }
@@ -682,7 +719,10 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
682 // this is is under UpdateLock. 719 // this is is under UpdateLock.
683 public void PostUpdate(BSPhysObject updatee) 720 public void PostUpdate(BSPhysObject updatee)
684 { 721 {
685 ObjectsWithUpdates.Add(updatee); 722 lock (UpdateLock)
723 {
724 ObjectsWithUpdates.Add(updatee);
725 }
686 } 726 }
687 727
688 // The simulator thinks it is physics time so return all the collisions and position 728 // The simulator thinks it is physics time so return all the collisions and position
@@ -710,9 +750,18 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
710 // The simulator expects collisions for avatars even if there are have been no collisions. 750 // The simulator expects collisions for avatars even if there are have been no collisions.
711 // The event updates avatar animations and stuff. 751 // The event updates avatar animations and stuff.
712 // If you fix avatar animation updates, remove this overhead and let normal collision processing happen. 752 // If you fix avatar animation updates, remove this overhead and let normal collision processing happen.
713 foreach (BSPhysObject bsp in m_avatars) 753 // Note that we get a copy of the list to search because SendCollision() can take a while.
714 if (!ObjectsWithCollisions.Contains(bsp)) // don't call avatars twice 754 HashSet<BSPhysObject> tempAvatarsInScene;
715 bsp.SendCollisions(); 755 lock (AvatarsInSceneLock)
756 {
757 tempAvatarsInScene = new HashSet<BSPhysObject>(AvatarsInScene);
758 }
759 foreach (BSPhysObject actor in tempAvatarsInScene)
760 {
761 if (!ObjectsWithCollisions.Contains(actor)) // don't call avatars twice
762 actor.SendCollisions();
763 }
764 tempAvatarsInScene = null;
716 765
717 // Objects that are done colliding are removed from the ObjectsWithCollisions list. 766 // Objects that are done colliding are removed from the ObjectsWithCollisions list.
718 // Not done above because it is inside an iteration of ObjectWithCollisions. 767 // Not done above because it is inside an iteration of ObjectWithCollisions.
@@ -762,6 +811,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
762 } 811 }
763 812
764 BSPhysObject collider; 813 BSPhysObject collider;
814 // NOTE that PhysObjects was locked before the call to SendCollision().
765 if (!PhysObjects.TryGetValue(localID, out collider)) 815 if (!PhysObjects.TryGetValue(localID, out collider))
766 { 816 {
767 // If the object that is colliding cannot be found, just ignore the collision. 817 // If the object that is colliding cannot be found, just ignore the collision.
@@ -780,7 +830,10 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
780 if (collider.Collide(collidingWith, collidee, collidePoint, collideNormal, penetration)) 830 if (collider.Collide(collidingWith, collidee, collidePoint, collideNormal, penetration))
781 { 831 {
782 // If a collision was 'good', remember to send it to the simulator 832 // If a collision was 'good', remember to send it to the simulator
783 ObjectsWithCollisions.Add(collider); 833 lock (CollisionLock)
834 {
835 ObjectsWithCollisions.Add(collider);
836 }
784 } 837 }
785 } 838 }
786 839
@@ -789,18 +842,25 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
789 842
790 public void BulletSPluginPhysicsThread() 843 public void BulletSPluginPhysicsThread()
791 { 844 {
845 Thread.CurrentThread.Priority = ThreadPriority.Highest;
846 m_updateWaitEvent = new ManualResetEvent(false);
847
792 while (m_initialized) 848 while (m_initialized)
793 { 849 {
794 int beginSimulationRealtimeMS = Util.EnvironmentTickCount(); 850 int beginSimulationRealtimeMS = Util.EnvironmentTickCount();
795 DoPhysicsStep(BSParam.PhysicsTimeStep); 851
852 if (BSParam.Active)
853 DoPhysicsStep(BSParam.PhysicsTimeStep);
854
796 int simulationRealtimeMS = Util.EnvironmentTickCountSubtract(beginSimulationRealtimeMS); 855 int simulationRealtimeMS = Util.EnvironmentTickCountSubtract(beginSimulationRealtimeMS);
797 int simulationTimeVsRealtimeDifferenceMS = ((int)(BSParam.PhysicsTimeStep*1000f)) - simulationRealtimeMS; 856 int simulationTimeVsRealtimeDifferenceMS = ((int)(BSParam.PhysicsTimeStep*1000f)) - simulationRealtimeMS;
798 857
799 if (simulationTimeVsRealtimeDifferenceMS > 0) 858 if (simulationTimeVsRealtimeDifferenceMS > 0)
800 { 859 {
801 // The simulation of the time interval took less than realtime. 860 // The simulation of the time interval took less than realtime.
802 // Do a sleep for the rest of realtime. 861 // Do a wait for the rest of realtime.
803 Thread.Sleep(simulationTimeVsRealtimeDifferenceMS); 862 m_updateWaitEvent.WaitOne(simulationTimeVsRealtimeDifferenceMS);
863 //Thread.Sleep(simulationTimeVsRealtimeDifferenceMS);
804 } 864 }
805 else 865 else
806 { 866 {
@@ -809,7 +869,11 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
809 // TODO. 869 // TODO.
810 DetailLog("{0},BulletSPluginPhysicsThread,longerThanRealtime={1}", BSScene.DetailLogZero, simulationTimeVsRealtimeDifferenceMS); 870 DetailLog("{0},BulletSPluginPhysicsThread,longerThanRealtime={1}", BSScene.DetailLogZero, simulationTimeVsRealtimeDifferenceMS);
811 } 871 }
872
873 Watchdog.UpdateThread();
812 } 874 }
875
876 Watchdog.RemoveThread();
813 } 877 }
814 878
815 #endregion // Simulation 879 #endregion // Simulation
@@ -882,6 +946,75 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
882 } 946 }
883 #endregion // Extensions 947 #endregion // Extensions
884 948
949 public static string PrimitiveBaseShapeToString(PrimitiveBaseShape pbs)
950 {
951 float pathShearX = pbs.PathShearX < 128 ? (float)pbs.PathShearX * 0.01f : (float)(pbs.PathShearX - 256) * 0.01f;
952 float pathShearY = pbs.PathShearY < 128 ? (float)pbs.PathShearY * 0.01f : (float)(pbs.PathShearY - 256) * 0.01f;
953 float pathBegin = (float)pbs.PathBegin * 2.0e-5f;
954 float pathEnd = 1.0f - (float)pbs.PathEnd * 2.0e-5f;
955 float pathScaleX = (float)(200 - pbs.PathScaleX) * 0.01f;
956 float pathScaleY = (float)(200 - pbs.PathScaleY) * 0.01f;
957 float pathTaperX = pbs.PathTaperX * 0.01f;
958 float pathTaperY = pbs.PathTaperY * 0.01f;
959
960 float profileBegin = (float)pbs.ProfileBegin * 2.0e-5f;
961 float profileEnd = 1.0f - (float)pbs.ProfileEnd * 2.0e-5f;
962 float profileHollow = (float)pbs.ProfileHollow * 2.0e-5f;
963 if (profileHollow > 0.95f)
964 profileHollow = 0.95f;
965
966 StringBuilder buff = new StringBuilder();
967 buff.Append("shape=");
968 buff.Append(((ProfileShape)pbs.ProfileShape).ToString());
969 buff.Append(",");
970 buff.Append("hollow=");
971 buff.Append(((HollowShape)pbs.HollowShape).ToString());
972 buff.Append(",");
973 buff.Append("pathCurve=");
974 buff.Append(((Extrusion)pbs.PathCurve).ToString());
975 buff.Append(",");
976 buff.Append("profCurve=");
977 buff.Append(((Extrusion)pbs.ProfileCurve).ToString());
978 buff.Append(",");
979 buff.Append("profHollow=");
980 buff.Append(profileHollow.ToString());
981 buff.Append(",");
982 buff.Append("pathBegEnd=");
983 buff.Append(pathBegin.ToString());
984 buff.Append("/");
985 buff.Append(pathEnd.ToString());
986 buff.Append(",");
987 buff.Append("profileBegEnd=");
988 buff.Append(profileBegin.ToString());
989 buff.Append("/");
990 buff.Append(profileEnd.ToString());
991 buff.Append(",");
992 buff.Append("scaleXY=");
993 buff.Append(pathScaleX.ToString());
994 buff.Append("/");
995 buff.Append(pathScaleY.ToString());
996 buff.Append(",");
997 buff.Append("shearXY=");
998 buff.Append(pathShearX.ToString());
999 buff.Append("/");
1000 buff.Append(pathShearY.ToString());
1001 buff.Append(",");
1002 buff.Append("taperXY=");
1003 buff.Append(pbs.PathTaperX.ToString());
1004 buff.Append("/");
1005 buff.Append(pbs.PathTaperY.ToString());
1006 buff.Append(",");
1007 buff.Append("skew=");
1008 buff.Append(pbs.PathSkew.ToString());
1009 buff.Append(",");
1010 buff.Append("twist/Beg=");
1011 buff.Append(pbs.PathTwist.ToString());
1012 buff.Append("/");
1013 buff.Append(pbs.PathTwistBegin.ToString());
1014
1015 return buff.ToString();
1016 }
1017
885 #region Taints 1018 #region Taints
886 // The simulation execution order is: 1019 // The simulation execution order is:
887 // Simulate() 1020 // Simulate()
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
index 32bbc8f..d1de844 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
@@ -36,7 +36,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin
36{ 36{
37public sealed class BSShapeCollection : IDisposable 37public sealed class BSShapeCollection : IDisposable
38{ 38{
39#pragma warning disable 414
39 private static string LogHeader = "[BULLETSIM SHAPE COLLECTION]"; 40 private static string LogHeader = "[BULLETSIM SHAPE COLLECTION]";
41#pragma warning restore 414
40 42
41 private BSScene m_physicsScene { get; set; } 43 private BSScene m_physicsScene { get; set; }
42 44
@@ -124,6 +126,10 @@ public sealed class BSShapeCollection : IDisposable
124 // Info in prim.BSShape is updated to the new shape. 126 // Info in prim.BSShape is updated to the new shape.
125 // Returns 'true' if the geometry was rebuilt. 127 // Returns 'true' if the geometry was rebuilt.
126 // Called at taint-time! 128 // Called at taint-time!
129 public const int AvatarShapeCapsule = 0;
130 public const int AvatarShapeCube = 1;
131 public const int AvatarShapeOvoid = 2;
132 public const int AvatarShapeMesh = 3;
127 private bool CreateGeom(bool forceRebuild, BSPhysObject prim, PhysicalDestructionCallback shapeCallback) 133 private bool CreateGeom(bool forceRebuild, BSPhysObject prim, PhysicalDestructionCallback shapeCallback)
128 { 134 {
129 bool ret = false; 135 bool ret = false;
@@ -137,10 +143,32 @@ public sealed class BSShapeCollection : IDisposable
137 if (theChar != null) 143 if (theChar != null)
138 { 144 {
139 DereferenceExistingShape(prim, shapeCallback); 145 DereferenceExistingShape(prim, shapeCallback);
140 prim.PhysShape = BSShapeNative.GetReference(m_physicsScene, prim, 146 switch (BSParam.AvatarShape)
147 {
148 case AvatarShapeCapsule:
149 prim.PhysShape = BSShapeNative.GetReference(m_physicsScene, prim,
141 BSPhysicsShapeType.SHAPE_CAPSULE, FixedShapeKey.KEY_CAPSULE); 150 BSPhysicsShapeType.SHAPE_CAPSULE, FixedShapeKey.KEY_CAPSULE);
142 ret = true; 151 ret = true;
143 haveShape = true; 152 haveShape = true;
153 break;
154 case AvatarShapeCube:
155 prim.PhysShape = BSShapeNative.GetReference(m_physicsScene, prim,
156 BSPhysicsShapeType.SHAPE_BOX, FixedShapeKey.KEY_CAPSULE);
157 ret = true;
158 haveShape = true;
159 break;
160 case AvatarShapeOvoid:
161 // Saddly, Bullet doesn't scale spheres so this doesn't work as an avatar shape
162 prim.PhysShape = BSShapeNative.GetReference(m_physicsScene, prim,
163 BSPhysicsShapeType.SHAPE_SPHERE, FixedShapeKey.KEY_CAPSULE);
164 ret = true;
165 haveShape = true;
166 break;
167 case AvatarShapeMesh:
168 break;
169 default:
170 break;
171 }
144 } 172 }
145 173
146 // If the prim attributes are simple, this could be a simple Bullet native shape 174 // If the prim attributes are simple, this could be a simple Bullet native shape
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs
index fe5ff6c..03a9ddc 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs
@@ -38,6 +38,76 @@ using OMV = OpenMetaverse;
38 38
39namespace OpenSim.Region.Physics.BulletSPlugin 39namespace OpenSim.Region.Physics.BulletSPlugin
40{ 40{
41// Information class that holds stats for the shape. Which values mean
42// something depends on the type of shape.
43// This information is used for debugging and stats and is not used
44// for operational things.
45public class ShapeInfoInfo
46{
47 public int Vertices { get; set; }
48 private int m_hullCount;
49 private int[] m_verticesPerHull;
50 public ShapeInfoInfo()
51 {
52 Vertices = 0;
53 m_hullCount = 0;
54 m_verticesPerHull = null;
55 }
56 public int HullCount
57 {
58 set
59 {
60 m_hullCount = value;
61 m_verticesPerHull = new int[m_hullCount];
62 Array.Clear(m_verticesPerHull, 0, m_hullCount);
63 }
64 get { return m_hullCount; }
65 }
66 public void SetVerticesPerHull(int hullNum, int vertices)
67 {
68 if (m_verticesPerHull != null && hullNum < m_verticesPerHull.Length)
69 {
70 m_verticesPerHull[hullNum] = vertices;
71 }
72 }
73 public int GetVerticesPerHull(int hullNum)
74 {
75 if (m_verticesPerHull != null && hullNum < m_verticesPerHull.Length)
76 {
77 return m_verticesPerHull[hullNum];
78 }
79 return 0;
80 }
81 public override string ToString()
82 {
83 StringBuilder buff = new StringBuilder();
84 // buff.Append("ShapeInfo=<");
85 buff.Append("<");
86 if (Vertices > 0)
87 {
88 buff.Append("verts=");
89 buff.Append(Vertices.ToString());
90 }
91
92 if (Vertices > 0 && HullCount > 0) buff.Append(",");
93
94 if (HullCount > 0)
95 {
96 buff.Append("nHulls=");
97 buff.Append(HullCount.ToString());
98 buff.Append(",");
99 buff.Append("hullVerts=");
100 for (int ii = 0; ii < HullCount; ii++)
101 {
102 if (ii != 0) buff.Append(",");
103 buff.Append(GetVerticesPerHull(ii).ToString());
104 }
105 }
106 buff.Append(">");
107 return buff.ToString();
108 }
109}
110
41public abstract class BSShape 111public abstract class BSShape
42{ 112{
43 private static string LogHeader = "[BULLETSIM SHAPE]"; 113 private static string LogHeader = "[BULLETSIM SHAPE]";
@@ -45,18 +115,21 @@ public abstract class BSShape
45 public int referenceCount { get; set; } 115 public int referenceCount { get; set; }
46 public DateTime lastReferenced { get; set; } 116 public DateTime lastReferenced { get; set; }
47 public BulletShape physShapeInfo { get; set; } 117 public BulletShape physShapeInfo { get; set; }
118 public ShapeInfoInfo shapeInfo { get; private set; }
48 119
49 public BSShape() 120 public BSShape()
50 { 121 {
51 referenceCount = 1; 122 referenceCount = 1;
52 lastReferenced = DateTime.Now; 123 lastReferenced = DateTime.Now;
53 physShapeInfo = new BulletShape(); 124 physShapeInfo = new BulletShape();
125 shapeInfo = new ShapeInfoInfo();
54 } 126 }
55 public BSShape(BulletShape pShape) 127 public BSShape(BulletShape pShape)
56 { 128 {
57 referenceCount = 1; 129 referenceCount = 1;
58 lastReferenced = DateTime.Now; 130 lastReferenced = DateTime.Now;
59 physShapeInfo = pShape; 131 physShapeInfo = pShape;
132 shapeInfo = new ShapeInfoInfo();
60 } 133 }
61 134
62 // Get another reference to this shape. 135 // Get another reference to this shape.
@@ -177,8 +250,7 @@ public abstract class BSShape
177 { 250 {
178 // If this mesh has an underlying asset and we have not failed getting it before, fetch the asset 251 // If this mesh has an underlying asset and we have not failed getting it before, fetch the asset
179 if (prim.BaseShape.SculptEntry 252 if (prim.BaseShape.SculptEntry
180 && prim.PrimAssetState != BSPhysObject.PrimAssetCondition.FailedAssetFetch 253 && !prim.AssetFailed()
181 && prim.PrimAssetState != BSPhysObject.PrimAssetCondition.FailedMeshing
182 && prim.PrimAssetState != BSPhysObject.PrimAssetCondition.Waiting 254 && prim.PrimAssetState != BSPhysObject.PrimAssetCondition.Waiting
183 && prim.BaseShape.SculptTexture != OMV.UUID.Zero 255 && prim.BaseShape.SculptTexture != OMV.UUID.Zero
184 ) 256 )
@@ -189,50 +261,46 @@ public abstract class BSShape
189 prim.PrimAssetState = BSPhysObject.PrimAssetCondition.Waiting; 261 prim.PrimAssetState = BSPhysObject.PrimAssetCondition.Waiting;
190 262
191 BSPhysObject xprim = prim; 263 BSPhysObject xprim = prim;
192 Util.FireAndForget(delegate 264 RequestAssetDelegate assetProvider = physicsScene.RequestAssetMethod;
265 if (assetProvider != null)
266 {
267 BSPhysObject yprim = xprim; // probably not necessary, but, just in case.
268 assetProvider(yprim.BaseShape.SculptTexture, delegate(AssetBase asset)
193 { 269 {
194 // physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,inFireAndForget", xprim.LocalID); 270 // physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,assetProviderCallback", xprim.LocalID);
195 RequestAssetDelegate assetProvider = physicsScene.RequestAssetMethod; 271 bool assetFound = false;
196 if (assetProvider != null) 272 string mismatchIDs = String.Empty; // DEBUG DEBUG
273 if (asset != null && yprim.BaseShape.SculptEntry)
197 { 274 {
198 BSPhysObject yprim = xprim; // probably not necessary, but, just in case. 275 if (yprim.BaseShape.SculptTexture.ToString() == asset.ID)
199 assetProvider(yprim.BaseShape.SculptTexture, delegate(AssetBase asset)
200 { 276 {
201 // physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,assetProviderCallback", xprim.LocalID); 277 yprim.BaseShape.SculptData = asset.Data;
202 bool assetFound = false; 278 // This will cause the prim to see that the filler shape is not the right
203 string mismatchIDs = String.Empty; // DEBUG DEBUG 279 // one and try again to build the object.
204 if (asset != null && yprim.BaseShape.SculptEntry) 280 // No race condition with the normal shape setting since the rebuild is at taint time.
205 { 281 yprim.PrimAssetState = BSPhysObject.PrimAssetCondition.Fetched;
206 if (yprim.BaseShape.SculptTexture.ToString() == asset.ID) 282 yprim.ForceBodyShapeRebuild(false /* inTaintTime */);
207 { 283 assetFound = true;
208 yprim.BaseShape.SculptData = asset.Data; 284 }
209 // This will cause the prim to see that the filler shape is not the right 285 else
210 // one and try again to build the object. 286 {
211 // No race condition with the normal shape setting since the rebuild is at taint time. 287 mismatchIDs = yprim.BaseShape.SculptTexture.ToString() + "/" + asset.ID;
212 yprim.PrimAssetState = BSPhysObject.PrimAssetCondition.Fetched; 288 }
213 yprim.ForceBodyShapeRebuild(false /* inTaintTime */);
214 assetFound = true;
215 }
216 else
217 {
218 mismatchIDs = yprim.BaseShape.SculptTexture.ToString() + "/" + asset.ID;
219 }
220 }
221 if (!assetFound)
222 {
223 yprim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedAssetFetch;
224 }
225 physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,fetchAssetCallback,found={1},isSculpt={2},ids={3}",
226 yprim.LocalID, assetFound, yprim.BaseShape.SculptEntry, mismatchIDs );
227 });
228 } 289 }
229 else 290 if (!assetFound)
230 { 291 {
231 xprim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedAssetFetch; 292 yprim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedAssetFetch;
232 physicsScene.Logger.ErrorFormat("{0} Physical object requires asset but no asset provider. Name={1}",
233 LogHeader, physicsScene.Name);
234 } 293 }
294 physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,fetchAssetCallback,found={1},isSculpt={2},ids={3}",
295 yprim.LocalID, assetFound, yprim.BaseShape.SculptEntry, mismatchIDs );
235 }); 296 });
297 }
298 else
299 {
300 xprim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedAssetFetch;
301 physicsScene.Logger.ErrorFormat("{0} Physical object requires asset but no asset provider. Name={1}",
302 LogHeader, physicsScene.Name);
303 }
236 } 304 }
237 else 305 else
238 { 306 {
@@ -288,6 +356,9 @@ public class BSShapeNull : BSShape
288} 356}
289 357
290// ============================================================================================================ 358// ============================================================================================================
359// BSShapeNative is a wrapper for a Bullet 'native' shape -- cube and sphere.
360// They are odd in that they don't allocate meshes but are computated/procedural.
361// This means allocation and freeing is different than meshes.
291public class BSShapeNative : BSShape 362public class BSShapeNative : BSShape
292{ 363{
293 private static string LogHeader = "[BULLETSIM SHAPE NATIVE]"; 364 private static string LogHeader = "[BULLETSIM SHAPE NATIVE]";
@@ -366,6 +437,7 @@ public class BSShapeNative : BSShape
366} 437}
367 438
368// ============================================================================================================ 439// ============================================================================================================
440// BSShapeMesh is a simple mesh.
369public class BSShapeMesh : BSShape 441public class BSShapeMesh : BSShape
370{ 442{
371 private static string LogHeader = "[BULLETSIM SHAPE MESH]"; 443 private static string LogHeader = "[BULLETSIM SHAPE MESH]";
@@ -395,9 +467,7 @@ public class BSShapeMesh : BSShape
395 467
396 // Check to see if mesh was created (might require an asset). 468 // Check to see if mesh was created (might require an asset).
397 newShape = VerifyMeshCreated(physicsScene, newShape, prim); 469 newShape = VerifyMeshCreated(physicsScene, newShape, prim);
398 if (!newShape.isNativeShape 470 if (!newShape.isNativeShape || prim.AssetFailed() )
399 || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedMeshing
400 || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedAssetFetch)
401 { 471 {
402 // If a mesh was what was created, remember the built shape for later sharing. 472 // If a mesh was what was created, remember the built shape for later sharing.
403 // Also note that if meshing failed we put it in the mesh list as there is nothing else to do about the mesh. 473 // Also note that if meshing failed we put it in the mesh list as there is nothing else to do about the mesh.
@@ -464,7 +534,11 @@ public class BSShapeMesh : BSShape
464 PrimitiveBaseShape pbs, OMV.Vector3 size, float lod) 534 PrimitiveBaseShape pbs, OMV.Vector3 size, float lod)
465 { 535 {
466 return BSShapeMesh.CreatePhysicalMeshShape(physicsScene, prim, newMeshKey, pbs, size, lod, 536 return BSShapeMesh.CreatePhysicalMeshShape(physicsScene, prim, newMeshKey, pbs, size, lod,
467 (w, iC, i, vC, v) => physicsScene.PE.CreateMeshShape(w, iC, i, vC, v) ); 537 (w, iC, i, vC, v) =>
538 {
539 shapeInfo.Vertices = vC;
540 return physicsScene.PE.CreateMeshShape(w, iC, i, vC, v);
541 });
468 } 542 }
469 543
470 // Code that uses the mesher to create the index/vertices info for a trimesh shape. 544 // Code that uses the mesher to create the index/vertices info for a trimesh shape.
@@ -554,11 +628,18 @@ public class BSShapeMesh : BSShape
554} 628}
555 629
556// ============================================================================================================ 630// ============================================================================================================
631// BSShapeHull is a physical shape representation htat is made up of many convex hulls.
632// The convex hulls are either supplied with the asset or are approximated by one of the
633// convex hull creation routines (in OpenSim or in Bullet).
557public class BSShapeHull : BSShape 634public class BSShapeHull : BSShape
558{ 635{
636#pragma warning disable 414
559 private static string LogHeader = "[BULLETSIM SHAPE HULL]"; 637 private static string LogHeader = "[BULLETSIM SHAPE HULL]";
638#pragma warning restore 414
639
560 public static Dictionary<System.UInt64, BSShapeHull> Hulls = new Dictionary<System.UInt64, BSShapeHull>(); 640 public static Dictionary<System.UInt64, BSShapeHull> Hulls = new Dictionary<System.UInt64, BSShapeHull>();
561 641
642
562 public BSShapeHull(BulletShape pShape) : base(pShape) 643 public BSShapeHull(BulletShape pShape) : base(pShape)
563 { 644 {
564 } 645 }
@@ -583,9 +664,7 @@ public class BSShapeHull : BSShape
583 664
584 // Check to see if hull was created (might require an asset). 665 // Check to see if hull was created (might require an asset).
585 newShape = VerifyMeshCreated(physicsScene, newShape, prim); 666 newShape = VerifyMeshCreated(physicsScene, newShape, prim);
586 if (!newShape.isNativeShape 667 if (!newShape.isNativeShape || prim.AssetFailed())
587 || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedMeshing
588 || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedAssetFetch)
589 { 668 {
590 // If a mesh was what was created, remember the built shape for later sharing. 669 // If a mesh was what was created, remember the built shape for later sharing.
591 Hulls.Add(newHullKey, retHull); 670 Hulls.Add(newHullKey, retHull);
@@ -623,6 +702,7 @@ public class BSShapeHull : BSShape
623 // TODO: schedule aging and destruction of unused meshes. 702 // TODO: schedule aging and destruction of unused meshes.
624 } 703 }
625 } 704 }
705
626 List<ConvexResult> m_hulls; 706 List<ConvexResult> m_hulls;
627 private BulletShape CreatePhysicalHull(BSScene physicsScene, BSPhysObject prim, System.UInt64 newHullKey, 707 private BulletShape CreatePhysicalHull(BSScene physicsScene, BSPhysObject prim, System.UInt64 newHullKey,
628 PrimitiveBaseShape pbs, OMV.Vector3 size, float lod) 708 PrimitiveBaseShape pbs, OMV.Vector3 size, float lod)
@@ -655,6 +735,7 @@ public class BSShapeHull : BSShape
655 if (allHulls != null && BSParam.ShouldUseAssetHulls) 735 if (allHulls != null && BSParam.ShouldUseAssetHulls)
656 { 736 {
657 int hullCount = allHulls.Count; 737 int hullCount = allHulls.Count;
738 shapeInfo.HullCount = hullCount;
658 int totalVertices = 1; // include one for the count of the hulls 739 int totalVertices = 1; // include one for the count of the hulls
659 // Using the structure described for HACD hulls, create the memory sturcture 740 // Using the structure described for HACD hulls, create the memory sturcture
660 // to pass the hull data to the creater. 741 // to pass the hull data to the creater.
@@ -667,6 +748,7 @@ public class BSShapeHull : BSShape
667 748
668 convHulls[0] = (float)hullCount; 749 convHulls[0] = (float)hullCount;
669 int jj = 1; 750 int jj = 1;
751 int hullIndex = 0;
670 foreach (List<OMV.Vector3> hullVerts in allHulls) 752 foreach (List<OMV.Vector3> hullVerts in allHulls)
671 { 753 {
672 convHulls[jj + 0] = hullVerts.Count; 754 convHulls[jj + 0] = hullVerts.Count;
@@ -681,6 +763,8 @@ public class BSShapeHull : BSShape
681 convHulls[jj + 2] = oneVert.Z; 763 convHulls[jj + 2] = oneVert.Z;
682 jj += 3; 764 jj += 3;
683 } 765 }
766 shapeInfo.SetVerticesPerHull(hullIndex, hullVerts.Count);
767 hullIndex++;
684 } 768 }
685 769
686 // create the hull data structure in Bullet 770 // create the hull data structure in Bullet
@@ -700,7 +784,7 @@ public class BSShapeHull : BSShape
700 784
701 if (meshShape.physShapeInfo.HasPhysicalShape) 785 if (meshShape.physShapeInfo.HasPhysicalShape)
702 { 786 {
703 HACDParams parms; 787 HACDParams parms = new HACDParams();
704 parms.maxVerticesPerHull = BSParam.BHullMaxVerticesPerHull; 788 parms.maxVerticesPerHull = BSParam.BHullMaxVerticesPerHull;
705 parms.minClusters = BSParam.BHullMinClusters; 789 parms.minClusters = BSParam.BHullMinClusters;
706 parms.compacityWeight = BSParam.BHullCompacityWeight; 790 parms.compacityWeight = BSParam.BHullCompacityWeight;
@@ -710,12 +794,17 @@ public class BSShapeHull : BSShape
710 parms.addNeighboursDistPoints = BSParam.NumericBool(BSParam.BHullAddNeighboursDistPoints); 794 parms.addNeighboursDistPoints = BSParam.NumericBool(BSParam.BHullAddNeighboursDistPoints);
711 parms.addFacesPoints = BSParam.NumericBool(BSParam.BHullAddFacesPoints); 795 parms.addFacesPoints = BSParam.NumericBool(BSParam.BHullAddFacesPoints);
712 parms.shouldAdjustCollisionMargin = BSParam.NumericBool(BSParam.BHullShouldAdjustCollisionMargin); 796 parms.shouldAdjustCollisionMargin = BSParam.NumericBool(BSParam.BHullShouldAdjustCollisionMargin);
797 parms.whichHACD = 0; // Use the HACD routine that comes with Bullet
713 798
714 physicsScene.DetailLog("{0},BSShapeHull.CreatePhysicalHull,hullFromMesh,beforeCall", prim.LocalID, newShape.HasPhysicalShape); 799 physicsScene.DetailLog("{0},BSShapeHull.CreatePhysicalHull,hullFromMesh,beforeCall", prim.LocalID, newShape.HasPhysicalShape);
715 newShape = physicsScene.PE.BuildHullShapeFromMesh(physicsScene.World, meshShape.physShapeInfo, parms); 800 newShape = physicsScene.PE.BuildHullShapeFromMesh(physicsScene.World, meshShape.physShapeInfo, parms);
716 physicsScene.DetailLog("{0},BSShapeHull.CreatePhysicalHull,hullFromMesh,shape={1}", prim.LocalID, newShape); 801 physicsScene.DetailLog("{0},BSShapeHull.CreatePhysicalHull,hullFromMesh,shape={1}", prim.LocalID, newShape);
717 802
718 // Now done with the mesh shape. 803 // Now done with the mesh shape.
804 shapeInfo.HullCount = 1;
805 BSShapeMesh maybeMesh = meshShape as BSShapeMesh;
806 if (maybeMesh != null)
807 shapeInfo.SetVerticesPerHull(0, maybeMesh.shapeInfo.Vertices);
719 meshShape.Dereference(physicsScene); 808 meshShape.Dereference(physicsScene);
720 } 809 }
721 physicsScene.DetailLog("{0},BSShapeHull.CreatePhysicalHull,bulletHACD,exit,hasBody={1}", prim.LocalID, newShape.HasPhysicalShape); 810 physicsScene.DetailLog("{0},BSShapeHull.CreatePhysicalHull,bulletHACD,exit,hasBody={1}", prim.LocalID, newShape.HasPhysicalShape);
@@ -865,6 +954,8 @@ public class BSShapeHull : BSShape
865} 954}
866 955
867// ============================================================================================================ 956// ============================================================================================================
957// BSShapeCompound is a wrapper for the Bullet compound shape which is built from multiple, separate
958// meshes. Used by BulletSim for complex shapes like linksets.
868public class BSShapeCompound : BSShape 959public class BSShapeCompound : BSShape
869{ 960{
870 private static string LogHeader = "[BULLETSIM SHAPE COMPOUND]"; 961 private static string LogHeader = "[BULLETSIM SHAPE COMPOUND]";
@@ -993,6 +1084,11 @@ public class BSShapeCompound : BSShape
993 BSShapeNative nativeShape = new BSShapeNative(pShape); 1084 BSShapeNative nativeShape = new BSShapeNative(pShape);
994 nativeShape.Dereference(physicsScene); 1085 nativeShape.Dereference(physicsScene);
995 } 1086 }
1087 else
1088 {
1089 physicsScene.Logger.WarnFormat("{0} DereferenceAnonCollisionShape. Did not find shape. {1}",
1090 LogHeader, pShape);
1091 }
996 } 1092 }
997 } 1093 }
998 } 1094 }
@@ -1002,9 +1098,15 @@ public class BSShapeCompound : BSShape
1002} 1098}
1003 1099
1004// ============================================================================================================ 1100// ============================================================================================================
1101// BSShapeConvexHull is a wrapper for a Bullet single convex hull. A BSShapeHull contains multiple convex
1102// hull shapes. This is used for simple prims that are convex and thus can be made into a simple
1103// collision shape (a single hull). More complex physical shapes will be BSShapeHull's.
1005public class BSShapeConvexHull : BSShape 1104public class BSShapeConvexHull : BSShape
1006{ 1105{
1106#pragma warning disable 414
1007 private static string LogHeader = "[BULLETSIM SHAPE CONVEX HULL]"; 1107 private static string LogHeader = "[BULLETSIM SHAPE CONVEX HULL]";
1108#pragma warning restore 414
1109
1008 public static Dictionary<System.UInt64, BSShapeConvexHull> ConvexHulls = new Dictionary<System.UInt64, BSShapeConvexHull>(); 1110 public static Dictionary<System.UInt64, BSShapeConvexHull> ConvexHulls = new Dictionary<System.UInt64, BSShapeConvexHull>();
1009 1111
1010 public BSShapeConvexHull(BulletShape pShape) : base(pShape) 1112 public BSShapeConvexHull(BulletShape pShape) : base(pShape)
@@ -1098,9 +1200,15 @@ public class BSShapeConvexHull : BSShape
1098 } 1200 }
1099} 1201}
1100// ============================================================================================================ 1202// ============================================================================================================
1203// BSShapeGImpact is a wrapper for the Bullet GImpact shape which is a collision mesh shape that
1204// can handle concave as well as convex shapes. Much slower computationally but creates smoother
1205// shapes than multiple convex hull approximations.
1101public class BSShapeGImpact : BSShape 1206public class BSShapeGImpact : BSShape
1102{ 1207{
1208#pragma warning disable 414
1103 private static string LogHeader = "[BULLETSIM SHAPE GIMPACT]"; 1209 private static string LogHeader = "[BULLETSIM SHAPE GIMPACT]";
1210#pragma warning restore 414
1211
1104 public static Dictionary<System.UInt64, BSShapeGImpact> GImpacts = new Dictionary<System.UInt64, BSShapeGImpact>(); 1212 public static Dictionary<System.UInt64, BSShapeGImpact> GImpacts = new Dictionary<System.UInt64, BSShapeGImpact>();
1105 1213
1106 public BSShapeGImpact(BulletShape pShape) : base(pShape) 1214 public BSShapeGImpact(BulletShape pShape) : base(pShape)
@@ -1130,9 +1238,7 @@ public class BSShapeGImpact : BSShape
1130 // Check to see if mesh was created (might require an asset). 1238 // Check to see if mesh was created (might require an asset).
1131 newShape = VerifyMeshCreated(physicsScene, newShape, prim); 1239 newShape = VerifyMeshCreated(physicsScene, newShape, prim);
1132 newShape.shapeKey = newMeshKey; 1240 newShape.shapeKey = newMeshKey;
1133 if (!newShape.isNativeShape 1241 if (!newShape.isNativeShape || prim.AssetFailed())
1134 || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedMeshing
1135 || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedAssetFetch)
1136 { 1242 {
1137 // If a mesh was what was created, remember the built shape for later sharing. 1243 // If a mesh was what was created, remember the built shape for later sharing.
1138 // Also note that if meshing failed we put it in the mesh list as there is nothing 1244 // Also note that if meshing failed we put it in the mesh list as there is nothing
@@ -1150,7 +1256,11 @@ public class BSShapeGImpact : BSShape
1150 PrimitiveBaseShape pbs, OMV.Vector3 size, float lod) 1256 PrimitiveBaseShape pbs, OMV.Vector3 size, float lod)
1151 { 1257 {
1152 return BSShapeMesh.CreatePhysicalMeshShape(physicsScene, prim, newMeshKey, pbs, size, lod, 1258 return BSShapeMesh.CreatePhysicalMeshShape(physicsScene, prim, newMeshKey, pbs, size, lod,
1153 (w, iC, i, vC, v) => physicsScene.PE.CreateGImpactShape(w, iC, i, vC, v) ); 1259 (w, iC, i, vC, v) =>
1260 {
1261 shapeInfo.Vertices = vC;
1262 return physicsScene.PE.CreateGImpactShape(w, iC, i, vC, v);
1263 });
1154 } 1264 }
1155 1265
1156 public override BSShape GetReference(BSScene pPhysicsScene, BSPhysObject pPrim) 1266 public override BSShape GetReference(BSScene pPhysicsScene, BSPhysObject pPrim)
@@ -1205,10 +1315,15 @@ public class BSShapeGImpact : BSShape
1205} 1315}
1206 1316
1207// ============================================================================================================ 1317// ============================================================================================================
1318// BSShapeAvatar is a specialized mesh shape for avatars.
1208public class BSShapeAvatar : BSShape 1319public class BSShapeAvatar : BSShape
1209{ 1320{
1321#pragma warning disable 414
1210 private static string LogHeader = "[BULLETSIM SHAPE AVATAR]"; 1322 private static string LogHeader = "[BULLETSIM SHAPE AVATAR]";
1211 public BSShapeAvatar() : base() 1323#pragma warning restore 414
1324
1325 public BSShapeAvatar()
1326 : base()
1212 { 1327 {
1213 } 1328 }
1214 public static BSShape GetReference(BSPhysObject prim) 1329 public static BSShape GetReference(BSPhysObject prim)
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs
index 8888d6d..d70b2fb 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs
@@ -58,7 +58,7 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys
58 { 58 {
59 initialMap[ii] = BSTerrainManager.HEIGHT_INITIALIZATION; 59 initialMap[ii] = BSTerrainManager.HEIGHT_INITIALIZATION;
60 } 60 }
61 m_mapInfo = new BulletHMapInfo(id, initialMap); 61 m_mapInfo = new BulletHMapInfo(id, initialMap, regionSize.X, regionSize.Y);
62 m_mapInfo.minCoords = minTerrainCoords; 62 m_mapInfo.minCoords = minTerrainCoords;
63 m_mapInfo.maxCoords = maxTerrainCoords; 63 m_mapInfo.maxCoords = maxTerrainCoords;
64 m_mapInfo.terrainRegionBase = TerrainBase; 64 m_mapInfo.terrainRegionBase = TerrainBase;
@@ -72,7 +72,7 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys
72 Vector3 minCoords, Vector3 maxCoords) 72 Vector3 minCoords, Vector3 maxCoords)
73 : base(physicsScene, regionBase, id) 73 : base(physicsScene, regionBase, id)
74 { 74 {
75 m_mapInfo = new BulletHMapInfo(id, initialMap); 75 m_mapInfo = new BulletHMapInfo(id, initialMap, maxCoords.X - minCoords.X, maxCoords.Y - minCoords.Y);
76 m_mapInfo.minCoords = minCoords; 76 m_mapInfo.minCoords = minCoords;
77 m_mapInfo.maxCoords = maxCoords; 77 m_mapInfo.maxCoords = maxCoords;
78 m_mapInfo.minZ = minCoords.Z; 78 m_mapInfo.minZ = minCoords.Z;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
index 441d2d3..50f917a 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -111,9 +111,11 @@ public sealed class BSTerrainManager : IDisposable
111 private Vector3 m_worldMax; 111 private Vector3 m_worldMax;
112 private PhysicsScene MegaRegionParentPhysicsScene { get; set; } 112 private PhysicsScene MegaRegionParentPhysicsScene { get; set; }
113 113
114 public BSTerrainManager(BSScene physicsScene) 114 public BSTerrainManager(BSScene physicsScene, Vector3 regionSize)
115 { 115 {
116 m_physicsScene = physicsScene; 116 m_physicsScene = physicsScene;
117 DefaultRegionSize = regionSize;
118
117 m_terrains = new Dictionary<Vector3,BSTerrainPhys>(); 119 m_terrains = new Dictionary<Vector3,BSTerrainPhys>();
118 120
119 // Assume one region of default size 121 // Assume one region of default size
@@ -135,8 +137,9 @@ public sealed class BSTerrainManager : IDisposable
135 DetailLog("{0},BSTerrainManager.CreateInitialGroundPlaneAndTerrain,region={1}", BSScene.DetailLogZero, m_physicsScene.RegionName); 137 DetailLog("{0},BSTerrainManager.CreateInitialGroundPlaneAndTerrain,region={1}", BSScene.DetailLogZero, m_physicsScene.RegionName);
136 // The ground plane is here to catch things that are trying to drop to negative infinity 138 // The ground plane is here to catch things that are trying to drop to negative infinity
137 BulletShape groundPlaneShape = m_physicsScene.PE.CreateGroundPlaneShape(BSScene.GROUNDPLANE_ID, 1f, BSParam.TerrainCollisionMargin); 139 BulletShape groundPlaneShape = m_physicsScene.PE.CreateGroundPlaneShape(BSScene.GROUNDPLANE_ID, 1f, BSParam.TerrainCollisionMargin);
140 Vector3 groundPlaneAltitude = new Vector3(0f, 0f, BSParam.TerrainGroundPlane);
138 m_groundPlane = m_physicsScene.PE.CreateBodyWithDefaultMotionState(groundPlaneShape, 141 m_groundPlane = m_physicsScene.PE.CreateBodyWithDefaultMotionState(groundPlaneShape,
139 BSScene.GROUNDPLANE_ID, Vector3.Zero, Quaternion.Identity); 142 BSScene.GROUNDPLANE_ID, groundPlaneAltitude, Quaternion.Identity);
140 143
141 // Everything collides with the ground plane. 144 // Everything collides with the ground plane.
142 m_groundPlane.collisionType = CollisionType.Groundplane; 145 m_groundPlane.collisionType = CollisionType.Groundplane;
@@ -237,9 +240,6 @@ public sealed class BSTerrainManager : IDisposable
237 // Called during taint-time. 240 // Called during taint-time.
238 private void UpdateTerrain(uint id, float[] heightMap, Vector3 minCoords, Vector3 maxCoords) 241 private void UpdateTerrain(uint id, float[] heightMap, Vector3 minCoords, Vector3 maxCoords)
239 { 242 {
240 DetailLog("{0},BSTerrainManager.UpdateTerrain,call,id={1},minC={2},maxC={3}",
241 BSScene.DetailLogZero, id, minCoords, maxCoords);
242
243 // Find high and low points of passed heightmap. 243 // Find high and low points of passed heightmap.
244 // The min and max passed in is usually the area objects can be in (maximum 244 // The min and max passed in is usually the area objects can be in (maximum
245 // object height, for instance). The terrain wants the bounding box for the 245 // object height, for instance). The terrain wants the bounding box for the
@@ -259,6 +259,9 @@ public sealed class BSTerrainManager : IDisposable
259 minCoords.Z = minZ; 259 minCoords.Z = minZ;
260 maxCoords.Z = maxZ; 260 maxCoords.Z = maxZ;
261 261
262 DetailLog("{0},BSTerrainManager.UpdateTerrain,call,id={1},minC={2},maxC={3}",
263 BSScene.DetailLogZero, id, minCoords, maxCoords);
264
262 Vector3 terrainRegionBase = new Vector3(minCoords.X, minCoords.Y, 0f); 265 Vector3 terrainRegionBase = new Vector3(minCoords.X, minCoords.Y, 0f);
263 266
264 lock (m_terrains) 267 lock (m_terrains)
@@ -267,8 +270,8 @@ public sealed class BSTerrainManager : IDisposable
267 if (m_terrains.TryGetValue(terrainRegionBase, out terrainPhys)) 270 if (m_terrains.TryGetValue(terrainRegionBase, out terrainPhys))
268 { 271 {
269 // There is already a terrain in this spot. Free the old and build the new. 272 // There is already a terrain in this spot. Free the old and build the new.
270 DetailLog("{0},BSTErrainManager.UpdateTerrain:UpdateExisting,call,id={1},base={2},minC={3},maxC={4}", 273 DetailLog("{0},BSTerrainManager.UpdateTerrain:UpdateExisting,call,id={1},base={2},minC={3},maxC={4}",
271 BSScene.DetailLogZero, id, terrainRegionBase, minCoords, minCoords); 274 BSScene.DetailLogZero, id, terrainRegionBase, minCoords, maxCoords);
272 275
273 // Remove old terrain from the collection 276 // Remove old terrain from the collection
274 m_terrains.Remove(terrainRegionBase); 277 m_terrains.Remove(terrainRegionBase);
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs
index 971ff9f..5932461 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs
@@ -165,14 +165,15 @@ public class BulletConstraint
165// than making copies. 165// than making copies.
166public class BulletHMapInfo 166public class BulletHMapInfo
167{ 167{
168 public BulletHMapInfo(uint id, float[] hm) { 168 public BulletHMapInfo(uint id, float[] hm, float pSizeX, float pSizeY) {
169 ID = id; 169 ID = id;
170 heightMap = hm; 170 heightMap = hm;
171 terrainRegionBase = OMV.Vector3.Zero; 171 terrainRegionBase = OMV.Vector3.Zero;
172 minCoords = new OMV.Vector3(100f, 100f, 25f); 172 minCoords = new OMV.Vector3(100f, 100f, 25f);
173 maxCoords = new OMV.Vector3(101f, 101f, 26f); 173 maxCoords = new OMV.Vector3(101f, 101f, 26f);
174 minZ = maxZ = 0f; 174 minZ = maxZ = 0f;
175 sizeX = sizeY = 256f; 175 sizeX = pSizeX;
176 sizeY = pSizeY;
176 } 177 }
177 public uint ID; 178 public uint ID;
178 public float[] heightMap; 179 public float[] heightMap;
@@ -189,6 +190,7 @@ public class BulletHMapInfo
189public enum CollisionType 190public enum CollisionType
190{ 191{
191 Avatar, 192 Avatar,
193 PhantomToOthersAvatar, // An avatar that it phantom to other avatars but not to anything else
192 Groundplane, 194 Groundplane,
193 Terrain, 195 Terrain,
194 Static, 196 Static,
@@ -230,7 +232,12 @@ public static Dictionary<CollisionType, CollisionTypeFilterGroup> CollisionTypeM
230 { CollisionType.Avatar, 232 { CollisionType.Avatar,
231 new CollisionTypeFilterGroup(CollisionType.Avatar, 233 new CollisionTypeFilterGroup(CollisionType.Avatar,
232 (uint)CollisionFilterGroups.BCharacterGroup, 234 (uint)CollisionFilterGroups.BCharacterGroup,
233 (uint)CollisionFilterGroups.BAllGroup) 235 (uint)(CollisionFilterGroups.BAllGroup))
236 },
237 { CollisionType.PhantomToOthersAvatar,
238 new CollisionTypeFilterGroup(CollisionType.PhantomToOthersAvatar,
239 (uint)CollisionFilterGroups.BCharacterGroup,
240 (uint)(CollisionFilterGroups.BAllGroup & ~CollisionFilterGroups.BCharacterGroup))
234 }, 241 },
235 { CollisionType.Groundplane, 242 { CollisionType.Groundplane,
236 new CollisionTypeFilterGroup(CollisionType.Groundplane, 243 new CollisionTypeFilterGroup(CollisionType.Groundplane,
diff --git a/OpenSim/Region/Physics/BulletSPlugin/Properties/AssemblyInfo.cs b/OpenSim/Region/Physics/BulletSPlugin/Properties/AssemblyInfo.cs
index d069178..4f90eee 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.8.0.*")] 32[assembly: AssemblyVersion("0.8.2.*")]
33 33
diff --git a/OpenSim/Region/Physics/BulletSPlugin/Tests/BulletSimTestsUtil.cs b/OpenSim/Region/Physics/BulletSPlugin/Tests/BulletSimTestsUtil.cs
index 28207a4..775bca2 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/Tests/BulletSimTestsUtil.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/Tests/BulletSimTestsUtil.cs
@@ -28,15 +28,16 @@
28using System; 28using System;
29using System.IO; 29using System.IO;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Linq;
32using System.Text; 31using System.Text;
33 32
34using Nini.Config; 33using Nini.Config;
35 34
36using OpenSim.Framework; 35using OpenSim.Framework;
37using OpenSim.Region.Physics.BulletSPlugin; 36using OpenSim.Region.Physics.Manager;
38using OpenSim.Region.Physics.Meshing; 37using OpenSim.Region.Physics.Meshing;
39 38
39using OpenMetaverse;
40
40namespace OpenSim.Region.Physics.BulletSPlugin.Tests 41namespace OpenSim.Region.Physics.BulletSPlugin.Tests
41{ 42{
42// Utility functions for building up and tearing down the sample physics environments 43// Utility functions for building up and tearing down the sample physics environments
@@ -77,17 +78,21 @@ public static class BulletSimTestsUtil
77 bulletSimConfig.Set("VehicleLoggingEnabled","True"); 78 bulletSimConfig.Set("VehicleLoggingEnabled","True");
78 } 79 }
79 80
80 BSPlugin bsPlugin = new BSPlugin(); 81 PhysicsPluginManager physicsPluginManager;
82 physicsPluginManager = new PhysicsPluginManager();
83 physicsPluginManager.LoadPluginsFromAssemblies("Physics");
84
85 Vector3 regionExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight);
86
87 PhysicsScene pScene = physicsPluginManager.GetPhysicsScene(
88 "BulletSim", "Meshmerizer", openSimINI, "BSTestRegion", regionExtent);
81 89
82 BSScene bsScene = (BSScene)bsPlugin.GetScene("BSTestRegion"); 90 BSScene bsScene = pScene as BSScene;
83 91
84 // Since the asset requestor is not initialized, any mesh or sculptie will be a cube. 92 // Since the asset requestor is not initialized, any mesh or sculptie will be a cube.
85 // In the future, add a fake asset fetcher to get meshes and sculpts. 93 // In the future, add a fake asset fetcher to get meshes and sculpts.
86 // bsScene.RequestAssetMethod = ???; 94 // bsScene.RequestAssetMethod = ???;
87 95
88 Meshing.Meshmerizer mesher = new Meshmerizer(openSimINI);
89 bsScene.Initialise(mesher, openSimINI);
90
91 return bsScene; 96 return bsScene;
92 } 97 }
93 98
diff --git a/OpenSim/Region/Physics/BulletSPlugin/Tests/HullCreation.cs b/OpenSim/Region/Physics/BulletSPlugin/Tests/HullCreation.cs
new file mode 100644
index 0000000..5a5de11
--- /dev/null
+++ b/OpenSim/Region/Physics/BulletSPlugin/Tests/HullCreation.cs
@@ -0,0 +1,205 @@
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
28using System;
29using System.Collections.Generic;
30using System.Linq;
31using System.Text;
32
33using NUnit.Framework;
34using log4net;
35
36using OpenSim.Framework;
37using OpenSim.Region.Physics.BulletSPlugin;
38using OpenSim.Region.Physics.Manager;
39using OpenSim.Tests.Common;
40
41using OpenMetaverse;
42
43namespace OpenSim.Region.Physics.BulletSPlugin.Tests
44{
45[TestFixture]
46public class HullCreation : OpenSimTestCase
47{
48 // Documentation on attributes: http://www.nunit.org/index.php?p=attributes&r=2.6.1
49 // Documentation on assertions: http://www.nunit.org/index.php?p=assertions&r=2.6.1
50
51 BSScene PhysicsScene { get; set; }
52 Vector3 ObjectInitPosition;
53
54 [TestFixtureSetUp]
55 public void Init()
56 {
57
58 }
59
60 [TestFixtureTearDown]
61 public void TearDown()
62 {
63 if (PhysicsScene != null)
64 {
65 // The Dispose() will also free any physical objects in the scene
66 PhysicsScene.Dispose();
67 PhysicsScene = null;
68 }
69 }
70
71 [TestCase(7, 2, 5f, 5f, 32, 0f)] /* default hull parameters */
72 public void GeomHullConvexDecomp( int maxDepthSplit,
73 int maxDepthSplitForSimpleShapes,
74 float concavityThresholdPercent,
75 float volumeConservationThresholdPercent,
76 int maxVertices,
77 float maxSkinWidth)
78 {
79 // Setup the physics engine to use the C# version of convex decomp
80 Dictionary<string, string> engineParams = new Dictionary<string, string>();
81 engineParams.Add("MeshSculptedPrim", "true"); // ShouldMeshSculptedPrim
82 engineParams.Add("ForceSimplePrimMeshing", "false"); // ShouldForceSimplePrimMeshing
83 engineParams.Add("UseHullsForPhysicalObjects", "true"); // ShouldUseHullsForPhysicalObjects
84 engineParams.Add("ShouldRemoveZeroWidthTriangles", "true");
85 engineParams.Add("ShouldUseBulletHACD", "false");
86 engineParams.Add("ShouldUseSingleConvexHullForPrims", "true");
87 engineParams.Add("ShouldUseGImpactShapeForPrims", "false");
88 engineParams.Add("ShouldUseAssetHulls", "true");
89
90 engineParams.Add("CSHullMaxDepthSplit", maxDepthSplit.ToString());
91 engineParams.Add("CSHullMaxDepthSplitForSimpleShapes", maxDepthSplitForSimpleShapes.ToString());
92 engineParams.Add("CSHullConcavityThresholdPercent", concavityThresholdPercent.ToString());
93 engineParams.Add("CSHullVolumeConservationThresholdPercent", volumeConservationThresholdPercent.ToString());
94 engineParams.Add("CSHullMaxVertices", maxVertices.ToString());
95 engineParams.Add("CSHullMaxSkinWidth", maxSkinWidth.ToString());
96
97 PhysicsScene = BulletSimTestsUtil.CreateBasicPhysicsEngine(engineParams);
98
99 PrimitiveBaseShape pbs;
100 Vector3 pos;
101 Vector3 size;
102 Quaternion rot;
103 bool isPhys;
104
105 // Cylinder
106 pbs = PrimitiveBaseShape.CreateCylinder();
107 pos = new Vector3(100.0f, 100.0f, 0f);
108 pos.Z = PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(pos) + 10f;
109 ObjectInitPosition = pos;
110 size = new Vector3(2f, 2f, 2f);
111 pbs.Scale = size;
112 rot = Quaternion.Identity;
113 isPhys = true;
114 uint cylinderLocalID = 123;
115 PhysicsScene.AddPrimShape("testCylinder", pbs, pos, size, rot, isPhys, cylinderLocalID);
116 BSPrim primTypeCylinder = (BSPrim)PhysicsScene.PhysObjects[cylinderLocalID];
117
118 // Hollow Cylinder
119 pbs = PrimitiveBaseShape.CreateCylinder();
120 pbs.ProfileHollow = (ushort)(0.70f * 50000);
121 pos = new Vector3(110.0f, 110.0f, 0f);
122 pos.Z = PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(pos) + 10f;
123 ObjectInitPosition = pos;
124 size = new Vector3(2f, 2f, 2f);
125 pbs.Scale = size;
126 rot = Quaternion.Identity;
127 isPhys = true;
128 uint hollowCylinderLocalID = 124;
129 PhysicsScene.AddPrimShape("testHollowCylinder", pbs, pos, size, rot, isPhys, hollowCylinderLocalID);
130 BSPrim primTypeHollowCylinder = (BSPrim)PhysicsScene.PhysObjects[hollowCylinderLocalID];
131
132 // Torus
133 // ProfileCurve = Circle, PathCurve = Curve1
134 pbs = PrimitiveBaseShape.CreateSphere();
135 pbs.ProfileShape = (byte)ProfileShape.Circle;
136 pbs.PathCurve = (byte)Extrusion.Curve1;
137 pbs.PathScaleX = 100; // default hollow info as set in the viewer
138 pbs.PathScaleY = (int)(.25f / 0.01f) + 200;
139 pos = new Vector3(120.0f, 120.0f, 0f);
140 pos.Z = PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(pos) + 10f;
141 ObjectInitPosition = pos;
142 size = new Vector3(2f, 4f, 4f);
143 pbs.Scale = size;
144 rot = Quaternion.Identity;
145 isPhys = true;
146 uint torusLocalID = 125;
147 PhysicsScene.AddPrimShape("testTorus", pbs, pos, size, rot, isPhys, torusLocalID);
148 BSPrim primTypeTorus = (BSPrim)PhysicsScene.PhysObjects[torusLocalID];
149
150 // The actual prim shape creation happens at taint time
151 PhysicsScene.ProcessTaints();
152
153 // Check out the created hull shapes and report their characteristics
154 ReportShapeGeom(primTypeCylinder);
155 ReportShapeGeom(primTypeHollowCylinder);
156 ReportShapeGeom(primTypeTorus);
157 }
158
159 [TestCase]
160 public void GeomHullBulletHACD()
161 {
162 // Cylinder
163 // Hollow Cylinder
164 // Torus
165 }
166
167 private void ReportShapeGeom(BSPrim prim)
168 {
169 if (prim != null)
170 {
171 if (prim.PhysShape.HasPhysicalShape)
172 {
173 BSShape physShape = prim.PhysShape;
174 string shapeType = physShape.GetType().ToString();
175 switch (shapeType)
176 {
177 case "OpenSim.Region.Physics.BulletSPlugin.BSShapeNative":
178 BSShapeNative nShape = physShape as BSShapeNative;
179 prim.PhysScene.DetailLog("{0}, type={1}", prim.Name, shapeType);
180 break;
181 case "OpenSim.Region.Physics.BulletSPlugin.BSShapeMesh":
182 BSShapeMesh mShape = physShape as BSShapeMesh;
183 prim.PhysScene.DetailLog("{0}, mesh, shapeInfo={1}", prim.Name, mShape.shapeInfo);
184 break;
185 case "OpenSim.Region.Physics.BulletSPlugin.BSShapeHull":
186 // BSShapeHull hShape = physShape as BSShapeHull;
187 // prim.PhysScene.DetailLog("{0}, hull, shapeInfo={1}", prim.Name, hShape.shapeInfo);
188 break;
189 case "OpenSim.Region.Physics.BulletSPlugin.BSShapeConvexHull":
190 BSShapeConvexHull chShape = physShape as BSShapeConvexHull;
191 prim.PhysScene.DetailLog("{0}, convexHull, shapeInfo={1}", prim.Name, chShape.shapeInfo);
192 break;
193 case "OpenSim.Region.Physics.BulletSPlugin.BSShapeCompound":
194 BSShapeCompound cShape = physShape as BSShapeCompound;
195 prim.PhysScene.DetailLog("{0}, type={1}", prim.Name, shapeType);
196 break;
197 default:
198 prim.PhysScene.DetailLog("{0}, type={1}", prim.Name, shapeType);
199 break;
200 }
201 }
202 }
203 }
204}
205} \ No newline at end of file
diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs b/OpenSim/Region/Physics/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs
index b8cf624..c5867b2 100644
--- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
32// You can specify all the values or you can default the Build and Revision Numbers 32// You can specify all the values or you can default the Build and Revision Numbers
33// by using the '*' as shown below: 33// by using the '*' as shown below:
34// [assembly: AssemblyVersion("1.0.*")] 34// [assembly: AssemblyVersion("1.0.*")]
35[assembly: AssemblyVersion("0.8.0.*")] 35[assembly: AssemblyVersion("0.8.2.*")]
36 36
diff --git a/OpenSim/Region/Physics/Manager/AssemblyInfo.cs b/OpenSim/Region/Physics/Manager/AssemblyInfo.cs
index 10e850e..33f60e4 100644
--- a/OpenSim/Region/Physics/Manager/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/Manager/AssemblyInfo.cs
@@ -55,4 +55,4 @@ using System.Runtime.InteropServices;
55// You can specify all values by your own or you can build default build and revision 55// You can specify all values by your own or you can build default build and revision
56// numbers with the '*' character (the default): 56// numbers with the '*' character (the default):
57 57
58[assembly : AssemblyVersion("0.8.0.*")] 58[assembly : AssemblyVersion("0.8.2.*")]
diff --git a/OpenSim/Region/Physics/Manager/NullPhysicsScene.cs b/OpenSim/Region/Physics/Manager/NullPhysicsScene.cs
index 1ccf46d..b52f1f6 100644
--- a/OpenSim/Region/Physics/Manager/NullPhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/NullPhysicsScene.cs
@@ -45,7 +45,8 @@ namespace OpenSim.Region.Physics.Manager
45 // Does nothing right now 45 // Does nothing right now
46 } 46 }
47 47
48 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) 48 public override PhysicsActor AddAvatar(
49 string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying)
49 { 50 {
50 m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddAvatar({0})", position); 51 m_log.InfoFormat("[PHYSICS]: NullPhysicsScene : AddAvatar({0})", position);
51 return PhysicsActor.Null; 52 return PhysicsActor.Null;
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
index 44bfd42..60f6480 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
@@ -386,7 +386,7 @@ namespace OpenSim.Region.Physics.Manager
386 386
387 // Used for MoveTo 387 // Used for MoveTo
388 public abstract Vector3 PIDTarget { set; } 388 public abstract Vector3 PIDTarget { set; }
389 public abstract bool PIDActive { set;} 389 public abstract bool PIDActive { get; set; }
390 public abstract float PIDTau { set; } 390 public abstract float PIDTau { set; }
391 391
392 // Used for llSetHoverHeight and maybe vehicle height 392 // Used for llSetHoverHeight and maybe vehicle height
@@ -611,7 +611,13 @@ namespace OpenSim.Region.Physics.Manager
611 } 611 }
612 612
613 public override Vector3 PIDTarget { set { return; } } 613 public override Vector3 PIDTarget { set { return; } }
614 public override bool PIDActive { set { return; } } 614
615 public override bool PIDActive
616 {
617 get { return false; }
618 set { return; }
619 }
620
615 public override float PIDTau { set { return; } } 621 public override float PIDTau { set { return; } }
616 622
617 public override float PIDHoverHeight { set { return; } } 623 public override float PIDHoverHeight { set { return; } }
diff --git a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
index d14edfd..ddbe80b 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
@@ -180,7 +180,7 @@ namespace OpenSim.Region.Physics.Manager
180 { 180 {
181 if (!pluginType.IsAbstract) 181 if (!pluginType.IsAbstract)
182 { 182 {
183 Type physTypeInterface = pluginType.GetInterface("IPhysicsPlugin", true); 183 Type physTypeInterface = pluginType.GetInterface("IPhysicsPlugin");
184 184
185 if (physTypeInterface != null) 185 if (physTypeInterface != null)
186 { 186 {
@@ -194,7 +194,7 @@ namespace OpenSim.Region.Physics.Manager
194 } 194 }
195 } 195 }
196 196
197 Type meshTypeInterface = pluginType.GetInterface("IMeshingPlugin", true); 197 Type meshTypeInterface = pluginType.GetInterface("IMeshingPlugin");
198 198
199 if (meshTypeInterface != null) 199 if (meshTypeInterface != null)
200 { 200 {
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
index 4f4ff07..96ef0a6 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
@@ -148,26 +148,38 @@ namespace OpenSim.Region.Physics.Manager
148 /// </summary> 148 /// </summary>
149 /// <param name="avName"></param> 149 /// <param name="avName"></param>
150 /// <param name="position"></param> 150 /// <param name="position"></param>
151 /// <param name="velocity"></param>
151 /// <param name="size"></param> 152 /// <param name="size"></param>
152 /// <param name="isFlying"></param> 153 /// <param name="isFlying"></param>
153 /// <returns></returns> 154 /// <returns></returns>
155<<<<<<< HEAD
156 public abstract PhysicsActor AddAvatar(
157 string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying);
158
159=======
154 public virtual PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) 160 public virtual PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
155 { 161 {
156 return null; 162 return null;
157 } 163 }
164>>>>>>> avn/ubitvar
158 /// <summary> 165 /// <summary>
159 /// Add an avatar 166 /// Add an avatar
160 /// </summary> 167 /// </summary>
161 /// <param name="localID"></param> 168 /// <param name="localID"></param>
162 /// <param name="avName"></param> 169 /// <param name="avName"></param>
163 /// <param name="position"></param> 170 /// <param name="position"></param>
171 /// <param name="velocity"></param>
164 /// <param name="size"></param> 172 /// <param name="size"></param>
165 /// <param name="isFlying"></param> 173 /// <param name="isFlying"></param>
166 /// <returns></returns> 174 /// <returns></returns>
167 public virtual PhysicsActor AddAvatar(uint localID, string avName, Vector3 position, Vector3 size, bool isFlying) 175 public virtual PhysicsActor AddAvatar(
176 uint localID, string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying)
168 { 177 {
169 PhysicsActor ret = AddAvatar(avName, position, size, isFlying); 178 PhysicsActor ret = AddAvatar(avName, position, velocity, size, isFlying);
170 if (ret != null) ret.LocalID = localID; 179
180 if (ret != null)
181 ret.LocalID = localID;
182
171 return ret; 183 return ret;
172 } 184 }
173 185
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index d67d4d2..ef6482a 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
@@ -84,7 +84,8 @@ namespace OpenSim.Region.Physics.Meshing
84 private List<List<Vector3>> mConvexHulls = null; 84 private List<List<Vector3>> mConvexHulls = null;
85 private List<Vector3> mBoundingHull = null; 85 private List<Vector3> mBoundingHull = null;
86 86
87 private Dictionary<ulong, Mesh> m_uniqueMeshes = new Dictionary<ulong, Mesh>(); 87 // Mesh cache. Static so it can be shared across instances of this class
88 private static Dictionary<ulong, Mesh> m_uniqueMeshes = new Dictionary<ulong, Mesh>();
88 89
89 public Meshmerizer(IConfigSource config) 90 public Meshmerizer(IConfigSource config)
90 { 91 {
@@ -937,8 +938,11 @@ namespace OpenSim.Region.Physics.Meshing
937 if (shouldCache) 938 if (shouldCache)
938 { 939 {
939 key = primShape.GetMeshKey(size, lod); 940 key = primShape.GetMeshKey(size, lod);
940 if (m_uniqueMeshes.TryGetValue(key, out mesh)) 941 lock (m_uniqueMeshes)
941 return mesh; 942 {
943 if (m_uniqueMeshes.TryGetValue(key, out mesh))
944 return mesh;
945 }
942 } 946 }
943 947
944 if (size.X < 0.01f) size.X = 0.01f; 948 if (size.X < 0.01f) size.X = 0.01f;
@@ -964,7 +968,10 @@ namespace OpenSim.Region.Physics.Meshing
964 968
965 if (shouldCache) 969 if (shouldCache)
966 { 970 {
967 m_uniqueMeshes.Add(key, mesh); 971 lock (m_uniqueMeshes)
972 {
973 m_uniqueMeshes.Add(key, mesh);
974 }
968 } 975 }
969 } 976 }
970 977
diff --git a/OpenSim/Region/Physics/Meshing/Properties/AssemblyInfo.cs b/OpenSim/Region/Physics/Meshing/Properties/AssemblyInfo.cs
index 8542753..ec968c0 100644
--- a/OpenSim/Region/Physics/Meshing/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/Meshing/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.8.0.*")] 32[assembly: AssemblyVersion("0.8.2.*")]
33 33
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 43bef3c..9203169 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -1251,8 +1251,12 @@ namespace OpenSim.Region.Physics.OdePlugin
1251 public override Vector3 PIDTarget { set { return; } } 1251 public override Vector3 PIDTarget { set { return; } }
1252 public override bool PIDActive 1252 public override bool PIDActive
1253 { 1253 {
1254<<<<<<< HEAD
1255 get { return false; }
1256=======
1254 // os version 1257 // os version
1255 // get { return false; } 1258 // get { return false; }
1259>>>>>>> avn/ubitvar
1256 set { return; } 1260 set { return; }
1257 } 1261 }
1258 public override float PIDTau { set { return; } } 1262 public override float PIDTau { set { return; } }
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 218ccda..6363422 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -114,7 +114,6 @@ namespace OpenSim.Region.Physics.OdePlugin
114 private float m_PIDTau; 114 private float m_PIDTau;
115 private float PID_D = 35f; 115 private float PID_D = 35f;
116 private float PID_G = 25f; 116 private float PID_G = 25f;
117 private bool m_usePID;
118 117
119 // KF: These next 7 params apply to llSetHoverHeight(float height, integer water, float tau), 118 // KF: These next 7 params apply to llSetHoverHeight(float height, integer water, float tau),
120 // and are for non-VEHICLES only. 119 // and are for non-VEHICLES only.
@@ -1731,7 +1730,7 @@ Console.WriteLine(" JointCreateFixed");
1731 // gravityz multiplier = 1 - m_buoyancy 1730 // gravityz multiplier = 1 - m_buoyancy
1732 fz = _parent_scene.gravityz * (1.0f - m_buoyancy) * m_mass; 1731 fz = _parent_scene.gravityz * (1.0f - m_buoyancy) * m_mass;
1733 1732
1734 if (m_usePID) 1733 if (PIDActive)
1735 { 1734 {
1736//Console.WriteLine("PID " + Name); 1735//Console.WriteLine("PID " + Name);
1737 // KF - this is for object move? eg. llSetPos() ? 1736 // KF - this is for object move? eg. llSetPos() ?
@@ -1803,7 +1802,7 @@ Console.WriteLine(" JointCreateFixed");
1803 } // end if (PIDActive) 1802 } // end if (PIDActive)
1804 1803
1805 // Hover PID Controller needs to be mutually exlusive to MoveTo PID controller 1804 // Hover PID Controller needs to be mutually exlusive to MoveTo PID controller
1806 if (m_useHoverPID && !m_usePID) 1805 if (m_useHoverPID && !PIDActive)
1807 { 1806 {
1808//Console.WriteLine("Hover " + Name); 1807//Console.WriteLine("Hover " + Name);
1809 1808
@@ -2875,7 +2874,7 @@ Console.WriteLine(" JointCreateFixed");
2875 // it does make sense to do this for tiny little instabilities with physical prim, however 0.5m/frame is fairly large. 2874 // it does make sense to do this for tiny little instabilities with physical prim, however 0.5m/frame is fairly large.
2876 // reducing this to 0.02m/frame seems to help the angular rubberbanding quite a bit, however, to make sure it doesn't affect elevators and vehicles 2875 // reducing this to 0.02m/frame seems to help the angular rubberbanding quite a bit, however, to make sure it doesn't affect elevators and vehicles
2877 // adding these logical exclusion situations to maintain this where I think it was intended to be. 2876 // adding these logical exclusion situations to maintain this where I think it was intended to be.
2878 if (m_throttleUpdates || m_usePID || (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) || (Amotor != IntPtr.Zero)) 2877 if (m_throttleUpdates || PIDActive || (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) || (Amotor != IntPtr.Zero))
2879 { 2878 {
2880 m_minvelocity = 0.5f; 2879 m_minvelocity = 0.5f;
2881 } 2880 }
@@ -2956,10 +2955,14 @@ Console.WriteLine(" JointCreateFixed");
2956 m_log.WarnFormat("[PHYSICS]: Got NaN PIDTarget from Scene on Object {0}", Name); 2955 m_log.WarnFormat("[PHYSICS]: Got NaN PIDTarget from Scene on Object {0}", Name);
2957 } 2956 }
2958 } 2957 }
2958<<<<<<< HEAD
2959 public override bool PIDActive { get; set; }
2960=======
2959 // os version 2961 // os version
2960 //public override bool PIDActive {get { return m_usePID; } set { m_usePID = value; } } 2962 //public override bool PIDActive {get { return m_usePID; } set { m_usePID = value; } }
2961 public override bool PIDActive { set { m_usePID = value; } } 2963 public override bool PIDActive { set { m_usePID = value; } }
2962 2964
2965>>>>>>> avn/ubitvar
2963 public override float PIDTau { set { m_PIDTau = value; } } 2966 public override float PIDTau { set { m_PIDTau = value; } }
2964 2967
2965 public override float PIDHoverHeight { set { m_PIDHoverHeight = value; ; } } 2968 public override float PIDHoverHeight { set { m_PIDHoverHeight = value; ; } }
@@ -3356,10 +3359,14 @@ Console.WriteLine(" JointCreateFixed");
3356 RequestAssetDelegate assetProvider = _parent_scene.RequestAssetMethod; 3359 RequestAssetDelegate assetProvider = _parent_scene.RequestAssetMethod;
3357 if (assetProvider != null) 3360 if (assetProvider != null)
3358 assetProvider(_pbs.SculptTexture, MeshAssetReceived); 3361 assetProvider(_pbs.SculptTexture, MeshAssetReceived);
3362<<<<<<< HEAD
3363 }, null, "ODEPrim.CheckMeshAsset");
3364=======
3359 // os version 3365 // os version
3360 //}, null, "ODEPrim.CheckMeshAsset"); 3366 //}, null, "ODEPrim.CheckMeshAsset");
3361 // avn 3367 // avn
3362 }); 3368 });
3369>>>>>>> avn/ubitvar
3363 } 3370 }
3364 } 3371 }
3365 3372
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index 820e649..7f4a809 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -2020,6 +2020,13 @@ namespace OpenSim.Region.Physics.OdePlugin
2020 2020
2021 #region Add/Remove Entities 2021 #region Add/Remove Entities
2022 2022
2023<<<<<<< HEAD
2024 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying)
2025 {
2026 OdeCharacter newAv
2027 = new OdeCharacter(
2028 avName, this, position, velocity, size, avPIDD, avPIDP,
2029=======
2023/* core version 2030/* core version
2024 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying) 2031 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying)
2025 { 2032 {
@@ -2041,6 +2048,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2041 OdeCharacter newAv 2048 OdeCharacter newAv
2042 = new OdeCharacter( 2049 = new OdeCharacter(
2043 avName, this, position, Vector3.Zero, size, avPIDD, avPIDP, 2050 avName, this, position, Vector3.Zero, size, avPIDD, avPIDP,
2051>>>>>>> avn/ubitvar
2044 avCapRadius, avStandupTensor, avDensity, 2052 avCapRadius, avStandupTensor, avDensity,
2045 avMovementDivisorWalk, avMovementDivisorRun); 2053 avMovementDivisorWalk, avMovementDivisorRun);
2046 2054
diff --git a/OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs
index 83be103..fc1ffba 100644
--- a/OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs
@@ -55,4 +55,4 @@ using System.Runtime.InteropServices;
55// You can specify all values by your own or you can build default build and revision 55// You can specify all values by your own or you can build default build and revision
56// numbers with the '*' character (the default): 56// numbers with the '*' character (the default):
57 57
58[assembly : AssemblyVersion("0.8.0.*")] 58[assembly : AssemblyVersion("0.8.2.*")]
diff --git a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs
index ae534ea..40ab984 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs
@@ -273,9 +273,10 @@ namespace OpenSim.Region.Physics.POSPlugin
273 set { return; } 273 set { return; }
274 } 274 }
275 275
276 public override bool PIDActive 276 public override bool PIDActive
277 { 277 {
278 set { return; } 278 get { return false; }
279 set { return; }
279 } 280 }
280 281
281 public override float PIDTau 282 public override float PIDTau
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs
index 2ea8bfc..782ba82 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs
@@ -270,6 +270,7 @@ namespace OpenSim.Region.Physics.POSPlugin
270 270
271 public override bool PIDActive 271 public override bool PIDActive
272 { 272 {
273 get { return false; }
273 set { return; } 274 set { return; }
274 } 275 }
275 276
diff --git a/OpenSim/Region/Physics/POSPlugin/POSScene.cs b/OpenSim/Region/Physics/POSPlugin/POSScene.cs
index d30d482..080c6ab 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSScene.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSScene.cs
@@ -58,7 +58,8 @@ namespace OpenSim.Region.Physics.POSPlugin
58 { 58 {
59 } 59 }
60 60
61 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) 61 public override PhysicsActor AddAvatar(
62 string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying)
62 { 63 {
63 POSCharacter act = new POSCharacter(); 64 POSCharacter act = new POSCharacter();
64 act.Position = position; 65 act.Position = position;
diff --git a/OpenSim/Region/RegionCombinerModule/Properties/AssemblyInfo.cs b/OpenSim/Region/RegionCombinerModule/Properties/AssemblyInfo.cs
index c341dfd..11b89d2 100644
--- a/OpenSim/Region/RegionCombinerModule/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/RegionCombinerModule/Properties/AssemblyInfo.cs
@@ -1,6 +1,7 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.CompilerServices; 2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices; 3using System.Runtime.InteropServices;
4using Mono.Addins;
4 5
5// General Information about an assembly is controlled through the following 6// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information 7// set of attributes. Change these attribute values to modify the information
@@ -29,5 +30,7 @@ using System.Runtime.InteropServices;
29// Build Number 30// Build Number
30// Revision 31// Revision
31// 32//
32[assembly: AssemblyVersion("0.8.0.*")] 33[assembly: AssemblyVersion("0.8.2.*")]
33 34
35[assembly: Addin("OpenSim.RegionModules.RegionCombinerModule", OpenSim.VersionInfo.VersionNumber)]
36[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)]
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
index 341c8f8..0fe3ab0 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
@@ -41,9 +41,11 @@ using Mono.Addins;
41 41
42namespace OpenSim.Region.RegionCombinerModule 42namespace OpenSim.Region.RegionCombinerModule
43{ 43{
44 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RegionCombinerModule")]
44 public class RegionCombinerModule : ISharedRegionModule, IRegionCombinerModule 45 public class RegionCombinerModule : ISharedRegionModule, IRegionCombinerModule
45 { 46 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48// private static string LogHeader = "[REGION COMBINER MODULE]";
47 49
48 public string Name 50 public string Name
49 { 51 {
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs
index 40ed3fd..ddfe3e0 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs
@@ -34,7 +34,7 @@ using OpenSim.Region.Framework.Scenes;
34 34
35namespace OpenSim.Region.RegionCombinerModule 35namespace OpenSim.Region.RegionCombinerModule
36{ 36{
37 public class RegionCombinerPermissionModule 37 public class RegionCombinerPermissionModule
38 { 38 {
39 private Scene m_rootScene; 39 private Scene m_rootScene;
40 40
diff --git a/OpenSim/Region/RegionCombinerModule/RegionData.cs b/OpenSim/Region/RegionCombinerModule/RegionData.cs
index bd0e398..42fca9f 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionData.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionData.cs
@@ -34,6 +34,7 @@ namespace OpenSim.Region.RegionCombinerModule
34 { 34 {
35 public UUID RegionId; 35 public UUID RegionId;
36 public Scene RegionScene; 36 public Scene RegionScene;
37 // Offset of this region from the base of the root region.
37 public Vector3 Offset; 38 public Vector3 Offset;
38 } 39 }
39} \ No newline at end of file 40} \ No newline at end of file
diff --git a/OpenSim/Region/RegionCombinerModule/Resources/RegionCombinerModule.addin.xml b/OpenSim/Region/RegionCombinerModule/Resources/RegionCombinerModule.addin.xml
deleted file mode 100644
index 13cb8b6..0000000
--- a/OpenSim/Region/RegionCombinerModule/Resources/RegionCombinerModule.addin.xml
+++ /dev/null
@@ -1,14 +0,0 @@
1<Addin id="OpenSim.RegionModules.RegionCombinerModule" version="0.3">
2 <Runtime>
3 <Import assembly="OpenSim.Region.RegionCombinerModule.dll"/>
4 </Runtime>
5
6 <Dependencies>
7 <Addin id="OpenSim" version="0.5" />
8 </Dependencies>
9
10 <Extension path = "/OpenSim/RegionModules">
11 <RegionModule id="RegionCombinerModule" type="OpenSim.Region.RegionCombinerModule.RegionCombinerModule" />
12 </Extension>
13
14</Addin>
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/ICompiler.cs b/OpenSim/Region/ScriptEngine/Interfaces/ICompiler.cs
index e4ca635..a7fa502 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/ICompiler.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/ICompiler.cs
@@ -34,7 +34,36 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
34{ 34{
35 public interface ICompiler 35 public interface ICompiler
36 { 36 {
37 void PerformScriptCompile(string source, string asset, UUID ownerID, out string assembly, out Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap); 37 /// <summary>
38 /// Performs the script compile.
39 /// </summary>
40 /// <param name="Script"></param>
41 /// <param name="asset"></param>
42 /// <param name="ownerUUID"></param>
43 /// <param name="alwaysRecompile">
44 /// If set to true then always recompile the script, even if we have a DLL already cached.
45 /// </param>
46 /// <param name="assembly"></param>
47 /// <param name="linemap"></param>
48 void PerformScriptCompile(
49 string source, string asset, UUID ownerID,
50 out string assembly, out Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap);
51
52 /// <summary>
53 /// Performs the script compile.
54 /// </summary>
55 /// <param name="Script"></param>
56 /// <param name="asset"></param>
57 /// <param name="ownerUUID"></param>
58 /// <param name="alwaysRecompile">
59 /// If set to true then always recompile the script, even if we have a DLL already cached.
60 /// </param>
61 /// <param name="assembly"></param>
62 /// <param name="linemap"></param>
63 void PerformScriptCompile(
64 string source, string asset, UUID ownerID, bool alwaysRecompile,
65 out string assembly, out Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap);
66
38 string[] GetWarnings(); 67 string[] GetWarnings();
39 } 68 }
40} 69}
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs
index 30e99b0..b9970bf 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs
@@ -46,6 +46,6 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
46 /// <param name='item'>/param> 46 /// <param name='item'>/param>
47 /// <param name='coopSleepHandle'>/param> 47 /// <param name='coopSleepHandle'>/param>
48 void Initialize( 48 void Initialize(
49 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle); 49 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item);
50 } 50 }
51} \ No newline at end of file 51}
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs
index b8fdd01..6355669 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs
@@ -110,5 +110,7 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
110 ParameterInfo[] ScriptBaseClassParameters { get; } 110 ParameterInfo[] ScriptBaseClassParameters { get; }
111 111
112 IScriptApi GetApi(UUID itemID, string name); 112 IScriptApi GetApi(UUID itemID, string name);
113
114 void SleepScript(UUID itemID, int delay);
113 } 115 }
114} 116}
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
index b9a217b..e4297c4 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
@@ -29,6 +29,7 @@ using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Threading; 31using System.Threading;
32using System.Diagnostics;
32using OpenMetaverse; 33using OpenMetaverse;
33using log4net; 34using log4net;
34using OpenSim.Framework; 35using OpenSim.Framework;
@@ -93,24 +94,30 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
93 bool ShuttingDown { get; set; } 94 bool ShuttingDown { get; set; }
94 95
95 /// <summary> 96 /// <summary>
97 /// When stopping the script: should it remain stopped permanently (i.e., save !Running in its state)?
98 /// </summary>
99 bool StayStopped { get; set; }
100
101 /// <summary>
96 /// Script state 102 /// Script state
97 /// </summary> 103 /// </summary>
98 string State { get; set; } 104 string State { get; set; }
99 105
100 /// <summary> 106 /// <summary>
101 /// Time the script was last started 107 /// If true then the engine is responsible for persisted state. If false then some other component may
108 /// persist state (e.g. attachments persisting in assets).
102 /// </summary> 109 /// </summary>
103 DateTime TimeStarted { get; } 110 bool StatePersistedHere { get; }
104 111
105 /// <summary> 112 /// <summary>
106 /// Tick the last measurement period was started. 113 /// Time the script was last started
107 /// </summary> 114 /// </summary>
108 long MeasurementPeriodTickStart { get; } 115 DateTime TimeStarted { get; }
109 116
110 /// <summary> 117 /// <summary>
111 /// Ticks spent executing in the last measurement period. 118 /// Collects information about how long the script was executed.
112 /// </summary> 119 /// </summary>
113 long MeasurementPeriodExecutionTime { get; } 120 MetricsCollectorTime ExecutionTime { get; }
114 121
115 /// <summary> 122 /// <summary>
116 /// Scene part in which this script instance is contained. 123 /// Scene part in which this script instance is contained.
@@ -157,6 +164,9 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
157 void ClearQueue(); 164 void ClearQueue();
158 int StartParam { get; set; } 165 int StartParam { get; set; }
159 166
167 WaitHandle CoopWaitHandle { get; }
168 Stopwatch ExecutionTimer { get; }
169
160 void RemoveState(); 170 void RemoveState();
161 171
162 void Init(); 172 void Init();
@@ -172,8 +182,9 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
172 /// <param name="timeout"></param> 182 /// <param name="timeout"></param>
173 /// How many milliseconds we will wait for an existing script event to finish before 183 /// How many milliseconds we will wait for an existing script event to finish before
174 /// forcibly aborting that event. 184 /// forcibly aborting that event.
185 /// <param name="clearEventQueue">If true then the event queue is also cleared</param>
175 /// <returns>true if the script was successfully stopped, false otherwise</returns> 186 /// <returns>true if the script was successfully stopped, false otherwise</returns>
176 bool Stop(int timeout); 187 bool Stop(int timeout, bool clearEventQueue = false);
177 188
178 void SetState(string state); 189 void SetState(string state);
179 190
@@ -222,7 +233,7 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
222 void SetVars(Dictionary<string, object> vars); 233 void SetVars(Dictionary<string, object> vars);
223 DetectParams GetDetectParams(int idx); 234 DetectParams GetDetectParams(int idx);
224 UUID GetDetectID(int idx); 235 UUID GetDetectID(int idx);
225 void SaveState(string assembly); 236 void SaveState();
226 void DestroyScriptInstance(); 237 void DestroyScriptInstance();
227 238
228 IScriptApi GetApi(string name); 239 IScriptApi GetApi(string name);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
index 1e19032..df1bd8b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
@@ -182,7 +182,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
182 { 182 {
183 // Start the thread that will be doing the work 183 // Start the thread that will be doing the work
184 cmdHandlerThread 184 cmdHandlerThread
185 = Watchdog.StartThread( 185 = WorkManager.StartThread(
186 CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true, true); 186 CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true, true);
187 } 187 }
188 } 188 }
@@ -301,6 +301,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
301 } 301 }
302 } 302 }
303 303
304 public static void StateChange(IScriptEngine engine, uint localID, UUID itemID)
305 {
306 // Remove a specific script
307
308 // Remove dataserver events
309 m_Dataserver[engine].RemoveEvents(localID, itemID);
310
311 IWorldComm comms = engine.World.RequestModuleInterface<IWorldComm>();
312 if (comms != null)
313 comms.DeleteListener(itemID);
314
315 IXMLRPC xmlrpc = engine.World.RequestModuleInterface<IXMLRPC>();
316 if (xmlrpc != null)
317 {
318 xmlrpc.DeleteChannels(itemID);
319 xmlrpc.CancelSRDRequests(itemID);
320 }
321 // Remove Sensors
322 m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID);
323
324 }
325
304 /// <summary> 326 /// <summary>
305 /// Get the sensor repeat plugin for this script engine. 327 /// Get the sensor repeat plugin for this script engine.
306 /// </summary> 328 /// </summary>
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index b5ba4a0..f637a1d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -28,7 +28,13 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31<<<<<<< HEAD
32using System.Diagnostics;
33using System.Drawing;
34using System.Drawing.Imaging;
35=======
31using System.Diagnostics; //for [DebuggerNonUserCode] 36using System.Diagnostics; //for [DebuggerNonUserCode]
37>>>>>>> avn/ubitvar
32using System.Runtime.Remoting.Lifetime; 38using System.Runtime.Remoting.Lifetime;
33using System.Text; 39using System.Text;
34using System.Threading; 40using System.Threading;
@@ -37,8 +43,13 @@ using System.Timers;
37using Nini.Config; 43using Nini.Config;
38using log4net; 44using log4net;
39using OpenMetaverse; 45using OpenMetaverse;
46<<<<<<< HEAD
47using OpenMetaverse.Assets;
48=======
40using OpenMetaverse.StructuredData; 49using OpenMetaverse.StructuredData;
50>>>>>>> avn/ubitvar
41using OpenMetaverse.Packets; 51using OpenMetaverse.Packets;
52using OpenMetaverse.Rendering;
42using OpenSim; 53using OpenSim;
43using OpenSim.Framework; 54using OpenSim.Framework;
44 55
@@ -92,6 +103,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
92 { 103 {
93 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 104 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
94 105
106 public int LlRequestAgentDataCacheTimeoutMs { get; set; }
107
95 protected IScriptEngine m_ScriptEngine; 108 protected IScriptEngine m_ScriptEngine;
96 protected SceneObjectPart m_host; 109 protected SceneObjectPart m_host;
97 110
@@ -99,14 +112,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
99 /// Used for script sleeps when we are using co-operative script termination. 112 /// Used for script sleeps when we are using co-operative script termination.
100 /// </summary> 113 /// </summary>
101 /// <remarks>null if co-operative script termination is not active</remarks> 114 /// <remarks>null if co-operative script termination is not active</remarks>
102 WaitHandle m_coopSleepHandle;
103
104 /// <summary> 115 /// <summary>
105 /// The item that hosts this script 116 /// The item that hosts this script
106 /// </summary> 117 /// </summary>
107 protected TaskInventoryItem m_item; 118 protected TaskInventoryItem m_item;
108 119
109 protected bool throwErrorOnNotImplemented = true; 120 protected bool throwErrorOnNotImplemented = false;
110 protected AsyncCommandManager AsyncCommands = null; 121 protected AsyncCommandManager AsyncCommands = null;
111 protected float m_ScriptDelayFactor = 1.0f; 122 protected float m_ScriptDelayFactor = 1.0f;
112 protected float m_ScriptDistanceFactor = 1.0f; 123 protected float m_ScriptDistanceFactor = 1.0f;
@@ -122,6 +133,128 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
122 protected bool m_scriptConsoleChannelEnabled = false; 133 protected bool m_scriptConsoleChannelEnabled = false;
123 protected bool m_debuggerSafe = false; 134 protected bool m_debuggerSafe = false;
124 protected IUrlModule m_UrlModule = null; 135 protected IUrlModule m_UrlModule = null;
136<<<<<<< HEAD
137 protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache = new Dictionary<UUID, UserInfoCacheEntry>();
138 protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp.
139 protected int m_sleepMsOnSetTexture = 200;
140 protected int m_sleepMsOnSetLinkTexture = 200;
141 protected int m_sleepMsOnScaleTexture = 200;
142 protected int m_sleepMsOnOffsetTexture = 200;
143 protected int m_sleepMsOnRotateTexture = 200;
144 protected int m_sleepMsOnSetPos = 200;
145 protected int m_sleepMsOnSetRot = 200;
146 protected int m_sleepMsOnSetLocalRot = 200;
147 protected int m_sleepMsOnPreloadSound = 1000;
148 protected int m_sleepMsOnMakeExplosion = 100;
149 protected int m_sleepMsOnMakeFountain = 100;
150 protected int m_sleepMsOnMakeSmoke = 100;
151 protected int m_sleepMsOnMakeFire = 100;
152 protected int m_sleepMsOnRezAtRoot = 100;
153 protected int m_sleepMsOnInstantMessage = 2000;
154 protected int m_sleepMsOnEmail = 20000;
155 protected int m_sleepMsOnCreateLink = 1000;
156 protected int m_sleepMsOnGiveInventory = 3000;
157 protected int m_sleepMsOnRequestAgentData = 100;
158 protected int m_sleepMsOnRequestInventoryData = 1000;
159 protected int m_sleepMsOnSetDamage = 5000;
160 protected int m_sleepMsOnTextBox = 1000;
161 protected int m_sleepMsOnAdjustSoundVolume = 100;
162 protected int m_sleepMsOnEjectFromLand = 5000;
163 protected int m_sleepMsOnAddToLandPassList = 100;
164 protected int m_sleepMsOnDialog = 1000;
165 protected int m_sleepMsOnRemoteLoadScript = 3000;
166 protected int m_sleepMsOnRemoteLoadScriptPin = 3000;
167 protected int m_sleepMsOnOpenRemoteDataChannel = 1000;
168 protected int m_sleepMsOnSendRemoteData = 3000;
169 protected int m_sleepMsOnRemoteDataReply = 3000;
170 protected int m_sleepMsOnCloseRemoteDataChannel = 1000;
171 protected int m_sleepMsOnSetPrimitiveParams = 200;
172 protected int m_sleepMsOnSetLinkPrimitiveParams = 200;
173 protected int m_sleepMsOnXorBase64Strings = 300;
174 protected int m_sleepMsOnSetParcelMusicURL = 2000;
175 protected int m_sleepMsOnGetPrimMediaParams = 1000;
176 protected int m_sleepMsOnGetLinkMedia = 1000;
177 protected int m_sleepMsOnSetPrimMediaParams = 1000;
178 protected int m_sleepMsOnSetLinkMedia = 1000;
179 protected int m_sleepMsOnClearPrimMedia = 1000;
180 protected int m_sleepMsOnClearLinkMedia = 1000;
181 protected int m_sleepMsOnRequestSimulatorData = 1000;
182 protected int m_sleepMsOnLoadURL = 10000;
183 protected int m_sleepMsOnParcelMediaCommandList = 2000;
184 protected int m_sleepMsOnParcelMediaQuery = 2000;
185 protected int m_sleepMsOnModPow = 1000;
186 protected int m_sleepMsOnSetPrimURL = 2000;
187 protected int m_sleepMsOnRefreshPrimURL = 20000;
188 protected int m_sleepMsOnMapDestination = 1000;
189 protected int m_sleepMsOnAddToLandBanList = 100;
190 protected int m_sleepMsOnRemoveFromLandPassList = 100;
191 protected int m_sleepMsOnRemoveFromLandBanList = 100;
192 protected int m_sleepMsOnResetLandBanList = 100;
193 protected int m_sleepMsOnResetLandPassList = 100;
194 protected int m_sleepMsOnGetParcelPrimOwners = 2000;
195 protected int m_sleepMsOnGetNumberOfNotecardLines = 100;
196 protected int m_sleepMsOnGetNotecardLine = 100;
197 protected string m_internalObjectHost = "lsl.opensim.local";
198 protected bool m_restrictEmail = false;
199 protected ISoundModule m_SoundModule = null;
200
201 protected float m_avatarHeightCorrection = 0.2f;
202 protected bool m_useSimpleBoxesInGetBoundingBox = false;
203 protected bool m_addStatsInGetBoundingBox = false;
204
205 //LSL Avatar Bounding Box (lABB), lower (1) and upper (2),
206 //standing (Std), Groundsitting (Grs), Sitting (Sit),
207 //along X, Y and Z axes, constants (0) and coefficients (1)
208 protected float m_lABB1StdX0 = -0.275f;
209 protected float m_lABB2StdX0 = 0.275f;
210 protected float m_lABB1StdY0 = -0.35f;
211 protected float m_lABB2StdY0 = 0.35f;
212 protected float m_lABB1StdZ0 = -0.1f;
213 protected float m_lABB1StdZ1 = -0.5f;
214 protected float m_lABB2StdZ0 = 0.1f;
215 protected float m_lABB2StdZ1 = 0.5f;
216 protected float m_lABB1GrsX0 = -0.3875f;
217 protected float m_lABB2GrsX0 = 0.3875f;
218 protected float m_lABB1GrsY0 = -0.5f;
219 protected float m_lABB2GrsY0 = 0.5f;
220 protected float m_lABB1GrsZ0 = -0.05f;
221 protected float m_lABB1GrsZ1 = -0.375f;
222 protected float m_lABB2GrsZ0 = 0.5f;
223 protected float m_lABB2GrsZ1 = 0.0f;
224 protected float m_lABB1SitX0 = -0.5875f;
225 protected float m_lABB2SitX0 = 0.1875f;
226 protected float m_lABB1SitY0 = -0.35f;
227 protected float m_lABB2SitY0 = 0.35f;
228 protected float m_lABB1SitZ0 = -0.35f;
229 protected float m_lABB1SitZ1 = -0.375f;
230 protected float m_lABB2SitZ0 = -0.25f;
231 protected float m_lABB2SitZ1 = 0.25f;
232
233 protected float m_primSafetyCoeffX = 2.414214f;
234 protected float m_primSafetyCoeffY = 2.414214f;
235 protected float m_primSafetyCoeffZ = 1.618034f;
236 protected bool m_useCastRayV3 = false;
237 protected float m_floatToleranceInCastRay = 0.00001f;
238 protected float m_floatTolerance2InCastRay = 0.001f;
239 protected DetailLevel m_primLodInCastRay = DetailLevel.Medium;
240 protected DetailLevel m_sculptLodInCastRay = DetailLevel.Medium;
241 protected DetailLevel m_meshLodInCastRay = DetailLevel.Highest;
242 protected DetailLevel m_avatarLodInCastRay = DetailLevel.Medium;
243 protected int m_maxHitsInCastRay = 16;
244 protected int m_maxHitsPerPrimInCastRay = 16;
245 protected int m_maxHitsPerObjectInCastRay = 16;
246 protected bool m_detectExitsInCastRay = false;
247 protected bool m_filterPartsInCastRay = false;
248 protected bool m_doAttachmentsInCastRay = false;
249 protected int m_msThrottleInCastRay = 200;
250 protected int m_msPerRegionInCastRay = 40;
251 protected int m_msPerAvatarInCastRay = 10;
252 protected int m_msMinInCastRay = 2;
253 protected int m_msMaxInCastRay = 40;
254 protected static List<CastRayCall> m_castRayCalls = new List<CastRayCall>();
255 protected bool m_useMeshCacheInCastRay = true;
256 protected static Dictionary<ulong, FacetedMesh> m_cachedMeshes = new Dictionary<ulong, FacetedMesh>();
257=======
125 protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache = 258 protected Dictionary<UUID, UserInfoCacheEntry> m_userInfoCache =
126 new Dictionary<UUID, UserInfoCacheEntry>(); 259 new Dictionary<UUID, UserInfoCacheEntry>();
127 protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp. 260 protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp.
@@ -155,6 +288,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
155 {"TURNRIGHT", "Turning Right"}, 288 {"TURNRIGHT", "Turning Right"},
156 {"WALK", "Walking"} 289 {"WALK", "Walking"}
157 }; 290 };
291>>>>>>> avn/ubitvar
158 292
159 //An array of HTTP/1.1 headers that are not allowed to be used 293 //An array of HTTP/1.1 headers that are not allowed to be used
160 //as custom headers by llHTTPRequest. 294 //as custom headers by llHTTPRequest.
@@ -174,15 +308,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
174 }; 308 };
175 309
176 public void Initialize( 310 public void Initialize(
177 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle) 311 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item)
178 { 312 {
179 m_lastSayShoutCheck = DateTime.UtcNow; 313 m_lastSayShoutCheck = DateTime.UtcNow;
180 314
181 m_ScriptEngine = scriptEngine; 315 m_ScriptEngine = scriptEngine;
182 m_host = host; 316 m_host = host;
183 m_item = item; 317 m_item = item;
318<<<<<<< HEAD
319=======
184 m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); 320 m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false);
185 m_coopSleepHandle = coopSleepHandle; 321 m_coopSleepHandle = coopSleepHandle;
322>>>>>>> avn/ubitvar
186 323
187 LoadConfig(); 324 LoadConfig();
188 325
@@ -199,30 +336,102 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
199 /// </summary> 336 /// </summary>
200 private void LoadConfig() 337 private void LoadConfig()
201 { 338 {
202 m_ScriptDelayFactor = 339 LlRequestAgentDataCacheTimeoutMs = 20000;
203 m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f); 340
204 m_ScriptDistanceFactor = 341 IConfig seConfig = m_ScriptEngine.Config;
205 m_ScriptEngine.Config.GetFloat("ScriptDistanceLimitFactor", 1.0f); 342
206 m_MinTimerInterval = 343 if (seConfig != null)
207 m_ScriptEngine.Config.GetFloat("MinTimerInterval", 0.5f); 344 {
208 m_automaticLinkPermission = 345 m_ScriptDelayFactor =
209 m_ScriptEngine.Config.GetBoolean("AutomaticLinkPermission", false); 346 seConfig.GetFloat("ScriptDelayFactor", m_ScriptDelayFactor);
210 m_notecardLineReadCharsMax = 347 m_ScriptDistanceFactor =
211 m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255); 348 seConfig.GetFloat("ScriptDistanceLimitFactor", m_ScriptDistanceFactor);
349 m_MinTimerInterval =
350 seConfig.GetFloat("MinTimerInterval", m_MinTimerInterval);
351 m_automaticLinkPermission =
352 seConfig.GetBoolean("AutomaticLinkPermission", m_automaticLinkPermission);
353 m_notecardLineReadCharsMax =
354 seConfig.GetInt("NotecardLineReadCharsMax", m_notecardLineReadCharsMax);
355
356 // Rezzing an object with a velocity can create recoil. This feature seems to have been
357 // removed from recent versions of SL. The code computes recoil (vel*mass) and scales
358 // it by this factor. May be zero to turn off recoil all together.
359 m_recoilScaleFactor = m_ScriptEngine.Config.GetFloat("RecoilScaleFactor", m_recoilScaleFactor);
360 }
361
212 if (m_notecardLineReadCharsMax > 65535) 362 if (m_notecardLineReadCharsMax > 65535)
213 m_notecardLineReadCharsMax = 65535; 363 m_notecardLineReadCharsMax = 65535;
214 364
215 // load limits for particular subsystems. 365 // load limits for particular subsystems.
216 IConfig SMTPConfig; 366 IConfigSource seConfigSource = m_ScriptEngine.ConfigSource;
217 if ((SMTPConfig = m_ScriptEngine.ConfigSource.Configs["SMTP"]) != null) {
218 // there's an smtp config, so load in the snooze time.
219 EMAIL_PAUSE_TIME = SMTPConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME);
220 }
221 367
222 // Rezzing an object with a velocity can create recoil. This feature seems to have been 368 if (seConfigSource != null)
223 // removed from recent versions of SL. The code computes recoil (vel*mass) and scales 369 {
224 // it by this factor. May be zero to turn off recoil all together. 370 IConfig lslConfig = seConfigSource.Configs["LL-Functions"];
225 m_recoilScaleFactor = m_ScriptEngine.Config.GetFloat("RecoilScaleFactor", m_recoilScaleFactor); 371 if (lslConfig != null)
372 {
373 m_restrictEmail = lslConfig.GetBoolean("RestrictEmail", m_restrictEmail);
374 m_avatarHeightCorrection = lslConfig.GetFloat("AvatarHeightCorrection", m_avatarHeightCorrection);
375 m_useSimpleBoxesInGetBoundingBox = lslConfig.GetBoolean("UseSimpleBoxesInGetBoundingBox", m_useSimpleBoxesInGetBoundingBox);
376 m_addStatsInGetBoundingBox = lslConfig.GetBoolean("AddStatsInGetBoundingBox", m_addStatsInGetBoundingBox);
377 m_lABB1StdX0 = lslConfig.GetFloat("LowerAvatarBoundingBoxStandingXconst", m_lABB1StdX0);
378 m_lABB2StdX0 = lslConfig.GetFloat("UpperAvatarBoundingBoxStandingXconst", m_lABB2StdX0);
379 m_lABB1StdY0 = lslConfig.GetFloat("LowerAvatarBoundingBoxStandingYconst", m_lABB1StdY0);
380 m_lABB2StdY0 = lslConfig.GetFloat("UpperAvatarBoundingBoxStandingYconst", m_lABB2StdY0);
381 m_lABB1StdZ0 = lslConfig.GetFloat("LowerAvatarBoundingBoxStandingZconst", m_lABB1StdZ0);
382 m_lABB1StdZ1 = lslConfig.GetFloat("LowerAvatarBoundingBoxStandingZcoeff", m_lABB1StdZ1);
383 m_lABB2StdZ0 = lslConfig.GetFloat("UpperAvatarBoundingBoxStandingZconst", m_lABB2StdZ0);
384 m_lABB2StdZ1 = lslConfig.GetFloat("UpperAvatarBoundingBoxStandingZcoeff", m_lABB2StdZ1);
385 m_lABB1GrsX0 = lslConfig.GetFloat("LowerAvatarBoundingBoxGroundsittingXconst", m_lABB1GrsX0);
386 m_lABB2GrsX0 = lslConfig.GetFloat("UpperAvatarBoundingBoxGroundsittingXconst", m_lABB2GrsX0);
387 m_lABB1GrsY0 = lslConfig.GetFloat("LowerAvatarBoundingBoxGroundsittingYconst", m_lABB1GrsY0);
388 m_lABB2GrsY0 = lslConfig.GetFloat("UpperAvatarBoundingBoxGroundsittingYconst", m_lABB2GrsY0);
389 m_lABB1GrsZ0 = lslConfig.GetFloat("LowerAvatarBoundingBoxGroundsittingZconst", m_lABB1GrsZ0);
390 m_lABB1GrsZ1 = lslConfig.GetFloat("LowerAvatarBoundingBoxGroundsittingZcoeff", m_lABB1GrsZ1);
391 m_lABB2GrsZ0 = lslConfig.GetFloat("UpperAvatarBoundingBoxGroundsittingZconst", m_lABB2GrsZ0);
392 m_lABB2GrsZ1 = lslConfig.GetFloat("UpperAvatarBoundingBoxGroundsittingZcoeff", m_lABB2GrsZ1);
393 m_lABB1SitX0 = lslConfig.GetFloat("LowerAvatarBoundingBoxSittingXconst", m_lABB1SitX0);
394 m_lABB2SitX0 = lslConfig.GetFloat("UpperAvatarBoundingBoxSittingXconst", m_lABB2SitX0);
395 m_lABB1SitY0 = lslConfig.GetFloat("LowerAvatarBoundingBoxSittingYconst", m_lABB1SitY0);
396 m_lABB2SitY0 = lslConfig.GetFloat("UpperAvatarBoundingBoxSittingYconst", m_lABB2SitY0);
397 m_lABB1SitZ0 = lslConfig.GetFloat("LowerAvatarBoundingBoxSittingZconst", m_lABB1SitZ0);
398 m_lABB1SitZ1 = lslConfig.GetFloat("LowerAvatarBoundingBoxSittingZcoeff", m_lABB1SitZ1);
399 m_lABB2SitZ0 = lslConfig.GetFloat("UpperAvatarBoundingBoxSittingZconst", m_lABB2SitZ0);
400 m_lABB2SitZ1 = lslConfig.GetFloat("UpperAvatarBoundingBoxSittingZcoeff", m_lABB2SitZ1);
401 m_primSafetyCoeffX = lslConfig.GetFloat("PrimBoundingBoxSafetyCoefficientX", m_primSafetyCoeffX);
402 m_primSafetyCoeffY = lslConfig.GetFloat("PrimBoundingBoxSafetyCoefficientY", m_primSafetyCoeffY);
403 m_primSafetyCoeffZ = lslConfig.GetFloat("PrimBoundingBoxSafetyCoefficientZ", m_primSafetyCoeffZ);
404 m_useCastRayV3 = lslConfig.GetBoolean("UseLlCastRayV3", m_useCastRayV3);
405 m_floatToleranceInCastRay = lslConfig.GetFloat("FloatToleranceInLlCastRay", m_floatToleranceInCastRay);
406 m_floatTolerance2InCastRay = lslConfig.GetFloat("FloatTolerance2InLlCastRay", m_floatTolerance2InCastRay);
407 m_primLodInCastRay = (DetailLevel)lslConfig.GetInt("PrimDetailLevelInLlCastRay", (int)m_primLodInCastRay);
408 m_sculptLodInCastRay = (DetailLevel)lslConfig.GetInt("SculptDetailLevelInLlCastRay", (int)m_sculptLodInCastRay);
409 m_meshLodInCastRay = (DetailLevel)lslConfig.GetInt("MeshDetailLevelInLlCastRay", (int)m_meshLodInCastRay);
410 m_avatarLodInCastRay = (DetailLevel)lslConfig.GetInt("AvatarDetailLevelInLlCastRay", (int)m_avatarLodInCastRay);
411 m_maxHitsInCastRay = lslConfig.GetInt("MaxHitsInLlCastRay", m_maxHitsInCastRay);
412 m_maxHitsPerPrimInCastRay = lslConfig.GetInt("MaxHitsPerPrimInLlCastRay", m_maxHitsPerPrimInCastRay);
413 m_maxHitsPerObjectInCastRay = lslConfig.GetInt("MaxHitsPerObjectInLlCastRay", m_maxHitsPerObjectInCastRay);
414 m_detectExitsInCastRay = lslConfig.GetBoolean("DetectExitHitsInLlCastRay", m_detectExitsInCastRay);
415 m_filterPartsInCastRay = lslConfig.GetBoolean("FilterPartsInLlCastRay", m_filterPartsInCastRay);
416 m_doAttachmentsInCastRay = lslConfig.GetBoolean("DoAttachmentsInLlCastRay", m_doAttachmentsInCastRay);
417 m_msThrottleInCastRay = lslConfig.GetInt("ThrottleTimeInMsInLlCastRay", m_msThrottleInCastRay);
418 m_msPerRegionInCastRay = lslConfig.GetInt("AvailableTimeInMsPerRegionInLlCastRay", m_msPerRegionInCastRay);
419 m_msPerAvatarInCastRay = lslConfig.GetInt("AvailableTimeInMsPerAvatarInLlCastRay", m_msPerAvatarInCastRay);
420 m_msMinInCastRay = lslConfig.GetInt("RequiredAvailableTimeInMsInLlCastRay", m_msMinInCastRay);
421 m_msMaxInCastRay = lslConfig.GetInt("MaximumAvailableTimeInMsInLlCastRay", m_msMaxInCastRay);
422 m_useMeshCacheInCastRay = lslConfig.GetBoolean("UseMeshCacheInLlCastRay", m_useMeshCacheInCastRay);
423 }
424
425 IConfig smtpConfig = seConfigSource.Configs["SMTP"];
426 if (smtpConfig != null)
427 {
428 // there's an smtp config, so load in the snooze time.
429 EMAIL_PAUSE_TIME = smtpConfig.GetInt("email_pause_time", EMAIL_PAUSE_TIME);
430
431 m_internalObjectHost = smtpConfig.GetString("internal_object_host", m_internalObjectHost);
432 }
433 }
434 m_sleepMsOnEmail = EMAIL_PAUSE_TIME * 1000;
226 } 435 }
227 436
228 public override Object InitializeLifetimeService() 437 public override Object InitializeLifetimeService()
@@ -249,21 +458,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
249 458
250 protected virtual void Sleep(int delay) 459 protected virtual void Sleep(int delay)
251 { 460 {
252 if (m_coopSleepHandle == null) 461 if (m_item == null) // Some unit tests don't set this
253 System.Threading.Thread.Sleep(delay); 462 {
254 else 463 Thread.Sleep(delay);
255 CheckForCoopTermination(delay); 464 return;
465 }
466
467 m_ScriptEngine.SleepScript(m_item.ItemID, delay);
256 } 468 }
257 469
258 /// <summary> 470 /// <summary>
259 /// Check for co-operative termination. 471 /// Check for co-operative termination.
260 /// </summary> 472 /// </summary>
261 /// <param name='delay'>If called with 0, then just the check is performed with no wait.</param> 473 /// <param name='delay'>If called with 0, then just the check is performed with no wait.</param>
262 protected virtual void CheckForCoopTermination(int delay)
263 {
264 if (m_coopSleepHandle.WaitOne(delay))
265 throw new ScriptCoopStopException();
266 }
267 474
268 public Scene World 475 public Scene World
269 { 476 {
@@ -302,7 +509,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
302 if ((item = GetScriptByName(name)) != UUID.Zero) 509 if ((item = GetScriptByName(name)) != UUID.Zero)
303 m_ScriptEngine.ResetScript(item); 510 m_ScriptEngine.ResetScript(item);
304 else 511 else
305 ShoutError("llResetOtherScript: script "+name+" not found"); 512 Error("llResetOtherScript", "Can't find script '" + name + "'");
306 } 513 }
307 514
308 public LSL_Integer llGetScriptState(string name) 515 public LSL_Integer llGetScriptState(string name)
@@ -316,7 +523,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
316 return m_ScriptEngine.GetScriptState(item) ?1:0; 523 return m_ScriptEngine.GetScriptState(item) ?1:0;
317 } 524 }
318 525
319 ShoutError("llGetScriptState: script "+name+" not found"); 526 Error("llGetScriptState", "Can't find script '" + name + "'");
320 527
321 // If we didn't find it, then it's safe to 528 // If we didn't find it, then it's safe to
322 // assume it is not running. 529 // assume it is not running.
@@ -339,7 +546,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
339 } 546 }
340 else 547 else
341 { 548 {
342 ShoutError("llSetScriptState: script "+name+" not found"); 549 Error("llSetScriptState", "Can't find script '" + name + "'");
343 } 550 }
344 } 551 }
345 552
@@ -405,6 +612,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
405 /// <returns> 612 /// <returns>
406 /// The link entity. null if not found. 613 /// The link entity. null if not found.
407 /// </returns> 614 /// </returns>
615 /// <param name='part'></param>
408 /// <param name='linknum'> 616 /// <param name='linknum'>
409 /// Can be either a non-negative integer or ScriptBaseClass.LINK_THIS (-4). 617 /// Can be either a non-negative integer or ScriptBaseClass.LINK_THIS (-4).
410 /// If ScriptBaseClass.LINK_THIS then the entity containing the script is returned. 618 /// If ScriptBaseClass.LINK_THIS then the entity containing the script is returned.
@@ -415,26 +623,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
415 /// Otherwise, if a positive linknum is given which is greater than the number of entities in the linkset, then 623 /// Otherwise, if a positive linknum is given which is greater than the number of entities in the linkset, then
416 /// null is returned. 624 /// null is returned.
417 /// </param> 625 /// </param>
418 public ISceneEntity GetLinkEntity(int linknum) 626 public ISceneEntity GetLinkEntity(SceneObjectPart part, int linknum)
419 { 627 {
420 if (linknum < 0) 628 if (linknum < 0)
421 { 629 {
422 if (linknum == ScriptBaseClass.LINK_THIS) 630 if (linknum == ScriptBaseClass.LINK_THIS)
423 return m_host; 631 return part;
424 else 632 else
425 return null; 633 return null;
426 } 634 }
427 635
428 int actualPrimCount = m_host.ParentGroup.PrimCount; 636 int actualPrimCount = part.ParentGroup.PrimCount;
429 List<UUID> sittingAvatarIds = m_host.ParentGroup.GetSittingAvatars(); 637 List<ScenePresence> sittingAvatars = part.ParentGroup.GetSittingAvatars();
430 int adjustedPrimCount = actualPrimCount + sittingAvatarIds.Count; 638 int adjustedPrimCount = actualPrimCount + sittingAvatars.Count;
431 639
432 // Special case for a single prim. In this case the linknum is zero. However, this will not match a single 640 // Special case for a single prim. In this case the linknum is zero. However, this will not match a single
433 // prim that has any avatars sat upon it (in which case the root prim is link 1). 641 // prim that has any avatars sat upon it (in which case the root prim is link 1).
434 if (linknum == 0) 642 if (linknum == 0)
435 { 643 {
436 if (actualPrimCount == 1 && sittingAvatarIds.Count == 0) 644 if (actualPrimCount == 1 && sittingAvatars.Count == 0)
437 return m_host; 645 return part;
438 646
439 return null; 647 return null;
440 } 648 }
@@ -442,8 +650,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
442 // here we must match 1 (ScriptBaseClass.LINK_ROOT). 650 // here we must match 1 (ScriptBaseClass.LINK_ROOT).
443 else if (linknum == ScriptBaseClass.LINK_ROOT && actualPrimCount == 1) 651 else if (linknum == ScriptBaseClass.LINK_ROOT && actualPrimCount == 1)
444 { 652 {
445 if (sittingAvatarIds.Count > 0) 653 if (sittingAvatars.Count > 0)
446 return m_host.ParentGroup.RootPart; 654 return part.ParentGroup.RootPart;
447 else 655 else
448 return null; 656 return null;
449 } 657 }
@@ -451,15 +659,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
451 { 659 {
452 if (linknum <= actualPrimCount) 660 if (linknum <= actualPrimCount)
453 { 661 {
454 return m_host.ParentGroup.GetLinkNumPart(linknum); 662 return part.ParentGroup.GetLinkNumPart(linknum);
455 } 663 }
456 else 664 else
457 { 665 {
458 ScenePresence sp = World.GetScenePresence(sittingAvatarIds[linknum - actualPrimCount - 1]); 666 return sittingAvatars[linknum - actualPrimCount - 1];
459 if (sp != null)
460 return sp;
461 else
462 return null;
463 } 667 }
464 } 668 }
465 else 669 else
@@ -521,6 +725,54 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
521 } 725 }
522 } 726 }
523 727
728 public List<ISceneEntity> GetLinkEntities(int linkType)
729 {
730 return GetLinkEntities(m_host, linkType);
731 }
732
733 public List<ISceneEntity> GetLinkEntities(SceneObjectPart part, int linkType)
734 {
735 List<ISceneEntity> ret;
736
737 switch (linkType)
738 {
739 case ScriptBaseClass.LINK_SET:
740 return new List<ISceneEntity>(part.ParentGroup.Parts);
741
742 case ScriptBaseClass.LINK_ROOT:
743 return new List<ISceneEntity>() { part.ParentGroup.RootPart };
744
745 case ScriptBaseClass.LINK_ALL_OTHERS:
746 ret = new List<ISceneEntity>(part.ParentGroup.Parts);
747
748 if (ret.Contains(part))
749 ret.Remove(part);
750
751 return ret;
752
753 case ScriptBaseClass.LINK_ALL_CHILDREN:
754 ret = new List<ISceneEntity>(part.ParentGroup.Parts);
755
756 if (ret.Contains(part.ParentGroup.RootPart))
757 ret.Remove(part.ParentGroup.RootPart);
758
759 return ret;
760
761 case ScriptBaseClass.LINK_THIS:
762 return new List<ISceneEntity>() { part };
763
764 default:
765 if (linkType < 0)
766 return new List<ISceneEntity>();
767
768 ISceneEntity target = GetLinkEntity(part, linkType);
769 if (target == null)
770 return new List<ISceneEntity>();
771
772 return new List<ISceneEntity>() { target };
773 }
774 }
775
524 //These are the implementations of the various ll-functions used by the LSL scripts. 776 //These are the implementations of the various ll-functions used by the LSL scripts.
525 public LSL_Float llSin(double f) 777 public LSL_Float llSin(double f)
526 { 778 {
@@ -577,10 +829,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
577 public LSL_Float llFrand(double mag) 829 public LSL_Float llFrand(double mag)
578 { 830 {
579 m_host.AddScriptLPS(1); 831 m_host.AddScriptLPS(1);
580 lock (Util.RandomClass) 832
581 { 833 return Util.RandomClass.NextDouble() * mag;
582 return Util.RandomClass.NextDouble() * mag;
583 }
584 } 834 }
585 835
586 public LSL_Integer llFloor(double f) 836 public LSL_Integer llFloor(double f)
@@ -1032,7 +1282,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1032 { 1282 {
1033 if (channelID == 0) 1283 if (channelID == 0)
1034 { 1284 {
1035 LSLError("Cannot use llRegionSay() on channel 0"); 1285 Error("llRegionSay", "Cannot use on channel 0");
1036 return; 1286 return;
1037 } 1287 }
1038 1288
@@ -1041,6 +1291,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1041 1291
1042 m_host.AddScriptLPS(1); 1292 m_host.AddScriptLPS(1);
1043 1293
1294 World.SimChat(Utils.StringToBytes(text),
1295 ChatTypeEnum.Region, channelID, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, false);
1296
1044 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); 1297 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
1045 if (wComm != null) 1298 if (wComm != null)
1046 wComm.DeliverMessage(ChatTypeEnum.Region, channelID, m_host.Name, m_host.UUID, text); 1299 wComm.DeliverMessage(ChatTypeEnum.Region, channelID, m_host.Name, m_host.UUID, text);
@@ -1058,6 +1311,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1058 UUID TargetID; 1311 UUID TargetID;
1059 UUID.TryParse(target, out TargetID); 1312 UUID.TryParse(target, out TargetID);
1060 1313
1314 World.SimChatToAgent(TargetID, Utils.StringToBytes(msg),
1315 channel, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, true);
1316
1061 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); 1317 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
1062 if (wComm != null) 1318 if (wComm != null)
1063 if (!wComm.DeliverMessageTo(TargetID, channel, m_host.AbsolutePosition, m_host.Name, m_host.UUID, msg, out error)) 1319 if (!wComm.DeliverMessageTo(TargetID, channel, m_host.AbsolutePosition, m_host.Name, m_host.UUID, msg, out error))
@@ -1466,12 +1722,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1466 } 1722 }
1467 1723
1468 if ((status & ScriptBaseClass.STATUS_BLOCK_GRAB) == ScriptBaseClass.STATUS_BLOCK_GRAB) 1724 if ((status & ScriptBaseClass.STATUS_BLOCK_GRAB) == ScriptBaseClass.STATUS_BLOCK_GRAB)
1469 { 1725 m_host.BlockGrab = value != 0;
1470 if (value != 0) 1726
1471 m_host.SetBlockGrab(true); 1727 if ((status & ScriptBaseClass.STATUS_BLOCK_GRAB_OBJECT) == ScriptBaseClass.STATUS_BLOCK_GRAB_OBJECT)
1472 else 1728 m_host.ParentGroup.BlockGrabOverride = value != 0;
1473 m_host.SetBlockGrab(false);
1474 }
1475 1729
1476 if ((status & ScriptBaseClass.STATUS_DIE_AT_EDGE) == ScriptBaseClass.STATUS_DIE_AT_EDGE) 1730 if ((status & ScriptBaseClass.STATUS_DIE_AT_EDGE) == ScriptBaseClass.STATUS_DIE_AT_EDGE)
1477 { 1731 {
@@ -1532,10 +1786,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1532 return 0; 1786 return 0;
1533 1787
1534 case ScriptBaseClass.STATUS_BLOCK_GRAB: 1788 case ScriptBaseClass.STATUS_BLOCK_GRAB:
1535 if (m_host.GetBlockGrab()) 1789 return m_host.BlockGrab ? 1 : 0;
1536 return 1; 1790
1537 else 1791 case ScriptBaseClass.STATUS_BLOCK_GRAB_OBJECT:
1538 return 0; 1792 return m_host.ParentGroup.BlockGrabOverride ? 1 : 0;
1539 1793
1540 case ScriptBaseClass.STATUS_DIE_AT_EDGE: 1794 case ScriptBaseClass.STATUS_DIE_AT_EDGE:
1541 if (m_host.GetDieAtEdge()) 1795 if (m_host.GetDieAtEdge())
@@ -2047,9 +2301,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2047 part.Shape.LightColorR = Util.Clip((float)color.x, 0.0f, 1.0f); 2301 part.Shape.LightColorR = Util.Clip((float)color.x, 0.0f, 1.0f);
2048 part.Shape.LightColorG = Util.Clip((float)color.y, 0.0f, 1.0f); 2302 part.Shape.LightColorG = Util.Clip((float)color.y, 0.0f, 1.0f);
2049 part.Shape.LightColorB = Util.Clip((float)color.z, 0.0f, 1.0f); 2303 part.Shape.LightColorB = Util.Clip((float)color.z, 0.0f, 1.0f);
2050 part.Shape.LightIntensity = intensity; 2304 part.Shape.LightIntensity = Util.Clip((float)intensity, 0.0f, 1.0f);
2051 part.Shape.LightRadius = radius; 2305 part.Shape.LightRadius = Util.Clip((float)radius, 0.1f, 20.0f);
2052 part.Shape.LightFalloff = falloff; 2306 part.Shape.LightFalloff = Util.Clip((float)falloff, 0.01f, 2.0f);
2053 } 2307 }
2054 else 2308 else
2055 { 2309 {
@@ -2111,7 +2365,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2111 { 2365 {
2112 m_host.AddScriptLPS(1); 2366 m_host.AddScriptLPS(1);
2113 SetTexture(m_host, texture, face); 2367 SetTexture(m_host, texture, face);
2114 ScriptSleep(200); 2368 ScriptSleep(m_sleepMsOnSetTexture);
2115 } 2369 }
2116 2370
2117 public void llSetLinkTexture(int linknumber, string texture, int face) 2371 public void llSetLinkTexture(int linknumber, string texture, int face)
@@ -2119,6 +2373,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2119 m_host.AddScriptLPS(1); 2373 m_host.AddScriptLPS(1);
2120 2374
2121 List<SceneObjectPart> parts = GetLinkParts(linknumber); 2375 List<SceneObjectPart> parts = GetLinkParts(linknumber);
2376<<<<<<< HEAD
2377
2378 foreach (SceneObjectPart part in parts)
2379 SetTexture(part, texture, face);
2380
2381 ScriptSleep(m_sleepMsOnSetLinkTexture);
2382=======
2122 if (parts.Count > 0) 2383 if (parts.Count > 0)
2123 { 2384 {
2124 try 2385 try
@@ -2131,6 +2392,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2131 } 2392 }
2132 } 2393 }
2133 ScriptSleep(200); 2394 ScriptSleep(200);
2395>>>>>>> avn/ubitvar
2134 } 2396 }
2135 2397
2136 protected void SetTexture(SceneObjectPart part, string texture, int face) 2398 protected void SetTexture(SceneObjectPart part, string texture, int face)
@@ -2177,7 +2439,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2177 m_host.AddScriptLPS(1); 2439 m_host.AddScriptLPS(1);
2178 2440
2179 ScaleTexture(m_host, u, v, face); 2441 ScaleTexture(m_host, u, v, face);
2180 ScriptSleep(200); 2442 ScriptSleep(m_sleepMsOnScaleTexture);
2181 } 2443 }
2182 2444
2183 protected void ScaleTexture(SceneObjectPart part, double u, double v, int face) 2445 protected void ScaleTexture(SceneObjectPart part, double u, double v, int face)
@@ -2216,7 +2478,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2216 { 2478 {
2217 m_host.AddScriptLPS(1); 2479 m_host.AddScriptLPS(1);
2218 OffsetTexture(m_host, u, v, face); 2480 OffsetTexture(m_host, u, v, face);
2219 ScriptSleep(200); 2481 ScriptSleep(m_sleepMsOnOffsetTexture);
2220 } 2482 }
2221 2483
2222 protected void OffsetTexture(SceneObjectPart part, double u, double v, int face) 2484 protected void OffsetTexture(SceneObjectPart part, double u, double v, int face)
@@ -2255,7 +2517,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2255 { 2517 {
2256 m_host.AddScriptLPS(1); 2518 m_host.AddScriptLPS(1);
2257 RotateTexture(m_host, rotation, face); 2519 RotateTexture(m_host, rotation, face);
2258 ScriptSleep(200); 2520 ScriptSleep(m_sleepMsOnRotateTexture);
2259 } 2521 }
2260 2522
2261 protected void RotateTexture(SceneObjectPart part, double rotation, int face) 2523 protected void RotateTexture(SceneObjectPart part, double rotation, int face)
@@ -2333,7 +2595,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2333 2595
2334 SetPos(m_host, pos, true); 2596 SetPos(m_host, pos, true);
2335 2597
2336 ScriptSleep(200); 2598 ScriptSleep(m_sleepMsOnSetPos);
2337 } 2599 }
2338 2600
2339 /// <summary> 2601 /// <summary>
@@ -2521,14 +2783,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2521 } 2783 }
2522 } 2784 }
2523 2785
2524 ScriptSleep(200); 2786 ScriptSleep(m_sleepMsOnSetRot);
2525 } 2787 }
2526 2788
2527 public void llSetLocalRot(LSL_Rotation rot) 2789 public void llSetLocalRot(LSL_Rotation rot)
2528 { 2790 {
2529 m_host.AddScriptLPS(1); 2791 m_host.AddScriptLPS(1);
2530 SetRot(m_host, rot); 2792 SetRot(m_host, rot);
2531 ScriptSleep(200); 2793 ScriptSleep(m_sleepMsOnSetLocalRot);
2532 } 2794 }
2533 2795
2534 protected void SetRot(SceneObjectPart part, Quaternion rot) 2796 protected void SetRot(SceneObjectPart part, Quaternion rot)
@@ -2776,8 +3038,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2776 if (m_host.ParentGroup.IsAttachment) 3038 if (m_host.ParentGroup.IsAttachment)
2777 { 3039 {
2778 ScenePresence avatar = m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.AttachedAvatar); 3040 ScenePresence avatar = m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.AttachedAvatar);
3041<<<<<<< HEAD
3042 vel = avatar.GetWorldVelocity();
3043=======
2779 if (avatar != null) 3044 if (avatar != null)
2780 vel = avatar.Velocity; 3045 vel = avatar.Velocity;
3046>>>>>>> avn/ubitvar
2781 } 3047 }
2782 else 3048 else
2783 { 3049 {
@@ -2843,9 +3109,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2843 public void llSound(string sound, double volume, int queue, int loop) 3109 public void llSound(string sound, double volume, int queue, int loop)
2844 { 3110 {
2845 m_host.AddScriptLPS(1); 3111 m_host.AddScriptLPS(1);
2846 // This function has been deprecated 3112 Deprecated("llSound", "Use llPlaySound instead");
2847 // see http://www.lslwiki.net/lslwiki/wakka.php?wakka=llSound
2848 Deprecated("llSound");
2849 } 3113 }
2850 3114
2851 // Xantor 20080528 PlaySound updated so it accepts an objectinventory name -or- a key to a sound 3115 // Xantor 20080528 PlaySound updated so it accepts an objectinventory name -or- a key to a sound
@@ -2933,7 +3197,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2933 m_host.AddScriptLPS(1); 3197 m_host.AddScriptLPS(1);
2934 if (m_SoundModule != null) 3198 if (m_SoundModule != null)
2935 m_SoundModule.PreloadSound(m_host.UUID, ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound), 0); 3199 m_SoundModule.PreloadSound(m_host.UUID, ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, sound), 0);
2936 ScriptSleep(1000); 3200 ScriptSleep(m_sleepMsOnPreloadSound);
2937 } 3201 }
2938 3202
2939 /// <summary> 3203 /// <summary>
@@ -3177,7 +3441,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3177 3441
3178 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0) 3442 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0)
3179 { 3443 {
3180 LSLError("No permissions to give money"); 3444 Error("llGiveMoney", "No permissions to give money");
3181 return; 3445 return;
3182 } 3446 }
3183 3447
@@ -3185,7 +3449,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3185 3449
3186 if (!UUID.TryParse(destination, out toID)) 3450 if (!UUID.TryParse(destination, out toID))
3187 { 3451 {
3188 LSLError("Bad key in llGiveMoney"); 3452 Error("llGiveMoney", "Bad key in llGiveMoney");
3189 return; 3453 return;
3190 } 3454 }
3191 3455
@@ -3199,38 +3463,43 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3199 3463
3200 string reason; 3464 string reason;
3201 money.ObjectGiveMoney( 3465 money.ObjectGiveMoney(
3466<<<<<<< HEAD
3467 m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount);
3468 }, null, "LSL_Api.llGiveMoney");
3469=======
3202 m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount,UUID.Zero, out reason); 3470 m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount,UUID.Zero, out reason);
3203 }); 3471 });
3204 3472
3205 return 0; 3473 return 0;
3474>>>>>>> avn/ubitvar
3206 } 3475 }
3207 3476
3208 public void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset) 3477 public void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset)
3209 { 3478 {
3210 m_host.AddScriptLPS(1); 3479 m_host.AddScriptLPS(1);
3211 Deprecated("llMakeExplosion"); 3480 Deprecated("llMakeExplosion", "Use llParticleSystem instead");
3212 ScriptSleep(100); 3481 ScriptSleep(m_sleepMsOnMakeExplosion);
3213 } 3482 }
3214 3483
3215 public void llMakeFountain(int particles, double scale, double vel, double lifetime, double arc, int bounce, string texture, LSL_Vector offset, double bounce_offset) 3484 public void llMakeFountain(int particles, double scale, double vel, double lifetime, double arc, int bounce, string texture, LSL_Vector offset, double bounce_offset)
3216 { 3485 {
3217 m_host.AddScriptLPS(1); 3486 m_host.AddScriptLPS(1);
3218 Deprecated("llMakeFountain"); 3487 Deprecated("llMakeFountain", "Use llParticleSystem instead");
3219 ScriptSleep(100); 3488 ScriptSleep(m_sleepMsOnMakeFountain);
3220 } 3489 }
3221 3490
3222 public void llMakeSmoke(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset) 3491 public void llMakeSmoke(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset)
3223 { 3492 {
3224 m_host.AddScriptLPS(1); 3493 m_host.AddScriptLPS(1);
3225 Deprecated("llMakeSmoke"); 3494 Deprecated("llMakeSmoke", "Use llParticleSystem instead");
3226 ScriptSleep(100); 3495 ScriptSleep(m_sleepMsOnMakeSmoke);
3227 } 3496 }
3228 3497
3229 public void llMakeFire(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset) 3498 public void llMakeFire(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset)
3230 { 3499 {
3231 m_host.AddScriptLPS(1); 3500 m_host.AddScriptLPS(1);
3232 Deprecated("llMakeFire"); 3501 Deprecated("llMakeFire", "Use llParticleSystem instead");
3233 ScriptSleep(100); 3502 ScriptSleep(m_sleepMsOnMakeFire);
3234 } 3503 }
3235 3504
3236 public void llRezAtRoot(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param) 3505 public void llRezAtRoot(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param)
@@ -3256,13 +3525,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3256 3525
3257 if (item == null) 3526 if (item == null)
3258 { 3527 {
3259 llSay(0, "Could not find object " + inventory); 3528 Error("llRezAtRoot", "Can't find object '" + inventory + "'");
3260 return; 3529 return;
3261 } 3530 }
3262 3531
3263 if (item.InvType != (int)InventoryType.Object) 3532 if (item.InvType != (int)InventoryType.Object)
3264 { 3533 {
3265 llSay(0, "Unable to create requested object. Object is missing from database."); 3534 Error("llRezAtRoot", "Can't create requested object; object is missing from database");
3266 return; 3535 return;
3267 } 3536 }
3268 3537
@@ -3305,11 +3574,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3305 } 3574 }
3306 // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) 3575 // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
3307 } 3576 }
3577<<<<<<< HEAD
3578 }, null, "LSL_Api.llRezAtRoot");
3579=======
3308 return; 3580 return;
3309 }); 3581 });
3582>>>>>>> avn/ubitvar
3310 3583
3311 //ScriptSleep((int)((groupmass * velmag) / 10)); 3584 //ScriptSleep((int)((groupmass * velmag) / 10));
3312 ScriptSleep(100); 3585 ScriptSleep(m_sleepMsOnRezAtRoot);
3313 } 3586 }
3314 3587
3315 public void llRezObject(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param) 3588 public void llRezObject(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param)
@@ -3321,6 +3594,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3321 { 3594 {
3322 m_host.AddScriptLPS(1); 3595 m_host.AddScriptLPS(1);
3323 3596
3597<<<<<<< HEAD
3598 // normalized direction to target
3599 LSL_Vector dir = llVecNorm(target - from);
3600 // use vertical to help compute left axis
3601 LSL_Vector up = new LSL_Vector(0.0, 0.0, 1.0);
3602 // find normalized left axis parallel to horizon
3603 LSL_Vector left = llVecNorm(LSL_Vector.Cross(up, dir));
3604 // make up orthogonal to left and dir
3605 up = LSL_Vector.Cross(dir, left);
3606
3607 // compute rotation based on orthogonal axes
3608 LSL_Rotation rot = new LSL_Rotation(0.0, 0.707107, 0.0, 0.707107) * llAxes2Rot(dir, left, up);
3609
3610 // Per discussion with Melanie, for non-physical objects llLookAt appears to simply
3611 // set the rotation of the object, copy that behavior
3612 PhysicsActor pa = m_host.PhysActor;
3613
3614 if (m_host.ParentGroup.IsAttachment || strength == 0 || pa == null || !pa.IsPhysical)
3615=======
3324 // Get the normalized vector to the target 3616 // Get the normalized vector to the target
3325 LSL_Vector d1 = llVecNorm(target - llGetPos()); 3617 LSL_Vector d1 = llVecNorm(target - llGetPos());
3326 3618
@@ -3337,6 +3629,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3337 LSL_Rotation r3 = new LSL_Rotation(0.000000, 0.707107, 0.000000, 0.707107); 3629 LSL_Rotation r3 = new LSL_Rotation(0.000000, 0.707107, 0.000000, 0.707107);
3338 3630
3339 if (m_host.PhysActor == null || !m_host.PhysActor.IsPhysical) 3631 if (m_host.PhysActor == null || !m_host.PhysActor.IsPhysical)
3632>>>>>>> avn/ubitvar
3340 { 3633 {
3341 // Do nothing if either value is 0 (this has been checked in SL) 3634 // Do nothing if either value is 0 (this has been checked in SL)
3342 if (strength <= 0.0 || damping <= 0.0) 3635 if (strength <= 0.0 || damping <= 0.0)
@@ -3359,7 +3652,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3359 public void llStopLookAt() 3652 public void llStopLookAt()
3360 { 3653 {
3361 m_host.AddScriptLPS(1); 3654 m_host.AddScriptLPS(1);
3362// NotImplemented("llStopLookAt");
3363 m_host.StopLookAt(); 3655 m_host.StopLookAt();
3364 } 3656 }
3365 3657
@@ -3411,10 +3703,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3411 } 3703 }
3412 } 3704 }
3413 3705
3706<<<<<<< HEAD
3707 public LSL_Float llGetMassMKS()
3708 {
3709 // this is what the wiki says it does!
3710 // http://wiki.secondlife.com/wiki/LlGetMassMKS
3711 return llGetMass() * 100.0;
3712=======
3414 3713
3415 public LSL_Float llGetMassMKS() 3714 public LSL_Float llGetMassMKS()
3416 { 3715 {
3417 return 100f * llGetMass(); 3716 return 100f * llGetMass();
3717>>>>>>> avn/ubitvar
3418 } 3718 }
3419 3719
3420 public void llCollisionFilter(string name, string id, int accept) 3720 public void llCollisionFilter(string name, string id, int accept)
@@ -3504,7 +3804,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3504 /// </remarks> 3804 /// </remarks>
3505 public void DetachFromAvatar() 3805 public void DetachFromAvatar()
3506 { 3806 {
3507 Util.FireAndForget(DetachWrapper, m_host); 3807 Util.FireAndForget(DetachWrapper, m_host, "LSL_Api.DetachFromAvatar");
3508 } 3808 }
3509 3809
3510 private void DetachWrapper(object o) 3810 private void DetachWrapper(object o)
@@ -3545,13 +3845,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3545 public void llTakeCamera(string avatar) 3845 public void llTakeCamera(string avatar)
3546 { 3846 {
3547 m_host.AddScriptLPS(1); 3847 m_host.AddScriptLPS(1);
3548 Deprecated("llTakeCamera"); 3848 Deprecated("llTakeCamera", "Use llSetCameraParams instead");
3549 } 3849 }
3550 3850
3551 public void llReleaseCamera(string avatar) 3851 public void llReleaseCamera(string avatar)
3552 { 3852 {
3553 m_host.AddScriptLPS(1); 3853 m_host.AddScriptLPS(1);
3554 Deprecated("llReleaseCamera"); 3854 Deprecated("llReleaseCamera", "Use llClearCameraParams instead");
3555 } 3855 }
3556 3856
3557 public LSL_String llGetOwner() 3857 public LSL_String llGetOwner()
@@ -3583,14 +3883,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3583 3883
3584 // TODO: figure out values for client, fromSession, and imSessionID 3884 // TODO: figure out values for client, fromSession, and imSessionID
3585 // client.SendInstantMessage(m_host.UUID, fromSession, message, user, imSessionID, m_host.Name, AgentManager.InstantMessageDialog.MessageFromAgent, (uint)Util.UnixTimeSinceEpoch()); 3885 // client.SendInstantMessage(m_host.UUID, fromSession, message, user, imSessionID, m_host.Name, AgentManager.InstantMessageDialog.MessageFromAgent, (uint)Util.UnixTimeSinceEpoch());
3886<<<<<<< HEAD
3887
3888=======
3586 UUID friendTransactionID = UUID.Random(); 3889 UUID friendTransactionID = UUID.Random();
3587 3890
3588 //m_pendingFriendRequests.Add(friendTransactionID, fromAgentID); 3891 //m_pendingFriendRequests.Add(friendTransactionID, fromAgentID);
3589 3892
3893>>>>>>> avn/ubitvar
3590 GridInstantMessage msg = new GridInstantMessage(); 3894 GridInstantMessage msg = new GridInstantMessage();
3591 msg.fromAgentID = new Guid(m_host.UUID.ToString()); // fromAgentID.Guid; 3895 msg.fromAgentID = new Guid(m_host.OwnerID.ToString()); // fromAgentID.Guid;
3592 msg.toAgentID = new Guid(user); // toAgentID.Guid; 3896 msg.toAgentID = new Guid(user); // toAgentID.Guid;
3593 msg.imSessionID = new Guid(friendTransactionID.ToString()); // This is the item we're mucking with here 3897 msg.imSessionID = new Guid(m_host.UUID.ToString()); // This is the item we're mucking with here
3594// m_log.Debug("[Scripting IM]: From:" + msg.fromAgentID.ToString() + " To: " + msg.toAgentID.ToString() + " Session:" + msg.imSessionID.ToString() + " Message:" + message); 3898// m_log.Debug("[Scripting IM]: From:" + msg.fromAgentID.ToString() + " To: " + msg.toAgentID.ToString() + " Session:" + msg.imSessionID.ToString() + " Message:" + message);
3595// m_log.Debug("[Scripting IM]: Filling Session: " + msg.imSessionID.ToString()); 3899// m_log.Debug("[Scripting IM]: Filling Session: " + msg.imSessionID.ToString());
3596// DateTime dt = DateTime.UtcNow; 3900// DateTime dt = DateTime.UtcNow;
@@ -3648,7 +3952,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3648 m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); 3952 m_TransferModule.SendInstantMessage(msg, delegate(bool success) {});
3649 } 3953 }
3650 3954
3651 ScriptSleep(2000); 3955 ScriptSleep(m_sleepMsOnInstantMessage);
3652 } 3956 }
3653 3957
3654 public void llEmail(string address, string subject, string message) 3958 public void llEmail(string address, string subject, string message)
@@ -3657,12 +3961,36 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3657 IEmailModule emailModule = m_ScriptEngine.World.RequestModuleInterface<IEmailModule>(); 3961 IEmailModule emailModule = m_ScriptEngine.World.RequestModuleInterface<IEmailModule>();
3658 if (emailModule == null) 3962 if (emailModule == null)
3659 { 3963 {
3660 ShoutError("llEmail: email module not configured"); 3964 Error("llEmail", "Email module not configured");
3661 return; 3965 return;
3662 } 3966 }
3663 3967
3968 //Restrict email destination to the avatars registered email address?
3969 //The restriction only applies if the destination address is not local.
3970 if (m_restrictEmail == true && address.Contains(m_internalObjectHost) == false)
3971 {
3972 UserAccount account =
3973 World.UserAccountService.GetUserAccount(
3974 World.RegionInfo.ScopeID,
3975 m_host.OwnerID);
3976
3977 if (account == null)
3978 {
3979 Error("llEmail", "Can't find user account for '" + m_host.OwnerID.ToString() + "'");
3980 return;
3981 }
3982
3983 if (String.IsNullOrEmpty(account.Email))
3984 {
3985 Error("llEmail", "User account has not registered an email address.");
3986 return;
3987 }
3988
3989 address = account.Email;
3990 }
3991
3664 emailModule.SendEmail(m_host.UUID, address, subject, message); 3992 emailModule.SendEmail(m_host.UUID, address, subject, message);
3665 ScriptSleep(EMAIL_PAUSE_TIME * 1000); 3993 ScriptSleep(m_sleepMsOnEmail);
3666 } 3994 }
3667 3995
3668 public void llGetNextEmail(string address, string subject) 3996 public void llGetNextEmail(string address, string subject)
@@ -3671,7 +3999,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3671 IEmailModule emailModule = m_ScriptEngine.World.RequestModuleInterface<IEmailModule>(); 3999 IEmailModule emailModule = m_ScriptEngine.World.RequestModuleInterface<IEmailModule>();
3672 if (emailModule == null) 4000 if (emailModule == null)
3673 { 4001 {
3674 ShoutError("llGetNextEmail: email module not configured"); 4002 Error("llGetNextEmail", "Email module not configured");
3675 return; 4003 return;
3676 } 4004 }
3677 Email email; 4005 Email email;
@@ -3756,17 +4084,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3756 catch (NotImplementedException) 4084 catch (NotImplementedException)
3757 { 4085 {
3758 // Currently not implemented in DotNetEngine only XEngine 4086 // Currently not implemented in DotNetEngine only XEngine
3759 NotImplemented("llMinEventDelay in DotNetEngine"); 4087 NotImplemented("llMinEventDelay", "In DotNetEngine");
3760 } 4088 }
3761 } 4089 }
3762 4090
3763 /// <summary>
3764 /// llSoundPreload is deprecated. In SL this appears to do absolutely nothing
3765 /// and is documented to have no delay.
3766 /// </summary>
3767 public void llSoundPreload(string sound) 4091 public void llSoundPreload(string sound)
3768 { 4092 {
3769 m_host.AddScriptLPS(1); 4093 m_host.AddScriptLPS(1);
4094 Deprecated("llSoundPreload", "Use llPreloadSound instead");
3770 } 4095 }
3771 4096
3772 public void llRotLookAt(LSL_Rotation target, double strength, double damping) 4097 public void llRotLookAt(LSL_Rotation target, double strength, double damping)
@@ -3864,6 +4189,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3864 4189
3865 protected void TargetOmega(SceneObjectPart part, LSL_Vector axis, double spinrate, double gain) 4190 protected void TargetOmega(SceneObjectPart part, LSL_Vector axis, double spinrate, double gain)
3866 { 4191 {
4192 PhysicsActor pa = part.PhysActor;
4193 if ( ( pa == null || !pa.IsPhysical ) && gain == 0.0d )
4194 spinrate = 0.0d;
3867 part.UpdateAngularVelocity(axis * spinrate); 4195 part.UpdateAngularVelocity(axis * spinrate);
3868 } 4196 }
3869 4197
@@ -3909,13 +4237,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3909 ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION | 4237 ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION |
3910 ScriptBaseClass.PERMISSION_CONTROL_CAMERA | 4238 ScriptBaseClass.PERMISSION_CONTROL_CAMERA |
3911 ScriptBaseClass.PERMISSION_TRACK_CAMERA | 4239 ScriptBaseClass.PERMISSION_TRACK_CAMERA |
4240<<<<<<< HEAD
4241 ScriptBaseClass.PERMISSION_ATTACH;
4242=======
3912 ScriptBaseClass.PERMISSION_ATTACH | 4243 ScriptBaseClass.PERMISSION_ATTACH |
3913 ScriptBaseClass.PERMISSION_OVERRIDE_ANIMATIONS; 4244 ScriptBaseClass.PERMISSION_OVERRIDE_ANIMATIONS;
3914 4245
4246>>>>>>> avn/ubitvar
3915 } 4247 }
3916 else 4248 else
3917 { 4249 {
3918 if (m_host.ParentGroup.GetSittingAvatars().Contains(agentID)) 4250 if (m_host.ParentGroup.GetSittingAvatars().SingleOrDefault(sp => sp.UUID == agentID) != null)
3919 { 4251 {
3920 // When agent is sitting, certain permissions are implicit if requested from sitting agent 4252 // When agent is sitting, certain permissions are implicit if requested from sitting agent
3921 implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION | 4253 implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION |
@@ -3950,10 +4282,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3950 } 4282 }
3951 4283
3952 ScenePresence presence = World.GetScenePresence(agentID); 4284 ScenePresence presence = World.GetScenePresence(agentID);
4285
3953 if (presence != null) 4286 if (presence != null)
3954 { 4287 {
3955 // If permissions are being requested from an NPC and were not implicitly granted above then 4288 // If permissions are being requested from an NPC and were not implicitly granted above then
3956 // auto grant all reuqested permissions if the script is owned by the NPC or the NPCs owner 4289 // auto grant all requested permissions if the script is owned by the NPC or the NPCs owner
3957 INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); 4290 INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
3958 if (npcModule != null && npcModule.IsNPC(agentID, World)) 4291 if (npcModule != null && npcModule.IsNPC(agentID, World))
3959 { 4292 {
@@ -4076,23 +4409,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4076 public void llCreateLink(string target, int parent) 4409 public void llCreateLink(string target, int parent)
4077 { 4410 {
4078 m_host.AddScriptLPS(1); 4411 m_host.AddScriptLPS(1);
4412<<<<<<< HEAD
4413=======
4079 4414
4080 UUID targetID; 4415 UUID targetID;
4081 4416
4082 if (!UUID.TryParse(target, out targetID)) 4417 if (!UUID.TryParse(target, out targetID))
4083 return; 4418 return;
4419>>>>>>> avn/ubitvar
4084 4420
4085 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 4421 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
4086 && !m_automaticLinkPermission) 4422 && !m_automaticLinkPermission)
4087 { 4423 {
4088 ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); 4424 Error("llCreateLink", "PERMISSION_CHANGE_LINKS permission not set");
4089 return; 4425 return;
4090 } 4426 }
4091 4427
4092 IClientAPI client = null; 4428 CreateLink(target, parent);
4093 ScenePresence sp = World.GetScenePresence(m_item.PermsGranter); 4429 }
4094 if (sp != null) 4430
4095 client = sp.ControllingClient; 4431 public void CreateLink(string target, int parent)
4432 {
4433 UUID targetID;
4434
4435 if (!UUID.TryParse(target, out targetID))
4436 return;
4096 4437
4097 SceneObjectPart targetPart = World.GetSceneObjectPart((UUID)targetID); 4438 SceneObjectPart targetPart = World.GetSceneObjectPart((UUID)targetID);
4098 4439
@@ -4127,10 +4468,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4127 parentPrim.HasGroupChanged = true; 4468 parentPrim.HasGroupChanged = true;
4128 parentPrim.ScheduleGroupForFullUpdate(); 4469 parentPrim.ScheduleGroupForFullUpdate();
4129 4470
4471 IClientAPI client = null;
4472 ScenePresence sp = World.GetScenePresence(m_host.OwnerID);
4473 if (sp != null)
4474 client = sp.ControllingClient;
4475
4130 if (client != null) 4476 if (client != null)
4131 parentPrim.SendPropertiesToClient(client); 4477 parentPrim.SendPropertiesToClient(client);
4132 4478
4133 ScriptSleep(1000); 4479 ScriptSleep(m_sleepMsOnCreateLink);
4134 } 4480 }
4135 4481
4136 public void llBreakLink(int linknum) 4482 public void llBreakLink(int linknum)
@@ -4140,10 +4486,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4140 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 4486 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
4141 && !m_automaticLinkPermission) 4487 && !m_automaticLinkPermission)
4142 { 4488 {
4143 ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); 4489 Error("llBreakLink", "PERMISSION_CHANGE_LINKS permission not set");
4144 return; 4490 return;
4145 } 4491 }
4146 4492
4493 BreakLink(linknum);
4494 }
4495
4496 public void BreakLink(int linknum)
4497 {
4147 if (linknum < ScriptBaseClass.LINK_THIS) 4498 if (linknum < ScriptBaseClass.LINK_THIS)
4148 return; 4499 return;
4149 4500
@@ -4238,6 +4589,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4238 { 4589 {
4239 m_host.AddScriptLPS(1); 4590 m_host.AddScriptLPS(1);
4240 4591
4592<<<<<<< HEAD
4593 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
4594 && !m_automaticLinkPermission)
4595 {
4596 Error("llBreakAllLinks", "PERMISSION_CHANGE_LINKS permission not set");
4597 return;
4598 }
4599
4600 BreakAllLinks();
4601 }
4602
4603 public void BreakAllLinks()
4604 {
4605=======
4241 TaskInventoryItem item = m_item; 4606 TaskInventoryItem item = m_item;
4242 4607
4243 if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 4608 if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
@@ -4247,6 +4612,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4247 return; 4612 return;
4248 } 4613 }
4249 4614
4615>>>>>>> avn/ubitvar
4250 SceneObjectGroup parentPrim = m_host.ParentGroup; 4616 SceneObjectGroup parentPrim = m_host.ParentGroup;
4251 if (parentPrim.AttachmentPoint != 0) 4617 if (parentPrim.AttachmentPoint != 0)
4252 return; // Fail silently if attached 4618 return; // Fail silently if attached
@@ -4277,8 +4643,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4277 { 4643 {
4278 linknum -= (m_host.ParentGroup.PrimCount) + 1; 4644 linknum -= (m_host.ParentGroup.PrimCount) + 1;
4279 4645
4646<<<<<<< HEAD
4647 ISceneEntity entity = GetLinkEntity(m_host, linknum);
4648=======
4280 if (linknum < 0) 4649 if (linknum < 0)
4281 return UUID.Zero.ToString(); 4650 return UUID.Zero.ToString();
4651>>>>>>> avn/ubitvar
4282 4652
4283 List<ScenePresence> avatars = GetLinkAvatars(ScriptBaseClass.LINK_SET); 4653 List<ScenePresence> avatars = GetLinkAvatars(ScriptBaseClass.LINK_SET);
4284 if (avatars.Count > linknum) 4654 if (avatars.Count > linknum)
@@ -4333,7 +4703,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4333 { 4703 {
4334 m_host.AddScriptLPS(1); 4704 m_host.AddScriptLPS(1);
4335 4705
4336 ISceneEntity entity = GetLinkEntity(linknum); 4706 ISceneEntity entity = GetLinkEntity(m_host, linknum);
4337 4707
4338 if (entity != null) 4708 if (entity != null)
4339 return entity.Name; 4709 return entity.Name;
@@ -4401,7 +4771,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4401 4771
4402 if (!UUID.TryParse(destination, out destId)) 4772 if (!UUID.TryParse(destination, out destId))
4403 { 4773 {
4404 llSay(0, "Could not parse key " + destination); 4774 Error("llGiveInventory", "Can't parse destination key '" + destination + "'");
4405 return; 4775 return;
4406 } 4776 }
4407 4777
@@ -4409,9 +4779,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4409 4779
4410 if (item == null) 4780 if (item == null)
4411 { 4781 {
4782<<<<<<< HEAD
4783 Error("llGiveInventory", "Can't find inventory object '" + inventory + "'");
4784 return;
4785=======
4412 llSay(0, String.Format("Could not find object '{0}'", inventory)); 4786 llSay(0, String.Format("Could not find object '{0}'", inventory));
4413 return; 4787 return;
4414// throw new Exception(String.Format("The inventory object '{0}' could not be found", inventory)); 4788// throw new Exception(String.Format("The inventory object '{0}' could not be found", inventory));
4789>>>>>>> avn/ubitvar
4415 } 4790 }
4416 4791
4417 UUID objId = item.ItemID; 4792 UUID objId = item.ItemID;
@@ -4435,16 +4810,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4435 4810
4436 if (account == null) 4811 if (account == null)
4437 { 4812 {
4438 llSay(0, "Can't find destination "+destId.ToString()); 4813 GridUserInfo info = World.GridUserService.GetGridUserInfo(destId.ToString());
4439 return; 4814 if(info == null || info.Online == false)
4815 {
4816 Error("llGiveInventory", "Can't find destination '" + destId.ToString() + "'");
4817 return;
4818 }
4440 } 4819 }
4441 } 4820 }
4442 4821
4443 // destination is an avatar 4822 // destination is an avatar
4444 InventoryItemBase agentItem = World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId); 4823 string message;
4824 InventoryItemBase agentItem = World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId, out message);
4445 4825
4446 if (agentItem == null) 4826 if (agentItem == null)
4827 {
4828 llSay(0, message);
4447 return; 4829 return;
4830 }
4448 4831
4449 byte[] bucket = new byte[1]; 4832 byte[] bucket = new byte[1];
4450 bucket[0] = (byte)item.Type; 4833 bucket[0] = (byte)item.Type;
@@ -4462,6 +4845,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4462 4845
4463 ScenePresence sp; 4846 ScenePresence sp;
4464 4847
4848<<<<<<< HEAD
4849 ScriptSleep(m_sleepMsOnGiveInventory);
4850=======
4465 if (World.TryGetScenePresence(destId, out sp)) 4851 if (World.TryGetScenePresence(destId, out sp))
4466 { 4852 {
4467 sp.ControllingClient.SendInstantMessage(msg); 4853 sp.ControllingClient.SendInstantMessage(msg);
@@ -4474,6 +4860,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4474 4860
4475 //This delay should only occur when giving inventory to avatars. 4861 //This delay should only occur when giving inventory to avatars.
4476 ScriptSleep(3000); 4862 ScriptSleep(3000);
4863>>>>>>> avn/ubitvar
4477 } 4864 }
4478 } 4865 }
4479 4866
@@ -4532,6 +4919,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4532 { 4919 {
4533 m_host.AddScriptLPS(1); 4920 m_host.AddScriptLPS(1);
4534 4921
4922<<<<<<< HEAD
4923 UUID uuid = (UUID)id;
4924 PresenceInfo pinfo = null;
4925 UserAccount account;
4926
4927 UserInfoCacheEntry ce;
4928
4929 lock (m_userInfoCache)
4930 {
4931=======
4535 UUID uuid; 4932 UUID uuid;
4536 if (UUID.TryParse(id, out uuid)) 4933 if (UUID.TryParse(id, out uuid))
4537 { 4934 {
@@ -4539,6 +4936,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4539 UserAccount account; 4936 UserAccount account;
4540 4937
4541 UserInfoCacheEntry ce; 4938 UserInfoCacheEntry ce;
4939>>>>>>> avn/ubitvar
4542 if (!m_userInfoCache.TryGetValue(uuid, out ce)) 4940 if (!m_userInfoCache.TryGetValue(uuid, out ce))
4543 { 4941 {
4544 account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, uuid); 4942 account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, uuid);
@@ -4547,7 +4945,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4547 m_userInfoCache[uuid] = null; // Cache negative 4945 m_userInfoCache[uuid] = null; // Cache negative
4548 return UUID.Zero.ToString(); 4946 return UUID.Zero.ToString();
4549 } 4947 }
4948<<<<<<< HEAD
4949=======
4550 4950
4951>>>>>>> avn/ubitvar
4551 4952
4552 PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() }); 4953 PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() });
4553 if (pinfos != null && pinfos.Length > 0) 4954 if (pinfos != null && pinfos.Length > 0)
@@ -4560,6 +4961,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4560 } 4961 }
4561 } 4962 }
4562 } 4963 }
4964<<<<<<< HEAD
4965
4966 ce = new UserInfoCacheEntry();
4967 ce.time = Util.EnvironmentTickCount();
4968 ce.account = account;
4969 ce.pinfo = pinfo;
4970
4971 m_userInfoCache[uuid] = ce;
4972 }
4973 else
4974 {
4975 if (ce == null)
4976 return UUID.Zero.ToString();
4977
4978 account = ce.account;
4979
4980 if (Util.EnvironmentTickCount() < ce.time || (Util.EnvironmentTickCount() - ce.time)
4981 >= LlRequestAgentDataCacheTimeoutMs)
4982 {
4983 PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() });
4984 if (pinfos != null && pinfos.Length > 0)
4985 {
4986 foreach (PresenceInfo p in pinfos)
4987 {
4988 if (p.RegionID != UUID.Zero)
4989 {
4990 pinfo = p;
4991 }
4992 }
4993 }
4994 else
4995 {
4996 pinfo = null;
4997=======
4563 4998
4564 ce = new UserInfoCacheEntry(); 4999 ce = new UserInfoCacheEntry();
4565 ce.time = Util.EnvironmentTickCount(); 5000 ce.time = Util.EnvironmentTickCount();
@@ -4587,17 +5022,60 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4587 { 5022 {
4588 pinfo = p; 5023 pinfo = p;
4589 } 5024 }
5025>>>>>>> avn/ubitvar
4590 } 5026 }
5027
5028 ce.time = Util.EnvironmentTickCount();
5029 ce.pinfo = pinfo;
4591 } 5030 }
4592 else 5031 else
5032 {
5033 pinfo = ce.pinfo;
5034 }
5035<<<<<<< HEAD
5036 }
5037 }
5038=======
5039 else
4593 pinfo = null; 5040 pinfo = null;
4594 5041
4595 ce.time = Util.EnvironmentTickCount(); 5042 ce.time = Util.EnvironmentTickCount();
4596 ce.pinfo = pinfo; 5043 ce.pinfo = pinfo;
4597 } 5044 }
5045>>>>>>> avn/ubitvar
4598 5046
4599 string reply = String.Empty; 5047 string reply = String.Empty;
4600 5048
5049<<<<<<< HEAD
5050 switch (data)
5051 {
5052 case ScriptBaseClass.DATA_ONLINE:
5053 if (pinfo != null && pinfo.RegionID != UUID.Zero)
5054 reply = "1";
5055 else
5056 reply = "0";
5057 break;
5058 case ScriptBaseClass.DATA_NAME: // (First Last)
5059 reply = account.FirstName + " " + account.LastName;
5060 break;
5061 case ScriptBaseClass.DATA_BORN: // (YYYY-MM-DD)
5062 DateTime born = new DateTime(1970, 1, 1, 0, 0, 0, 0);
5063 born = born.AddSeconds(account.Created);
5064 reply = born.ToString("yyyy-MM-dd");
5065 break;
5066 case ScriptBaseClass.DATA_RATING: // (0,0,0,0,0,0)
5067 reply = "0,0,0,0,0,0";
5068 break;
5069 case 7: // DATA_USERLEVEL (integer). This is not available in LL and so has no constant.
5070 reply = account.UserLevel.ToString();
5071 break;
5072 case ScriptBaseClass.DATA_PAYINFO: // (0|1|2|3)
5073 reply = "0";
5074 break;
5075 default:
5076 return UUID.Zero.ToString(); // Raise no event
5077 }
5078=======
4601 switch (data) 5079 switch (data)
4602 { 5080 {
4603 case 1: // DATA_ONLINE (0|1) 5081 case 1: // DATA_ONLINE (0|1)
@@ -4623,6 +5101,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4623 default: 5101 default:
4624 return UUID.Zero.ToString(); // Raise no event 5102 return UUID.Zero.ToString(); // Raise no event
4625 } 5103 }
5104>>>>>>> avn/ubitvar
4626 5105
4627 UUID rq = UUID.Random(); 5106 UUID rq = UUID.Random();
4628 5107
@@ -4633,6 +5112,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4633 AsyncCommands. 5112 AsyncCommands.
4634 DataserverPlugin.DataserverReply(rq.ToString(), reply); 5113 DataserverPlugin.DataserverReply(rq.ToString(), reply);
4635 5114
5115<<<<<<< HEAD
5116 ScriptSleep(m_sleepMsOnRequestAgentData);
5117 return tid.ToString();
5118=======
4636 ScriptSleep(100); 5119 ScriptSleep(100);
4637 return tid.ToString(); 5120 return tid.ToString();
4638 } 5121 }
@@ -4641,6 +5124,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4641 ShoutError("Invalid UUID passed to llRequestAgentData."); 5124 ShoutError("Invalid UUID passed to llRequestAgentData.");
4642 } 5125 }
4643 return ""; 5126 return "";
5127>>>>>>> avn/ubitvar
4644 } 5128 }
4645 5129
4646 public LSL_String llRequestInventoryData(string name) 5130 public LSL_String llRequestInventoryData(string name)
@@ -4672,12 +5156,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4672 reply); 5156 reply);
4673 }); 5157 });
4674 5158
4675 ScriptSleep(1000); 5159 ScriptSleep(m_sleepMsOnRequestInventoryData);
4676 return tid.ToString(); 5160 return tid.ToString();
4677 } 5161 }
4678 } 5162 }
4679 5163
4680 ScriptSleep(1000); 5164 ScriptSleep(m_sleepMsOnRequestInventoryData);
4681 return String.Empty; 5165 return String.Empty;
4682 } 5166 }
4683 5167
@@ -4717,7 +5201,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4717 } 5201 }
4718 } 5202 }
4719 5203
4720 ScriptSleep(5000); 5204 ScriptSleep(m_sleepMsOnSetDamage);
4721 } 5205 }
4722 5206
4723 public void llTeleportAgent(string agent, string destination, LSL_Vector targetPos, LSL_Vector targetLookAt) 5207 public void llTeleportAgent(string agent, string destination, LSL_Vector targetPos, LSL_Vector targetLookAt)
@@ -4768,7 +5252,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4768 m_host.AddScriptLPS(1); 5252 m_host.AddScriptLPS(1);
4769 UUID agentId = new UUID(); 5253 UUID agentId = new UUID();
4770 5254
5255<<<<<<< HEAD
5256 ulong regionHandle = Util.RegionWorldLocToHandle((uint)global_coords.x, (uint)global_coords.y);
5257=======
4771 ulong regionHandle = Utils.UIntsToLong((uint)(global_coords.x / 256) * 256, (uint)(global_coords.y / 256) * 256); 5258 ulong regionHandle = Utils.UIntsToLong((uint)(global_coords.x / 256) * 256, (uint)(global_coords.y / 256) * 256);
5259>>>>>>> avn/ubitvar
4772 5260
4773 if (UUID.TryParse(agent, out agentId)) 5261 if (UUID.TryParse(agent, out agentId))
4774 { 5262 {
@@ -4834,22 +5322,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4834 UUID av = new UUID(); 5322 UUID av = new UUID();
4835 if (!UUID.TryParse(agent,out av)) 5323 if (!UUID.TryParse(agent,out av))
4836 { 5324 {
4837 LSLError("First parameter to llTextBox needs to be a key"); 5325 Error("llTextBox", "First parameter must be a key");
4838 return; 5326 return;
4839 } 5327 }
4840 5328
4841 if (message == string.Empty) 5329 if (message == string.Empty)
4842 { 5330 {
4843 ShoutError("Trying to use llTextBox with empty message."); 5331 Error("llTextBox", "Empty message");
4844 } 5332 }
4845 else if (message.Length > 512) 5333 else if (message.Length > 512)
4846 { 5334 {
4847 ShoutError("Trying to use llTextBox with message over 512 characters."); 5335 Error("llTextBox", "Message more than 512 characters");
4848 } 5336 }
4849 else 5337 else
4850 { 5338 {
4851 dm.SendTextBoxToUser(av, message, chatChannel, m_host.Name, m_host.UUID, m_host.OwnerID); 5339 dm.SendTextBoxToUser(av, message, chatChannel, m_host.Name, m_host.UUID, m_host.OwnerID);
4852 ScriptSleep(1000); 5340 ScriptSleep(m_sleepMsOnTextBox);
4853 } 5341 }
4854 } 5342 }
4855 5343
@@ -5566,9 +6054,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5566 // so the OR check may be a little redundant, but it's being done 6054 // so the OR check may be a little redundant, but it's being done
5567 // for completion and should LSL_Key ever be implemented 6055 // for completion and should LSL_Key ever be implemented
5568 // as it's own struct 6056 // as it's own struct
6057 // NOTE: 3rd case is needed because a NULL_KEY comes through as
6058 // type 'obj' and wrongly returns ""
5569 else if (!(src.Data[index] is LSL_String || 6059 else if (!(src.Data[index] is LSL_String ||
6060<<<<<<< HEAD
6061 src.Data[index] is LSL_Key ||
6062 src.Data[index].ToString() == "00000000-0000-0000-0000-000000000000"))
6063=======
5570 src.Data[index] is LSL_Key || 6064 src.Data[index] is LSL_Key ||
5571 src.Data[index] is String)) 6065 src.Data[index] is String))
6066>>>>>>> avn/ubitvar
5572 { 6067 {
5573 return ""; 6068 return "";
5574 } 6069 }
@@ -5776,7 +6271,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5776 public LSL_List llListRandomize(LSL_List src, int stride) 6271 public LSL_List llListRandomize(LSL_List src, int stride)
5777 { 6272 {
5778 LSL_List result; 6273 LSL_List result;
5779 Random rand = new Random(); 6274 BetterRandom rand = new BetterRandom();
5780 6275
5781 int chunkk; 6276 int chunkk;
5782 int[] chunks; 6277 int[] chunks;
@@ -5792,24 +6287,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5792 // If not, then return the src list. This also 6287 // If not, then return the src list. This also
5793 // traps those cases where stride > length. 6288 // traps those cases where stride > length.
5794 6289
5795 if (src.Length != stride && src.Length%stride == 0) 6290 if (src.Length != stride && src.Length % stride == 0)
5796 { 6291 {
5797 chunkk = src.Length/stride; 6292 chunkk = src.Length/stride;
5798 6293
5799 chunks = new int[chunkk]; 6294 chunks = new int[chunkk];
5800 6295
5801 for (int i = 0; i < chunkk; i++) 6296 for (int i = 0; i < chunkk; i++)
6297 {
5802 chunks[i] = i; 6298 chunks[i] = i;
6299 }
5803 6300
5804 // Knuth shuffle the chunkk index 6301 // Knuth shuffle the chunkk index
5805 for (int i = chunkk - 1; i >= 1; i--) 6302 for (int i = chunkk - 1; i > 0; i--)
5806 { 6303 {
5807 // Elect an unrandomized chunk to swap 6304 // Elect an unrandomized chunk to swap
5808 int index = rand.Next(i + 1); 6305 int index = rand.Next(i + 1);
5809 int tmp;
5810 6306
5811 // and swap position with first unrandomized chunk 6307 // and swap position with first unrandomized chunk
5812 tmp = chunks[i]; 6308 int tmp = chunks[i];
5813 chunks[i] = chunks[index]; 6309 chunks[i] = chunks[index];
5814 chunks[index] = tmp; 6310 chunks[index] = tmp;
5815 } 6311 }
@@ -5822,7 +6318,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5822 { 6318 {
5823 for (int j = 0; j < stride; j++) 6319 for (int j = 0; j < stride; j++)
5824 { 6320 {
5825 result.Add(src.Data[chunks[i]*stride+j]); 6321 result.Add(src.Data[chunks[i] * stride + j]);
5826 } 6322 }
5827 } 6323 }
5828 } 6324 }
@@ -5947,6 +6443,74 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5947 { 6443 {
5948 m_host.AddScriptLPS(1); 6444 m_host.AddScriptLPS(1);
5949 return new LSL_Vector(World.RegionInfo.WorldLocX, World.RegionInfo.WorldLocY, 0); 6445 return new LSL_Vector(World.RegionInfo.WorldLocX, World.RegionInfo.WorldLocY, 0);
6446<<<<<<< HEAD
6447 }
6448
6449 public LSL_String llGetEnv(LSL_String name)
6450 {
6451 m_host.AddScriptLPS(1);
6452 if (name == "agent_limit")
6453 {
6454 return World.RegionInfo.RegionSettings.AgentLimit.ToString();
6455 }
6456 else if (name == "dynamic_pathfinding")
6457 {
6458 return "0";
6459 }
6460 else if (name == "estate_id")
6461 {
6462 return World.RegionInfo.EstateSettings.EstateID.ToString();
6463 }
6464 else if (name == "estate_name")
6465 {
6466 return World.RegionInfo.EstateSettings.EstateName;
6467 }
6468 else if (name == "frame_number")
6469 {
6470 return World.Frame.ToString();
6471 }
6472 else if (name == "region_cpu_ratio")
6473 {
6474 return "1";
6475 }
6476 else if (name == "region_idle")
6477 {
6478 return "0";
6479 }
6480 else if (name == "region_product_name")
6481 {
6482 if (World.RegionInfo.RegionType != String.Empty)
6483 return World.RegionInfo.RegionType;
6484 else
6485 return "";
6486 }
6487 else if (name == "region_product_sku")
6488 {
6489 return "OpenSim";
6490 }
6491 else if (name == "region_start_time")
6492 {
6493 return World.UnixStartTime.ToString();
6494 }
6495 else if (name == "sim_channel")
6496 {
6497 return "OpenSim";
6498 }
6499 else if (name == "sim_version")
6500 {
6501 return World.GetSimulatorVersion();
6502 }
6503 else if (name == "simulator_hostname")
6504 {
6505 IUrlModule UrlModule = World.RequestModuleInterface<IUrlModule>();
6506 return UrlModule.ExternalHostNameForLSL;
6507 }
6508 else
6509 {
6510 return "";
6511 }
6512=======
6513>>>>>>> avn/ubitvar
5950 } 6514 }
5951 6515
5952 /// <summary> 6516 /// <summary>
@@ -5958,8 +6522,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5958 public LSL_List llListInsertList(LSL_List dest, LSL_List src, int index) 6522 public LSL_List llListInsertList(LSL_List dest, LSL_List src, int index)
5959 { 6523 {
5960 6524
5961 LSL_List pref = null; 6525 LSL_List pref;
5962 LSL_List suff = null; 6526 LSL_List suff;
5963 6527
5964 m_host.AddScriptLPS(1); 6528 m_host.AddScriptLPS(1);
5965 6529
@@ -6253,12 +6817,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6253 6817
6254 public LSL_String llGetAgentLanguage(string id) 6818 public LSL_String llGetAgentLanguage(string id)
6255 { 6819 {
6256 // This should only return a value if the avatar is in the same region 6820 // This should only return a value if the avatar is in the same region, but eh. idc.
6257 //ckrinke 1-30-09 : This needs to parse the XMLRPC language field supplied
6258 //by the client at login. Currently returning only en-us until our I18N
6259 //effort gains momentum
6260 m_host.AddScriptLPS(1); 6821 m_host.AddScriptLPS(1);
6261 return "en-us"; 6822 if (World.AgentPreferencesService == null)
6823 {
6824 Error("llGetAgentLanguage", "No AgentPreferencesService present");
6825 }
6826 else
6827 {
6828 UUID key = new UUID();
6829 if (UUID.TryParse(id, out key))
6830 {
6831 return new LSL_String(World.AgentPreferencesService.GetLang(key));
6832 }
6833 }
6834 return new LSL_String("en-us");
6262 } 6835 }
6263 /// <summary> 6836 /// <summary>
6264 /// http://wiki.secondlife.com/wiki/LlGetAgentList 6837 /// http://wiki.secondlife.com/wiki/LlGetAgentList
@@ -6347,7 +6920,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6347 { 6920 {
6348 m_host.AddScriptLPS(1); 6921 m_host.AddScriptLPS(1);
6349 m_host.AdjustSoundGain(volume); 6922 m_host.AdjustSoundGain(volume);
6350 ScriptSleep(100); 6923 ScriptSleep(m_sleepMsOnAdjustSoundVolume);
6351 } 6924 }
6352 6925
6353 public void llSetSoundRadius(double radius) 6926 public void llSetSoundRadius(double radius)
@@ -6461,7 +7034,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6461 } 7034 }
6462 } 7035 }
6463 } 7036 }
6464 ScriptSleep(5000); 7037 ScriptSleep(m_sleepMsOnEjectFromLand);
6465 } 7038 }
6466 7039
6467 public LSL_List llParseString2List(string str, LSL_List separators, LSL_List in_spacers) 7040 public LSL_List llParseString2List(string str, LSL_List separators, LSL_List in_spacers)
@@ -6580,10 +7153,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6580 if (UUID.TryParse(id, out key)) 7153 if (UUID.TryParse(id, out key))
6581 { 7154 {
6582 ScenePresence av = World.GetScenePresence(key); 7155 ScenePresence av = World.GetScenePresence(key);
7156 List<ScenePresence> sittingAvatars = m_host.ParentGroup.GetSittingAvatars();
6583 7157
6584 if (av != null) 7158 if (av != null)
6585 { 7159 {
6586 if (llAvatarOnSitTarget() == id) 7160 if (sittingAvatars.Contains(av))
6587 { 7161 {
6588 // if the avatar is sitting on this object, then 7162 // if the avatar is sitting on this object, then
6589 // we can unsit them. We don't want random scripts unsitting random people 7163 // we can unsit them. We don't want random scripts unsitting random people
@@ -6699,8 +7273,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6699 public virtual LSL_Integer llGetFreeMemory() 7273 public virtual LSL_Integer llGetFreeMemory()
6700 { 7274 {
6701 m_host.AddScriptLPS(1); 7275 m_host.AddScriptLPS(1);
6702 // Make scripts designed for LSO happy 7276 // Make scripts designed for Mono happy
6703 return 16384; 7277 return 65536;
6704 } 7278 }
6705 7279
6706 public LSL_Integer llGetFreeURLs() 7280 public LSL_Integer llGetFreeURLs()
@@ -6813,17 +7387,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6813 7387
6814 foreach (SceneObjectPart part in parts) 7388 foreach (SceneObjectPart part in parts)
6815 { 7389 {
6816 SetParticleSystem(part, rules); 7390 SetParticleSystem(part, rules, "llLinkParticleSystem");
6817 } 7391 }
6818 } 7392 }
6819 7393
6820 public void llParticleSystem(LSL_List rules) 7394 public void llParticleSystem(LSL_List rules)
6821 { 7395 {
6822 m_host.AddScriptLPS(1); 7396 m_host.AddScriptLPS(1);
6823 SetParticleSystem(m_host, rules); 7397 SetParticleSystem(m_host, rules, "llParticleSystem");
6824 } 7398 }
6825 7399
6826 private void SetParticleSystem(SceneObjectPart part, LSL_List rules) 7400 private void SetParticleSystem(SceneObjectPart part, LSL_List rules, string originFunc)
6827 { 7401 {
6828 if (rules.Length == 0) 7402 if (rules.Length == 0)
6829 { 7403 {
@@ -6840,62 +7414,152 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6840 7414
6841 for (int i = 0; i < rules.Length; i += 2) 7415 for (int i = 0; i < rules.Length; i += 2)
6842 { 7416 {
6843 switch (rules.GetLSLIntegerItem(i)) 7417 int psystype;
7418 try
7419 {
7420 psystype = rules.GetLSLIntegerItem(i);
7421 }
7422 catch (InvalidCastException)
7423 {
7424 Error(originFunc, string.Format("Error running particle system params index #{0}: particle system parameter type must be integer", i));
7425 return;
7426 }
7427 switch (psystype)
6844 { 7428 {
6845 case (int)ScriptBaseClass.PSYS_PART_FLAGS: 7429 case (int)ScriptBaseClass.PSYS_PART_FLAGS:
6846 prules.PartDataFlags = (Primitive.ParticleSystem.ParticleDataFlags)(uint)rules.GetLSLIntegerItem(i + 1); 7430 try
7431 {
7432 prules.PartDataFlags = (Primitive.ParticleSystem.ParticleDataFlags)(uint)rules.GetLSLIntegerItem(i + 1);
7433 }
7434 catch(InvalidCastException)
7435 {
7436 Error(originFunc, string.Format("Error running rule PSYS_PART_FLAGS: arg #{0} - parameter 1 must be integer", i + 1));
7437 return;
7438 }
6847 break; 7439 break;
6848 7440
6849 case (int)ScriptBaseClass.PSYS_PART_START_COLOR: 7441 case (int)ScriptBaseClass.PSYS_PART_START_COLOR:
6850 tempv = rules.GetVector3Item(i + 1); 7442 try
7443 {
7444 tempv = rules.GetVector3Item(i + 1);
7445 }
7446 catch(InvalidCastException)
7447 {
7448 Error(originFunc, string.Format("Error running rule PSYS_PART_START_COLOR: arg #{0} - parameter 1 must be vector", i + 1));
7449 return;
7450 }
6851 prules.PartStartColor.R = (float)tempv.x; 7451 prules.PartStartColor.R = (float)tempv.x;
6852 prules.PartStartColor.G = (float)tempv.y; 7452 prules.PartStartColor.G = (float)tempv.y;
6853 prules.PartStartColor.B = (float)tempv.z; 7453 prules.PartStartColor.B = (float)tempv.z;
6854 break; 7454 break;
6855 7455
6856 case (int)ScriptBaseClass.PSYS_PART_START_ALPHA: 7456 case (int)ScriptBaseClass.PSYS_PART_START_ALPHA:
6857 tempf = (float)rules.GetLSLFloatItem(i + 1); 7457 try
7458 {
7459 tempf = (float)rules.GetLSLFloatItem(i + 1);
7460 }
7461 catch(InvalidCastException)
7462 {
7463 Error(originFunc, string.Format("Error running rule PSYS_PART_START_ALPHA: arg #{0} - parameter 1 must be float", i + 1));
7464 return;
7465 }
6858 prules.PartStartColor.A = tempf; 7466 prules.PartStartColor.A = tempf;
6859 break; 7467 break;
6860 7468
6861 case (int)ScriptBaseClass.PSYS_PART_END_COLOR: 7469 case (int)ScriptBaseClass.PSYS_PART_END_COLOR:
6862 tempv = rules.GetVector3Item(i + 1); 7470 try
7471 {
7472 tempv = rules.GetVector3Item(i + 1);
7473 }
7474 catch(InvalidCastException)
7475 {
7476 Error(originFunc, string.Format("Error running rule PSYS_PART_END_COLOR: arg #{0} - parameter 1 must be vector", i + 1));
7477 return;
7478 }
6863 prules.PartEndColor.R = (float)tempv.x; 7479 prules.PartEndColor.R = (float)tempv.x;
6864 prules.PartEndColor.G = (float)tempv.y; 7480 prules.PartEndColor.G = (float)tempv.y;
6865 prules.PartEndColor.B = (float)tempv.z; 7481 prules.PartEndColor.B = (float)tempv.z;
6866 break; 7482 break;
6867 7483
6868 case (int)ScriptBaseClass.PSYS_PART_END_ALPHA: 7484 case (int)ScriptBaseClass.PSYS_PART_END_ALPHA:
6869 tempf = (float)rules.GetLSLFloatItem(i + 1); 7485 try
7486 {
7487 tempf = (float)rules.GetLSLFloatItem(i + 1);
7488 }
7489 catch(InvalidCastException)
7490 {
7491 Error(originFunc, string.Format("Error running rule PSYS_PART_END_ALPHA: arg #{0} - parameter 1 must be float", i + 1));
7492 return;
7493 }
6870 prules.PartEndColor.A = tempf; 7494 prules.PartEndColor.A = tempf;
6871 break; 7495 break;
6872 7496
6873 case (int)ScriptBaseClass.PSYS_PART_START_SCALE: 7497 case (int)ScriptBaseClass.PSYS_PART_START_SCALE:
6874 tempv = rules.GetVector3Item(i + 1); 7498 try
6875 prules.PartStartScaleX = (float)tempv.x; 7499 {
6876 prules.PartStartScaleY = (float)tempv.y; 7500 tempv = rules.GetVector3Item(i + 1);
7501 }
7502 catch(InvalidCastException)
7503 {
7504 Error(originFunc, string.Format("Error running rule PSYS_PART_START_SCALE: arg #{0} - parameter 1 must be vector", i + 1));
7505 return;
7506 }
7507 prules.PartStartScaleX = validParticleScale((float)tempv.x);
7508 prules.PartStartScaleY = validParticleScale((float)tempv.y);
6877 break; 7509 break;
6878 7510
6879 case (int)ScriptBaseClass.PSYS_PART_END_SCALE: 7511 case (int)ScriptBaseClass.PSYS_PART_END_SCALE:
6880 tempv = rules.GetVector3Item(i + 1); 7512 try
6881 prules.PartEndScaleX = (float)tempv.x; 7513 {
6882 prules.PartEndScaleY = (float)tempv.y; 7514 tempv = rules.GetVector3Item(i + 1);
7515 }
7516 catch(InvalidCastException)
7517 {
7518 Error(originFunc, string.Format("Error running rule PSYS_PART_END_SCALE: arg #{0} - parameter 1 must be vector", i + 1));
7519 return;
7520 }
7521 prules.PartEndScaleX = validParticleScale((float)tempv.x);
7522 prules.PartEndScaleY = validParticleScale((float)tempv.y);
6883 break; 7523 break;
6884 7524
6885 case (int)ScriptBaseClass.PSYS_PART_MAX_AGE: 7525 case (int)ScriptBaseClass.PSYS_PART_MAX_AGE:
6886 tempf = (float)rules.GetLSLFloatItem(i + 1); 7526 try
7527 {
7528 tempf = (float)rules.GetLSLFloatItem(i + 1);
7529 }
7530 catch(InvalidCastException)
7531 {
7532 Error(originFunc, string.Format("Error running rule PSYS_PART_MAX_AGE: arg #{0} - parameter 1 must be float", i + 1));
7533 return;
7534 }
6887 prules.PartMaxAge = tempf; 7535 prules.PartMaxAge = tempf;
6888 break; 7536 break;
6889 7537
6890 case (int)ScriptBaseClass.PSYS_SRC_ACCEL: 7538 case (int)ScriptBaseClass.PSYS_SRC_ACCEL:
6891 tempv = rules.GetVector3Item(i + 1); 7539 try
7540 {
7541 tempv = rules.GetVector3Item(i + 1);
7542 }
7543 catch(InvalidCastException)
7544 {
7545 Error(originFunc, string.Format("Error running rule PSYS_SRC_ACCEL: arg #{0} - parameter 1 must be vector", i + 1));
7546 return;
7547 }
6892 prules.PartAcceleration.X = (float)tempv.x; 7548 prules.PartAcceleration.X = (float)tempv.x;
6893 prules.PartAcceleration.Y = (float)tempv.y; 7549 prules.PartAcceleration.Y = (float)tempv.y;
6894 prules.PartAcceleration.Z = (float)tempv.z; 7550 prules.PartAcceleration.Z = (float)tempv.z;
6895 break; 7551 break;
6896 7552
6897 case (int)ScriptBaseClass.PSYS_SRC_PATTERN: 7553 case (int)ScriptBaseClass.PSYS_SRC_PATTERN:
6898 tmpi = (int)rules.GetLSLIntegerItem(i + 1); 7554 try
7555 {
7556 tmpi = (int)rules.GetLSLIntegerItem(i + 1);
7557 }
7558 catch(InvalidCastException)
7559 {
7560 Error(originFunc, string.Format("Error running rule PSYS_SRC_PATTERN: arg #{0} - parameter 1 must be integer", i + 1));
7561 return;
7562 }
6899 prules.Pattern = (Primitive.ParticleSystem.SourcePattern)tmpi; 7563 prules.Pattern = (Primitive.ParticleSystem.SourcePattern)tmpi;
6900 break; 7564 break;
6901 7565
@@ -6904,67 +7568,171 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6904 // client tells the difference between the two by looking at the 0x02 bit in 7568 // client tells the difference between the two by looking at the 0x02 bit in
6905 // the PartFlags variable. 7569 // the PartFlags variable.
6906 case (int)ScriptBaseClass.PSYS_SRC_INNERANGLE: 7570 case (int)ScriptBaseClass.PSYS_SRC_INNERANGLE:
6907 tempf = (float)rules.GetLSLFloatItem(i + 1); 7571 try
7572 {
7573 tempf = (float)rules.GetLSLFloatItem(i + 1);
7574 }
7575 catch(InvalidCastException)
7576 {
7577 Error(originFunc, string.Format("Error running rule PSYS_SRC_INNERANGLE: arg #{0} - parameter 1 must be float", i + 1));
7578 return;
7579 }
6908 prules.InnerAngle = (float)tempf; 7580 prules.InnerAngle = (float)tempf;
6909 prules.PartFlags &= 0xFFFFFFFD; // Make sure new angle format is off. 7581 prules.PartFlags &= 0xFFFFFFFD; // Make sure new angle format is off.
6910 break; 7582 break;
6911 7583
6912 case (int)ScriptBaseClass.PSYS_SRC_OUTERANGLE: 7584 case (int)ScriptBaseClass.PSYS_SRC_OUTERANGLE:
6913 tempf = (float)rules.GetLSLFloatItem(i + 1); 7585 try
7586 {
7587 tempf = (float)rules.GetLSLFloatItem(i + 1);
7588 }
7589 catch(InvalidCastException)
7590 {
7591 Error(originFunc, string.Format("Error running rule PSYS_SRC_OUTERANGLE: arg #{0} - parameter 1 must be float", i + 1));
7592 return;
7593 }
6914 prules.OuterAngle = (float)tempf; 7594 prules.OuterAngle = (float)tempf;
6915 prules.PartFlags &= 0xFFFFFFFD; // Make sure new angle format is off. 7595 prules.PartFlags &= 0xFFFFFFFD; // Make sure new angle format is off.
6916 break; 7596 break;
6917 7597
6918 case (int)ScriptBaseClass.PSYS_PART_BLEND_FUNC_SOURCE: 7598 case (int)ScriptBaseClass.PSYS_PART_BLEND_FUNC_SOURCE:
6919 tmpi = (int)rules.GetLSLIntegerItem(i + 1); 7599 try
7600 {
7601 tmpi = (int)rules.GetLSLIntegerItem(i + 1);
7602 }
7603 catch(InvalidCastException)
7604 {
7605 Error(originFunc, string.Format("Error running rule PSYS_PART_BLEND_FUNC_SOURCE: arg #{0} - parameter 1 must be integer", i + 1));
7606 return;
7607 }
6920 prules.BlendFuncSource = (byte)tmpi; 7608 prules.BlendFuncSource = (byte)tmpi;
6921 break; 7609 break;
6922 7610
6923 case (int)ScriptBaseClass.PSYS_PART_BLEND_FUNC_DEST: 7611 case (int)ScriptBaseClass.PSYS_PART_BLEND_FUNC_DEST:
6924 tmpi = (int)rules.GetLSLIntegerItem(i + 1); 7612 try
7613 {
7614 tmpi = (int)rules.GetLSLIntegerItem(i + 1);
7615 }
7616 catch(InvalidCastException)
7617 {
7618 Error(originFunc, string.Format("Error running rule PSYS_PART_BLEND_FUNC_DEST: arg #{0} - parameter 1 must be integer", i + 1));
7619 return;
7620 }
6925 prules.BlendFuncDest = (byte)tmpi; 7621 prules.BlendFuncDest = (byte)tmpi;
6926 break; 7622 break;
6927 7623
6928 case (int)ScriptBaseClass.PSYS_PART_START_GLOW: 7624 case (int)ScriptBaseClass.PSYS_PART_START_GLOW:
6929 tempf = (float)rules.GetLSLFloatItem(i + 1); 7625 try
7626 {
7627 tempf = (float)rules.GetLSLFloatItem(i + 1);
7628 }
7629 catch(InvalidCastException)
7630 {
7631 Error(originFunc, string.Format("Error running rule PSYS_PART_START_GLOW: arg #{0} - parameter 1 must be float", i + 1));
7632 return;
7633 }
6930 prules.PartStartGlow = (float)tempf; 7634 prules.PartStartGlow = (float)tempf;
6931 break; 7635 break;
6932 7636
6933 case (int)ScriptBaseClass.PSYS_PART_END_GLOW: 7637 case (int)ScriptBaseClass.PSYS_PART_END_GLOW:
6934 tempf = (float)rules.GetLSLFloatItem(i + 1); 7638 try
7639 {
7640 tempf = (float)rules.GetLSLFloatItem(i + 1);
7641 }
7642 catch(InvalidCastException)
7643 {
7644 Error(originFunc, string.Format("Error running rule PSYS_PART_END_GLOW: arg #{0} - parameter 1 must be float", i + 1));
7645 return;
7646 }
6935 prules.PartEndGlow = (float)tempf; 7647 prules.PartEndGlow = (float)tempf;
6936 break; 7648 break;
6937 7649
6938 case (int)ScriptBaseClass.PSYS_SRC_TEXTURE: 7650 case (int)ScriptBaseClass.PSYS_SRC_TEXTURE:
6939 prules.Texture = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, rules.GetLSLStringItem(i + 1)); 7651 try
7652 {
7653 prules.Texture = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, rules.GetLSLStringItem(i + 1));
7654 }
7655 catch(InvalidCastException)
7656 {
7657 Error(originFunc, string.Format("Error running rule PSYS_SRC_TEXTURE: arg #{0} - parameter 1 must be string or key", i + 1));
7658 return;
7659 }
6940 break; 7660 break;
6941 7661
6942 case (int)ScriptBaseClass.PSYS_SRC_BURST_RATE: 7662 case (int)ScriptBaseClass.PSYS_SRC_BURST_RATE:
6943 tempf = (float)rules.GetLSLFloatItem(i + 1); 7663 try
7664 {
7665 tempf = (float)rules.GetLSLFloatItem(i + 1);
7666 }
7667 catch(InvalidCastException)
7668 {
7669 Error(originFunc, string.Format("Error running rule PSYS_SRC_BURST_RATE: arg #{0} - parameter 1 must be float", i + 1));
7670 return;
7671 }
6944 prules.BurstRate = (float)tempf; 7672 prules.BurstRate = (float)tempf;
6945 break; 7673 break;
6946 7674
6947 case (int)ScriptBaseClass.PSYS_SRC_BURST_PART_COUNT: 7675 case (int)ScriptBaseClass.PSYS_SRC_BURST_PART_COUNT:
6948 prules.BurstPartCount = (byte)(int)rules.GetLSLIntegerItem(i + 1); 7676 try
7677 {
7678 prules.BurstPartCount = (byte)(int)rules.GetLSLIntegerItem(i + 1);
7679 }
7680 catch(InvalidCastException)
7681 {
7682 Error(originFunc, string.Format("Error running rule PSYS_SRC_BURST_PART_COUNT: arg #{0} - parameter 1 must be integer", i + 1));
7683 return;
7684 }
6949 break; 7685 break;
6950 7686
6951 case (int)ScriptBaseClass.PSYS_SRC_BURST_RADIUS: 7687 case (int)ScriptBaseClass.PSYS_SRC_BURST_RADIUS:
6952 tempf = (float)rules.GetLSLFloatItem(i + 1); 7688 try
7689 {
7690 tempf = (float)rules.GetLSLFloatItem(i + 1);
7691 }
7692 catch(InvalidCastException)
7693 {
7694 Error(originFunc, string.Format("Error running rule PSYS_SRC_BURST_RADIUS: arg #{0} - parameter 1 must be float", i + 1));
7695 return;
7696 }
6953 prules.BurstRadius = (float)tempf; 7697 prules.BurstRadius = (float)tempf;
6954 break; 7698 break;
6955 7699
6956 case (int)ScriptBaseClass.PSYS_SRC_BURST_SPEED_MIN: 7700 case (int)ScriptBaseClass.PSYS_SRC_BURST_SPEED_MIN:
6957 tempf = (float)rules.GetLSLFloatItem(i + 1); 7701 try
7702 {
7703 tempf = (float)rules.GetLSLFloatItem(i + 1);
7704 }
7705 catch(InvalidCastException)
7706 {
7707 Error(originFunc, string.Format("Error running rule PSYS_SRC_BURST_SPEED_MIN: arg #{0} - parameter 1 must be float", i + 1));
7708 return;
7709 }
6958 prules.BurstSpeedMin = (float)tempf; 7710 prules.BurstSpeedMin = (float)tempf;
6959 break; 7711 break;
6960 7712
6961 case (int)ScriptBaseClass.PSYS_SRC_BURST_SPEED_MAX: 7713 case (int)ScriptBaseClass.PSYS_SRC_BURST_SPEED_MAX:
6962 tempf = (float)rules.GetLSLFloatItem(i + 1); 7714 try
7715 {
7716 tempf = (float)rules.GetLSLFloatItem(i + 1);
7717 }
7718 catch(InvalidCastException)
7719 {
7720 Error(originFunc, string.Format("Error running rule PSYS_SRC_BURST_SPEED_MAX: arg #{0} - parameter 1 must be float", i + 1));
7721 return;
7722 }
6963 prules.BurstSpeedMax = (float)tempf; 7723 prules.BurstSpeedMax = (float)tempf;
6964 break; 7724 break;
6965 7725
6966 case (int)ScriptBaseClass.PSYS_SRC_MAX_AGE: 7726 case (int)ScriptBaseClass.PSYS_SRC_MAX_AGE:
6967 tempf = (float)rules.GetLSLFloatItem(i + 1); 7727 try
7728 {
7729 tempf = (float)rules.GetLSLFloatItem(i + 1);
7730 }
7731 catch(InvalidCastException)
7732 {
7733 Error(originFunc, string.Format("Error running rule PSYS_SRC_MAX_AGE: arg #{0} - parameter 1 must be float", i + 1));
7734 return;
7735 }
6968 prules.MaxAge = (float)tempf; 7736 prules.MaxAge = (float)tempf;
6969 break; 7737 break;
6970 7738
@@ -6982,20 +7750,44 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6982 7750
6983 case (int)ScriptBaseClass.PSYS_SRC_OMEGA: 7751 case (int)ScriptBaseClass.PSYS_SRC_OMEGA:
6984 // AL: This is an assumption, since it is the only thing that would match. 7752 // AL: This is an assumption, since it is the only thing that would match.
6985 tempv = rules.GetVector3Item(i + 1); 7753 try
7754 {
7755 tempv = rules.GetVector3Item(i + 1);
7756 }
7757 catch(InvalidCastException)
7758 {
7759 Error(originFunc, string.Format("Error running rule PSYS_SRC_OMEGA: arg #{0} - parameter 1 must be vector", i + 1));
7760 return;
7761 }
6986 prules.AngularVelocity.X = (float)tempv.x; 7762 prules.AngularVelocity.X = (float)tempv.x;
6987 prules.AngularVelocity.Y = (float)tempv.y; 7763 prules.AngularVelocity.Y = (float)tempv.y;
6988 prules.AngularVelocity.Z = (float)tempv.z; 7764 prules.AngularVelocity.Z = (float)tempv.z;
6989 break; 7765 break;
6990 7766
6991 case (int)ScriptBaseClass.PSYS_SRC_ANGLE_BEGIN: 7767 case (int)ScriptBaseClass.PSYS_SRC_ANGLE_BEGIN:
6992 tempf = (float)rules.GetLSLFloatItem(i + 1); 7768 try
7769 {
7770 tempf = (float)rules.GetLSLFloatItem(i + 1);
7771 }
7772 catch(InvalidCastException)
7773 {
7774 Error(originFunc, string.Format("Error running rule PSYS_SRC_ANGLE_BEGIN: arg #{0} - parameter 1 must be float", i + 1));
7775 return;
7776 }
6993 prules.InnerAngle = (float)tempf; 7777 prules.InnerAngle = (float)tempf;
6994 prules.PartFlags |= 0x02; // Set new angle format. 7778 prules.PartFlags |= 0x02; // Set new angle format.
6995 break; 7779 break;
6996 7780
6997 case (int)ScriptBaseClass.PSYS_SRC_ANGLE_END: 7781 case (int)ScriptBaseClass.PSYS_SRC_ANGLE_END:
6998 tempf = (float)rules.GetLSLFloatItem(i + 1); 7782 try
7783 {
7784 tempf = (float)rules.GetLSLFloatItem(i + 1);
7785 }
7786 catch (InvalidCastException)
7787 {
7788 Error(originFunc, string.Format("Error running rule PSYS_SRC_ANGLE_END: arg #{0} - parameter 1 must be float", i + 1));
7789 return;
7790 }
6999 prules.OuterAngle = (float)tempf; 7791 prules.OuterAngle = (float)tempf;
7000 prules.PartFlags |= 0x02; // Set new angle format. 7792 prules.PartFlags |= 0x02; // Set new angle format.
7001 break; 7793 break;
@@ -7010,6 +7802,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7010 part.SendFullUpdateToAllClients(); 7802 part.SendFullUpdateToAllClients();
7011 } 7803 }
7012 7804
7805 private float validParticleScale(float value)
7806 {
7807 if (value > 4.0f) return 4.0f;
7808 return value;
7809 }
7810
7013 public void llGroundRepel(double height, int water, double tau) 7811 public void llGroundRepel(double height, int water, double tau)
7014 { 7812 {
7015 m_host.AddScriptLPS(1); 7813 m_host.AddScriptLPS(1);
@@ -7249,7 +8047,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7249 World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land); 8047 World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land);
7250 } 8048 }
7251 } 8049 }
7252 ScriptSleep(100); 8050 ScriptSleep(m_sleepMsOnAddToLandPassList);
7253 } 8051 }
7254 8052
7255 public void llSetTouchText(string text) 8053 public void llSetTouchText(string text)
@@ -7268,12 +8066,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7268 { 8066 {
7269 m_host.AddScriptLPS(1); 8067 m_host.AddScriptLPS(1);
7270 m_host.SetCameraEyeOffset(offset); 8068 m_host.SetCameraEyeOffset(offset);
8069
8070 if (m_host.ParentGroup.RootPart.GetCameraEyeOffset() == Vector3.Zero)
8071 m_host.ParentGroup.RootPart.SetCameraEyeOffset(offset);
7271 } 8072 }
7272 8073
7273 public void llSetCameraAtOffset(LSL_Vector offset) 8074 public void llSetCameraAtOffset(LSL_Vector offset)
7274 { 8075 {
7275 m_host.AddScriptLPS(1); 8076 m_host.AddScriptLPS(1);
7276 m_host.SetCameraAtOffset(offset); 8077 m_host.SetCameraAtOffset(offset);
8078
8079 if (m_host.ParentGroup.RootPart.GetCameraAtOffset() == Vector3.Zero)
8080 m_host.ParentGroup.RootPart.SetCameraAtOffset(offset);
7277 } 8081 }
7278 8082
7279 public void llSetLinkCamera(LSL_Integer link, LSL_Vector eye, LSL_Vector at) 8083 public void llSetLinkCamera(LSL_Integer link, LSL_Vector eye, LSL_Vector at)
@@ -7348,16 +8152,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7348 UUID av = new UUID(); 8152 UUID av = new UUID();
7349 if (!UUID.TryParse(avatar,out av)) 8153 if (!UUID.TryParse(avatar,out av))
7350 { 8154 {
8155<<<<<<< HEAD
8156 Error("llDialog", "First parameter must be a key");
8157=======
7351 //LSLError("First parameter to llDialog needs to be a key"); 8158 //LSLError("First parameter to llDialog needs to be a key");
8159>>>>>>> avn/ubitvar
7352 return; 8160 return;
7353 } 8161 }
7354 if (buttons.Length < 1) 8162 if (buttons.Length < 1)
7355 { 8163 {
8164<<<<<<< HEAD
8165 Error("llDialog", "At least 1 button must be shown");
8166 return;
8167 }
8168 if (buttons.Length > 12)
8169 {
8170 Error("llDialog", "No more than 12 buttons can be shown");
8171 return;
8172=======
7356 buttons.Add("OK"); 8173 buttons.Add("OK");
7357 } 8174 }
7358 if (buttons.Length > 12) 8175 if (buttons.Length > 12)
7359 { 8176 {
7360 ShoutError("button list too long, must be 12 or fewer entries"); 8177 ShoutError("button list too long, must be 12 or fewer entries");
8178>>>>>>> avn/ubitvar
7361 } 8179 }
7362 int length = buttons.Length; 8180 int length = buttons.Length;
7363 if (length > 12) 8181 if (length > 12)
@@ -7368,12 +8186,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7368 { 8186 {
7369 if (buttons.Data[i].ToString() == String.Empty) 8187 if (buttons.Data[i].ToString() == String.Empty)
7370 { 8188 {
8189<<<<<<< HEAD
8190 Error("llDialog", "Button label cannot be blank");
8191=======
7371 ShoutError("button label cannot be blank"); 8192 ShoutError("button label cannot be blank");
8193>>>>>>> avn/ubitvar
7372 return; 8194 return;
7373 } 8195 }
7374 if (buttons.Data[i].ToString().Length > 24) 8196 if (buttons.Data[i].ToString().Length > 24)
7375 { 8197 {
8198<<<<<<< HEAD
8199 Error("llDialog", "Button label cannot be longer than 24 characters");
8200=======
7376 ShoutError("button label cannot be longer than 24 characters"); 8201 ShoutError("button label cannot be longer than 24 characters");
8202>>>>>>> avn/ubitvar
7377 return; 8203 return;
7378 } 8204 }
7379 buts[i] = buttons.Data[i].ToString(); 8205 buts[i] = buttons.Data[i].ToString();
@@ -7383,7 +8209,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7383 av, m_host.Name, m_host.UUID, m_host.OwnerID, 8209 av, m_host.Name, m_host.UUID, m_host.OwnerID,
7384 message, new UUID("00000000-0000-2222-3333-100000001000"), chat_channel, buts); 8210 message, new UUID("00000000-0000-2222-3333-100000001000"), chat_channel, buts);
7385 8211
7386 ScriptSleep(1000); 8212 ScriptSleep(m_sleepMsOnDialog);
7387 } 8213 }
7388 8214
7389 public void llVolumeDetect(int detect) 8215 public void llVolumeDetect(int detect)
@@ -7394,16 +8220,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7394 m_host.ParentGroup.ScriptSetVolumeDetect(detect != 0); 8220 m_host.ParentGroup.ScriptSetVolumeDetect(detect != 0);
7395 } 8221 }
7396 8222
7397 /// <summary>
7398 /// This is a depecated function so this just replicates the result of
7399 /// invoking it in SL
7400 /// </summary>
7401 public void llRemoteLoadScript(string target, string name, int running, int start_param) 8223 public void llRemoteLoadScript(string target, string name, int running, int start_param)
7402 { 8224 {
7403 m_host.AddScriptLPS(1); 8225 m_host.AddScriptLPS(1);
7404 // Report an error as it does in SL 8226 Deprecated("llRemoteLoadScript", "Use llRemoteLoadScriptPin instead");
7405 ShoutError("Deprecated. Please use llRemoteLoadScriptPin instead."); 8227 ScriptSleep(m_sleepMsOnRemoteLoadScript);
7406 ScriptSleep(3000);
7407 } 8228 }
7408 8229
7409 public void llSetRemoteScriptAccessPin(int pin) 8230 public void llSetRemoteScriptAccessPin(int pin)
@@ -7420,7 +8241,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7420 8241
7421 if (!UUID.TryParse(target, out destId)) 8242 if (!UUID.TryParse(target, out destId))
7422 { 8243 {
7423 llSay(0, "Could not parse key " + target); 8244 Error("llRemoteLoadScriptPin", "Can't parse key '" + target + "'");
7424 return; 8245 return;
7425 } 8246 }
7426 8247
@@ -7436,7 +8257,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7436 // make sure the object is a script 8257 // make sure the object is a script
7437 if (item == null || item.Type != 10) 8258 if (item == null || item.Type != 10)
7438 { 8259 {
7439 llSay(0, "Could not find script " + name); 8260 Error("llRemoteLoadScriptPin", "Can't find script '" + name + "'");
7440 return; 8261 return;
7441 } 8262 }
7442 8263
@@ -7453,7 +8274,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7453 } 8274 }
7454 } 8275 }
7455 // this will cause the delay even if the script pin or permissions were wrong - seems ok 8276 // this will cause the delay even if the script pin or permissions were wrong - seems ok
7456 ScriptSleep(3000); 8277 ScriptSleep(m_sleepMsOnRemoteLoadScriptPin);
7457 } 8278 }
7458 8279
7459 public void llOpenRemoteDataChannel() 8280 public void llOpenRemoteDataChannel()
@@ -7484,14 +8305,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7484 m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams("remote_data", resobj, 8305 m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams("remote_data", resobj,
7485 new DetectParams[0])); 8306 new DetectParams[0]));
7486 } 8307 }
7487 ScriptSleep(1000); 8308 ScriptSleep(m_sleepMsOnOpenRemoteDataChannel);
7488 } 8309 }
7489 8310
7490 public LSL_String llSendRemoteData(string channel, string dest, int idata, string sdata) 8311 public LSL_String llSendRemoteData(string channel, string dest, int idata, string sdata)
7491 { 8312 {
7492 m_host.AddScriptLPS(1); 8313 m_host.AddScriptLPS(1);
7493 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 8314 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
7494 ScriptSleep(3000); 8315 ScriptSleep(m_sleepMsOnSendRemoteData);
7495 if (xmlrpcMod == null) 8316 if (xmlrpcMod == null)
7496 return ""; 8317 return "";
7497 return (xmlrpcMod.SendRemoteData(m_host.LocalId, m_item.ItemID, channel, dest, idata, sdata)).ToString(); 8318 return (xmlrpcMod.SendRemoteData(m_host.LocalId, m_item.ItemID, channel, dest, idata, sdata)).ToString();
@@ -7503,7 +8324,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7503 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 8324 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
7504 if (xmlrpcMod != null) 8325 if (xmlrpcMod != null)
7505 xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata); 8326 xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata);
7506 ScriptSleep(3000); 8327 ScriptSleep(m_sleepMsOnRemoteDataReply);
7507 } 8328 }
7508 8329
7509 public void llCloseRemoteDataChannel(string channel) 8330 public void llCloseRemoteDataChannel(string channel)
@@ -7519,7 +8340,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7519 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 8340 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
7520 if (xmlrpcMod != null) 8341 if (xmlrpcMod != null)
7521 xmlrpcMod.CloseXMLRPCChannel((UUID)channel); 8342 xmlrpcMod.CloseXMLRPCChannel((UUID)channel);
7522 ScriptSleep(1000); 8343 ScriptSleep(m_sleepMsOnCloseRemoteDataChannel);
7523 } 8344 }
7524 8345
7525 public LSL_String llMD5String(string src, int nonce) 8346 public LSL_String llMD5String(string src, int nonce)
@@ -7567,13 +8388,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7567 { 8388 {
7568 cut.y = 1f; 8389 cut.y = 1f;
7569 } 8390 }
7570 if (cut.y - cut.x < 0.05f) 8391 if (cut.y - cut.x < 0.02f)
7571 { 8392 {
7572 cut.x = cut.y - 0.05f; 8393 cut.x = cut.y - 0.02f;
7573 if (cut.x < 0.0f) 8394 if (cut.x < 0.0f)
7574 { 8395 {
7575 cut.x = 0.0f; 8396 cut.x = 0.0f;
7576 cut.y = 0.05f; 8397 cut.y = 0.02f;
7577 } 8398 }
7578 } 8399 }
7579 shapeBlock.ProfileBegin = (ushort)(50000 * cut.x); 8400 shapeBlock.ProfileBegin = (ushort)(50000 * cut.x);
@@ -7595,12 +8416,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7595 hollow = 0.70f; 8416 hollow = 0.70f;
7596 } 8417 }
7597 } 8418 }
7598 // Otherwise, hollow is limited to 95%. 8419 // Otherwise, hollow is limited to 99%.
7599 else 8420 else
7600 { 8421 {
7601 if (hollow > 0.95f) 8422 if (hollow > 0.99f)
7602 { 8423 {
7603 hollow = 0.95f; 8424 hollow = 0.99f;
7604 } 8425 }
7605 } 8426 }
7606 shapeBlock.ProfileHollow = (ushort)(50000 * hollow); 8427 shapeBlock.ProfileHollow = (ushort)(50000 * hollow);
@@ -7730,9 +8551,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7730 { 8551 {
7731 dimple.y = 1f; 8552 dimple.y = 1f;
7732 } 8553 }
7733 if (dimple.y - cut.x < 0.05f) 8554 if (dimple.y - dimple.x < 0.02f)
7734 { 8555 {
7735 dimple.x = cut.y - 0.05f; 8556 dimple.x = dimple.y - 0.02f;
8557 if (dimple.x < 0.0f)
8558 {
8559 dimple.x = 0.0f;
8560 dimple.y = 0.02f;
8561 }
7736 } 8562 }
7737 shapeBlock.ProfileBegin = (ushort)(50000 * dimple.x); 8563 shapeBlock.ProfileBegin = (ushort)(50000 * dimple.x);
7738 shapeBlock.ProfileEnd = (ushort)(50000 * (1 - dimple.y)); 8564 shapeBlock.ProfileEnd = (ushort)(50000 * (1 - dimple.y));
@@ -7756,17 +8582,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7756 shapeBlock.PathBegin = shapeBlock.ProfileBegin; 8582 shapeBlock.PathBegin = shapeBlock.ProfileBegin;
7757 shapeBlock.PathEnd = shapeBlock.ProfileEnd; 8583 shapeBlock.PathEnd = shapeBlock.ProfileEnd;
7758 8584
7759 if (holesize.x < 0.05f) 8585 if (holesize.x < 0.01f)
7760 { 8586 {
7761 holesize.x = 0.05f; 8587 holesize.x = 0.01f;
7762 } 8588 }
7763 if (holesize.x > 1f) 8589 if (holesize.x > 1f)
7764 { 8590 {
7765 holesize.x = 1f; 8591 holesize.x = 1f;
7766 } 8592 }
7767 if (holesize.y < 0.05f) 8593 if (holesize.y < 0.01f)
7768 { 8594 {
7769 holesize.y = 0.05f; 8595 holesize.y = 0.01f;
7770 } 8596 }
7771 if (holesize.y > 0.5f) 8597 if (holesize.y > 0.5f)
7772 { 8598 {
@@ -7812,13 +8638,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7812 { 8638 {
7813 profilecut.y = 1f; 8639 profilecut.y = 1f;
7814 } 8640 }
7815 if (profilecut.y - profilecut.x < 0.05f) 8641 if (profilecut.y - profilecut.x < 0.02f)
7816 { 8642 {
7817 profilecut.x = profilecut.y - 0.05f; 8643 profilecut.x = profilecut.y - 0.02f;
7818 if (profilecut.x < 0.0f) 8644 if (profilecut.x < 0.0f)
7819 { 8645 {
7820 profilecut.x = 0.0f; 8646 profilecut.x = 0.0f;
7821 profilecut.y = 0.05f; 8647 profilecut.y = 0.02f;
7822 } 8648 }
7823 } 8649 }
7824 shapeBlock.ProfileBegin = (ushort)(50000 * profilecut.x); 8650 shapeBlock.ProfileBegin = (ushort)(50000 * profilecut.x);
@@ -7919,18 +8745,36 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7919 { 8745 {
7920 m_host.AddScriptLPS(1); 8746 m_host.AddScriptLPS(1);
7921 8747
7922 setLinkPrimParams(ScriptBaseClass.LINK_THIS, rules, "llSetPrimitiveParams"); 8748 SetLinkPrimParams(ScriptBaseClass.LINK_THIS, rules, "llSetPrimitiveParams");
7923 8749
7924 ScriptSleep(200); 8750 ScriptSleep(m_sleepMsOnSetPrimitiveParams);
7925 } 8751 }
7926 8752
8753<<<<<<< HEAD
8754 public void llSetLinkPrimitiveParams(int linknumber, LSL_List rules)
8755 {
8756 m_host.AddScriptLPS(1);
8757
8758 SetLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParams");
8759
8760 ScriptSleep(m_sleepMsOnSetLinkPrimitiveParams);
8761 }
8762
8763=======
8764>>>>>>> avn/ubitvar
7927 public void llSetLinkPrimitiveParamsFast(int linknumber, LSL_List rules) 8765 public void llSetLinkPrimitiveParamsFast(int linknumber, LSL_List rules)
7928 { 8766 {
7929 m_host.AddScriptLPS(1); 8767 m_host.AddScriptLPS(1);
7930 8768
7931 setLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParamsFast"); 8769 SetLinkPrimParams(linknumber, rules, "llSetLinkPrimitiveParamsFast");
7932 } 8770 }
7933 8771
8772<<<<<<< HEAD
8773 protected void SetLinkPrimParams(int linknumber, LSL_List rules, string originFunc)
8774 {
8775 SetEntityParams(GetLinkEntities(linknumber), rules, originFunc);
8776 }
8777=======
7934 private void setLinkPrimParams(int linknumber, LSL_List rules, string originFunc) 8778 private void setLinkPrimParams(int linknumber, LSL_List rules, string originFunc)
7935 { 8779 {
7936 List<object> parts = new List<object>(); 8780 List<object> parts = new List<object>();
@@ -7940,11 +8784,61 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7940 parts.Add(p); 8784 parts.Add(p);
7941 foreach (ScenePresence p in avatars) 8785 foreach (ScenePresence p in avatars)
7942 parts.Add(p); 8786 parts.Add(p);
8787>>>>>>> avn/ubitvar
7943 8788
7944 LSL_List remaining = null; 8789 protected void SetEntityParams(List<ISceneEntity> entities, LSL_List rules, string originFunc)
8790 {
8791 LSL_List remaining = new LSL_List();
7945 uint rulesParsed = 0; 8792 uint rulesParsed = 0;
7946 8793
8794<<<<<<< HEAD
8795 foreach (ISceneEntity entity in entities)
8796 {
8797 if (entity is SceneObjectPart)
8798 remaining = SetPrimParams((SceneObjectPart)entity, rules, originFunc, ref rulesParsed);
8799 else
8800 remaining = SetAgentParams((ScenePresence)entity, rules, originFunc, ref rulesParsed);
8801 }
8802
8803 while (remaining.Length > 2)
8804 {
8805 int linknumber;
8806 try
8807 {
8808 linknumber = remaining.GetLSLIntegerItem(0);
8809 }
8810 catch(InvalidCastException)
8811 {
8812 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_LINK_TARGET: parameter 2 must be integer", rulesParsed));
8813 return;
8814 }
8815
8816 rules = remaining.GetSublist(1, -1);
8817 entities = GetLinkEntities(linknumber);
8818
8819 foreach (ISceneEntity entity in entities)
8820 {
8821 if (entity is SceneObjectPart)
8822 remaining = SetPrimParams((SceneObjectPart)entity, rules, originFunc, ref rulesParsed);
8823 else
8824 remaining = SetAgentParams((ScenePresence)entity, rules, originFunc, ref rulesParsed);
8825 }
8826 }
8827 }
8828
8829 public void llSetKeyframedMotion(LSL_List frames, LSL_List options)
8830 {
8831 SceneObjectGroup group = m_host.ParentGroup;
8832
8833 if (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical)
8834 return;
8835 if (group.IsAttachment)
8836 return;
8837
8838 if (frames.Data.Length > 0) // We are getting a new motion
8839=======
7947 if (parts.Count > 0) 8840 if (parts.Count > 0)
8841>>>>>>> avn/ubitvar
7948 { 8842 {
7949 foreach (object part in parts) 8843 foreach (object part in parts)
7950 { 8844 {
@@ -8078,32 +8972,55 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8078 8972
8079 switch (code) 8973 switch (code)
8080 { 8974 {
8081 case (int)ScriptBaseClass.PRIM_POSITION: 8975 case ScriptBaseClass.PRIM_POSITION:
8082 case (int)ScriptBaseClass.PRIM_POS_LOCAL: 8976 case ScriptBaseClass.PRIM_POS_LOCAL:
8083 if (remain < 1) 8977 if (remain < 1)
8084 return null; 8978 return new LSL_List();
8085 8979
8980<<<<<<< HEAD
8981 try
8982 {
8983 v = rules.GetVector3Item(idx++);
8984 }
8985 catch(InvalidCastException)
8986 {
8987 if(code == ScriptBaseClass.PRIM_POSITION)
8988 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_POSITION: arg #{1} - parameter 1 must be vector", rulesParsed, idx - idxStart - 1));
8989 else
8990 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_POS_LOCAL: arg #{1} - parameter 1 must be vector", rulesParsed, idx - idxStart - 1));
8991 return new LSL_List();
8992 }
8993=======
8086 v=rules.GetVector3Item(idx++); 8994 v=rules.GetVector3Item(idx++);
8087 if (part.IsRoot && !part.ParentGroup.IsAttachment) 8995 if (part.IsRoot && !part.ParentGroup.IsAttachment)
8088 currentPosition = GetSetPosTarget(part, v, currentPosition, true); 8996 currentPosition = GetSetPosTarget(part, v, currentPosition, true);
8089 else 8997 else
8090 currentPosition = GetSetPosTarget(part, v, currentPosition, false); 8998 currentPosition = GetSetPosTarget(part, v, currentPosition, false);
8999>>>>>>> avn/ubitvar
8091 positionChanged = true; 9000 positionChanged = true;
8092 9001
8093 break; 9002 break;
8094 case (int)ScriptBaseClass.PRIM_SIZE: 9003 case ScriptBaseClass.PRIM_SIZE:
8095 if (remain < 1) 9004 if (remain < 1)
8096 return null; 9005 return new LSL_List();
8097 9006
8098 v=rules.GetVector3Item(idx++); 9007 v=rules.GetVector3Item(idx++);
8099 SetScale(part, v); 9008 SetScale(part, v);
8100 9009
8101 break; 9010 break;
8102 case (int)ScriptBaseClass.PRIM_ROTATION: 9011 case ScriptBaseClass.PRIM_ROTATION:
8103 if (remain < 1) 9012 if (remain < 1)
8104 return null; 9013 return new LSL_List();
8105 9014 LSL_Rotation q;
8106 LSL_Rotation q = rules.GetQuaternionItem(idx++); 9015 try
9016 {
9017 q = rules.GetQuaternionItem(idx++);
9018 }
9019 catch(InvalidCastException)
9020 {
9021 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_ROTATION: arg #{1} - parameter 1 must be rotation", rulesParsed, idx - idxStart - 1));
9022 return new LSL_List();
9023 }
8107 // try to let this work as in SL... 9024 // try to let this work as in SL...
8108 if (part.ParentID == 0 || (part.ParentGroup != null && part == part.ParentGroup.RootPart)) 9025 if (part.ParentID == 0 || (part.ParentGroup != null && part == part.ParentGroup.RootPart))
8109 { 9026 {
@@ -8119,11 +9036,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8119 9036
8120 break; 9037 break;
8121 9038
8122 case (int)ScriptBaseClass.PRIM_TYPE: 9039 case ScriptBaseClass.PRIM_TYPE:
8123 if (remain < 3) 9040 if (remain < 3)
8124 return null; 9041 return new LSL_List();
8125 9042
8126 code = (int)rules.GetLSLIntegerItem(idx++); 9043 try
9044 {
9045 code = (int)rules.GetLSLIntegerItem(idx++);
9046 }
9047 catch(InvalidCastException)
9048 {
9049 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE: arg #{1} - parameter 1 must be integer", rulesParsed, idx - idxStart - 1));
9050 return new LSL_List();
9051 }
8127 9052
8128 remain = rules.Length - idx; 9053 remain = rules.Length - idx;
8129 float hollow; 9054 float hollow;
@@ -8138,140 +9063,625 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8138 9063
8139 switch (code) 9064 switch (code)
8140 { 9065 {
8141 case (int)ScriptBaseClass.PRIM_TYPE_BOX: 9066 case ScriptBaseClass.PRIM_TYPE_BOX:
8142 if (remain < 6) 9067 if (remain < 6)
8143 return null; 9068 return new LSL_List();
8144 9069
8145 face = (int)rules.GetLSLIntegerItem(idx++); 9070 try
8146 v = rules.GetVector3Item(idx++); // cut 9071 {
8147 hollow = (float)rules.GetLSLFloatItem(idx++); 9072 face = (int)rules.GetLSLIntegerItem(idx++);
8148 twist = rules.GetVector3Item(idx++); 9073 }
8149 taper_b = rules.GetVector3Item(idx++); 9074 catch(InvalidCastException)
8150 topshear = rules.GetVector3Item(idx++); 9075 {
9076 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_BOX: arg #{1} - parameter 2 must be integer", rulesParsed, idx - idxStart - 1));
9077 return new LSL_List();
9078 }
9079 try
9080 {
9081 v = rules.GetVector3Item(idx++); // cut
9082 }
9083 catch(InvalidCastException)
9084 {
9085 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_BOX: arg #{1} - parameter 3 must be vector", rulesParsed, idx - idxStart - 1));
9086 return new LSL_List();
9087 }
9088 try
9089 {
9090 hollow = (float)rules.GetLSLFloatItem(idx++);
9091 }
9092 catch(InvalidCastException)
9093 {
9094 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_BOX: arg #{1} - parameter 4 must be float", rulesParsed, idx - idxStart - 1));
9095 return new LSL_List();
9096 }
9097 try
9098 {
9099 twist = rules.GetVector3Item(idx++);
9100 }
9101 catch(InvalidCastException)
9102 {
9103 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_BOX: arg #{1} - parameter 5 must be vector", rulesParsed, idx - idxStart - 1));
9104 return new LSL_List();
9105 }
9106 try
9107 {
9108 taper_b = rules.GetVector3Item(idx++);
9109 }
9110 catch(InvalidCastException)
9111 {
9112 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_BOX: arg #{1} - parameter 6 must be vector", rulesParsed, idx - idxStart - 1));
9113 return new LSL_List();
9114 }
9115 try
9116 {
9117 topshear = rules.GetVector3Item(idx++);
9118 }
9119 catch(InvalidCastException)
9120 {
9121 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_BOX: arg #{1} - parameter 7 must be vector", rulesParsed, idx - idxStart - 1));
9122 return new LSL_List();
9123 }
8151 9124
8152 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 9125 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear,
8153 (byte)ProfileShape.Square, (byte)Extrusion.Straight); 9126 (byte)ProfileShape.Square, (byte)Extrusion.Straight);
8154 break; 9127 break;
8155 9128
8156 case (int)ScriptBaseClass.PRIM_TYPE_CYLINDER: 9129 case ScriptBaseClass.PRIM_TYPE_CYLINDER:
8157 if (remain < 6) 9130 if (remain < 6)
8158 return null; 9131 return new LSL_List();
8159 9132
8160 face = (int)rules.GetLSLIntegerItem(idx++); // holeshape 9133 try
8161 v = rules.GetVector3Item(idx++); // cut 9134 {
8162 hollow = (float)rules.GetLSLFloatItem(idx++); 9135 face = (int)rules.GetLSLIntegerItem(idx++); // holeshape
8163 twist = rules.GetVector3Item(idx++); 9136 }
8164 taper_b = rules.GetVector3Item(idx++); 9137 catch(InvalidCastException)
8165 topshear = rules.GetVector3Item(idx++); 9138 {
9139 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_CYLINDER: arg #{1} - parameter 3 must be integer", rulesParsed, idx - idxStart - 1));
9140 return new LSL_List();
9141 }
9142 try
9143 {
9144 v = rules.GetVector3Item(idx++); // cut
9145 }
9146 catch(InvalidCastException)
9147 {
9148 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_CYLINDER: arg #{1} - parameter 4 must be vector", rulesParsed, idx - idxStart - 1));
9149 return new LSL_List();
9150 }
9151 try
9152 {
9153 hollow = (float)rules.GetLSLFloatItem(idx++);
9154 }
9155 catch(InvalidCastException)
9156 {
9157 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_CYLINDER: arg #{1} - parameter 5 must be float", rulesParsed, idx - idxStart - 1));
9158 return new LSL_List();
9159 }
9160 try
9161 {
9162 twist = rules.GetVector3Item(idx++);
9163 }
9164 catch(InvalidCastException)
9165 {
9166 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_CYLINDER: arg #{1} - parameter 6 must be vector", rulesParsed, idx - idxStart - 1));
9167 return new LSL_List();
9168 }
9169 try
9170 {
9171 taper_b = rules.GetVector3Item(idx++);
9172 }
9173 catch(InvalidCastException)
9174 {
9175 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_CYLINDER: arg #{1} - parameter 7 must be vector", rulesParsed, idx - idxStart - 1));
9176 return new LSL_List();
9177 }
9178 try
9179 {
9180 topshear = rules.GetVector3Item(idx++);
9181 }
9182 catch(InvalidCastException)
9183 {
9184 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_CYLINDER: arg #{1} - parameter 8 must be vector", rulesParsed, idx - idxStart - 1));
9185 return new LSL_List();
9186 }
8166 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 9187 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear,
8167 (byte)ProfileShape.Circle, (byte)Extrusion.Straight); 9188 (byte)ProfileShape.Circle, (byte)Extrusion.Straight);
8168 break; 9189 break;
8169 9190
8170 case (int)ScriptBaseClass.PRIM_TYPE_PRISM: 9191 case ScriptBaseClass.PRIM_TYPE_PRISM:
8171 if (remain < 6) 9192 if (remain < 6)
8172 return null; 9193 return new LSL_List();
8173 9194
8174 face = (int)rules.GetLSLIntegerItem(idx++); // holeshape 9195 try
8175 v = rules.GetVector3Item(idx++); //cut 9196 {
8176 hollow = (float)rules.GetLSLFloatItem(idx++); 9197 face = (int)rules.GetLSLIntegerItem(idx++); // holeshape
8177 twist = rules.GetVector3Item(idx++); 9198 }
8178 taper_b = rules.GetVector3Item(idx++); 9199 catch(InvalidCastException)
8179 topshear = rules.GetVector3Item(idx++); 9200 {
9201 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_PRISM: arg #{1} - parameter 3 must be integer", rulesParsed, idx - idxStart - 1));
9202 return new LSL_List();
9203 }
9204 try
9205 {
9206 v = rules.GetVector3Item(idx++); //cut
9207 }
9208 catch(InvalidCastException)
9209 {
9210 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_PRISM: arg #{1} - parameter 4 must be vector", rulesParsed, idx - idxStart - 1));
9211 return new LSL_List();
9212 }
9213 try
9214 {
9215 hollow = (float)rules.GetLSLFloatItem(idx++);
9216 }
9217 catch(InvalidCastException)
9218 {
9219 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_PRISM: arg #{1} - parameter 5 must be float", rulesParsed, idx - idxStart - 1));
9220 return new LSL_List();
9221 }
9222 try
9223 {
9224 twist = rules.GetVector3Item(idx++);
9225 }
9226 catch(InvalidCastException)
9227 {
9228 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_PRISM: arg #{1} - parameter 6 must be vector", rulesParsed, idx - idxStart - 1));
9229 return new LSL_List();
9230 }
9231 try
9232 {
9233 taper_b = rules.GetVector3Item(idx++);
9234 }
9235 catch(InvalidCastException)
9236 {
9237 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_PRISM: arg #{1} - parameter 7 must be vector", rulesParsed, idx - idxStart - 1));
9238 return new LSL_List();
9239 }
9240 try
9241 {
9242 topshear = rules.GetVector3Item(idx++);
9243 }
9244 catch(InvalidCastException)
9245 {
9246 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_PRISM: arg #{1} - parameter 8 must be vector", rulesParsed, idx - idxStart - 1));
9247 return new LSL_List();
9248 }
8180 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear, 9249 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, topshear,
8181 (byte)ProfileShape.EquilateralTriangle, (byte)Extrusion.Straight); 9250 (byte)ProfileShape.EquilateralTriangle, (byte)Extrusion.Straight);
8182 break; 9251 break;
8183 9252
8184 case (int)ScriptBaseClass.PRIM_TYPE_SPHERE: 9253 case ScriptBaseClass.PRIM_TYPE_SPHERE:
8185 if (remain < 5) 9254 if (remain < 5)
8186 return null; 9255 return new LSL_List();
8187 9256
8188 face = (int)rules.GetLSLIntegerItem(idx++); // holeshape 9257 try
8189 v = rules.GetVector3Item(idx++); // cut 9258 {
8190 hollow = (float)rules.GetLSLFloatItem(idx++); 9259 face = (int)rules.GetLSLIntegerItem(idx++); // holeshape
8191 twist = rules.GetVector3Item(idx++); 9260 }
8192 taper_b = rules.GetVector3Item(idx++); // dimple 9261 catch(InvalidCastException)
9262 {
9263 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_SPHERE: arg #{1} - parameter 3 must be integer", rulesParsed, idx - idxStart - 1));
9264 return new LSL_List();
9265 }
9266 try
9267 {
9268 v = rules.GetVector3Item(idx++); // cut
9269 }
9270 catch(InvalidCastException)
9271 {
9272 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_SPHERE: arg #{1} - parameter 4 must be vector", rulesParsed, idx - idxStart - 1));
9273 return new LSL_List();
9274 }
9275 try
9276 {
9277 hollow = (float)rules.GetLSLFloatItem(idx++);
9278 }
9279 catch(InvalidCastException)
9280 {
9281 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_SPHERE: arg #{1} - parameter 5 must be float", rulesParsed, idx - idxStart - 1));
9282 return new LSL_List();
9283 }
9284 try
9285 {
9286 twist = rules.GetVector3Item(idx++);
9287 }
9288 catch(InvalidCastException)
9289 {
9290 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_SPHERE: arg #{1} - parameter 6 must be vector", rulesParsed, idx - idxStart - 1));
9291 return new LSL_List();
9292 }
9293 try
9294 {
9295 taper_b = rules.GetVector3Item(idx++); // dimple
9296 }
9297 catch(InvalidCastException)
9298 {
9299 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_SPHERE: arg #{1} - parameter 7 must be vector", rulesParsed, idx - idxStart - 1));
9300 return new LSL_List();
9301 }
8193 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b, 9302 SetPrimitiveShapeParams(part, face, v, hollow, twist, taper_b,
8194 (byte)ProfileShape.HalfCircle, (byte)Extrusion.Curve1); 9303 (byte)ProfileShape.HalfCircle, (byte)Extrusion.Curve1);
8195 break; 9304 break;
8196 9305
8197 case (int)ScriptBaseClass.PRIM_TYPE_TORUS: 9306 case ScriptBaseClass.PRIM_TYPE_TORUS:
8198 if (remain < 11) 9307 if (remain < 11)
8199 return null; 9308 return new LSL_List();
8200 9309
8201 face = (int)rules.GetLSLIntegerItem(idx++); // holeshape 9310 try
8202 v = rules.GetVector3Item(idx++); //cut 9311 {
8203 hollow = (float)rules.GetLSLFloatItem(idx++); 9312 face = (int)rules.GetLSLIntegerItem(idx++); // holeshape
8204 twist = rules.GetVector3Item(idx++); 9313 }
8205 holesize = rules.GetVector3Item(idx++); 9314 catch(InvalidCastException)
8206 topshear = rules.GetVector3Item(idx++); 9315 {
8207 profilecut = rules.GetVector3Item(idx++); 9316 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 3 must be integer", rulesParsed, idx - idxStart - 1));
8208 taper_b = rules.GetVector3Item(idx++); // taper_a 9317 return new LSL_List();
8209 revolutions = (float)rules.GetLSLFloatItem(idx++); 9318 }
8210 radiusoffset = (float)rules.GetLSLFloatItem(idx++); 9319 try
8211 skew = (float)rules.GetLSLFloatItem(idx++); 9320 {
9321 v = rules.GetVector3Item(idx++); //cut
9322 }
9323 catch(InvalidCastException)
9324 {
9325 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 4 must be vector", rulesParsed, idx - idxStart - 1));
9326 return new LSL_List();
9327 }
9328 try
9329 {
9330 hollow = (float)rules.GetLSLFloatItem(idx++);
9331 }
9332 catch(InvalidCastException)
9333 {
9334 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 5 must be float", rulesParsed, idx - idxStart - 1));
9335 return new LSL_List();
9336 }
9337 try
9338 {
9339 twist = rules.GetVector3Item(idx++);
9340 }
9341 catch(InvalidCastException)
9342 {
9343 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 6 must be vector", rulesParsed, idx - idxStart - 1));
9344 return new LSL_List();
9345 }
9346 try
9347 {
9348 holesize = rules.GetVector3Item(idx++);
9349 }
9350 catch(InvalidCastException)
9351 {
9352 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 7 must be vector", rulesParsed, idx - idxStart - 1));
9353 return new LSL_List();
9354 }
9355 try
9356 {
9357 topshear = rules.GetVector3Item(idx++);
9358 }
9359 catch(InvalidCastException)
9360 {
9361 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 8 must be vector", rulesParsed, idx - idxStart - 1));
9362 return new LSL_List();
9363 }
9364 try
9365 {
9366 profilecut = rules.GetVector3Item(idx++);
9367 }
9368 catch(InvalidCastException)
9369 {
9370 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 9 must be vector", rulesParsed, idx - idxStart - 1));
9371 return new LSL_List();
9372 }
9373 try
9374 {
9375 taper_b = rules.GetVector3Item(idx++); // taper_a
9376 }
9377 catch(InvalidCastException)
9378 {
9379 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 10 must be vector", rulesParsed, idx - idxStart - 1));
9380 return new LSL_List();
9381 }
9382 try
9383 {
9384 revolutions = (float)rules.GetLSLFloatItem(idx++);
9385 }
9386 catch(InvalidCastException)
9387 {
9388 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 11 must be float", rulesParsed, idx - idxStart - 1));
9389 return new LSL_List();
9390 }
9391 try
9392 {
9393 radiusoffset = (float)rules.GetLSLFloatItem(idx++);
9394 }
9395 catch(InvalidCastException)
9396 {
9397 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 12 must be float", rulesParsed, idx - idxStart - 1));
9398 return new LSL_List();
9399 }
9400 try
9401 {
9402 skew = (float)rules.GetLSLFloatItem(idx++);
9403 }
9404 catch(InvalidCastException)
9405 {
9406 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TORUS: arg #{1} - parameter 13 must be vector", rulesParsed, idx - idxStart - 1));
9407 return new LSL_List();
9408 }
8212 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, 9409 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
8213 revolutions, radiusoffset, skew, (byte)ProfileShape.Circle, (byte)Extrusion.Curve1); 9410 revolutions, radiusoffset, skew, (byte)ProfileShape.Circle, (byte)Extrusion.Curve1);
8214 break; 9411 break;
8215 9412
8216 case (int)ScriptBaseClass.PRIM_TYPE_TUBE: 9413 case ScriptBaseClass.PRIM_TYPE_TUBE:
8217 if (remain < 11) 9414 if (remain < 11)
8218 return null; 9415 return new LSL_List();
8219 9416
8220 face = (int)rules.GetLSLIntegerItem(idx++); // holeshape 9417 try
8221 v = rules.GetVector3Item(idx++); //cut 9418 {
8222 hollow = (float)rules.GetLSLFloatItem(idx++); 9419 face = (int)rules.GetLSLIntegerItem(idx++); // holeshape
8223 twist = rules.GetVector3Item(idx++); 9420 }
8224 holesize = rules.GetVector3Item(idx++); 9421 catch(InvalidCastException)
8225 topshear = rules.GetVector3Item(idx++); 9422 {
8226 profilecut = rules.GetVector3Item(idx++); 9423 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 3 must be integer", rulesParsed, idx - idxStart - 1));
8227 taper_b = rules.GetVector3Item(idx++); // taper_a 9424 return new LSL_List();
8228 revolutions = (float)rules.GetLSLFloatItem(idx++); 9425 }
8229 radiusoffset = (float)rules.GetLSLFloatItem(idx++); 9426 try
8230 skew = (float)rules.GetLSLFloatItem(idx++); 9427 {
9428 v = rules.GetVector3Item(idx++); //cut
9429 }
9430 catch(InvalidCastException)
9431 {
9432 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 4 must be vector", rulesParsed, idx - idxStart - 1));
9433 return new LSL_List();
9434 }
9435 try
9436 {
9437 hollow = (float)rules.GetLSLFloatItem(idx++);
9438 }
9439 catch(InvalidCastException)
9440 {
9441 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 5 must be float", rulesParsed, idx - idxStart - 1));
9442 return new LSL_List();
9443 }
9444 try
9445 {
9446 twist = rules.GetVector3Item(idx++);
9447 }
9448 catch(InvalidCastException)
9449 {
9450 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 6 must be vector", rulesParsed, idx - idxStart - 1));
9451 return new LSL_List();
9452 }
9453 try
9454 {
9455 holesize = rules.GetVector3Item(idx++);
9456 }
9457 catch(InvalidCastException)
9458 {
9459 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 7 must be vector", rulesParsed, idx - idxStart - 1));
9460 return new LSL_List();
9461 }
9462 try
9463 {
9464 topshear = rules.GetVector3Item(idx++);
9465 }
9466 catch(InvalidCastException)
9467 {
9468 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 8 must be vector", rulesParsed, idx - idxStart - 1));
9469 return new LSL_List();
9470 }
9471 try
9472 {
9473 profilecut = rules.GetVector3Item(idx++);
9474 }
9475 catch(InvalidCastException)
9476 {
9477 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 9 must be vector", rulesParsed, idx - idxStart - 1));
9478 return new LSL_List();
9479 }
9480 try
9481 {
9482 taper_b = rules.GetVector3Item(idx++); // taper_a
9483 }
9484 catch(InvalidCastException)
9485 {
9486 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 10 must be vector", rulesParsed, idx - idxStart - 1));
9487 return new LSL_List();
9488 }
9489 try
9490 {
9491 revolutions = (float)rules.GetLSLFloatItem(idx++);
9492 }
9493 catch(InvalidCastException)
9494 {
9495 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 11 must be float", rulesParsed, idx - idxStart - 1));
9496 return new LSL_List();
9497 }
9498 try
9499 {
9500 radiusoffset = (float)rules.GetLSLFloatItem(idx++);
9501 }
9502 catch(InvalidCastException)
9503 {
9504 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 12 must be float", rulesParsed, idx - idxStart - 1));
9505 return new LSL_List();
9506 }
9507 try
9508 {
9509 skew = (float)rules.GetLSLFloatItem(idx++);
9510 }
9511 catch(InvalidCastException)
9512 {
9513 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_TUBE: arg #{1} - parameter 13 must be float", rulesParsed, idx - idxStart - 1));
9514 return new LSL_List();
9515 }
8231 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, 9516 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
8232 revolutions, radiusoffset, skew, (byte)ProfileShape.Square, (byte)Extrusion.Curve1); 9517 revolutions, radiusoffset, skew, (byte)ProfileShape.Square, (byte)Extrusion.Curve1);
8233 break; 9518 break;
8234 9519
8235 case (int)ScriptBaseClass.PRIM_TYPE_RING: 9520 case ScriptBaseClass.PRIM_TYPE_RING:
8236 if (remain < 11) 9521 if (remain < 11)
8237 return null; 9522 return new LSL_List();
8238 9523
8239 face = (int)rules.GetLSLIntegerItem(idx++); // holeshape 9524 try
8240 v = rules.GetVector3Item(idx++); //cut 9525 {
8241 hollow = (float)rules.GetLSLFloatItem(idx++); 9526 face = (int)rules.GetLSLIntegerItem(idx++); // holeshape
8242 twist = rules.GetVector3Item(idx++); 9527 }
8243 holesize = rules.GetVector3Item(idx++); 9528 catch(InvalidCastException)
8244 topshear = rules.GetVector3Item(idx++); 9529 {
8245 profilecut = rules.GetVector3Item(idx++); 9530 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 3 must be integer", rulesParsed, idx - idxStart - 1));
8246 taper_b = rules.GetVector3Item(idx++); // taper_a 9531 return new LSL_List();
8247 revolutions = (float)rules.GetLSLFloatItem(idx++); 9532 }
8248 radiusoffset = (float)rules.GetLSLFloatItem(idx++); 9533 try
8249 skew = (float)rules.GetLSLFloatItem(idx++); 9534 {
9535 v = rules.GetVector3Item(idx++); //cut
9536 }
9537 catch(InvalidCastException)
9538 {
9539 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 4 must be vector", rulesParsed, idx - idxStart - 1));
9540 return new LSL_List();
9541 }
9542 try
9543 {
9544 hollow = (float)rules.GetLSLFloatItem(idx++);
9545 }
9546 catch(InvalidCastException)
9547 {
9548 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 5 must be float", rulesParsed, idx - idxStart - 1));
9549 return new LSL_List();
9550 }
9551 try
9552 {
9553 twist = rules.GetVector3Item(idx++);
9554 }
9555 catch(InvalidCastException)
9556 {
9557 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 6 must be vector", rulesParsed, idx - idxStart - 1));
9558 return new LSL_List();
9559 }
9560 try
9561 {
9562 holesize = rules.GetVector3Item(idx++);
9563 }
9564 catch(InvalidCastException)
9565 {
9566 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 7 must be vector", rulesParsed, idx - idxStart - 1));
9567 return new LSL_List();
9568 }
9569 try
9570 {
9571 topshear = rules.GetVector3Item(idx++);
9572 }
9573 catch(InvalidCastException)
9574 {
9575 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 8 must be vector", rulesParsed, idx - idxStart - 1));
9576 return new LSL_List();
9577 }
9578 try
9579 {
9580 profilecut = rules.GetVector3Item(idx++);
9581 }
9582 catch(InvalidCastException)
9583 {
9584 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 9 must be vector", rulesParsed, idx - idxStart - 1));
9585 return new LSL_List();
9586 }
9587 try
9588 {
9589 taper_b = rules.GetVector3Item(idx++); // taper_a
9590 }
9591 catch(InvalidCastException)
9592 {
9593 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 10 must be vector", rulesParsed, idx - idxStart - 1));
9594 return new LSL_List();
9595 }
9596 try
9597 {
9598 revolutions = (float)rules.GetLSLFloatItem(idx++);
9599 }
9600 catch(InvalidCastException)
9601 {
9602 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 11 must be float", rulesParsed, idx - idxStart - 1));
9603 return new LSL_List();
9604 }
9605 try
9606 {
9607 radiusoffset = (float)rules.GetLSLFloatItem(idx++);
9608 }
9609 catch(InvalidCastException)
9610 {
9611 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 12 must be float", rulesParsed, idx - idxStart - 1));
9612 return new LSL_List();
9613 }
9614 try
9615 {
9616 skew = (float)rules.GetLSLFloatItem(idx++);
9617 }
9618 catch(InvalidCastException)
9619 {
9620 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_RING: arg #{1} - parameter 13 must be float", rulesParsed, idx - idxStart - 1));
9621 return new LSL_List();
9622 }
8250 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, 9623 SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
8251 revolutions, radiusoffset, skew, (byte)ProfileShape.EquilateralTriangle, (byte)Extrusion.Curve1); 9624 revolutions, radiusoffset, skew, (byte)ProfileShape.EquilateralTriangle, (byte)Extrusion.Curve1);
8252 break; 9625 break;
8253 9626
8254 case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: 9627 case ScriptBaseClass.PRIM_TYPE_SCULPT:
8255 if (remain < 2) 9628 if (remain < 2)
8256 return null; 9629 return new LSL_List();
8257 9630
8258 string map = rules.Data[idx++].ToString(); 9631 string map = rules.Data[idx++].ToString();
8259 face = (int)rules.GetLSLIntegerItem(idx++); // type 9632 try
9633 {
9634 face = (int)rules.GetLSLIntegerItem(idx++); // type
9635 }
9636 catch(InvalidCastException)
9637 {
9638 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TYPE, PRIM_TYPE_SCULPT: arg #{1} - parameter 4 must be integer", rulesParsed, idx - idxStart - 1));
9639 return new LSL_List();
9640 }
8260 SetPrimitiveShapeParams(part, map, face, (byte)Extrusion.Curve1); 9641 SetPrimitiveShapeParams(part, map, face, (byte)Extrusion.Curve1);
8261 break; 9642 break;
8262 } 9643 }
8263 9644
8264 break; 9645 break;
8265 9646
8266 case (int)ScriptBaseClass.PRIM_TEXTURE: 9647 case ScriptBaseClass.PRIM_TEXTURE:
8267 if (remain < 5) 9648 if (remain < 5)
8268 return null; 9649 return new LSL_List();
8269 9650
8270 face=(int)rules.GetLSLIntegerItem(idx++); 9651 face=(int)rules.GetLSLIntegerItem(idx++);
8271 string tex=rules.Data[idx++].ToString(); 9652 string tex;
8272 LSL_Vector repeats=rules.GetVector3Item(idx++); 9653 LSL_Vector repeats;
8273 LSL_Vector offsets=rules.GetVector3Item(idx++); 9654 LSL_Vector offsets;
8274 double rotation=(double)rules.GetLSLFloatItem(idx++); 9655 double rotation;
9656
9657 tex = rules.Data[idx++].ToString();
9658 try
9659 {
9660 repeats = rules.GetVector3Item(idx++);
9661 }
9662 catch(InvalidCastException)
9663 {
9664 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TEXTURE: arg #{1} - parameter 3 must be vector", rulesParsed, idx - idxStart - 1));
9665 return new LSL_List();
9666 }
9667 try
9668 {
9669 offsets = rules.GetVector3Item(idx++);
9670 }
9671 catch(InvalidCastException)
9672 {
9673 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TEXTURE: arg #{1} - parameter 4 must be vector", rulesParsed, idx - idxStart - 1));
9674 return new LSL_List();
9675 }
9676 try
9677 {
9678 rotation = (double)rules.GetLSLFloatItem(idx++);
9679 }
9680 catch(InvalidCastException)
9681 {
9682 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TEXTURE: arg #{1} - parameter 5 must be float", rulesParsed, idx - idxStart - 1));
9683 return new LSL_List();
9684 }
8275 9685
8276 SetTexture(part, tex, face); 9686 SetTexture(part, tex, face);
8277 ScaleTexture(part, repeats.x, repeats.y, face); 9687 ScaleTexture(part, repeats.x, repeats.y, face);
@@ -8280,114 +9690,328 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8280 9690
8281 break; 9691 break;
8282 9692
8283 case (int)ScriptBaseClass.PRIM_COLOR: 9693 case ScriptBaseClass.PRIM_COLOR:
8284 if (remain < 3) 9694 if (remain < 3)
8285 return null; 9695 return new LSL_List();
8286 9696
8287 face=(int)rules.GetLSLIntegerItem(idx++); 9697 LSL_Vector color;
8288 LSL_Vector color=rules.GetVector3Item(idx++); 9698 double alpha;
8289 double alpha=(double)rules.GetLSLFloatItem(idx++); 9699
9700 try
9701 {
9702 face = (int)rules.GetLSLIntegerItem(idx++);
9703 }
9704 catch(InvalidCastException)
9705 {
9706 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_COLOR: arg #{1} - parameter 2 must be integer", rulesParsed, idx - idxStart - 1));
9707 return new LSL_List();
9708 }
9709 try
9710 {
9711 color = rules.GetVector3Item(idx++);
9712 }
9713 catch(InvalidCastException)
9714 {
9715 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_COLOR: arg #{1} - parameter 3 must be vector", rulesParsed, idx - idxStart - 1));
9716 return new LSL_List();
9717 }
9718 try
9719 {
9720 alpha = (double)rules.GetLSLFloatItem(idx++);
9721 }
9722 catch(InvalidCastException)
9723 {
9724 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_COLOR: arg #{1} - parameter 4 must be float", rulesParsed, idx - idxStart - 1));
9725 return new LSL_List();
9726 }
8290 9727
8291 part.SetFaceColorAlpha(face, color, alpha); 9728 part.SetFaceColorAlpha(face, color, alpha);
8292 9729
8293 break; 9730 break;
8294 9731
8295 case (int)ScriptBaseClass.PRIM_FLEXIBLE: 9732 case ScriptBaseClass.PRIM_FLEXIBLE:
8296 if (remain < 7) 9733 if (remain < 7)
8297 return null; 9734 return new LSL_List();
8298 9735 bool flexi;
8299 bool flexi = rules.GetLSLIntegerItem(idx++); 9736 int softness;
8300 int softness = rules.GetLSLIntegerItem(idx++); 9737 float gravity;
8301 float gravity = (float)rules.GetLSLFloatItem(idx++); 9738 float friction;
8302 float friction = (float)rules.GetLSLFloatItem(idx++); 9739 float wind;
8303 float wind = (float)rules.GetLSLFloatItem(idx++); 9740 float tension;
8304 float tension = (float)rules.GetLSLFloatItem(idx++); 9741 LSL_Vector force;
8305 LSL_Vector force = rules.GetVector3Item(idx++); 9742
9743 try
9744 {
9745 flexi = rules.GetLSLIntegerItem(idx++);
9746 }
9747 catch(InvalidCastException)
9748 {
9749 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_FLEXIBLE: arg #{1} - parameter 2 must be integer", rulesParsed, idx - idxStart - 1));
9750 return new LSL_List();
9751 }
9752 try
9753 {
9754 softness = rules.GetLSLIntegerItem(idx++);
9755 }
9756 catch(InvalidCastException)
9757 {
9758 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_FLEXIBLE: arg #{1} - parameter 3 must be integer", rulesParsed, idx - idxStart - 1));
9759 return new LSL_List();
9760 }
9761 try
9762 {
9763 gravity = (float)rules.GetLSLFloatItem(idx++);
9764 }
9765 catch(InvalidCastException)
9766 {
9767 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_FLEXIBLE: arg #{1} - parameter 4 must be float", rulesParsed, idx - idxStart - 1));
9768 return new LSL_List();
9769 }
9770 try
9771 {
9772 friction = (float)rules.GetLSLFloatItem(idx++);
9773 }
9774 catch(InvalidCastException)
9775 {
9776 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_FLEXIBLE: arg #{1} - parameter 5 must be float", rulesParsed, idx - idxStart - 1));
9777 return new LSL_List();
9778 }
9779 try
9780 {
9781 wind = (float)rules.GetLSLFloatItem(idx++);
9782 }
9783 catch(InvalidCastException)
9784 {
9785 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_FLEXIBLE: arg #{1} - parameter 6 must be float", rulesParsed, idx - idxStart - 1));
9786 return new LSL_List();
9787 }
9788 try
9789 {
9790 tension = (float)rules.GetLSLFloatItem(idx++);
9791 }
9792 catch(InvalidCastException)
9793 {
9794 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_FLEXIBLE: arg #{1} - parameter 7 must be float", rulesParsed, idx - idxStart - 1));
9795 return new LSL_List();
9796 }
9797 try
9798 {
9799 force = rules.GetVector3Item(idx++);
9800 }
9801 catch(InvalidCastException)
9802 {
9803 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_FLEXIBLE: arg #{1} - parameter 8 must be vector", rulesParsed, idx - idxStart - 1));
9804 return new LSL_List();
9805 }
8306 9806
8307 SetFlexi(part, flexi, softness, gravity, friction, wind, tension, force); 9807 SetFlexi(part, flexi, softness, gravity, friction, wind, tension, force);
8308 9808
8309 break; 9809 break;
8310 9810
8311 case (int)ScriptBaseClass.PRIM_POINT_LIGHT: 9811 case ScriptBaseClass.PRIM_POINT_LIGHT:
8312 if (remain < 5) 9812 if (remain < 5)
8313 return null; 9813 return new LSL_List();
8314 bool light = rules.GetLSLIntegerItem(idx++); 9814 bool light;
8315 LSL_Vector lightcolor = rules.GetVector3Item(idx++); 9815 LSL_Vector lightcolor;
8316 float intensity = (float)rules.GetLSLFloatItem(idx++); 9816 float intensity;
8317 float radius = (float)rules.GetLSLFloatItem(idx++); 9817 float radius;
8318 float falloff = (float)rules.GetLSLFloatItem(idx++); 9818 float falloff;
9819
9820 try
9821 {
9822 light = rules.GetLSLIntegerItem(idx++);
9823 }
9824 catch(InvalidCastException)
9825 {
9826 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_POINT_LIGHT: arg #{1} - parameter 2 must be integer", rulesParsed, idx - idxStart - 1));
9827 return new LSL_List();
9828 }
9829 try
9830 {
9831 lightcolor = rules.GetVector3Item(idx++);
9832 }
9833 catch(InvalidCastException)
9834 {
9835 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_POINT_LIGHT: arg #{1} - parameter 3 must be vector", rulesParsed, idx - idxStart - 1));
9836 return new LSL_List();
9837 }
9838 try
9839 {
9840 intensity = (float)rules.GetLSLFloatItem(idx++);
9841 }
9842 catch(InvalidCastException)
9843 {
9844 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_POINT_LIGHT: arg #{1} - parameter 4 must be float", rulesParsed, idx - idxStart - 1));
9845 return new LSL_List();
9846 }
9847 try
9848 {
9849 radius = (float)rules.GetLSLFloatItem(idx++);
9850 }
9851 catch(InvalidCastException)
9852 {
9853 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_POINT_LIGHT: arg #{1} - parameter 5 must be float", rulesParsed, idx - idxStart - 1));
9854 return new LSL_List();
9855 }
9856 try
9857 {
9858 falloff = (float)rules.GetLSLFloatItem(idx++);
9859 }
9860 catch(InvalidCastException)
9861 {
9862 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_POINT_LIGHT: arg #{1} - parameter 6 must be float", rulesParsed, idx - idxStart - 1));
9863 return new LSL_List();
9864 }
8319 9865
8320 SetPointLight(part, light, lightcolor, intensity, radius, falloff); 9866 SetPointLight(part, light, lightcolor, intensity, radius, falloff);
8321 9867
8322 break; 9868 break;
8323 9869
8324 case (int)ScriptBaseClass.PRIM_GLOW: 9870 case ScriptBaseClass.PRIM_GLOW:
8325 if (remain < 2) 9871 if (remain < 2)
8326 return null; 9872 return new LSL_List();
8327 face = rules.GetLSLIntegerItem(idx++); 9873
8328 float glow = (float)rules.GetLSLFloatItem(idx++); 9874 float glow;
9875
9876 try
9877 {
9878 face = rules.GetLSLIntegerItem(idx++);
9879 }
9880 catch(InvalidCastException)
9881 {
9882 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_GLOW: arg #{1} - parameter 2 must be integer", rulesParsed, idx - idxStart - 1));
9883 return new LSL_List();
9884 }
9885 try
9886 {
9887 glow = (float)rules.GetLSLFloatItem(idx++);
9888 }
9889 catch(InvalidCastException)
9890 {
9891 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_GLOW: arg #{1} - parameter 3 must be float", rulesParsed, idx - idxStart - 1));
9892 return new LSL_List();
9893 }
8329 9894
8330 SetGlow(part, face, glow); 9895 SetGlow(part, face, glow);
8331 9896
8332 break; 9897 break;
8333 9898
8334 case (int)ScriptBaseClass.PRIM_BUMP_SHINY: 9899 case ScriptBaseClass.PRIM_BUMP_SHINY:
8335 if (remain < 3) 9900 if (remain < 3)
8336 return null; 9901 return new LSL_List();
8337 face = (int)rules.GetLSLIntegerItem(idx++); 9902
8338 int shiny = (int)rules.GetLSLIntegerItem(idx++); 9903 int shiny;
8339 Bumpiness bump = (Bumpiness)(int)rules.GetLSLIntegerItem(idx++); 9904 Bumpiness bump;
9905
9906 try
9907 {
9908 face = (int)rules.GetLSLIntegerItem(idx++);
9909 }
9910 catch(InvalidCastException)
9911 {
9912 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_BUMP_SHINY: arg #{1} - parameter 2 must be integer", rulesParsed, idx - idxStart - 1));
9913 return new LSL_List();
9914 }
9915 try
9916 {
9917 shiny = (int)rules.GetLSLIntegerItem(idx++);
9918 }
9919 catch(InvalidCastException)
9920 {
9921 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_BUMP_SHINY: arg #{1} - parameter 3 must be integer", rulesParsed, idx - idxStart - 1));
9922 return new LSL_List();
9923 }
9924 try
9925 {
9926 bump = (Bumpiness)(int)rules.GetLSLIntegerItem(idx++);
9927 }
9928 catch(InvalidCastException)
9929 {
9930 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_BUMP_SHINY: arg #{1} - parameter 4 must be integer", rulesParsed, idx - idxStart - 1));
9931 return new LSL_List();
9932 }
8340 9933
8341 SetShiny(part, face, shiny, bump); 9934 SetShiny(part, face, shiny, bump);
8342 9935
8343 break; 9936 break;
8344 9937
8345 case (int)ScriptBaseClass.PRIM_FULLBRIGHT: 9938 case ScriptBaseClass.PRIM_FULLBRIGHT:
8346 if (remain < 2) 9939 if (remain < 2)
8347 return null; 9940 return new LSL_List();
8348 face = rules.GetLSLIntegerItem(idx++); 9941 bool st;
8349 bool st = rules.GetLSLIntegerItem(idx++);
8350 SetFullBright(part, face , st);
8351 break;
8352
8353 case (int)ScriptBaseClass.PRIM_MATERIAL:
8354 if (remain < 1)
8355 return null;
8356 int mat = rules.GetLSLIntegerItem(idx++);
8357 if (mat < 0 || mat > 7)
8358 return null;
8359 9942
8360 part.Material = Convert.ToByte(mat); 9943 try
8361 break; 9944 {
9945 face = rules.GetLSLIntegerItem(idx++);
9946 }
9947 catch(InvalidCastException)
9948 {
9949 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_FULLBRIGHT: arg #{1} - parameter 2 must be integer", rulesParsed, idx - idxStart - 1));
9950 return new LSL_List();
9951 }
9952 try
9953 {
9954 st = rules.GetLSLIntegerItem(idx++);
9955 }
9956 catch(InvalidCastException)
9957 {
9958 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_FULLBRIGHT: arg #{1} - parameter 4 must be integer", rulesParsed, idx - idxStart - 1));
9959 return new LSL_List();
9960 }
9961 SetFullBright(part, face , st);
9962 break;
8362 9963
8363 case (int)ScriptBaseClass.PRIM_PHANTOM: 9964 case ScriptBaseClass.PRIM_MATERIAL:
8364 if (remain < 1) 9965 if (remain < 1)
8365 return null; 9966 return new LSL_List();
9967 int mat;
8366 9968
8367 string ph = rules.Data[idx++].ToString(); 9969 try
8368 part.ParentGroup.ScriptSetPhantomStatus(ph.Equals("1")); 9970 {
9971 mat = rules.GetLSLIntegerItem(idx++);
9972 }
9973 catch(InvalidCastException)
9974 {
9975 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_MATERIAL: arg #{1} - parameter 2 must be integer", rulesParsed, idx - idxStart - 1));
9976 return new LSL_List();
9977 }
9978 if (mat < 0 || mat > 7)
9979 return new LSL_List();
8369 9980
8370 break; 9981 part.Material = Convert.ToByte(mat);
9982 break;
8371 9983
8372 case (int)ScriptBaseClass.PRIM_PHYSICS: 9984 case ScriptBaseClass.PRIM_PHANTOM:
8373 if (remain < 1) 9985 if (remain < 1)
8374 return null; 9986 return new LSL_List();
8375 string phy = rules.Data[idx++].ToString(); 9987
8376 bool physics; 9988 string ph = rules.Data[idx++].ToString();
9989 part.ParentGroup.ScriptSetPhantomStatus(ph.Equals("1"));
8377 9990
8378 if (phy.Equals("1")) 9991 break;
8379 physics = true;
8380 else
8381 physics = false;
8382 9992
8383 part.ScriptSetPhysicsStatus(physics); 9993 case ScriptBaseClass.PRIM_PHYSICS:
8384 break; 9994 if (remain < 1)
9995 return new LSL_List();
9996 string phy = rules.Data[idx++].ToString();
9997 part.ScriptSetPhysicsStatus(phy.Equals("1"));
9998 break;
8385 9999
8386 case (int)ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE: 10000 case ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE:
8387 if (remain < 1) 10001 if (remain < 1)
8388 return null; 10002 return new LSL_List();
8389 10003
8390 int shape_type = rules.GetLSLIntegerItem(idx++); 10004 int shape_type;
10005
10006 try
10007 {
10008 shape_type = rules.GetLSLIntegerItem(idx++);
10009 }
10010 catch(InvalidCastException)
10011 {
10012 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_PHYSICS_SHAPE_TYPE: arg #{1} - parameter 2 must be integer", rulesParsed, idx - idxStart - 1));
10013 return new LSL_List();
10014 }
8391 10015
8392 ExtraPhysicsData physdata = new ExtraPhysicsData(); 10016 ExtraPhysicsData physdata = new ExtraPhysicsData();
8393 physdata.Density = part.Density; 10017 physdata.Density = part.Density;
@@ -8399,6 +10023,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8399 10023
8400 break; 10024 break;
8401 10025
10026<<<<<<< HEAD
10027 case ScriptBaseClass.PRIM_TEMP_ON_REZ:
10028=======
8402 case (int)ScriptBaseClass.PRIM_PHYSICS_MATERIAL: 10029 case (int)ScriptBaseClass.PRIM_PHYSICS_MATERIAL:
8403 if (remain < 5) 10030 if (remain < 5)
8404 return null; 10031 return null;
@@ -8414,76 +10041,192 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8414 break; 10041 break;
8415 10042
8416 case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: 10043 case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
10044>>>>>>> avn/ubitvar
8417 if (remain < 1) 10045 if (remain < 1)
8418 return null; 10046 return new LSL_List();
8419 string temp = rules.Data[idx++].ToString(); 10047 string temp = rules.Data[idx++].ToString();
8420 10048
8421 part.ParentGroup.ScriptSetTemporaryStatus(temp.Equals("1")); 10049 part.ParentGroup.ScriptSetTemporaryStatus(temp.Equals("1"));
8422 10050
8423 break; 10051 break;
8424 10052
8425 case (int)ScriptBaseClass.PRIM_TEXGEN: 10053 case ScriptBaseClass.PRIM_TEXGEN:
8426 if (remain < 2) 10054 if (remain < 2)
8427 return null; 10055 return new LSL_List();
8428 //face,type 10056 //face,type
8429 face = rules.GetLSLIntegerItem(idx++); 10057 int style;
8430 int style = rules.GetLSLIntegerItem(idx++); 10058
10059 try
10060 {
10061 face = rules.GetLSLIntegerItem(idx++);
10062 }
10063 catch(InvalidCastException)
10064 {
10065 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TEXGEN: arg #{1} - parameter 2 must be integer", rulesParsed, idx - idxStart - 1));
10066 return new LSL_List();
10067 }
10068 try
10069 {
10070 style = rules.GetLSLIntegerItem(idx++);
10071 }
10072 catch(InvalidCastException)
10073 {
10074 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TEXGEN: arg #{1} - parameter 3 must be integer", rulesParsed, idx - idxStart - 1));
10075 return new LSL_List();
10076 }
8431 SetTexGen(part, face, style); 10077 SetTexGen(part, face, style);
8432 break; 10078 break;
8433 case (int)ScriptBaseClass.PRIM_TEXT: 10079 case ScriptBaseClass.PRIM_TEXT:
8434 if (remain < 3) 10080 if (remain < 3)
8435 return null; 10081 return new LSL_List();
8436 string primText = rules.GetLSLStringItem(idx++); 10082 string primText;
8437 LSL_Vector primTextColor = rules.GetVector3Item(idx++); 10083 LSL_Vector primTextColor;
8438 LSL_Float primTextAlpha = rules.GetLSLFloatItem(idx++); 10084 LSL_Float primTextAlpha;
10085
10086 try
10087 {
10088 primText = rules.GetLSLStringItem(idx++);
10089 }
10090 catch(InvalidCastException)
10091 {
10092 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TEXT: arg #{1} - parameter 2 must be string", rulesParsed, idx - idxStart - 1));
10093 return new LSL_List();
10094 }
10095 try
10096 {
10097 primTextColor = rules.GetVector3Item(idx++);
10098 }
10099 catch(InvalidCastException)
10100 {
10101 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TEXT: arg #{1} - parameter 3 must be vector", rulesParsed, idx - idxStart - 1));
10102 return new LSL_List();
10103 }
10104 try
10105 {
10106 primTextAlpha = rules.GetLSLFloatItem(idx++);
10107 }
10108 catch(InvalidCastException)
10109 {
10110 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_TEXT: arg #{1} - parameter 4 must be float", rulesParsed, idx - idxStart - 1));
10111 return new LSL_List();
10112 }
8439 Vector3 av3 = Util.Clip(primTextColor, 0.0f, 1.0f); 10113 Vector3 av3 = Util.Clip(primTextColor, 0.0f, 1.0f);
8440 part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f)); 10114 part.SetText(primText, av3, Util.Clip((float)primTextAlpha, 0.0f, 1.0f));
8441 10115
8442 break; 10116 break;
8443 case (int)ScriptBaseClass.PRIM_NAME: 10117
10118 case ScriptBaseClass.PRIM_NAME:
8444 if (remain < 1) 10119 if (remain < 1)
8445 return null; 10120 return new LSL_List();
8446 string primName = rules.GetLSLStringItem(idx++); 10121 try
8447 part.Name = primName; 10122 {
10123 string primName = rules.GetLSLStringItem(idx++);
10124 part.Name = primName;
10125 }
10126 catch(InvalidCastException)
10127 {
10128 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_NAME: arg #{1} - parameter 2 must be string", rulesParsed, idx - idxStart - 1));
10129 return new LSL_List();
10130 }
8448 break; 10131 break;
8449 case (int)ScriptBaseClass.PRIM_DESC: 10132 case ScriptBaseClass.PRIM_DESC:
8450 if (remain < 1) 10133 if (remain < 1)
8451 return null; 10134 return new LSL_List();
8452 string primDesc = rules.GetLSLStringItem(idx++); 10135 try
8453 part.Description = primDesc; 10136 {
10137 string primDesc = rules.GetLSLStringItem(idx++);
10138 part.Description = primDesc;
10139 }
10140 catch(InvalidCastException)
10141 {
10142 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_DESC: arg #{1} - parameter 2 must be string", rulesParsed, idx - idxStart - 1));
10143 return new LSL_List();
10144 }
8454 break; 10145 break;
8455 case (int)ScriptBaseClass.PRIM_ROT_LOCAL: 10146 case ScriptBaseClass.PRIM_ROT_LOCAL:
8456 if (remain < 1) 10147 if (remain < 1)
8457 return null; 10148 return new LSL_List();
8458 SetRot(part, rules.GetQuaternionItem(idx++)); 10149 LSL_Rotation rot;
10150 try
10151 {
10152 rot = rules.GetQuaternionItem(idx++);
10153 }
10154 catch(InvalidCastException)
10155 {
10156 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_ROT_LOCAL: arg #{1} - parameter 2 must be rotation", rulesParsed, idx - idxStart - 1));
10157 return new LSL_List();
10158 }
10159 SetRot(part, rot);
8459 break; 10160 break;
8460 case (int)ScriptBaseClass.PRIM_OMEGA: 10161
10162 case ScriptBaseClass.PRIM_OMEGA:
8461 if (remain < 3) 10163 if (remain < 3)
8462 return null; 10164 return new LSL_List();
8463 LSL_Vector axis = rules.GetVector3Item(idx++); 10165 LSL_Vector axis;
8464 LSL_Float spinrate = rules.GetLSLFloatItem(idx++); 10166 LSL_Float spinrate;
8465 LSL_Float gain = rules.GetLSLFloatItem(idx++); 10167 LSL_Float gain;
10168
10169 try
10170 {
10171 axis = rules.GetVector3Item(idx++);
10172 }
10173 catch(InvalidCastException)
10174 {
10175 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_OMEGA: arg #{1} - parameter 2 must be vector", rulesParsed, idx - idxStart - 1));
10176 return new LSL_List();
10177 }
10178 try
10179 {
10180 spinrate = rules.GetLSLFloatItem(idx++);
10181 }
10182 catch(InvalidCastException)
10183 {
10184 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_OMEGA: arg #{1} - parameter 3 must be float", rulesParsed, idx - idxStart - 1));
10185 return new LSL_List();
10186 }
10187 try
10188 {
10189 gain = rules.GetLSLFloatItem(idx++);
10190 }
10191 catch(InvalidCastException)
10192 {
10193 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_OMEGA: arg #{1} - parameter 4 must be float", rulesParsed, idx - idxStart - 1));
10194 return new LSL_List();
10195 }
8466 TargetOmega(part, axis, (double)spinrate, (double)gain); 10196 TargetOmega(part, axis, (double)spinrate, (double)gain);
8467 break; 10197 break;
8468 case (int)ScriptBaseClass.PRIM_SLICE: 10198
10199 case ScriptBaseClass.PRIM_SLICE:
8469 if (remain < 1) 10200 if (remain < 1)
8470 return null; 10201 return new LSL_List();
8471 LSL_Vector slice = rules.GetVector3Item(idx++); 10202 LSL_Vector slice;
10203 try
10204 {
10205 slice = rules.GetVector3Item(idx++);
10206 }
10207 catch(InvalidCastException)
10208 {
10209 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_SLICE: arg #{1} - parameter 2 must be vector", rulesParsed, idx - idxStart - 1));
10210 return new LSL_List();
10211 }
8472 part.UpdateSlice((float)slice.x, (float)slice.y); 10212 part.UpdateSlice((float)slice.x, (float)slice.y);
8473 break; 10213 break;
8474 case (int)ScriptBaseClass.PRIM_LINK_TARGET: 10214
10215 case ScriptBaseClass.PRIM_LINK_TARGET:
8475 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. 10216 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
8476 return null; 10217 return new LSL_List();
8477 10218
8478 return rules.GetSublist(idx, -1); 10219 return rules.GetSublist(idx, -1);
10220
10221 default:
10222 Error(originFunc, string.Format("Error running rule #{0}: arg #{1} - unsupported parameter", rulesParsed, idx - idxStart));
10223 return new LSL_List();
8479 } 10224 }
8480 } 10225 }
8481 } 10226 }
8482 catch (InvalidCastException e) 10227 catch (InvalidCastException e)
8483 { 10228 {
8484 ShoutError(string.Format( 10229 Error(originFunc, string.Format("Error running rule #{0}: arg #{1} - ", rulesParsed, idx - idxStart) + e.Message);
8485 "{0} error running rule #{1}: arg #{2} ",
8486 originFunc, rulesParsed, idx - idxStart) + e.Message);
8487 } 10230 }
8488 finally 10231 finally
8489 { 10232 {
@@ -8506,7 +10249,118 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8506 } 10249 }
8507 } 10250 }
8508 } 10251 }
8509 return null; 10252
10253 return new LSL_List();
10254 }
10255
10256 protected LSL_List SetAgentParams(ScenePresence sp, LSL_List rules, string originFunc, ref uint rulesParsed)
10257 {
10258 int idx = 0;
10259 int idxStart = 0;
10260
10261 try
10262 {
10263 while (idx < rules.Length)
10264 {
10265 ++rulesParsed;
10266 int code = rules.GetLSLIntegerItem(idx++);
10267
10268 int remain = rules.Length - idx;
10269 idxStart = idx;
10270
10271 switch (code)
10272 {
10273 case ScriptBaseClass.PRIM_POSITION:
10274 case ScriptBaseClass.PRIM_POS_LOCAL:
10275 if (remain < 1)
10276 return new LSL_List();
10277
10278 try
10279 {
10280 sp.OffsetPosition = rules.GetVector3Item(idx++);
10281 }
10282 catch(InvalidCastException)
10283 {
10284 if (code == ScriptBaseClass.PRIM_POSITION)
10285 {
10286 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_POSITION: arg #{1} - parameter 2 must be vector", rulesParsed, idx - idxStart - 1));
10287 }
10288 else
10289 {
10290 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_POS_LOCAL: arg #{1} - parameter 2 must be vector", rulesParsed, idx - idxStart - 1));
10291 }
10292 return new LSL_List();
10293 }
10294 break;
10295
10296 case ScriptBaseClass.PRIM_ROTATION:
10297 if (remain < 1)
10298 return new LSL_List();
10299
10300 Quaternion inRot;
10301
10302 try
10303 {
10304 inRot = rules.GetQuaternionItem(idx++);
10305 }
10306 catch(InvalidCastException)
10307 {
10308 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_ROTATION: arg #{1} - parameter 2 must be rotation", rulesParsed, idx - idxStart - 1));
10309 return new LSL_List();
10310 }
10311
10312 SceneObjectPart parentPart = sp.ParentPart;
10313
10314 if (parentPart != null)
10315 sp.Rotation = m_host.GetWorldRotation() * inRot;
10316
10317 break;
10318
10319 case ScriptBaseClass.PRIM_ROT_LOCAL:
10320 if (remain < 1)
10321 return new LSL_List();
10322
10323 try
10324 {
10325 sp.Rotation = rules.GetQuaternionItem(idx++);
10326 }
10327 catch(InvalidCastException)
10328 {
10329 Error(originFunc, string.Format("Error running rule #{0} -> PRIM_ROT_LOCAL: arg #{1} - parameter 2 must be rotation", rulesParsed, idx - idxStart - 1));
10330 return new LSL_List();
10331 }
10332
10333 break;
10334
10335 case ScriptBaseClass.PRIM_TYPE:
10336 Error(originFunc, "PRIM_TYPE disallowed on agent");
10337 return new LSL_List();
10338
10339 case ScriptBaseClass.PRIM_OMEGA:
10340 Error(originFunc, "PRIM_OMEGA disallowed on agent");
10341 return new LSL_List();
10342
10343 case ScriptBaseClass.PRIM_LINK_TARGET:
10344 if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless.
10345 return new LSL_List();
10346
10347 return rules.GetSublist(idx, -1);
10348
10349 default:
10350 Error(originFunc,
10351 string.Format("Error running rule #{0} on agent: arg #{1} - disallowed on agent", rulesParsed, idx - idxStart));
10352 return new LSL_List();
10353 }
10354 }
10355 }
10356 catch (InvalidCastException e)
10357 {
10358 Error(
10359 originFunc,
10360 string.Format("Error running rule #{0}: arg #{1} - ", rulesParsed, idx - idxStart) + e.Message);
10361 }
10362
10363 return new LSL_List();
8510 } 10364 }
8511 10365
8512 public LSL_String llStringToBase64(string str) 10366 public LSL_String llStringToBase64(string str)
@@ -8514,14 +10368,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8514 m_host.AddScriptLPS(1); 10368 m_host.AddScriptLPS(1);
8515 try 10369 try
8516 { 10370 {
8517 byte[] encData_byte = new byte[str.Length]; 10371 byte[] encData_byte;
8518 encData_byte = Util.UTF8.GetBytes(str); 10372 encData_byte = Util.UTF8.GetBytes(str);
8519 string encodedData = Convert.ToBase64String(encData_byte); 10373 string encodedData = Convert.ToBase64String(encData_byte);
8520 return encodedData; 10374 return encodedData;
8521 } 10375 }
8522 catch (Exception e) 10376 catch
8523 { 10377 {
8524 throw new Exception("Error in base64Encode" + e.Message); 10378 Error("llBase64ToString", "Error encoding string");
10379 return String.Empty;
8525 } 10380 }
8526 } 10381 }
8527 10382
@@ -8530,16 +10385,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8530 m_host.AddScriptLPS(1); 10385 m_host.AddScriptLPS(1);
8531 try 10386 try
8532 { 10387 {
8533 return Util.Base64ToString(str); 10388 byte[] b = Convert.FromBase64String(str);
10389 return Encoding.UTF8.GetString(b);
8534 } 10390 }
8535 catch (Exception e) 10391 catch
8536 { 10392 {
8537 throw new Exception("Error in base64Decode" + e.Message); 10393 Error("llBase64ToString", "Error decoding string");
10394 return String.Empty;
8538 } 10395 }
8539 } 10396 }
8540 10397
8541 public LSL_String llXorBase64Strings(string str1, string str2) 10398 public LSL_String llXorBase64Strings(string str1, string str2)
8542 { 10399 {
10400<<<<<<< HEAD
10401 m_host.AddScriptLPS(1);
10402 Deprecated("llXorBase64Strings", "Use llXorBase64 instead");
10403 ScriptSleep(m_sleepMsOnXorBase64Strings);
10404 return String.Empty;
10405=======
8543 int padding = 0; 10406 int padding = 0;
8544 10407
8545 string b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 10408 string b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
@@ -8638,12 +10501,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8638 output += "="; 10501 output += "=";
8639 10502
8640 return output; 10503 return output;
10504>>>>>>> avn/ubitvar
8641 } 10505 }
8642 10506
8643 public void llRemoteDataSetRegion() 10507 public void llRemoteDataSetRegion()
8644 { 10508 {
8645 m_host.AddScriptLPS(1); 10509 m_host.AddScriptLPS(1);
8646 Deprecated("llRemoteDataSetRegion"); 10510 Deprecated("llRemoteDataSetRegion", "Use llOpenRemoteDataChannel instead");
8647 } 10511 }
8648 10512
8649 public LSL_Float llLog10(double val) 10513 public LSL_Float llLog10(double val)
@@ -8684,7 +10548,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8684 10548
8685 land.SetMusicUrl(url); 10549 land.SetMusicUrl(url);
8686 10550
8687 ScriptSleep(2000); 10551 ScriptSleep(m_sleepMsOnSetParcelMusicURL);
8688 } 10552 }
8689 10553
8690 public LSL_String llGetParcelMusicURL() 10554 public LSL_String llGetParcelMusicURL()
@@ -8768,25 +10632,186 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8768 } 10632 }
8769 10633
8770 /// <summary> 10634 /// <summary>
8771 /// A partial implementation. 10635 /// Full implementation of llGetBoundingBox according to SL 2015-04-15.
10636 /// http://wiki.secondlife.com/wiki/LlGetBoundingBox
8772 /// http://lslwiki.net/lslwiki/wakka.php?wakka=llGetBoundingBox 10637 /// http://lslwiki.net/lslwiki/wakka.php?wakka=llGetBoundingBox
8773 /// So far only valid for standing/flying/ground sitting avatars and single prim objects. 10638 /// Returns local bounding box of avatar without attachments
8774 /// If the object has multiple prims and/or a sitting avatar then the bounding 10639 /// if target is non-seated avatar or prim/mesh in avatar attachment.
8775 /// box is for the root prim only. 10640 /// Returns local bounding box of object including seated avatars
10641 /// if target is seated avatar or prim/mesh in object.
10642 /// Uses meshing of prims for high accuracy
10643 /// or less accurate box models for speed.
8776 /// </summary> 10644 /// </summary>
8777 public LSL_List llGetBoundingBox(string obj) 10645 public LSL_List llGetBoundingBox(string obj)
8778 { 10646 {
8779 m_host.AddScriptLPS(1); 10647 m_host.AddScriptLPS(1);
10648
10649 // Get target avatar if non-seated avatar or attachment, or prim and object
8780 UUID objID = UUID.Zero; 10650 UUID objID = UUID.Zero;
10651 UUID.TryParse(obj, out objID);
10652 ScenePresence agent = World.GetScenePresence(objID);
10653 if (agent != null)
10654 {
10655 if (agent.ParentPart != null)
10656 {
10657 objID = agent.ParentPart.UUID;
10658 agent = null;
10659 }
10660 }
10661 SceneObjectGroup group = null;
10662 SceneObjectPart target = World.GetSceneObjectPart(objID);
10663 if (target != null)
10664 {
10665 group = target.ParentGroup;
10666 if (group.IsAttachment) {
10667 objID = group.AttachedAvatar;
10668 agent = World.GetScenePresence(objID);
10669 group = null;
10670 target = null;
10671 }
10672 }
10673
10674 // Initialize but break if no target
8781 LSL_List result = new LSL_List(); 10675 LSL_List result = new LSL_List();
10676<<<<<<< HEAD
10677 int groupCount = 0;
10678 int partCount = 0;
10679 int vertexCount = 0;
10680 if (target == null && agent == null)
10681=======
8782 10682
8783 // If the ID is not valid, return null result 10683 // If the ID is not valid, return null result
8784 if (!UUID.TryParse(obj, out objID)) 10684 if (!UUID.TryParse(obj, out objID))
10685>>>>>>> avn/ubitvar
8785 { 10686 {
8786 result.Add(new LSL_Vector()); 10687 result.Add(new LSL_Vector());
8787 result.Add(new LSL_Vector()); 10688 result.Add(new LSL_Vector());
10689 if (m_addStatsInGetBoundingBox)
10690 result.Add(new LSL_Vector((float)groupCount, (float)partCount, (float)vertexCount));
10691 return result;
10692 }
10693<<<<<<< HEAD
10694 Vector3 minPosition = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue);
10695 Vector3 maxPosition = new Vector3(float.MinValue, float.MinValue, float.MinValue);
10696
10697 // Try to get a mesher
10698 IRendering primMesher = null;
10699 List<string> renderers = RenderingLoader.ListRenderers(Util.ExecutingDirectory());
10700 if (renderers.Count > 0)
10701 primMesher = RenderingLoader.LoadRenderer(renderers[0]);
10702
10703 // Get bounding box of just avatar, seated or not
10704 if (agent != null)
10705 {
10706 bool hasParent = false;
10707 Vector3 lower;
10708 Vector3 upper;
10709 BoundingBoxOfScenePresence(agent, out lower, out upper);
10710 Vector3 offset = Vector3.Zero;
10711
10712 // Since local bounding box unrotated and untilted, keep it simple
10713 AddBoundingBoxOfSimpleBox(lower, upper, offset, agent.Rotation, hasParent, ref minPosition, ref maxPosition, ref vertexCount);
10714 partCount++;
10715 groupCount++;
10716
10717 // Return lower and upper bounding box corners
10718 result.Add(new LSL_Vector(minPosition));
10719 result.Add(new LSL_Vector(maxPosition));
10720 if (m_addStatsInGetBoundingBox)
10721 result.Add(new LSL_Vector((float)groupCount, (float)partCount, (float)vertexCount));
8788 return result; 10722 return result;
8789 } 10723 }
10724 // Get bounding box of object including seated avatars
10725 else if (group != null)
10726 {
10727 // Merge bounding boxes of all parts (prims and mesh)
10728 foreach (SceneObjectPart part in group.Parts)
10729 {
10730 bool hasParent = (!part.IsRoot);
10731 // When requested or if no mesher, keep it simple
10732 if (m_useSimpleBoxesInGetBoundingBox || primMesher == null)
10733 {
10734 AddBoundingBoxOfSimpleBox(part.Scale * -0.5f, part.Scale * 0.5f, part.OffsetPosition, part.RotationOffset, hasParent, ref minPosition, ref maxPosition, ref vertexCount);
10735 }
10736 // Do the full mounty
10737 else
10738 {
10739 Primitive omvPrim = part.Shape.ToOmvPrimitive(part.OffsetPosition, part.RotationOffset);
10740 byte[] sculptAsset = null;
10741 if (omvPrim.Sculpt != null)
10742 sculptAsset = World.AssetService.GetData(omvPrim.Sculpt.SculptTexture.ToString());
10743
10744 // When part is mesh
10745 // Quirk: Only imports as incompletely populated faceted mesh object, so needs an own handler.
10746 if (omvPrim.Sculpt != null && omvPrim.Sculpt.Type == SculptType.Mesh && sculptAsset != null)
10747 {
10748 AssetMesh meshAsset = new AssetMesh(omvPrim.Sculpt.SculptTexture, sculptAsset);
10749 FacetedMesh mesh = null;
10750 FacetedMesh.TryDecodeFromAsset(omvPrim, meshAsset, DetailLevel.Highest, out mesh);
10751 meshAsset = null;
10752 if (mesh != null)
10753 {
10754 AddBoundingBoxOfFacetedMesh(mesh, omvPrim, hasParent, ref minPosition, ref maxPosition, ref vertexCount);
10755 mesh = null;
10756 }
10757 }
10758
10759 // When part is sculpt
10760 // Quirk: Generated sculpt mesh is about 2.8% smaller in X and Y than visual sculpt.
10761 else if (omvPrim.Sculpt != null && omvPrim.Sculpt.Type != SculptType.Mesh && sculptAsset != null)
10762 {
10763 IJ2KDecoder imgDecoder = World.RequestModuleInterface<IJ2KDecoder>();
10764 if (imgDecoder != null)
10765 {
10766 Image sculpt = imgDecoder.DecodeToImage(sculptAsset);
10767 if (sculpt != null)
10768 {
10769 SimpleMesh mesh = primMesher.GenerateSimpleSculptMesh(omvPrim, (Bitmap)sculpt, DetailLevel.Medium);
10770 sculpt.Dispose();
10771 if (mesh != null)
10772 {
10773 AddBoundingBoxOfSimpleMesh(mesh, omvPrim, hasParent, ref minPosition, ref maxPosition, ref vertexCount);
10774 mesh = null;
10775 }
10776 }
10777 }
10778 }
10779
10780 // When part is prim
10781 else if (omvPrim.Sculpt == null)
10782 {
10783 SimpleMesh mesh = primMesher.GenerateSimpleMesh(omvPrim, DetailLevel.Medium);
10784 if (mesh != null)
10785 {
10786 AddBoundingBoxOfSimpleMesh(mesh, omvPrim, hasParent, ref minPosition, ref maxPosition, ref vertexCount);
10787 mesh = null;
10788 }
10789 }
10790
10791 // When all else fails, try fallback to simple box
10792 else
10793 {
10794 AddBoundingBoxOfSimpleBox(part.Scale * -0.5f, part.Scale * 0.5f, part.OffsetPosition, part.RotationOffset, hasParent, ref minPosition, ref maxPosition, ref vertexCount);
10795 }
10796 }
10797 partCount++;
10798 }
10799 }
10800
10801 // Merge bounding boxes of seated avatars
10802 foreach (ScenePresence sp in group.GetSittingAvatars())
10803 {
10804 Vector3 lower;
10805 Vector3 upper;
10806 BoundingBoxOfScenePresence(sp, out lower, out upper);
10807 Vector3 offset = sp.OffsetPosition;
10808
10809 bool hasParent = true;
10810 // When requested or if no mesher, keep it simple
10811 if (m_useSimpleBoxesInGetBoundingBox || primMesher == null)
10812 {
10813 AddBoundingBoxOfSimpleBox(lower, upper, offset, sp.Rotation, hasParent, ref minPosition, ref maxPosition, ref vertexCount);
10814=======
8790 10815
8791 // Check if this is an attached prim. If so, replace 10816 // Check if this is an attached prim. If so, replace
8792 // the UUID with the avatar UUID and report it's bounding box 10817 // the UUID with the avatar UUID and report it's bounding box
@@ -8830,9 +10855,68 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8830 // This is for ground sitting avatars TODO! 10855 // This is for ground sitting avatars TODO!
8831 lower = new LSL_Vector(-box.X - 0.1125, -box.Y, box.Z * -1.0f); 10856 lower = new LSL_Vector(-box.X - 0.1125, -box.Y, box.Z * -1.0f);
8832 upper = new LSL_Vector(box.X + 0.1125, box.Y, box.Z * -1.0f); 10857 upper = new LSL_Vector(box.X + 0.1125, box.Y, box.Z * -1.0f);
10858>>>>>>> avn/ubitvar
8833 } 10859 }
10860 // Do the full mounty
8834 else 10861 else
8835 { 10862 {
10863<<<<<<< HEAD
10864 // Prim shapes don't do center offsets, so add it here.
10865 offset = offset + (lower + upper) * 0.5f * sp.Rotation;
10866 Primitive omvPrim = MakeOpenMetaversePrim(upper - lower, offset, sp.Rotation, ScriptBaseClass.PRIM_TYPE_SPHERE);
10867 SimpleMesh mesh = primMesher.GenerateSimpleMesh(omvPrim, DetailLevel.Medium);
10868 AddBoundingBoxOfSimpleMesh(mesh, omvPrim, hasParent, ref minPosition, ref maxPosition, ref vertexCount);
10869 mesh = null;
10870 }
10871 partCount++;
10872 }
10873
10874 groupCount++;
10875
10876 // Return lower and upper bounding box corners
10877 result.Add(new LSL_Vector(minPosition));
10878 result.Add(new LSL_Vector(maxPosition));
10879 if (m_addStatsInGetBoundingBox)
10880 result.Add(new LSL_Vector((float)groupCount, (float)partCount, (float)vertexCount));
10881
10882 primMesher = null;
10883 return result;
10884 }
10885
10886 /// <summary>
10887 /// Helper to calculate bounding box of an avatar.
10888 /// </summary>
10889 private void BoundingBoxOfScenePresence(ScenePresence sp, out Vector3 lower, out Vector3 upper)
10890 {
10891 // Adjust from OS model
10892 // avatar height = visual height - 0.2, bounding box height = visual height
10893 // to SL model
10894 // avatar height = visual height, bounding box height = visual height + 0.2
10895 float height = sp.Appearance.AvatarHeight + m_avatarHeightCorrection;
10896
10897 // According to avatar bounding box in SL 2015-04-18:
10898 // standing = <-0.275,-0.35,-0.1-0.5*h> : <0.275,0.35,0.1+0.5*h>
10899 // groundsitting = <-0.3875,-0.5,-0.05-0.375*h> : <0.3875,0.5,0.5>
10900 // sitting = <-0.5875,-0.35,-0.35-0.375*h> : <0.1875,0.35,-0.25+0.25*h>
10901
10902 // When avatar is sitting
10903 if (sp.ParentPart != null)
10904 {
10905 lower = new Vector3(m_lABB1SitX0, m_lABB1SitY0, m_lABB1SitZ0 + m_lABB1SitZ1 * height);
10906 upper = new Vector3(m_lABB2SitX0, m_lABB2SitY0, m_lABB2SitZ0 + m_lABB2SitZ1 * height);
10907 }
10908 // When avatar is groundsitting
10909 else if (sp.Animator.Animations.ImplicitDefaultAnimation.AnimID == DefaultAvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
10910 {
10911 lower = new Vector3(m_lABB1GrsX0, m_lABB1GrsY0, m_lABB1GrsZ0 + m_lABB1GrsZ1 * height);
10912 upper = new Vector3(m_lABB2GrsX0, m_lABB2GrsY0, m_lABB2GrsZ0 + m_lABB2GrsZ1 * height);
10913 }
10914 // When avatar is standing or flying
10915 else
10916 {
10917 lower = new Vector3(m_lABB1StdX0, m_lABB1StdY0, m_lABB1StdZ0 + m_lABB1StdZ1 * height);
10918 upper = new Vector3(m_lABB2StdX0, m_lABB2StdY0, m_lABB2StdZ0 + m_lABB2StdZ1 * height);
10919=======
8836 // This is for standing/flying avatars 10920 // This is for standing/flying avatars
8837 lower = new LSL_Vector(-box.X, -box.Y, -box.Z); 10921 lower = new LSL_Vector(-box.X, -box.Y, -box.Z);
8838 upper = new LSL_Vector(box.X, box.Y, box.Z); 10922 upper = new LSL_Vector(box.X, box.Y, box.Z);
@@ -8890,22 +10974,230 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8890 result.Add(lower); 10974 result.Add(lower);
8891 result.Add(upper); 10975 result.Add(upper);
8892 return result; 10976 return result;
10977>>>>>>> avn/ubitvar
8893 } 10978 }
10979 }
8894 10980
8895 // Not found so return empty values 10981 /// <summary>
8896 result.Add(new LSL_Vector()); 10982 /// Helper to approximate a part with a simple box.
8897 result.Add(new LSL_Vector()); 10983 /// </summary>
8898 return result; 10984 private void AddBoundingBoxOfSimpleBox(Vector3 corner1, Vector3 corner2, Vector3 offset, Quaternion rotation, bool hasParent, ref Vector3 lower, ref Vector3 upper, ref int count)
10985 {
10986 // Parse the 8 box corners
10987 for (int i = 0; i < 8; i++)
10988 {
10989 // Calculate each box corner
10990 Vector3 position = corner1;
10991 if ((i & 1) != 0)
10992 position.X = corner2.X;
10993 if ((i & 2) != 0)
10994 position.Y = corner2.Y;
10995 if ((i & 4) != 0)
10996 position.Z = corner2.Z;
10997 // Rotate part unless part is root
10998 if (hasParent)
10999 position = position * rotation;
11000 position = position + offset;
11001 // Adjust lower and upper bounding box corners if needed
11002 lower = Vector3.Min(lower, position);
11003 upper = Vector3.Max(upper, position);
11004 count++;
11005 }
11006 }
11007
11008 /// <summary>
11009 /// Helper to parse a meshed prim and needed especially
11010 /// for accuracy with tortured prims and sculpts.
11011 /// </summary>
11012 private void AddBoundingBoxOfSimpleMesh(SimpleMesh mesh, Primitive prim, bool hasParent, ref Vector3 lower, ref Vector3 upper, ref int count)
11013 {
11014 // Quirk: A meshed box contains 10 instead of the 8 necessary vertices.
11015 if (mesh != null)
11016 {
11017 // Parse each vertex in mesh
11018 foreach (Vertex vertex in mesh.Vertices)
11019 {
11020 Vector3 position = vertex.Position;
11021 position = position * prim.Scale;
11022 // Rotate part unless part is root
11023 if (hasParent)
11024 position = position * prim.Rotation;
11025 position = position + prim.Position;
11026 // Adjust lower and upper bounding box corners if needed
11027 lower = Vector3.Min(lower, position);
11028 upper = Vector3.Max(upper, position);
11029 count++;
11030 }
11031 }
8899 } 11032 }
8900 11033
11034 /// <summary>
11035 /// Helper to parse mesh because no method exists
11036 /// to parse mesh assets to SimpleMesh.
11037 /// </summary>
11038 private void AddBoundingBoxOfFacetedMesh(FacetedMesh mesh, Primitive prim, bool hasParent, ref Vector3 lower, ref Vector3 upper, ref int count)
11039 {
11040 if (mesh != null)
11041 {
11042 // Parse each face in mesh
11043 // since vertex array isn't populated.
11044 // This parses each unique vertex 3-6 times.
11045 foreach (Face face in mesh.Faces)
11046 {
11047 // Parse each vertex in face
11048 foreach (Vertex vertex in face.Vertices)
11049 {
11050 Vector3 position = vertex.Position;
11051 position = position * prim.Scale;
11052 // Rotate part unless part is root
11053 if (hasParent)
11054 position = position * prim.Rotation;
11055 position = position + prim.Position;
11056 // Adjust lower and upper bounding box corners if needed
11057 lower = Vector3.Min(lower, position);
11058 upper = Vector3.Max(upper, position);
11059 count++;
11060 }
11061 }
11062 }
11063 }
11064
11065 /// <summary>
11066 /// Helper to make up an OpenMetaverse prim
11067 /// needed to create mesh from parts.
11068 /// </summary>
11069 private Primitive MakeOpenMetaversePrim(Vector3 scale, Vector3 position, Quaternion rotation, int primType)
11070 {
11071 // Initialize and set common parameters
11072 Primitive prim = new OpenMetaverse.Primitive();
11073 prim.Scale = scale;
11074 prim.Position = position;
11075 prim.Rotation = rotation;
11076 prim.PrimData.PathShearX = 0.0f;
11077 prim.PrimData.PathShearY = 0.0f;
11078 prim.PrimData.PathBegin = 0.0f;
11079 prim.PrimData.PathEnd = 1.0f;
11080 prim.PrimData.PathScaleX = 1.0f;
11081 prim.PrimData.PathScaleY = 1.0f;
11082 prim.PrimData.PathTaperX = 0.0f;
11083 prim.PrimData.PathTaperY = 0.0f;
11084 prim.PrimData.PathTwistBegin = 0.0f;
11085 prim.PrimData.PathTwist = 0.0f;
11086 prim.PrimData.ProfileBegin = 0.0f;
11087 prim.PrimData.ProfileEnd = 1.0f;
11088 prim.PrimData.ProfileHollow = 0.0f;
11089 prim.PrimData.ProfileCurve = (ProfileCurve)1;
11090 prim.PrimData.ProfileHole = (HoleType)0;
11091 prim.PrimData.PathCurve = (PathCurve)16;
11092 prim.PrimData.PathRadiusOffset = 0.0f;
11093 prim.PrimData.PathRevolutions = 1.0f;
11094 prim.PrimData.PathSkew = 0.0f;
11095 prim.PrimData.PCode = OpenMetaverse.PCode.Prim;
11096 prim.PrimData.State = (byte)0;
11097
11098 // Set type specific parameters
11099 switch (primType)
11100 {
11101 // Set specific parameters for box
11102 case ScriptBaseClass.PRIM_TYPE_BOX:
11103 prim.PrimData.PathScaleY = 1.0f;
11104 prim.PrimData.ProfileCurve = (ProfileCurve)1;
11105 prim.PrimData.PathCurve = (PathCurve)16;
11106 break;
11107 // Set specific parameters for cylinder
11108 case ScriptBaseClass.PRIM_TYPE_CYLINDER:
11109 prim.PrimData.PathScaleY = 1.0f;
11110 prim.PrimData.ProfileCurve = (ProfileCurve)0;
11111 prim.PrimData.PathCurve = (PathCurve)16;
11112 break;
11113 // Set specific parameters for prism
11114 case ScriptBaseClass.PRIM_TYPE_PRISM:
11115 prim.PrimData.PathScaleY = 1.0f;
11116 prim.PrimData.ProfileCurve = (ProfileCurve)3;
11117 prim.PrimData.PathCurve = (PathCurve)16;
11118 break;
11119 // Set specific parameters for sphere
11120 case ScriptBaseClass.PRIM_TYPE_SPHERE:
11121 prim.PrimData.PathScaleY = 1.0f;
11122 prim.PrimData.ProfileCurve = (ProfileCurve)5;
11123 prim.PrimData.PathCurve = (PathCurve)32;
11124 break;
11125 // Set specific parameters for torus
11126 case ScriptBaseClass.PRIM_TYPE_TORUS:
11127 prim.PrimData.PathScaleY = 0.5f;
11128 prim.PrimData.ProfileCurve = (ProfileCurve)0;
11129 prim.PrimData.PathCurve = (PathCurve)32;
11130 break;
11131 // Set specific parameters for tube
11132 case ScriptBaseClass.PRIM_TYPE_TUBE:
11133 prim.PrimData.PathScaleY = 0.5f;
11134 prim.PrimData.ProfileCurve = (ProfileCurve)1;
11135 prim.PrimData.PathCurve = (PathCurve)32;
11136 break;
11137 // Set specific parameters for ring
11138 case ScriptBaseClass.PRIM_TYPE_RING:
11139 prim.PrimData.PathScaleY = 0.5f;
11140 prim.PrimData.ProfileCurve = (ProfileCurve)3;
11141 prim.PrimData.PathCurve = (PathCurve)32;
11142 break;
11143 // Set specific parameters for sculpt
11144 case ScriptBaseClass.PRIM_TYPE_SCULPT:
11145 prim.PrimData.PathScaleY = 1.0f;
11146 prim.PrimData.ProfileCurve = (ProfileCurve)5;
11147 prim.PrimData.PathCurve = (PathCurve)32;
11148 break;
11149 // Default to specific parameters for box
11150 default:
11151 prim.PrimData.PathScaleY = 1.0f;
11152 prim.PrimData.ProfileCurve = (ProfileCurve)1;
11153 prim.PrimData.PathCurve = (PathCurve)16;
11154 break;
11155 }
11156
11157 return prim;
11158 }
11159
11160 /// <summary>
11161 /// Implementation of llGetGeometricCenter according to SL 2015-04-30.
11162 /// http://wiki.secondlife.com/wiki/LlGetGeometricCenter
11163 /// Returns the average position offset of all linked parts,
11164 /// including the root prim and seated avatars,
11165 /// relative to the root prim in local coordinates.
11166 /// </summary>
8901 public LSL_Vector llGetGeometricCenter() 11167 public LSL_Vector llGetGeometricCenter()
8902 { 11168 {
8903 return new LSL_Vector(m_host.GetGeometricCenter()); 11169 // Subtract whatever position the root prim has to make it zero
11170 Vector3 offset = m_host.ParentGroup.RootPart.OffsetPosition * -1.0f;
11171
11172 // Add all prim/part position offsets
11173 foreach (SceneObjectPart part in m_host.ParentGroup.Parts)
11174 offset = offset + part.OffsetPosition;
11175 // Add all avatar/scene presence position offsets
11176 foreach (ScenePresence sp in m_host.ParentGroup.GetSittingAvatars())
11177 offset = offset + sp.OffsetPosition;
11178
11179 // Calculate and return the average offset
11180 offset = offset / (float)(m_host.ParentGroup.PrimCount + m_host.ParentGroup.GetSittingAvatarsCount());
11181 return new LSL_Vector(offset);
8904 } 11182 }
8905 11183
8906 public LSL_List llGetPrimitiveParams(LSL_List rules) 11184 public LSL_List llGetPrimitiveParams(LSL_List rules)
8907 { 11185 {
11186<<<<<<< HEAD
11187 LSL_List result = new LSL_List();
11188 LSL_List remaining;
11189
11190 while (true)
11191 {
11192// m_log.DebugFormat(
11193// "[LSL API]: GetEntityParams has {0} rules with scene entity named {1}",
11194// rules.Length, entity != null ? entity.Name : "NULL");
11195
11196 if (entity == null)
11197 return result;
11198=======
8908 m_host.AddScriptLPS(1); 11199 m_host.AddScriptLPS(1);
11200>>>>>>> avn/ubitvar
8909 11201
8910 LSL_List result = new LSL_List(); 11202 LSL_List result = new LSL_List();
8911 11203
@@ -8915,7 +11207,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8915 { 11207 {
8916 int linknumber = remaining.GetLSLIntegerItem(0); 11208 int linknumber = remaining.GetLSLIntegerItem(0);
8917 rules = remaining.GetSublist(1, -1); 11209 rules = remaining.GetSublist(1, -1);
11210<<<<<<< HEAD
11211 entity = GetLinkEntity(m_host, linknumber);
11212 }
11213 }
11214=======
8918 List<SceneObjectPart> parts = GetLinkParts(linknumber); 11215 List<SceneObjectPart> parts = GetLinkParts(linknumber);
11216>>>>>>> avn/ubitvar
8919 11217
8920 foreach (SceneObjectPart part in parts) 11218 foreach (SceneObjectPart part in parts)
8921 remaining = GetPrimParams(part, rules, ref result); 11219 remaining = GetPrimParams(part, rules, ref result);
@@ -8928,8 +11226,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8928 { 11226 {
8929 m_host.AddScriptLPS(1); 11227 m_host.AddScriptLPS(1);
8930 11228
11229<<<<<<< HEAD
11230 return GetEntityParams(GetLinkEntity(m_host, linknumber), rules);
11231 }
11232=======
8931 // acording to SL wiki this must indicate a single link number or link_root or link_this. 11233 // acording to SL wiki this must indicate a single link number or link_root or link_this.
8932 // keep other options as before 11234 // keep other options as before
11235>>>>>>> avn/ubitvar
8933 11236
8934 List<SceneObjectPart> parts; 11237 List<SceneObjectPart> parts;
8935 List<ScenePresence> avatars; 11238 List<ScenePresence> avatars;
@@ -8945,12 +11248,161 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8945 remaining = null; 11248 remaining = null;
8946 foreach (SceneObjectPart part in parts) 11249 foreach (SceneObjectPart part in parts)
8947 { 11250 {
11251<<<<<<< HEAD
11252 case (int)ScriptBaseClass.PRIM_MATERIAL:
11253 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_MATERIAL_FLESH));
11254 break;
11255
11256 case (int)ScriptBaseClass.PRIM_PHYSICS:
11257 res.Add(ScriptBaseClass.FALSE);
11258 break;
11259
11260 case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
11261 res.Add(ScriptBaseClass.FALSE);
11262 break;
11263
11264 case (int)ScriptBaseClass.PRIM_PHANTOM:
11265 res.Add(ScriptBaseClass.FALSE);
11266 break;
11267
11268 case (int)ScriptBaseClass.PRIM_POSITION:
11269 res.Add(new LSL_Vector(sp.AbsolutePosition));
11270 break;
11271
11272 case (int)ScriptBaseClass.PRIM_SIZE:
11273 res.Add(GetAgentSize(sp));
11274 break;
11275
11276 case (int)ScriptBaseClass.PRIM_ROTATION:
11277 res.Add(sp.GetWorldRotation());
11278 break;
11279
11280 case (int)ScriptBaseClass.PRIM_TYPE:
11281 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TYPE_BOX));
11282 res.Add(new LSL_Integer(ScriptBaseClass.PRIM_HOLE_DEFAULT));
11283 res.Add(new LSL_Vector(0, 1, 0));
11284 res.Add(new LSL_Float(0));
11285 res.Add(new LSL_Vector(0, 0, 0));
11286 res.Add(new LSL_Vector(1, 1, 0));
11287 res.Add(new LSL_Vector(0, 0, 0));
11288 break;
11289
11290 case (int)ScriptBaseClass.PRIM_TEXTURE:
11291 if (remain < 1)
11292 return new LSL_List();
11293
11294 int face = (int)rules.GetLSLIntegerItem(idx++);
11295 if (face > 21)
11296 break;
11297
11298 res.Add(new LSL_String(""));
11299 res.Add(ScriptBaseClass.ZERO_VECTOR);
11300 res.Add(ScriptBaseClass.ZERO_VECTOR);
11301 res.Add(new LSL_Float(0));
11302 break;
11303
11304 case (int)ScriptBaseClass.PRIM_COLOR:
11305 if (remain < 1)
11306 return new LSL_List();
11307
11308 face = (int)rules.GetLSLIntegerItem(idx++);
11309 if (face > 21)
11310 break;
11311
11312 res.Add(ScriptBaseClass.ZERO_VECTOR);
11313 res.Add(new LSL_Float(0));
11314 break;
11315
11316 case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
11317 if (remain < 1)
11318 return new LSL_List();
11319
11320 face = (int)rules.GetLSLIntegerItem(idx++);
11321 if (face > 21)
11322 break;
11323
11324 res.Add(ScriptBaseClass.PRIM_SHINY_NONE);
11325 res.Add(ScriptBaseClass.PRIM_BUMP_NONE);
11326 break;
11327
11328 case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
11329 if (remain < 1)
11330 return new LSL_List();
11331
11332 face = (int)rules.GetLSLIntegerItem(idx++);
11333 if (face > 21)
11334 break;
11335
11336 res.Add(ScriptBaseClass.FALSE);
11337 break;
11338
11339 case (int)ScriptBaseClass.PRIM_FLEXIBLE:
11340 res.Add(ScriptBaseClass.FALSE);
11341 res.Add(new LSL_Integer(0));
11342 res.Add(new LSL_Float(0));
11343 res.Add(new LSL_Float(0));
11344 res.Add(new LSL_Float(0));
11345 res.Add(new LSL_Float(0));
11346 res.Add(ScriptBaseClass.ZERO_VECTOR);
11347 break;
11348
11349 case (int)ScriptBaseClass.PRIM_TEXGEN:
11350 if (remain < 1)
11351 return new LSL_List();
11352
11353 face = (int)rules.GetLSLIntegerItem(idx++);
11354 if (face > 21)
11355 break;
11356
11357 res.Add(ScriptBaseClass.PRIM_TEXGEN_DEFAULT);
11358 break;
11359
11360 case (int)ScriptBaseClass.PRIM_POINT_LIGHT:
11361 res.Add(ScriptBaseClass.FALSE);
11362 res.Add(ScriptBaseClass.ZERO_VECTOR);
11363 res.Add(ScriptBaseClass.ZERO_VECTOR);
11364 break;
11365
11366 case (int)ScriptBaseClass.PRIM_GLOW:
11367 if (remain < 1)
11368 return new LSL_List();
11369
11370 face = (int)rules.GetLSLIntegerItem(idx++);
11371 if (face > 21)
11372 break;
11373
11374 res.Add(new LSL_Float(0));
11375 break;
11376
11377 case (int)ScriptBaseClass.PRIM_TEXT:
11378 res.Add(new LSL_String(""));
11379 res.Add(ScriptBaseClass.ZERO_VECTOR);
11380 res.Add(new LSL_Float(1));
11381 break;
11382
11383 case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
11384 res.Add(new LSL_Rotation(sp.Rotation));
11385 break;
11386
11387 case (int)ScriptBaseClass.PRIM_POS_LOCAL:
11388 res.Add(new LSL_Vector(sp.OffsetPosition));
11389 break;
11390
11391 case (int)ScriptBaseClass.PRIM_SLICE:
11392 res.Add(new LSL_Vector(0, 1, 0));
11393 break;
11394
11395 case (int)ScriptBaseClass.PRIM_LINK_TARGET:
11396 if(remain < 3)
11397 return new LSL_List();
11398=======
8948 remaining = GetPrimParams(part, rules, ref res); 11399 remaining = GetPrimParams(part, rules, ref res);
8949 } 11400 }
8950 foreach (ScenePresence avatar in avatars) 11401 foreach (ScenePresence avatar in avatars)
8951 { 11402 {
8952 remaining = GetPrimParams(avatar, rules, ref res); 11403 remaining = GetPrimParams(avatar, rules, ref res);
8953 } 11404 }
11405>>>>>>> avn/ubitvar
8954 11406
8955 if ((object)remaining != null && remaining.Length > 0) 11407 if ((object)remaining != null && remaining.Length > 0)
8956 { 11408 {
@@ -8961,7 +11413,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8961 break; 11413 break;
8962 } 11414 }
8963 11415
11416<<<<<<< HEAD
11417 return new LSL_List();
11418=======
8964 return res; 11419 return res;
11420>>>>>>> avn/ubitvar
8965 } 11421 }
8966 11422
8967 public LSL_List GetPrimParams(SceneObjectPart part, LSL_List rules, ref LSL_List res) 11423 public LSL_List GetPrimParams(SceneObjectPart part, LSL_List rules, ref LSL_List res)
@@ -9014,6 +11470,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9014 res.Add(GetPartRot(part)); 11470 res.Add(GetPartRot(part));
9015 break; 11471 break;
9016 11472
11473 case (int)ScriptBaseClass.PRIM_PHYSICS_SHAPE_TYPE:
11474 res.Add(new LSL_Integer((int)part.PhysicsShapeType));
11475 break;
11476
9017 case (int)ScriptBaseClass.PRIM_TYPE: 11477 case (int)ScriptBaseClass.PRIM_TYPE:
9018 // implementing box 11478 // implementing box
9019 PrimitiveBaseShape Shape = part.Shape; 11479 PrimitiveBaseShape Shape = part.Shape;
@@ -9101,7 +11561,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9101 11561
9102 case (int)ScriptBaseClass.PRIM_TEXTURE: 11562 case (int)ScriptBaseClass.PRIM_TEXTURE:
9103 if (remain < 1) 11563 if (remain < 1)
9104 return null; 11564 return new LSL_List();
9105 11565
9106 int face = (int)rules.GetLSLIntegerItem(idx++); 11566 int face = (int)rules.GetLSLIntegerItem(idx++);
9107 Primitive.TextureEntry tex = part.Shape.Textures; 11567 Primitive.TextureEntry tex = part.Shape.Textures;
@@ -9141,7 +11601,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9141 11601
9142 case (int)ScriptBaseClass.PRIM_COLOR: 11602 case (int)ScriptBaseClass.PRIM_COLOR:
9143 if (remain < 1) 11603 if (remain < 1)
9144 return null; 11604 return new LSL_List();
9145 11605
9146 face=(int)rules.GetLSLIntegerItem(idx++); 11606 face=(int)rules.GetLSLIntegerItem(idx++);
9147 11607
@@ -9170,7 +11630,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9170 11630
9171 case (int)ScriptBaseClass.PRIM_BUMP_SHINY: 11631 case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
9172 if (remain < 1) 11632 if (remain < 1)
9173 return null; 11633 return new LSL_List();
9174 11634
9175 face = (int)rules.GetLSLIntegerItem(idx++); 11635 face = (int)rules.GetLSLIntegerItem(idx++);
9176 11636
@@ -9227,7 +11687,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9227 11687
9228 case (int)ScriptBaseClass.PRIM_FULLBRIGHT: 11688 case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
9229 if (remain < 1) 11689 if (remain < 1)
9230 return null; 11690 return new LSL_List();
9231 11691
9232 face = (int)rules.GetLSLIntegerItem(idx++); 11692 face = (int)rules.GetLSLIntegerItem(idx++);
9233 11693
@@ -9282,7 +11742,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9282 case (int)ScriptBaseClass.PRIM_TEXGEN: 11742 case (int)ScriptBaseClass.PRIM_TEXGEN:
9283 // (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR) 11743 // (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR)
9284 if (remain < 1) 11744 if (remain < 1)
9285 return null; 11745 return new LSL_List();
9286 11746
9287 face = (int)rules.GetLSLIntegerItem(idx++); 11747 face = (int)rules.GetLSLIntegerItem(idx++);
9288 11748
@@ -9331,7 +11791,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9331 11791
9332 case (int)ScriptBaseClass.PRIM_GLOW: 11792 case (int)ScriptBaseClass.PRIM_GLOW:
9333 if (remain < 1) 11793 if (remain < 1)
9334 return null; 11794 return new LSL_List();
9335 11795
9336 face = (int)rules.GetLSLIntegerItem(idx++); 11796 face = (int)rules.GetLSLIntegerItem(idx++);
9337 11797
@@ -9358,7 +11818,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9358 res.Add(new LSL_Vector(textColor.R, 11818 res.Add(new LSL_Vector(textColor.R,
9359 textColor.G, 11819 textColor.G,
9360 textColor.B)); 11820 textColor.B));
9361 res.Add(new LSL_Float(textColor.A)); 11821 res.Add(new LSL_Float(1.0 - textColor.A));
9362 break; 11822 break;
9363 11823
9364 case (int)ScriptBaseClass.PRIM_NAME: 11824 case (int)ScriptBaseClass.PRIM_NAME:
@@ -9388,26 +11848,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9388 11848
9389 // TODO: Should be issuing a runtime script warning in this case. 11849 // TODO: Should be issuing a runtime script warning in this case.
9390 if (remain < 2) 11850 if (remain < 2)
9391 return null; 11851 return new LSL_List();
9392 11852
9393 return rules.GetSublist(idx, -1); 11853 return rules.GetSublist(idx, -1);
9394 } 11854 }
9395 } 11855 }
9396 11856
9397 return null; 11857 return new LSL_List();
9398 } 11858 }
9399 11859
9400 public LSL_List llGetPrimMediaParams(int face, LSL_List rules) 11860 public LSL_List llGetPrimMediaParams(int face, LSL_List rules)
9401 { 11861 {
9402 m_host.AddScriptLPS(1); 11862 m_host.AddScriptLPS(1);
9403 ScriptSleep(1000); 11863 ScriptSleep(m_sleepMsOnGetPrimMediaParams);
9404 return GetPrimMediaParams(m_host, face, rules); 11864 return GetPrimMediaParams(m_host, face, rules);
9405 } 11865 }
9406 11866
9407 public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules) 11867 public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
9408 { 11868 {
9409 m_host.AddScriptLPS(1); 11869 m_host.AddScriptLPS(1);
9410 ScriptSleep(1000); 11870 ScriptSleep(m_sleepMsOnGetLinkMedia);
9411 if (link == ScriptBaseClass.LINK_ROOT) 11871 if (link == ScriptBaseClass.LINK_ROOT)
9412 return GetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules); 11872 return GetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules);
9413 else if (link == ScriptBaseClass.LINK_THIS) 11873 else if (link == ScriptBaseClass.LINK_THIS)
@@ -9527,14 +11987,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9527 public LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules) 11987 public LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules)
9528 { 11988 {
9529 m_host.AddScriptLPS(1); 11989 m_host.AddScriptLPS(1);
9530 ScriptSleep(1000); 11990 ScriptSleep(m_sleepMsOnSetPrimMediaParams);
9531 return SetPrimMediaParams(m_host, face, rules); 11991 return SetPrimMediaParams(m_host, face, rules);
9532 } 11992 }
9533 11993
9534 public LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules) 11994 public LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules)
9535 { 11995 {
9536 m_host.AddScriptLPS(1); 11996 m_host.AddScriptLPS(1);
9537 ScriptSleep(1000); 11997 ScriptSleep(m_sleepMsOnSetLinkMedia);
9538 if (link == ScriptBaseClass.LINK_ROOT) 11998 if (link == ScriptBaseClass.LINK_ROOT)
9539 return SetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules); 11999 return SetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules);
9540 else if (link == ScriptBaseClass.LINK_THIS) 12000 else if (link == ScriptBaseClass.LINK_THIS)
@@ -9653,14 +12113,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9653 public LSL_Integer llClearPrimMedia(LSL_Integer face) 12113 public LSL_Integer llClearPrimMedia(LSL_Integer face)
9654 { 12114 {
9655 m_host.AddScriptLPS(1); 12115 m_host.AddScriptLPS(1);
9656 ScriptSleep(1000); 12116 ScriptSleep(m_sleepMsOnClearPrimMedia);
9657 return ClearPrimMedia(m_host, face); 12117 return ClearPrimMedia(m_host, face);
9658 } 12118 }
9659 12119
9660 public LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face) 12120 public LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face)
9661 { 12121 {
9662 m_host.AddScriptLPS(1); 12122 m_host.AddScriptLPS(1);
9663 ScriptSleep(1000); 12123 ScriptSleep(m_sleepMsOnClearLinkMedia);
9664 if (link == ScriptBaseClass.LINK_ROOT) 12124 if (link == ScriptBaseClass.LINK_ROOT)
9665 return ClearPrimMedia(m_host.ParentGroup.RootPart, face); 12125 return ClearPrimMedia(m_host.ParentGroup.RootPart, face);
9666 else if (link == ScriptBaseClass.LINK_THIS) 12126 else if (link == ScriptBaseClass.LINK_THIS)
@@ -10268,7 +12728,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10268 12728
10269 if (item == null) 12729 if (item == null)
10270 { 12730 {
10271 llSay(0, "No item name '" + item + "'"); 12731 Error("llGetInventoryCreator", "Can't find item '" + item + "'");
10272 12732
10273 return String.Empty; 12733 return String.Empty;
10274 } 12734 }
@@ -10316,7 +12776,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10316 case ScriptBaseClass.DATA_SIM_POS: 12776 case ScriptBaseClass.DATA_SIM_POS:
10317 if (info == null) 12777 if (info == null)
10318 { 12778 {
10319 ScriptSleep(1000); 12779 ScriptSleep(m_sleepMsOnRequestSimulatorData);
10320 return UUID.Zero.ToString(); 12780 return UUID.Zero.ToString();
10321 } 12781 }
10322 12782
@@ -10363,7 +12823,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10363 case ScriptBaseClass.DATA_SIM_RATING: 12823 case ScriptBaseClass.DATA_SIM_RATING:
10364 if (info == null) 12824 if (info == null)
10365 { 12825 {
10366 ScriptSleep(1000); 12826 ScriptSleep(m_sleepMsOnRequestSimulatorData);
10367 return UUID.Zero.ToString(); 12827 return UUID.Zero.ToString();
10368 } 12828 }
10369 int access = info.Maturity; 12829 int access = info.Maturity;
@@ -10382,7 +12842,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10382 reply = "OpenSim"; 12842 reply = "OpenSim";
10383 break; 12843 break;
10384 default: 12844 default:
10385 ScriptSleep(1000); 12845 ScriptSleep(m_sleepMsOnRequestSimulatorData);
10386 return UUID.Zero.ToString(); // Raise no event 12846 return UUID.Zero.ToString(); // Raise no event
10387 } 12847 }
10388 UUID rq = UUID.Random(); 12848 UUID rq = UUID.Random();
@@ -10393,7 +12853,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10393 AsyncCommands. 12853 AsyncCommands.
10394 DataserverPlugin.DataserverReply(rq.ToString(), reply); 12854 DataserverPlugin.DataserverReply(rq.ToString(), reply);
10395 12855
10396 ScriptSleep(1000); 12856 ScriptSleep(m_sleepMsOnRequestSimulatorData);
10397 return tid.ToString(); 12857 return tid.ToString();
10398 } 12858 }
10399 catch(Exception) 12859 catch(Exception)
@@ -10462,7 +12922,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10462 12922
10463 public LSL_List llListReplaceList(LSL_List dest, LSL_List src, int start, int end) 12923 public LSL_List llListReplaceList(LSL_List dest, LSL_List src, int start, int end)
10464 { 12924 {
10465 LSL_List pref = null; 12925 LSL_List pref;
10466 12926
10467 m_host.AddScriptLPS(1); 12927 m_host.AddScriptLPS(1);
10468 12928
@@ -10542,7 +13002,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10542 dm.SendUrlToUser( 13002 dm.SendUrlToUser(
10543 new UUID(avatar_id), m_host.Name, m_host.UUID, m_host.OwnerID, false, message, url); 13003 new UUID(avatar_id), m_host.Name, m_host.UUID, m_host.OwnerID, false, message, url);
10544 13004
10545 ScriptSleep(10000); 13005 ScriptSleep(m_sleepMsOnLoadURL);
10546 } 13006 }
10547 13007
10548 public void llParcelMediaCommandList(LSL_List commandList) 13008 public void llParcelMediaCommandList(LSL_List commandList)
@@ -10591,7 +13051,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10591 presence = World.GetScenePresence(agentID); 13051 presence = World.GetScenePresence(agentID);
10592 } 13052 }
10593 } 13053 }
10594 else ShoutError("The argument of PARCEL_MEDIA_COMMAND_AGENT must be a key"); 13054 else Error("llParcelMediaCommandList", "The argument of PARCEL_MEDIA_COMMAND_AGENT must be a key");
10595 ++i; 13055 ++i;
10596 } 13056 }
10597 break; 13057 break;
@@ -10622,7 +13082,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10622 url = (LSL_String)commandList.Data[i + 1]; 13082 url = (LSL_String)commandList.Data[i + 1];
10623 update = true; 13083 update = true;
10624 } 13084 }
10625 else ShoutError("The argument of PARCEL_MEDIA_COMMAND_URL must be a string."); 13085 else Error("llParcelMediaCommandList", "The argument of PARCEL_MEDIA_COMMAND_URL must be a string");
10626 ++i; 13086 ++i;
10627 } 13087 }
10628 break; 13088 break;
@@ -10635,7 +13095,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10635 texture = (LSL_String)commandList.Data[i + 1]; 13095 texture = (LSL_String)commandList.Data[i + 1];
10636 update = true; 13096 update = true;
10637 } 13097 }
10638 else ShoutError("The argument of PARCEL_MEDIA_COMMAND_TEXTURE must be a string or key."); 13098 else Error("llParcelMediaCommandList", "The argument of PARCEL_MEDIA_COMMAND_TEXTURE must be a string or a key");
10639 ++i; 13099 ++i;
10640 } 13100 }
10641 break; 13101 break;
@@ -10647,7 +13107,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10647 { 13107 {
10648 time = (float)(LSL_Float)commandList.Data[i + 1]; 13108 time = (float)(LSL_Float)commandList.Data[i + 1];
10649 } 13109 }
10650 else ShoutError("The argument of PARCEL_MEDIA_COMMAND_TIME must be a float."); 13110 else Error("llParcelMediaCommandList", "The argument of PARCEL_MEDIA_COMMAND_TIME must be a float");
10651 ++i; 13111 ++i;
10652 } 13112 }
10653 break; 13113 break;
@@ -10661,7 +13121,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10661 update = true; 13121 update = true;
10662 } 13122 }
10663 13123
10664 else ShoutError("The argument of PARCEL_MEDIA_COMMAND_AUTO_ALIGN must be an integer."); 13124 else Error("llParcelMediaCommandList", "The argument of PARCEL_MEDIA_COMMAND_AUTO_ALIGN must be an integer");
10665 ++i; 13125 ++i;
10666 } 13126 }
10667 break; 13127 break;
@@ -10674,7 +13134,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10674 mediaType = (LSL_String)commandList.Data[i + 1]; 13134 mediaType = (LSL_String)commandList.Data[i + 1];
10675 update = true; 13135 update = true;
10676 } 13136 }
10677 else ShoutError("The argument of PARCEL_MEDIA_COMMAND_TYPE must be a string."); 13137 else Error("llParcelMediaCommandList", "The argument of PARCEL_MEDIA_COMMAND_TYPE must be a string");
10678 ++i; 13138 ++i;
10679 } 13139 }
10680 break; 13140 break;
@@ -10687,7 +13147,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10687 description = (LSL_String)commandList.Data[i + 1]; 13147 description = (LSL_String)commandList.Data[i + 1];
10688 update = true; 13148 update = true;
10689 } 13149 }
10690 else ShoutError("The argument of PARCEL_MEDIA_COMMAND_DESC must be a string."); 13150 else Error("llParcelMediaCommandList", "The argument of PARCEL_MEDIA_COMMAND_DESC must be a string");
10691 ++i; 13151 ++i;
10692 } 13152 }
10693 break; 13153 break;
@@ -10703,15 +13163,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10703 height = (LSL_Integer)commandList.Data[i + 2]; 13163 height = (LSL_Integer)commandList.Data[i + 2];
10704 update = true; 13164 update = true;
10705 } 13165 }
10706 else ShoutError("The second argument of PARCEL_MEDIA_COMMAND_SIZE must be an integer."); 13166 else Error("llParcelMediaCommandList", "The second argument of PARCEL_MEDIA_COMMAND_SIZE must be an integer");
10707 } 13167 }
10708 else ShoutError("The first argument of PARCEL_MEDIA_COMMAND_SIZE must be an integer."); 13168 else Error("llParcelMediaCommandList", "The first argument of PARCEL_MEDIA_COMMAND_SIZE must be an integer");
10709 i += 2; 13169 i += 2;
10710 } 13170 }
10711 break; 13171 break;
10712 13172
10713 default: 13173 default:
10714 NotImplemented("llParcelMediaCommandList parameter not supported yet: " + Enum.Parse(typeof(ParcelMediaCommandEnum), commandList.Data[i].ToString()).ToString()); 13174 NotImplemented("llParcelMediaCommandList", "Parameter not supported yet: " + Enum.Parse(typeof(ParcelMediaCommandEnum), commandList.Data[i].ToString()).ToString());
10715 break; 13175 break;
10716 }//end switch 13176 }//end switch
10717 }//end for 13177 }//end for
@@ -10785,7 +13245,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10785 time); 13245 time);
10786 } 13246 }
10787 } 13247 }
10788 ScriptSleep(2000); 13248 ScriptSleep(m_sleepMsOnParcelMediaCommandList);
10789 } 13249 }
10790 13250
10791 public LSL_List llParcelMediaQuery(LSL_List aList) 13251 public LSL_List llParcelMediaQuery(LSL_List aList)
@@ -10819,13 +13279,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10819 break; 13279 break;
10820 default: 13280 default:
10821 ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url; 13281 ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url;
10822 NotImplemented("llParcelMediaQuery parameter do not supported yet: " + Enum.Parse(mediaCommandEnum.GetType() , aList.Data[i].ToString()).ToString()); 13282 NotImplemented("llParcelMediaQuery", "Parameter not supported yet: " + Enum.Parse(mediaCommandEnum.GetType() , aList.Data[i].ToString()).ToString());
10823 break; 13283 break;
10824 } 13284 }
10825 13285
10826 } 13286 }
10827 } 13287 }
10828 ScriptSleep(2000); 13288 ScriptSleep(m_sleepMsOnParcelMediaQuery);
10829 return list; 13289 return list;
10830 } 13290 }
10831 13291
@@ -10834,7 +13294,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10834 m_host.AddScriptLPS(1); 13294 m_host.AddScriptLPS(1);
10835 Int64 tmp = 0; 13295 Int64 tmp = 0;
10836 Math.DivRem(Convert.ToInt64(Math.Pow(a, b)), c, out tmp); 13296 Math.DivRem(Convert.ToInt64(Math.Pow(a, b)), c, out tmp);
10837 ScriptSleep(1000); 13297 ScriptSleep(m_sleepMsOnModPow);
10838 return Convert.ToInt32(tmp); 13298 return Convert.ToInt32(tmp);
10839 } 13299 }
10840 13300
@@ -10856,11 +13316,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10856 13316
10857 if (quick_pay_buttons.Data.Length < 4) 13317 if (quick_pay_buttons.Data.Length < 4)
10858 { 13318 {
13319<<<<<<< HEAD
13320 Error("llSetPayPrice", "List must have at least 4 elements");
13321 return;
13322=======
10859 int x; 13323 int x;
10860 for (x=quick_pay_buttons.Data.Length; x<= 4; x++) 13324 for (x=quick_pay_buttons.Data.Length; x<= 4; x++)
10861 { 13325 {
10862 quick_pay_buttons.Add(ScriptBaseClass.PAY_HIDE); 13326 quick_pay_buttons.Add(ScriptBaseClass.PAY_HIDE);
10863 } 13327 }
13328>>>>>>> avn/ubitvar
10864 } 13329 }
10865 int[] nPrice = new int[5]; 13330 int[] nPrice = new int[5];
10866 nPrice[0] = price; 13331 nPrice[0] = price;
@@ -10881,7 +13346,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10881 13346
10882 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) 13347 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
10883 { 13348 {
10884 ShoutError("No permissions to track the camera"); 13349 Error("llGetCameraPos", "No permissions to track the camera");
10885 return Vector3.Zero; 13350 return Vector3.Zero;
10886 } 13351 }
10887 13352
@@ -10905,7 +13370,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10905 13370
10906 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) 13371 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
10907 { 13372 {
10908 ShoutError("No permissions to track the camera"); 13373 Error("llGetCameraRot", "No permissions to track the camera");
10909 return Quaternion.Identity; 13374 return Quaternion.Identity;
10910 } 13375 }
10911 13376
@@ -10919,25 +13384,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10919 return Quaternion.Identity; 13384 return Quaternion.Identity;
10920 } 13385 }
10921 13386
10922 /// <summary>
10923 /// The SL implementation does nothing, it is deprecated
10924 /// This duplicates SL
10925 /// </summary>
10926 public void llSetPrimURL(string url) 13387 public void llSetPrimURL(string url)
10927 { 13388 {
10928 m_host.AddScriptLPS(1); 13389 m_host.AddScriptLPS(1);
10929 ScriptSleep(2000); 13390 Deprecated("llSetPrimURL", "Use llSetPrimMediaParams instead");
13391 ScriptSleep(m_sleepMsOnSetPrimURL);
10930 } 13392 }
10931 13393
10932 /// <summary>
10933 /// The SL implementation shouts an error, it is deprecated
10934 /// This duplicates SL
10935 /// </summary>
10936 public void llRefreshPrimURL() 13394 public void llRefreshPrimURL()
10937 { 13395 {
10938 m_host.AddScriptLPS(1); 13396 m_host.AddScriptLPS(1);
10939 ShoutError("llRefreshPrimURL - not yet supported"); 13397 Deprecated("llRefreshPrimURL");
10940 ScriptSleep(20000); 13398 ScriptSleep(m_sleepMsOnRefreshPrimURL);
10941 } 13399 }
10942 13400
10943 public LSL_String llEscapeURL(string url) 13401 public LSL_String llEscapeURL(string url)
@@ -10989,8 +13447,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10989 avatar.ControllingClient.SendScriptTeleportRequest(m_host.Name, 13447 avatar.ControllingClient.SendScriptTeleportRequest(m_host.Name,
10990 simname, pos, lookAt); 13448 simname, pos, lookAt);
10991 } 13449 }
13450<<<<<<< HEAD
13451 ScriptSleep(m_sleepMsOnMapDestination);
13452=======
10992 13453
10993 ScriptSleep(1000); 13454 ScriptSleep(1000);
13455>>>>>>> avn/ubitvar
10994 } 13456 }
10995 13457
10996 public void llAddToLandBanList(string avatar, double hours) 13458 public void llAddToLandBanList(string avatar, double hours)
@@ -11031,7 +13493,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11031 World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land); 13493 World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land);
11032 } 13494 }
11033 } 13495 }
11034 ScriptSleep(100); 13496 ScriptSleep(m_sleepMsOnAddToLandBanList);
11035 } 13497 }
11036 13498
11037 public void llRemoveFromLandPassList(string avatar) 13499 public void llRemoveFromLandPassList(string avatar)
@@ -11058,7 +13520,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11058 } 13520 }
11059 } 13521 }
11060 } 13522 }
11061 ScriptSleep(100); 13523 ScriptSleep(m_sleepMsOnRemoveFromLandPassList);
11062 } 13524 }
11063 13525
11064 public void llRemoveFromLandBanList(string avatar) 13526 public void llRemoveFromLandBanList(string avatar)
@@ -11085,7 +13547,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11085 } 13547 }
11086 } 13548 }
11087 } 13549 }
11088 ScriptSleep(100); 13550 ScriptSleep(m_sleepMsOnRemoveFromLandBanList);
11089 } 13551 }
11090 13552
11091 public void llSetCameraParams(LSL_List rules) 13553 public void llSetCameraParams(LSL_List rules)
@@ -11115,7 +13577,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11115 object[] data = rules.Data; 13577 object[] data = rules.Data;
11116 for (int i = 0; i < data.Length; ++i) 13578 for (int i = 0; i < data.Length; ++i)
11117 { 13579 {
13580<<<<<<< HEAD
13581 int type;
13582 try
13583 {
13584 type = Convert.ToInt32(data[i++].ToString());
13585 }
13586 catch
13587 {
13588 Error("llSetCameraParams", string.Format("Invalid camera param type {0}", data[i - 1]));
13589 return;
13590 }
13591=======
11118 int type = Convert.ToInt32(data[i++].ToString()); 13592 int type = Convert.ToInt32(data[i++].ToString());
13593>>>>>>> avn/ubitvar
11119 if (i >= data.Length) break; // odd number of entries => ignore the last 13594 if (i >= data.Length) break; // odd number of entries => ignore the last
11120 13595
11121 // some special cases: Vector parameters are split into 3 float parameters (with type+1, type+2, type+3) 13596 // some special cases: Vector parameters are split into 3 float parameters (with type+1, type+2, type+3)
@@ -11125,9 +13600,63 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11125 case ScriptBaseClass.CAMERA_FOCUS_OFFSET: 13600 case ScriptBaseClass.CAMERA_FOCUS_OFFSET:
11126 case ScriptBaseClass.CAMERA_POSITION: 13601 case ScriptBaseClass.CAMERA_POSITION:
11127 LSL_Vector v = (LSL_Vector)data[i]; 13602 LSL_Vector v = (LSL_Vector)data[i];
11128 parameters.Add(type + 1, (float)v.x); 13603 try
11129 parameters.Add(type + 2, (float)v.y); 13604 {
11130 parameters.Add(type + 3, (float)v.z); 13605 parameters.Add(type + 1, (float)v.x);
13606 }
13607 catch
13608 {
13609 switch(type)
13610 {
13611 case ScriptBaseClass.CAMERA_FOCUS:
13612 Error("llSetCameraParams", "CAMERA_FOCUS: Parameter x is invalid");
13613 return;
13614 case ScriptBaseClass.CAMERA_FOCUS_OFFSET:
13615 Error("llSetCameraParams", "CAMERA_FOCUS_OFFSET: Parameter x is invalid");
13616 return;
13617 case ScriptBaseClass.CAMERA_POSITION:
13618 Error("llSetCameraParams", "CAMERA_POSITION: Parameter x is invalid");
13619 return;
13620 }
13621 }
13622 try
13623 {
13624 parameters.Add(type + 2, (float)v.y);
13625 }
13626 catch
13627 {
13628 switch(type)
13629 {
13630 case ScriptBaseClass.CAMERA_FOCUS:
13631 Error("llSetCameraParams", "CAMERA_FOCUS: Parameter y is invalid");
13632 return;
13633 case ScriptBaseClass.CAMERA_FOCUS_OFFSET:
13634 Error("llSetCameraParams", "CAMERA_FOCUS_OFFSET: Parameter y is invalid");
13635 return;
13636 case ScriptBaseClass.CAMERA_POSITION:
13637 Error("llSetCameraParams", "CAMERA_POSITION: Parameter y is invalid");
13638 return;
13639 }
13640 }
13641 try
13642 {
13643 parameters.Add(type + 3, (float)v.z);
13644 }
13645 catch
13646 {
13647 switch(type)
13648 {
13649 case ScriptBaseClass.CAMERA_FOCUS:
13650 Error("llSetCameraParams", "CAMERA_FOCUS: Parameter z is invalid");
13651 return;
13652 case ScriptBaseClass.CAMERA_FOCUS_OFFSET:
13653 Error("llSetCameraParams", "CAMERA_FOCUS_OFFSET: Parameter z is invalid");
13654 return;
13655 case ScriptBaseClass.CAMERA_POSITION:
13656 Error("llSetCameraParams", "CAMERA_POSITION: Parameter z is invalid");
13657 return;
13658 }
13659 }
11131 break; 13660 break;
11132 default: 13661 default:
11133 // TODO: clean that up as soon as the implicit casts are in 13662 // TODO: clean that up as soon as the implicit casts are in
@@ -11135,7 +13664,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11135 parameters.Add(type, (float)((LSL_Float)data[i]).value); 13664 parameters.Add(type, (float)((LSL_Float)data[i]).value);
11136 else if (data[i] is LSL_Integer) 13665 else if (data[i] is LSL_Integer)
11137 parameters.Add(type, (float)((LSL_Integer)data[i]).value); 13666 parameters.Add(type, (float)((LSL_Integer)data[i]).value);
11138 else parameters.Add(type, Convert.ToSingle(data[i])); 13667 else
13668 {
13669 try
13670 {
13671 parameters.Add(type, Convert.ToSingle(data[i]));
13672 }
13673 catch
13674 {
13675 Error("llSetCameraParams", string.Format("{0}: Parameter is invalid", type));
13676 }
13677 }
11139 break; 13678 break;
11140 } 13679 }
11141 } 13680 }
@@ -11306,7 +13845,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11306 if (!ok || flag < 0 || 13845 if (!ok || flag < 0 ||
11307 flag > (int)HttpRequestConstants.HTTP_PRAGMA_NO_CACHE) 13846 flag > (int)HttpRequestConstants.HTTP_PRAGMA_NO_CACHE)
11308 { 13847 {
11309 throw new ScriptException("Parameter " + i.ToString() + " is an invalid flag"); 13848 Error("llHTTPRequest", "Parameter " + i.ToString() + " is an invalid flag");
11310 } 13849 }
11311 13850
11312 param.Add(parameters.Data[i].ToString()); //Add parameter flag 13851 param.Add(parameters.Data[i].ToString()); //Add parameter flag
@@ -11330,12 +13869,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11330 { 13869 {
11331 //There must be at least one name/value pair for custom header 13870 //There must be at least one name/value pair for custom header
11332 if (count == 1) 13871 if (count == 1)
11333 throw new ScriptException("Missing name/value for custom header at parameter " + i.ToString()); 13872 Error("llHTTPRequest", "Missing name/value for custom header at parameter " + i.ToString());
11334 break; 13873 break;
11335 } 13874 }
11336 13875
11337 if (HttpStandardHeaders.Contains(parameters.Data[i].ToString(), StringComparer.OrdinalIgnoreCase)) 13876 if (HttpStandardHeaders.Contains(parameters.Data[i].ToString(), StringComparer.OrdinalIgnoreCase))
11338 throw new ScriptException("Name is invalid as a custom header at parameter " + i.ToString()); 13877 Error("llHTTPRequest", "Name is invalid as a custom header at parameter " + i.ToString());
11339 13878
11340 param.Add(parameters.Data[i].ToString()); 13879 param.Add(parameters.Data[i].ToString());
11341 param.Add(parameters.Data[i+1].ToString()); 13880 param.Add(parameters.Data[i+1].ToString());
@@ -11458,8 +13997,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11458 } 13997 }
11459 } 13998 }
11460 13999
14000 HttpInitialRequestStatus status;
11461 UUID reqID 14001 UUID reqID
11462 = httpScriptMod.StartHttpRequest(m_host.LocalId, m_item.ItemID, url, param, httpHeaders, body); 14002 = httpScriptMod.StartHttpRequest(m_host.LocalId, m_item.ItemID, url, param, httpHeaders, body, out status);
14003
14004 if (status == HttpInitialRequestStatus.DISALLOWED_BY_FILTER)
14005 Error("llHttpRequest", string.Format("Request to {0} disallowed by filter", url));
11463 14006
11464 if (reqID != UUID.Zero) 14007 if (reqID != UUID.Zero)
11465 return reqID.ToString(); 14008 return reqID.ToString();
@@ -11493,7 +14036,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11493 } 14036 }
11494 } 14037 }
11495 } 14038 }
11496 ScriptSleep(100); 14039 ScriptSleep(m_sleepMsOnResetLandBanList);
11497 } 14040 }
11498 14041
11499 public void llResetLandPassList() 14042 public void llResetLandPassList()
@@ -11510,7 +14053,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11510 } 14053 }
11511 } 14054 }
11512 } 14055 }
11513 ScriptSleep(100); 14056 ScriptSleep(m_sleepMsOnResetLandPassList);
11514 } 14057 }
11515 14058
11516 public LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide) 14059 public LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide)
@@ -11568,7 +14111,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11568 ret.Add(new LSL_Integer(detectedParams.Value)); 14111 ret.Add(new LSL_Integer(detectedParams.Value));
11569 } 14112 }
11570 } 14113 }
11571 ScriptSleep(2000); 14114 ScriptSleep(m_sleepMsOnGetParcelPrimOwners);
11572 return ret; 14115 return ret;
11573 } 14116 }
11574 14117
@@ -11699,8 +14242,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11699 ret.Add(new LSL_Rotation((double)avrot.X, (double)avrot.Y, (double)avrot.Z, (double)avrot.W)); 14242 ret.Add(new LSL_Rotation((double)avrot.X, (double)avrot.Y, (double)avrot.Z, (double)avrot.W));
11700 break; 14243 break;
11701 case ScriptBaseClass.OBJECT_VELOCITY: 14244 case ScriptBaseClass.OBJECT_VELOCITY:
14245<<<<<<< HEAD
14246 ret.Add(new LSL_Vector(av.GetWorldVelocity()));
14247=======
11702 Vector3 avvel = av.Velocity; 14248 Vector3 avvel = av.Velocity;
11703 ret.Add(new LSL_Vector((double)avvel.X, (double)avvel.Y, (double)avvel.Z)); 14249 ret.Add(new LSL_Vector((double)avvel.X, (double)avvel.Y, (double)avvel.Z));
14250>>>>>>> avn/ubitvar
11704 break; 14251 break;
11705 case ScriptBaseClass.OBJECT_OWNER: 14252 case ScriptBaseClass.OBJECT_OWNER:
11706 ret.Add(new LSL_String(id)); 14253 ret.Add(new LSL_String(id));
@@ -11765,6 +14312,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11765 case ScriptBaseClass.OBJECT_TEMP_ON_REZ: 14312 case ScriptBaseClass.OBJECT_TEMP_ON_REZ:
11766 ret.Add(new LSL_Integer(0)); 14313 ret.Add(new LSL_Integer(0));
11767 break; 14314 break;
14315 case ScriptBaseClass.OBJECT_RENDER_WEIGHT:
14316 ret.Add(new LSL_Integer(-1));
14317 break;
14318 case ScriptBaseClass.OBJECT_HOVER_HEIGHT:
14319 ret.Add(new LSL_Float(0));
14320 break;
14321 case ScriptBaseClass.OBJECT_BODY_SHAPE_TYPE:
14322 LSL_Float shapeType;
14323 if (av.Appearance.VisualParams[(int)AvatarAppearance.VPElement.SHAPE_MALE] != 0)
14324 shapeType = new LSL_Float(1);
14325 else
14326 shapeType = new LSL_Float(0);
14327 ret.Add(shapeType);
14328 break;
14329 case ScriptBaseClass.OBJECT_LAST_OWNER_ID:
14330 ret.Add(new LSL_Key(ScriptBaseClass.NULL_KEY));
14331 break;
11768 default: 14332 default:
11769 // Invalid or unhandled constant. 14333 // Invalid or unhandled constant.
11770 ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL)); 14334 ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
@@ -11793,20 +14357,43 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11793 ret.Add(new LSL_Vector(opos.X, opos.Y, opos.Z)); 14357 ret.Add(new LSL_Vector(opos.X, opos.Y, opos.Z));
11794 break; 14358 break;
11795 case ScriptBaseClass.OBJECT_ROT: 14359 case ScriptBaseClass.OBJECT_ROT:
14360 Quaternion rot = Quaternion.Identity;
14361
14362 if (obj.ParentGroup.IsAttachment)
11796 { 14363 {
11797 Quaternion rot = Quaternion.Identity; 14364 ScenePresence sp = World.GetScenePresence(obj.ParentGroup.AttachedAvatar);
11798 14365
14366 if (sp != null)
14367 rot = sp.GetWorldRotation();
14368 }
14369 else
14370 {
11799 if (obj.ParentGroup.RootPart == obj) 14371 if (obj.ParentGroup.RootPart == obj)
11800 rot = obj.ParentGroup.GroupRotation; 14372 rot = obj.ParentGroup.GroupRotation;
11801 else 14373 else
11802 rot = obj.GetWorldRotation(); 14374 rot = obj.GetWorldRotation();
11803
11804 LSL_Rotation objrot = new LSL_Rotation(rot);
11805 ret.Add(objrot);
11806 } 14375 }
14376
14377 LSL_Rotation objrot = new LSL_Rotation(rot);
14378 ret.Add(objrot);
14379
11807 break; 14380 break;
11808 case ScriptBaseClass.OBJECT_VELOCITY: 14381 case ScriptBaseClass.OBJECT_VELOCITY:
11809 ret.Add(new LSL_Vector(obj.Velocity)); 14382 Vector3 vel = Vector3.Zero;
14383
14384 if (obj.ParentGroup.IsAttachment)
14385 {
14386 ScenePresence sp = World.GetScenePresence(obj.ParentGroup.AttachedAvatar);
14387
14388 if (sp != null)
14389 vel = sp.GetWorldVelocity();
14390 }
14391 else
14392 {
14393 vel = obj.Velocity;
14394 }
14395
14396 ret.Add(vel);
11810 break; 14397 break;
11811 case ScriptBaseClass.OBJECT_OWNER: 14398 case ScriptBaseClass.OBJECT_OWNER:
11812 ret.Add(new LSL_String(obj.OwnerID.ToString())); 14399 ret.Add(new LSL_String(obj.OwnerID.ToString()));
@@ -11902,6 +14489,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11902 case ScriptBaseClass.OBJECT_TEMP_ON_REZ: 14489 case ScriptBaseClass.OBJECT_TEMP_ON_REZ:
11903 ret.Add(new LSL_Integer(obj.ParentGroup.IsTemporary ? 1 : 0)); 14490 ret.Add(new LSL_Integer(obj.ParentGroup.IsTemporary ? 1 : 0));
11904 break; 14491 break;
14492 case ScriptBaseClass.OBJECT_RENDER_WEIGHT:
14493 ret.Add(new LSL_Integer(0));
14494 break;
14495 case ScriptBaseClass.OBJECT_HOVER_HEIGHT:
14496 ret.Add(new LSL_Float(0));
14497 break;
14498 case ScriptBaseClass.OBJECT_BODY_SHAPE_TYPE:
14499 ret.Add(new LSL_Float(-1));
14500 break;
14501 case ScriptBaseClass.OBJECT_LAST_OWNER_ID:
14502 ret.Add(new LSL_Key(obj.ParentGroup.LastOwnerID.ToString()));
14503 break;
11905 default: 14504 default:
11906 // Invalid or unhandled constant. 14505 // Invalid or unhandled constant.
11907 ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL)); 14506 ret.Add(new LSL_Integer(ScriptBaseClass.OBJECT_UNKNOWN_DETAIL));
@@ -11926,25 +14525,71 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11926 return item.ItemID; 14525 return item.ItemID;
11927 } 14526 }
11928 14527
11929 internal void ShoutError(string msg) 14528 /// <summary>
14529 /// Reports the script error in the viewer's Script Warning/Error dialog and shouts it on the debug channel.
14530 /// </summary>
14531 /// <param name="command">The name of the command that generated the error.</param>
14532 /// <param name="message">The error message to report to the user.</param>
14533 internal void Error(string command, string message)
11930 { 14534 {
11931 llShout(ScriptBaseClass.DEBUG_CHANNEL, msg); 14535 string text = command + ": " + message;
14536 if (text.Length > 1023)
14537 {
14538 text = text.Substring(0, 1023);
14539 }
14540
14541 World.SimChat(Utils.StringToBytes(text), ChatTypeEnum.DebugChannel, ScriptBaseClass.DEBUG_CHANNEL,
14542 m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, false);
14543
14544 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
14545 if (wComm != null)
14546 {
14547 wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, text);
14548 }
11932 } 14549 }
11933 14550
11934 internal void NotImplemented(string command) 14551 /// <summary>
14552 /// Reports that the command is not implemented as a script error.
14553 /// </summary>
14554 /// <param name="command">The name of the command that is not implemented.</param>
14555 /// <param name="message">Additional information to report to the user. (Optional)</param>
14556 internal void NotImplemented(string command, string message = "")
11935 { 14557 {
11936 if (throwErrorOnNotImplemented) 14558 if (throwErrorOnNotImplemented)
11937 throw new NotImplementedException("Command not implemented: " + command); 14559 {
11938 } 14560 if (message != "")
14561 {
14562 message = " - " + message;
14563 }
11939 14564
11940 internal void Deprecated(string command) 14565 throw new NotImplementedException("Command not implemented: " + command + message);
11941 { 14566 }
11942 throw new ScriptException("Command deprecated: " + command); 14567 else
14568 {
14569 string text = "Command not implemented";
14570 if (message != "")
14571 {
14572 text = text + " - " + message;
14573 }
14574
14575 Error(command, text);
14576 }
11943 } 14577 }
11944 14578
11945 internal void LSLError(string msg) 14579 /// <summary>
14580 /// Reports that the command is deprecated as a script error.
14581 /// </summary>
14582 /// <param name="command">The name of the command that is deprecated.</param>
14583 /// <param name="message">Additional information to report to the user. (Optional)</param>
14584 internal void Deprecated(string command, string message = "")
11946 { 14585 {
11947 throw new ScriptException("LSL Runtime Error: " + msg); 14586 string text = "Command deprecated";
14587 if (message != "")
14588 {
14589 text = text + " - " + message;
14590 }
14591
14592 Error(command, text);
11948 } 14593 }
11949 14594
11950 public delegate void AssetRequestCallback(UUID assetID, AssetBase asset); 14595 public delegate void AssetRequestCallback(UUID assetID, AssetBase asset);
@@ -11976,7 +14621,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11976 if (assetID == UUID.Zero) 14621 if (assetID == UUID.Zero)
11977 { 14622 {
11978 // => complain loudly, as specified by the LSL docs 14623 // => complain loudly, as specified by the LSL docs
11979 ShoutError("Notecard '" + name + "' could not be found."); 14624 Error("llGetNumberOfNotecardLines", "Can't find notecard '" + name + "'");
11980 14625
11981 return UUID.Zero.ToString(); 14626 return UUID.Zero.ToString();
11982 } 14627 }
@@ -11990,7 +14635,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11990 { 14635 {
11991 AsyncCommands.DataserverPlugin.DataserverReply(reqIdentifier, NotecardCache.GetLines(assetID).ToString()); 14636 AsyncCommands.DataserverPlugin.DataserverReply(reqIdentifier, NotecardCache.GetLines(assetID).ToString());
11992 14637
11993 ScriptSleep(100); 14638 ScriptSleep(m_sleepMsOnGetNumberOfNotecardLines);
11994 return tid.ToString(); 14639 return tid.ToString();
11995 } 14640 }
11996 14641
@@ -11998,17 +14643,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11998 { 14643 {
11999 if (a == null || a.Type != 7) 14644 if (a == null || a.Type != 7)
12000 { 14645 {
12001 ShoutError("Notecard '" + name + "' could not be found."); 14646 Error("llGetNumberOfNotecardLines", "Can't find notecard '" + name + "'");
12002 return; 14647 return;
12003 } 14648 }
12004 14649
12005 string data = Encoding.UTF8.GetString(a.Data); 14650 NotecardCache.Cache(id, a.Data);
12006 //m_log.Debug(data);
12007 NotecardCache.Cache(id, data);
12008 AsyncCommands.DataserverPlugin.DataserverReply(reqIdentifier, NotecardCache.GetLines(id).ToString()); 14651 AsyncCommands.DataserverPlugin.DataserverReply(reqIdentifier, NotecardCache.GetLines(id).ToString());
12009 }); 14652 });
12010 14653
12011 ScriptSleep(100); 14654 ScriptSleep(m_sleepMsOnGetNumberOfNotecardLines);
12012 return tid.ToString(); 14655 return tid.ToString();
12013 } 14656 }
12014 14657
@@ -12029,7 +14672,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12029 if (assetID == UUID.Zero) 14672 if (assetID == UUID.Zero)
12030 { 14673 {
12031 // => complain loudly, as specified by the LSL docs 14674 // => complain loudly, as specified by the LSL docs
12032 ShoutError("Notecard '" + name + "' could not be found."); 14675 Error("llGetNotecardLine", "Can't find notecard '" + name + "'");
12033 14676
12034 return UUID.Zero.ToString(); 14677 return UUID.Zero.ToString();
12035 } 14678 }
@@ -12044,7 +14687,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12044 AsyncCommands.DataserverPlugin.DataserverReply( 14687 AsyncCommands.DataserverPlugin.DataserverReply(
12045 reqIdentifier, NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax)); 14688 reqIdentifier, NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax));
12046 14689
12047 ScriptSleep(100); 14690 ScriptSleep(m_sleepMsOnGetNotecardLine);
12048 return tid.ToString(); 14691 return tid.ToString();
12049 } 14692 }
12050 14693
@@ -12052,18 +14695,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12052 { 14695 {
12053 if (a == null || a.Type != 7) 14696 if (a == null || a.Type != 7)
12054 { 14697 {
12055 ShoutError("Notecard '" + name + "' could not be found."); 14698 Error("llGetNotecardLine", "Can't find notecard '" + name + "'");
12056 return; 14699 return;
12057 } 14700 }
12058 14701
12059 string data = Encoding.UTF8.GetString(a.Data); 14702 string data = Encoding.UTF8.GetString(a.Data);
12060 //m_log.Debug(data); 14703 //m_log.Debug(data);
12061 NotecardCache.Cache(id, data); 14704 NotecardCache.Cache(id, a.Data);
12062 AsyncCommands.DataserverPlugin.DataserverReply( 14705 AsyncCommands.DataserverPlugin.DataserverReply(
12063 reqIdentifier, NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax)); 14706 reqIdentifier, NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax));
12064 }); 14707 });
12065 14708
12066 ScriptSleep(100); 14709 ScriptSleep(m_sleepMsOnGetNotecardLine);
12067 return tid.ToString(); 14710 return tid.ToString();
12068 } 14711 }
12069 14712
@@ -12076,41 +14719,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12076 if (obj.OwnerID != m_host.OwnerID) 14719 if (obj.OwnerID != m_host.OwnerID)
12077 return; 14720 return;
12078 14721
12079 uint rulesParsed = 0; 14722 SetEntityParams(new List<ISceneEntity>() { obj }, rules, originFunc);
12080 LSL_List remaining = SetPrimParams(obj, rules, originFunc, ref rulesParsed);
12081
12082 while ((object)remaining != null && remaining.Length > 2)
12083 {
12084 LSL_Integer newLink = remaining.GetLSLIntegerItem(0);
12085 LSL_List newrules = remaining.GetSublist(1, -1);
12086 foreach(SceneObjectPart part in GetLinkParts(obj, newLink)){
12087 remaining = SetPrimParams(part, newrules, originFunc, ref rulesParsed);
12088 }
12089 }
12090 } 14723 }
12091 14724
12092 public LSL_List GetPrimitiveParamsEx(LSL_Key prim, LSL_List rules) 14725 public LSL_List GetPrimitiveParamsEx(LSL_Key prim, LSL_List rules)
12093 { 14726 {
12094 SceneObjectPart obj = World.GetSceneObjectPart(new UUID(prim)); 14727 SceneObjectPart obj = World.GetSceneObjectPart(new UUID(prim));
12095 14728
12096 LSL_List result = new LSL_List();
12097
12098 if (obj != null && obj.OwnerID == m_host.OwnerID) 14729 if (obj != null && obj.OwnerID == m_host.OwnerID)
12099 { 14730 return GetEntityParams(obj, rules);
12100 LSL_List remaining = GetPrimParams(obj, rules, ref result);
12101
12102 while (remaining != null && remaining.Length > 2)
12103 {
12104 int linknumber = remaining.GetLSLIntegerItem(0);
12105 rules = remaining.GetSublist(1, -1);
12106 List<SceneObjectPart> parts = GetLinkParts(linknumber);
12107
12108 foreach (SceneObjectPart part in parts)
12109 remaining = GetPrimParams(part, rules, ref result);
12110 }
12111 }
12112 14731
12113 return result; 14732 return new LSL_List();
12114 } 14733 }
12115 14734
12116 public LSL_Integer llGetLinkNumberOfSides(LSL_Integer link) 14735 public LSL_Integer llGetLinkNumberOfSides(LSL_Integer link)
@@ -12478,6 +15097,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12478 15097
12479 public LSL_List llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options) 15098 public LSL_List llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options)
12480 { 15099 {
15100 // Use llCastRay V3 if configured
15101 if (m_useCastRayV3)
15102 return llCastRayV3(start, end, options);
15103
12481 LSL_List list = new LSL_List(); 15104 LSL_List list = new LSL_List();
12482 15105
12483 m_host.AddScriptLPS(1); 15106 m_host.AddScriptLPS(1);
@@ -12679,6 +15302,872 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12679 return list; 15302 return list;
12680 } 15303 }
12681 15304
15305 /// <summary>
15306 /// Implementation of llCastRay similar to SL 2015-04-21.
15307 /// http://wiki.secondlife.com/wiki/LlCastRay
15308 /// Uses pure geometry, bounding shapes, meshing and no physics
15309 /// for prims, sculpts, meshes, avatars and terrain.
15310 /// Implements all flags, reject types and data flags.
15311 /// Can handle both objects/groups and prims/parts, by config.
15312 /// May sometimes be inaccurate owing to calculation precision,
15313 /// meshing detail level and a bug in libopenmetaverse PrimMesher.
15314 /// </summary>
15315 public LSL_List llCastRayV3(LSL_Vector start, LSL_Vector end, LSL_List options)
15316 {
15317 m_host.AddScriptLPS(1);
15318 LSL_List result = new LSL_List();
15319
15320 // Prepare throttle data
15321 int calledMs = Environment.TickCount;
15322 Stopwatch stopWatch = new Stopwatch();
15323 stopWatch.Start();
15324 UUID regionId = World.RegionInfo.RegionID;
15325 UUID userId = UUID.Zero;
15326 int msAvailable = 0;
15327 // Throttle per owner when attachment or "vehicle" (sat upon)
15328 if (m_host.ParentGroup.IsAttachment || m_host.ParentGroup.GetSittingAvatars().Count > 0)
15329 {
15330 userId = m_host.OwnerID;
15331 msAvailable = m_msPerAvatarInCastRay;
15332 }
15333 // Throttle per parcel when not attachment or vehicle
15334 else
15335 {
15336 LandData land = World.GetLandData(m_host.GetWorldPosition());
15337 if (land != null)
15338 msAvailable = m_msPerRegionInCastRay * land.Area / 65536;
15339 }
15340 // Clamp for "oversized" parcels on varregions
15341 if (msAvailable > m_msMaxInCastRay)
15342 msAvailable = m_msMaxInCastRay;
15343
15344 // Check throttle data
15345 int fromCalledMs = calledMs - m_msThrottleInCastRay;
15346 lock (m_castRayCalls)
15347 {
15348 for (int i = m_castRayCalls.Count - 1; i >= 0; i--)
15349 {
15350 // Delete old calls from throttle data
15351 if (m_castRayCalls[i].CalledMs < fromCalledMs)
15352 m_castRayCalls.RemoveAt(i);
15353 // Use current region (in multi-region sims)
15354 else if (m_castRayCalls[i].RegionId == regionId)
15355 {
15356 // Reduce available time with recent calls
15357 if (m_castRayCalls[i].UserId == userId)
15358 msAvailable -= m_castRayCalls[i].UsedMs;
15359 }
15360 }
15361 }
15362
15363 // Return failure if not enough available time
15364 if (msAvailable < m_msMinInCastRay)
15365 {
15366 result.Add(new LSL_Integer(ScriptBaseClass.RCERR_CAST_TIME_EXCEEDED));
15367 return result;
15368 }
15369
15370 // Initialize
15371 List<RayHit> rayHits = new List<RayHit>();
15372 float tol = m_floatToleranceInCastRay;
15373 Vector3 pos1Ray = start;
15374 Vector3 pos2Ray = end;
15375
15376 // Get input options
15377 int rejectTypes = 0;
15378 int dataFlags = 0;
15379 int maxHits = 1;
15380 bool detectPhantom = false;
15381 for (int i = 0; i < options.Length; i += 2)
15382 {
15383 if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_REJECT_TYPES)
15384 rejectTypes = options.GetLSLIntegerItem(i + 1);
15385 else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_DATA_FLAGS)
15386 dataFlags = options.GetLSLIntegerItem(i + 1);
15387 else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_MAX_HITS)
15388 maxHits = options.GetLSLIntegerItem(i + 1);
15389 else if (options.GetLSLIntegerItem(i) == ScriptBaseClass.RC_DETECT_PHANTOM)
15390 detectPhantom = (options.GetLSLIntegerItem(i + 1) != 0);
15391 }
15392 if (maxHits > m_maxHitsInCastRay)
15393 maxHits = m_maxHitsInCastRay;
15394 bool rejectAgents = ((rejectTypes & ScriptBaseClass.RC_REJECT_AGENTS) != 0);
15395 bool rejectPhysical = ((rejectTypes & ScriptBaseClass.RC_REJECT_PHYSICAL) != 0);
15396 bool rejectNonphysical = ((rejectTypes & ScriptBaseClass.RC_REJECT_NONPHYSICAL) != 0);
15397 bool rejectLand = ((rejectTypes & ScriptBaseClass.RC_REJECT_LAND) != 0);
15398 bool getNormal = ((dataFlags & ScriptBaseClass.RC_GET_NORMAL) != 0);
15399 bool getRootKey = ((dataFlags & ScriptBaseClass.RC_GET_ROOT_KEY) != 0);
15400 bool getLinkNum = ((dataFlags & ScriptBaseClass.RC_GET_LINK_NUM) != 0);
15401
15402 // Calculate some basic parameters
15403 Vector3 vecRay = pos2Ray - pos1Ray;
15404 float rayLength = vecRay.Length();
15405
15406 // Try to get a mesher and return failure if none, degenerate ray, or max 0 hits
15407 IRendering primMesher = null;
15408 List<string> renderers = RenderingLoader.ListRenderers(Util.ExecutingDirectory());
15409 if (renderers.Count < 1 || rayLength < tol || m_maxHitsInCastRay < 1)
15410 {
15411 result.Add(new LSL_Integer(ScriptBaseClass.RCERR_UNKNOWN));
15412 return result;
15413 }
15414 primMesher = RenderingLoader.LoadRenderer(renderers[0]);
15415
15416 // Iterate over all objects/groups and prims/parts in region
15417 World.ForEachSOG(
15418 delegate(SceneObjectGroup group)
15419 {
15420 // Check group filters unless part filters are configured
15421 bool isPhysical = (group.RootPart != null && group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical);
15422 bool isNonphysical = !isPhysical;
15423 bool isPhantom = group.IsPhantom || group.IsVolumeDetect;
15424 bool isAttachment = group.IsAttachment;
15425 bool doGroup = true;
15426 if (isPhysical && rejectPhysical)
15427 doGroup = false;
15428 if (isNonphysical && rejectNonphysical)
15429 doGroup = false;
15430 if (isPhantom && detectPhantom)
15431 doGroup = true;
15432 if (m_filterPartsInCastRay)
15433 doGroup = true;
15434 if (isAttachment && !m_doAttachmentsInCastRay)
15435 doGroup = false;
15436 // Parse object/group if passed filters
15437 if (doGroup)
15438 {
15439 // Iterate over all prims/parts in object/group
15440 foreach(SceneObjectPart part in group.Parts)
15441 {
15442 // Check part filters if configured
15443 if (m_filterPartsInCastRay)
15444 {
15445 isPhysical = (part.PhysActor != null && part.PhysActor.IsPhysical);
15446 isNonphysical = !isPhysical;
15447 isPhantom = ((part.Flags & PrimFlags.Phantom) != 0) || (part.VolumeDetectActive);
15448 bool doPart = true;
15449 if (isPhysical && rejectPhysical)
15450 doPart = false;
15451 if (isNonphysical && rejectNonphysical)
15452 doPart = false;
15453 if (isPhantom && detectPhantom)
15454 doPart = true;
15455 if (!doPart)
15456 continue;
15457 }
15458
15459 // Parse prim/part and project ray if passed filters
15460 Vector3 scalePart = part.Scale;
15461 Vector3 posPart = part.GetWorldPosition();
15462 Quaternion rotPart = part.GetWorldRotation();
15463 Quaternion rotPartInv = Quaternion.Inverse(rotPart);
15464 Vector3 pos1RayProj = ((pos1Ray - posPart) * rotPartInv) / scalePart;
15465 Vector3 pos2RayProj = ((pos2Ray - posPart) * rotPartInv) / scalePart;
15466
15467 // Filter parts by shape bounding boxes
15468 Vector3 shapeBoxMax = new Vector3(0.5f, 0.5f, 0.5f);
15469 if (!part.Shape.SculptEntry)
15470 shapeBoxMax = shapeBoxMax * (new Vector3(m_primSafetyCoeffX, m_primSafetyCoeffY, m_primSafetyCoeffZ));
15471 shapeBoxMax = shapeBoxMax + (new Vector3(tol, tol, tol));
15472 if (RayIntersectsShapeBox(pos1RayProj, pos2RayProj, shapeBoxMax))
15473 {
15474 // Prepare data needed to check for ray hits
15475 RayTrans rayTrans = new RayTrans();
15476 rayTrans.PartId = part.UUID;
15477 rayTrans.GroupId = part.ParentGroup.UUID;
15478 rayTrans.Link = group.PrimCount > 1 ? part.LinkNum : 0;
15479 rayTrans.ScalePart = scalePart;
15480 rayTrans.PositionPart = posPart;
15481 rayTrans.RotationPart = rotPart;
15482 rayTrans.ShapeNeedsEnds = true;
15483 rayTrans.Position1Ray = pos1Ray;
15484 rayTrans.Position1RayProj = pos1RayProj;
15485 rayTrans.VectorRayProj = pos2RayProj - pos1RayProj;
15486
15487 // Get detail level depending on type
15488 int lod = 0;
15489 // Mesh detail level
15490 if (part.Shape.SculptEntry && part.Shape.SculptType == (byte)SculptType.Mesh)
15491 lod = (int)m_meshLodInCastRay;
15492 // Sculpt detail level
15493 else if (part.Shape.SculptEntry && part.Shape.SculptType == (byte)SculptType.Mesh)
15494 lod = (int)m_sculptLodInCastRay;
15495 // Shape detail level
15496 else if (!part.Shape.SculptEntry)
15497 lod = (int)m_primLodInCastRay;
15498
15499 // Try to get cached mesh if configured
15500 ulong meshKey = 0;
15501 FacetedMesh mesh = null;
15502 if (m_useMeshCacheInCastRay)
15503 {
15504 meshKey = part.Shape.GetMeshKey(Vector3.One, (float)(4 << lod));
15505 lock (m_cachedMeshes)
15506 {
15507 m_cachedMeshes.TryGetValue(meshKey, out mesh);
15508 }
15509 }
15510
15511 // Create mesh if no cached mesh
15512 if (mesh == null)
15513 {
15514 // Make an OMV prim to be able to mesh part
15515 Primitive omvPrim = part.Shape.ToOmvPrimitive(posPart, rotPart);
15516 byte[] sculptAsset = null;
15517 if (omvPrim.Sculpt != null)
15518 sculptAsset = World.AssetService.GetData(omvPrim.Sculpt.SculptTexture.ToString());
15519
15520 // When part is mesh, get mesh
15521 if (omvPrim.Sculpt != null && omvPrim.Sculpt.Type == SculptType.Mesh && sculptAsset != null)
15522 {
15523 AssetMesh meshAsset = new AssetMesh(omvPrim.Sculpt.SculptTexture, sculptAsset);
15524 FacetedMesh.TryDecodeFromAsset(omvPrim, meshAsset, m_meshLodInCastRay, out mesh);
15525 meshAsset = null;
15526 }
15527
15528 // When part is sculpt, create mesh
15529 // Quirk: Generated sculpt mesh is about 2.8% smaller in X and Y than visual sculpt.
15530 else if (omvPrim.Sculpt != null && omvPrim.Sculpt.Type != SculptType.Mesh && sculptAsset != null)
15531 {
15532 IJ2KDecoder imgDecoder = World.RequestModuleInterface<IJ2KDecoder>();
15533 if (imgDecoder != null)
15534 {
15535 Image sculpt = imgDecoder.DecodeToImage(sculptAsset);
15536 if (sculpt != null)
15537 {
15538 mesh = primMesher.GenerateFacetedSculptMesh(omvPrim, (Bitmap)sculpt, m_sculptLodInCastRay);
15539 sculpt.Dispose();
15540 }
15541 }
15542 }
15543
15544 // When part is shape, create mesh
15545 else if (omvPrim.Sculpt == null)
15546 {
15547 if (
15548 omvPrim.PrimData.PathBegin == 0.0 && omvPrim.PrimData.PathEnd == 1.0 &&
15549 omvPrim.PrimData.PathTaperX == 0.0 && omvPrim.PrimData.PathTaperY == 0.0 &&
15550 omvPrim.PrimData.PathSkew == 0.0 &&
15551 omvPrim.PrimData.PathTwist - omvPrim.PrimData.PathTwistBegin == 0.0
15552 )
15553 rayTrans.ShapeNeedsEnds = false;
15554 mesh = primMesher.GenerateFacetedMesh(omvPrim, m_primLodInCastRay);
15555 }
15556
15557 // Cache mesh if configured
15558 if (m_useMeshCacheInCastRay && mesh != null)
15559 {
15560 lock(m_cachedMeshes)
15561 {
15562 if (!m_cachedMeshes.ContainsKey(meshKey))
15563 m_cachedMeshes.Add(meshKey, mesh);
15564 }
15565 }
15566 }
15567 // Check mesh for ray hits
15568 AddRayInFacetedMesh(mesh, rayTrans, ref rayHits);
15569 mesh = null;
15570 }
15571 }
15572 }
15573 }
15574 );
15575
15576 // Check avatar filter
15577 if (!rejectAgents)
15578 {
15579 // Iterate over all avatars in region
15580 World.ForEachRootScenePresence(
15581 delegate (ScenePresence sp)
15582 {
15583 // Get bounding box
15584 Vector3 lower;
15585 Vector3 upper;
15586 BoundingBoxOfScenePresence(sp, out lower, out upper);
15587 // Parse avatar
15588 Vector3 scalePart = upper - lower;
15589 Vector3 posPart = sp.AbsolutePosition;
15590 Quaternion rotPart = sp.GetWorldRotation();
15591 Quaternion rotPartInv = Quaternion.Inverse(rotPart);
15592 posPart = posPart + (lower + upper) * 0.5f * rotPart;
15593 // Project ray
15594 Vector3 pos1RayProj = ((pos1Ray - posPart) * rotPartInv) / scalePart;
15595 Vector3 pos2RayProj = ((pos2Ray - posPart) * rotPartInv) / scalePart;
15596
15597 // Filter avatars by shape bounding boxes
15598 Vector3 shapeBoxMax = new Vector3(0.5f + tol, 0.5f + tol, 0.5f + tol);
15599 if (RayIntersectsShapeBox(pos1RayProj, pos2RayProj, shapeBoxMax))
15600 {
15601 // Prepare data needed to check for ray hits
15602 RayTrans rayTrans = new RayTrans();
15603 rayTrans.PartId = sp.UUID;
15604 rayTrans.GroupId = sp.ParentPart != null ? sp.ParentPart.ParentGroup.UUID : sp.UUID;
15605 rayTrans.Link = sp.ParentPart != null ? UUID2LinkNumber(sp.ParentPart, sp.UUID) : 0;
15606 rayTrans.ScalePart = scalePart;
15607 rayTrans.PositionPart = posPart;
15608 rayTrans.RotationPart = rotPart;
15609 rayTrans.ShapeNeedsEnds = false;
15610 rayTrans.Position1Ray = pos1Ray;
15611 rayTrans.Position1RayProj = pos1RayProj;
15612 rayTrans.VectorRayProj = pos2RayProj - pos1RayProj;
15613
15614 // Try to get cached mesh if configured
15615 PrimitiveBaseShape prim = PrimitiveBaseShape.CreateSphere();
15616 int lod = (int)m_avatarLodInCastRay;
15617 ulong meshKey = prim.GetMeshKey(Vector3.One, (float)(4 << lod));
15618 FacetedMesh mesh = null;
15619 if (m_useMeshCacheInCastRay)
15620 {
15621 lock (m_cachedMeshes)
15622 {
15623 m_cachedMeshes.TryGetValue(meshKey, out mesh);
15624 }
15625 }
15626
15627 // Create mesh if no cached mesh
15628 if (mesh == null)
15629 {
15630 // Make OMV prim and create mesh
15631 prim.Scale = scalePart;
15632 Primitive omvPrim = prim.ToOmvPrimitive(posPart, rotPart);
15633 mesh = primMesher.GenerateFacetedMesh(omvPrim, m_avatarLodInCastRay);
15634
15635 // Cache mesh if configured
15636 if (m_useMeshCacheInCastRay && mesh != null)
15637 {
15638 lock(m_cachedMeshes)
15639 {
15640 if (!m_cachedMeshes.ContainsKey(meshKey))
15641 m_cachedMeshes.Add(meshKey, mesh);
15642 }
15643 }
15644 }
15645
15646 // Check mesh for ray hits
15647 AddRayInFacetedMesh(mesh, rayTrans, ref rayHits);
15648 mesh = null;
15649 }
15650 }
15651 );
15652 }
15653
15654 // Check terrain filter
15655 if (!rejectLand)
15656 {
15657 // Parse terrain
15658
15659 // Mesh terrain and check bounding box
15660 Vector3 lower;
15661 Vector3 upper;
15662 List<Tri> triangles = TrisFromHeightmapUnderRay(pos1Ray, pos2Ray, out lower, out upper);
15663 lower.Z -= tol;
15664 upper.Z += tol;
15665 if ((pos1Ray.Z >= lower.Z || pos2Ray.Z >= lower.Z) && (pos1Ray.Z <= upper.Z || pos2Ray.Z <= upper.Z))
15666 {
15667 // Prepare data needed to check for ray hits
15668 RayTrans rayTrans = new RayTrans();
15669 rayTrans.PartId = UUID.Zero;
15670 rayTrans.GroupId = UUID.Zero;
15671 rayTrans.Link = 0;
15672 rayTrans.ScalePart = new Vector3 (1.0f, 1.0f, 1.0f);
15673 rayTrans.PositionPart = Vector3.Zero;
15674 rayTrans.RotationPart = Quaternion.Identity;
15675 rayTrans.ShapeNeedsEnds = true;
15676 rayTrans.Position1Ray = pos1Ray;
15677 rayTrans.Position1RayProj = pos1Ray;
15678 rayTrans.VectorRayProj = vecRay;
15679
15680 // Check mesh
15681 AddRayInTris(triangles, rayTrans, ref rayHits);
15682 triangles = null;
15683 }
15684 }
15685
15686 // Sort hits by ascending distance
15687 rayHits.Sort((s1, s2) => s1.Distance.CompareTo(s2.Distance));
15688
15689 // Check excess hits per part and group
15690 for (int t = 0; t < 2; t++)
15691 {
15692 int maxHitsPerType = 0;
15693 UUID id = UUID.Zero;
15694 if (t == 0)
15695 maxHitsPerType = m_maxHitsPerPrimInCastRay;
15696 else
15697 maxHitsPerType = m_maxHitsPerObjectInCastRay;
15698
15699 // Handle excess hits only when needed
15700 if (maxHitsPerType < m_maxHitsInCastRay)
15701 {
15702 // Find excess hits
15703 Hashtable hits = new Hashtable();
15704 for (int i = rayHits.Count - 1; i >= 0; i--)
15705 {
15706 if (t == 0)
15707 id = rayHits[i].PartId;
15708 else
15709 id = rayHits[i].GroupId;
15710 if (hits.ContainsKey(id))
15711 hits[id] = (int)hits[id] + 1;
15712 else
15713 hits[id] = 1;
15714 }
15715
15716 // Remove excess hits
15717 for (int i = rayHits.Count - 1; i >= 0; i--)
15718 {
15719 if (t == 0)
15720 id = rayHits[i].PartId;
15721 else
15722 id = rayHits[i].GroupId;
15723 int hit = (int)hits[id];
15724 if (hit > m_maxHitsPerPrimInCastRay)
15725 {
15726 rayHits.RemoveAt(i);
15727 hit--;
15728 hits[id] = hit;
15729 }
15730 }
15731 }
15732 }
15733
15734 // Parse hits into result list according to data flags
15735 int hitCount = rayHits.Count;
15736 if (hitCount > maxHits)
15737 hitCount = maxHits;
15738 for (int i = 0; i < hitCount; i++)
15739 {
15740 RayHit rayHit = rayHits[i];
15741 if (getRootKey)
15742 result.Add(new LSL_Key(rayHit.GroupId.ToString()));
15743 else
15744 result.Add(new LSL_Key(rayHit.PartId.ToString()));
15745 result.Add(new LSL_Vector(rayHit.Position));
15746 if (getLinkNum)
15747 result.Add(new LSL_Integer(rayHit.Link));
15748 if (getNormal)
15749 result.Add(new LSL_Vector(rayHit.Normal));
15750 }
15751 result.Add(new LSL_Integer(hitCount));
15752
15753 // Add to throttle data
15754 stopWatch.Stop();
15755 CastRayCall castRayCall = new CastRayCall();
15756 castRayCall.RegionId = regionId;
15757 castRayCall.UserId = userId;
15758 castRayCall.CalledMs = calledMs;
15759 castRayCall.UsedMs = (int)stopWatch.ElapsedMilliseconds;
15760 lock (m_castRayCalls)
15761 {
15762 m_castRayCalls.Add(castRayCall);
15763 }
15764
15765 // Return hits
15766 return result;
15767 }
15768
15769 /// <summary>
15770 /// Struct for transmitting parameters required for finding llCastRay ray hits.
15771 /// </summary>
15772 public struct RayTrans
15773 {
15774 public UUID PartId;
15775 public UUID GroupId;
15776 public int Link;
15777 public Vector3 ScalePart;
15778 public Vector3 PositionPart;
15779 public Quaternion RotationPart;
15780 public bool ShapeNeedsEnds;
15781 public Vector3 Position1Ray;
15782 public Vector3 Position1RayProj;
15783 public Vector3 VectorRayProj;
15784 }
15785
15786 /// <summary>
15787 /// Struct for llCastRay ray hits.
15788 /// </summary>
15789 public struct RayHit
15790 {
15791 public UUID PartId;
15792 public UUID GroupId;
15793 public int Link;
15794 public Vector3 Position;
15795 public Vector3 Normal;
15796 public float Distance;
15797 }
15798
15799 /// <summary>
15800 /// Struct for llCastRay throttle data.
15801 /// </summary>
15802 public struct CastRayCall
15803 {
15804 public UUID RegionId;
15805 public UUID UserId;
15806 public int CalledMs;
15807 public int UsedMs;
15808 }
15809
15810 /// <summary>
15811 /// Helper to check if a ray intersects a shape bounding box.
15812 /// </summary>
15813 private bool RayIntersectsShapeBox(Vector3 pos1RayProj, Vector3 pos2RayProj, Vector3 shapeBoxMax)
15814 {
15815 // Skip if ray can't intersect bounding box;
15816 Vector3 rayBoxProjMin = Vector3.Min(pos1RayProj, pos2RayProj);
15817 Vector3 rayBoxProjMax = Vector3.Max(pos1RayProj, pos2RayProj);
15818 if (
15819 rayBoxProjMin.X > shapeBoxMax.X || rayBoxProjMin.Y > shapeBoxMax.Y || rayBoxProjMin.Z > shapeBoxMax.Z ||
15820 rayBoxProjMax.X < -shapeBoxMax.X || rayBoxProjMax.Y < -shapeBoxMax.Y || rayBoxProjMax.Z < -shapeBoxMax.Z
15821 )
15822 return false;
15823
15824 // Check if ray intersect any bounding box side
15825 int sign = 0;
15826 float dist = 0.0f;
15827 Vector3 posProj = Vector3.Zero;
15828 Vector3 vecRayProj = pos2RayProj - pos1RayProj;
15829
15830 // Check both X sides unless ray is parallell to them
15831 if (Math.Abs(vecRayProj.X) > m_floatToleranceInCastRay)
15832 {
15833 for (sign = -1; sign <= 1; sign += 2)
15834 {
15835 dist = ((float)sign * shapeBoxMax.X - pos1RayProj.X) / vecRayProj.X;
15836 posProj = pos1RayProj + vecRayProj * dist;
15837 if (Math.Abs(posProj.Y) <= shapeBoxMax.Y && Math.Abs(posProj.Z) <= shapeBoxMax.Z)
15838 return true;
15839 }
15840 }
15841
15842 // Check both Y sides unless ray is parallell to them
15843 if (Math.Abs(vecRayProj.Y) > m_floatToleranceInCastRay)
15844 {
15845 for (sign = -1; sign <= 1; sign += 2)
15846 {
15847 dist = ((float)sign * shapeBoxMax.Y - pos1RayProj.Y) / vecRayProj.Y;
15848 posProj = pos1RayProj + vecRayProj * dist;
15849 if (Math.Abs(posProj.X) <= shapeBoxMax.X && Math.Abs(posProj.Z) <= shapeBoxMax.Z)
15850 return true;
15851 }
15852 }
15853
15854 // Check both Z sides unless ray is parallell to them
15855 if (Math.Abs(vecRayProj.Z) > m_floatToleranceInCastRay)
15856 {
15857 for (sign = -1; sign <= 1; sign += 2)
15858 {
15859 dist = ((float)sign * shapeBoxMax.Z - pos1RayProj.Z) / vecRayProj.Z;
15860 posProj = pos1RayProj + vecRayProj * dist;
15861 if (Math.Abs(posProj.X) <= shapeBoxMax.X && Math.Abs(posProj.Y) <= shapeBoxMax.Y)
15862 return true;
15863 }
15864 }
15865
15866 // No hits on bounding box so return false
15867 return false;
15868 }
15869
15870 /// <summary>
15871 /// Helper to parse FacetedMesh for ray hits.
15872 /// </summary>
15873 private void AddRayInFacetedMesh(FacetedMesh mesh, RayTrans rayTrans, ref List<RayHit> rayHits)
15874 {
15875 if (mesh != null)
15876 {
15877 foreach (Face face in mesh.Faces)
15878 {
15879 for (int i = 0; i < face.Indices.Count; i += 3)
15880 {
15881 Tri triangle = new Tri();
15882 triangle.p1 = face.Vertices[face.Indices[i]].Position;
15883 triangle.p2 = face.Vertices[face.Indices[i + 1]].Position;
15884 triangle.p3 = face.Vertices[face.Indices[i + 2]].Position;
15885 AddRayInTri(triangle, rayTrans, ref rayHits);
15886 }
15887 }
15888 }
15889 }
15890
15891 /// <summary>
15892 /// Helper to parse Tri (triangle) List for ray hits.
15893 /// </summary>
15894 private void AddRayInTris(List<Tri> triangles, RayTrans rayTrans, ref List<RayHit> rayHits)
15895 {
15896 foreach (Tri triangle in triangles)
15897 {
15898 AddRayInTri(triangle, rayTrans, ref rayHits);
15899 }
15900 }
15901
15902 /// <summary>
15903 /// Helper to add ray hit in a Tri (triangle).
15904 /// </summary>
15905 private void AddRayInTri(Tri triProj, RayTrans rayTrans, ref List<RayHit> rayHits)
15906 {
15907 // Check for hit in triangle
15908 Vector3 posHitProj;
15909 Vector3 normalProj;
15910 if (HitRayInTri(triProj, rayTrans.Position1RayProj, rayTrans.VectorRayProj, out posHitProj, out normalProj))
15911 {
15912 // Hack to circumvent ghost face bug in PrimMesher by removing hits in (ghost) face plane through shape center
15913 if (Math.Abs(Vector3.Dot(posHitProj, normalProj)) < m_floatToleranceInCastRay && !rayTrans.ShapeNeedsEnds)
15914 return;
15915
15916 // Transform hit and normal to region coordinate system
15917 Vector3 posHit = rayTrans.PositionPart + (posHitProj * rayTrans.ScalePart) * rayTrans.RotationPart;
15918 Vector3 normal = Vector3.Normalize((normalProj * rayTrans.ScalePart) * rayTrans.RotationPart);
15919
15920 // Remove duplicate hits at triangle intersections
15921 float distance = Vector3.Distance(rayTrans.Position1Ray, posHit);
15922 for (int i = rayHits.Count - 1; i >= 0; i--)
15923 {
15924 if (rayHits[i].PartId != rayTrans.PartId)
15925 break;
15926 if (Math.Abs(rayHits[i].Distance - distance) < m_floatTolerance2InCastRay)
15927 return;
15928 }
15929
15930 // Build result data set
15931 RayHit rayHit = new RayHit();
15932 rayHit.PartId = rayTrans.PartId;
15933 rayHit.GroupId = rayTrans.GroupId;
15934 rayHit.Link = rayTrans.Link;
15935 rayHit.Position = posHit;
15936 rayHit.Normal = normal;
15937 rayHit.Distance = distance;
15938 rayHits.Add(rayHit);
15939 }
15940 }
15941
15942 /// <summary>
15943 /// Helper to find ray hit in triangle
15944 /// </summary>
15945 bool HitRayInTri(Tri triProj, Vector3 pos1RayProj, Vector3 vecRayProj, out Vector3 posHitProj, out Vector3 normalProj)
15946 {
15947 float tol = m_floatToleranceInCastRay;
15948 posHitProj = Vector3.Zero;
15949
15950 // Calculate triangle edge vectors
15951 Vector3 vec1Proj = triProj.p2 - triProj.p1;
15952 Vector3 vec2Proj = triProj.p3 - triProj.p2;
15953 Vector3 vec3Proj = triProj.p1 - triProj.p3;
15954
15955 // Calculate triangle normal
15956 normalProj = Vector3.Cross(vec1Proj, vec2Proj);
15957
15958 // Skip if degenerate triangle or ray parallell with triangle plane
15959 float divisor = Vector3.Dot(vecRayProj, normalProj);
15960 if (Math.Abs(divisor) < tol)
15961 return false;
15962
15963 // Skip if exit and not configured to detect
15964 if (divisor > tol && !m_detectExitsInCastRay)
15965 return false;
15966
15967 // Skip if outside ray ends
15968 float distanceProj = Vector3.Dot(triProj.p1 - pos1RayProj, normalProj) / divisor;
15969 if (distanceProj < -tol || distanceProj > 1 + tol)
15970 return false;
15971
15972 // Calculate hit position in triangle
15973 posHitProj = pos1RayProj + vecRayProj * distanceProj;
15974
15975 // Skip if outside triangle bounding box
15976 Vector3 triProjMin = Vector3.Min(Vector3.Min(triProj.p1, triProj.p2), triProj.p3);
15977 Vector3 triProjMax = Vector3.Max(Vector3.Max(triProj.p1, triProj.p2), triProj.p3);
15978 if (
15979 posHitProj.X < triProjMin.X - tol || posHitProj.Y < triProjMin.Y - tol || posHitProj.Z < triProjMin.Z - tol ||
15980 posHitProj.X > triProjMax.X + tol || posHitProj.Y > triProjMax.Y + tol || posHitProj.Z > triProjMax.Z + tol
15981 )
15982 return false;
15983
15984 // Skip if outside triangle
15985 if (
15986 Vector3.Dot(Vector3.Cross(vec1Proj, normalProj), posHitProj - triProj.p1) > tol ||
15987 Vector3.Dot(Vector3.Cross(vec2Proj, normalProj), posHitProj - triProj.p2) > tol ||
15988 Vector3.Dot(Vector3.Cross(vec3Proj, normalProj), posHitProj - triProj.p3) > tol
15989 )
15990 return false;
15991
15992 // Return hit
15993 return true;
15994 }
15995
15996 /// <summary>
15997 /// Helper to parse selected parts of HeightMap into a Tri (triangle) List and calculate bounding box.
15998 /// </summary>
15999 private List<Tri> TrisFromHeightmapUnderRay(Vector3 posStart, Vector3 posEnd, out Vector3 lower, out Vector3 upper)
16000 {
16001 // Get bounding X-Y rectangle of terrain under ray
16002 lower = Vector3.Min(posStart, posEnd);
16003 upper = Vector3.Max(posStart, posEnd);
16004 lower.X = (float)Math.Floor(lower.X);
16005 lower.Y = (float)Math.Floor(lower.Y);
16006 float zLower = float.MaxValue;
16007 upper.X = (float)Math.Ceiling(upper.X);
16008 upper.Y = (float)Math.Ceiling(upper.Y);
16009 float zUpper = float.MinValue;
16010
16011 // Initialize Tri (triangle) List
16012 List<Tri> triangles = new List<Tri>();
16013
16014 // Set parsing lane direction to major ray X-Y axis
16015 Vector3 vec = posEnd - posStart;
16016 float xAbs = Math.Abs(vec.X);
16017 float yAbs = Math.Abs(vec.Y);
16018 bool bigX = true;
16019 if (yAbs > xAbs)
16020 {
16021 bigX = false;
16022 vec = vec / yAbs;
16023 }
16024 else if (xAbs > yAbs || xAbs > 0.0f)
16025 vec = vec / xAbs;
16026 else
16027 vec = new Vector3(1.0f, 1.0f, 0.0f);
16028
16029 // Simplify by start parsing in lower end of lane
16030 if ((bigX && vec.X < 0.0f) || (!bigX && vec.Y < 0.0f))
16031 {
16032 Vector3 posTemp = posStart;
16033 posStart = posEnd;
16034 posEnd = posTemp;
16035 vec = vec * -1.0f;
16036 }
16037
16038 // First 1x1 rectangle under ray
16039 float xFloorOld = 0.0f;
16040 float yFloorOld = 0.0f;
16041 Vector3 pos = posStart;
16042 float xFloor = (float)Math.Floor(pos.X);
16043 float yFloor = (float)Math.Floor(pos.Y);
16044 AddTrisFromHeightmap(xFloor, yFloor, ref triangles, ref zLower, ref zUpper);
16045
16046 // Parse every remaining 1x1 rectangle under ray
16047 while (pos != posEnd)
16048 {
16049 // Next 1x1 rectangle under ray
16050 xFloorOld = xFloor;
16051 yFloorOld = yFloor;
16052 pos = pos + vec;
16053
16054 // Clip position to 1x1 rectangle border
16055 xFloor = (float)Math.Floor(pos.X);
16056 yFloor = (float)Math.Floor(pos.Y);
16057 if (bigX && pos.X > xFloor)
16058 {
16059 pos.Y -= vec.Y * (pos.X - xFloor);
16060 pos.X = xFloor;
16061 }
16062 else if (!bigX && pos.Y > yFloor)
16063 {
16064 pos.X -= vec.X * (pos.Y - yFloor);
16065 pos.Y = yFloor;
16066 }
16067
16068 // Last 1x1 rectangle under ray
16069 if ((bigX && pos.X >= posEnd.X) || (!bigX && pos.Y >= posEnd.Y))
16070 {
16071 pos = posEnd;
16072 xFloor = (float)Math.Floor(pos.X);
16073 yFloor = (float)Math.Floor(pos.Y);
16074 }
16075
16076 // Add new 1x1 rectangle in lane
16077 if ((bigX && xFloor != xFloorOld) || (!bigX && yFloor != yFloorOld))
16078 AddTrisFromHeightmap(xFloor, yFloor, ref triangles, ref zLower, ref zUpper);
16079 // Add last 1x1 rectangle in old lane at lane shift
16080 if (bigX && yFloor != yFloorOld)
16081 AddTrisFromHeightmap(xFloor, yFloorOld, ref triangles, ref zLower, ref zUpper);
16082 if (!bigX && xFloor != xFloorOld)
16083 AddTrisFromHeightmap(xFloorOld, yFloor, ref triangles, ref zLower, ref zUpper);
16084 }
16085
16086 // Finalize bounding box Z
16087 lower.Z = zLower;
16088 upper.Z = zUpper;
16089
16090 // Done and returning Tri (triangle)List
16091 return triangles;
16092 }
16093
16094 /// <summary>
16095 /// Helper to add HeightMap squares into Tri (triangle) List and adjust bounding box.
16096 /// </summary>
16097 private void AddTrisFromHeightmap(float xPos, float yPos, ref List<Tri> triangles, ref float zLower, ref float zUpper)
16098 {
16099 int xInt = (int)xPos;
16100 int yInt = (int)yPos;
16101
16102 // Corner 1 of 1x1 rectangle
16103 int x = Util.Clamp<int>(xInt+1, 0, World.Heightmap.Width - 1);
16104 int y = Util.Clamp<int>(yInt+1, 0, World.Heightmap.Height - 1);
16105 Vector3 pos1 = new Vector3(x, y, (float)World.Heightmap[x, y]);
16106 // Adjust bounding box
16107 zLower = Math.Min(zLower, pos1.Z);
16108 zUpper = Math.Max(zUpper, pos1.Z);
16109
16110 // Corner 2 of 1x1 rectangle
16111 x = Util.Clamp<int>(xInt, 0, World.Heightmap.Width - 1);
16112 y = Util.Clamp<int>(yInt+1, 0, World.Heightmap.Height - 1);
16113 Vector3 pos2 = new Vector3(x, y, (float)World.Heightmap[x, y]);
16114 // Adjust bounding box
16115 zLower = Math.Min(zLower, pos2.Z);
16116 zUpper = Math.Max(zUpper, pos2.Z);
16117
16118 // Corner 3 of 1x1 rectangle
16119 x = Util.Clamp<int>(xInt, 0, World.Heightmap.Width - 1);
16120 y = Util.Clamp<int>(yInt, 0, World.Heightmap.Height - 1);
16121 Vector3 pos3 = new Vector3(x, y, (float)World.Heightmap[x, y]);
16122 // Adjust bounding box
16123 zLower = Math.Min(zLower, pos3.Z);
16124 zUpper = Math.Max(zUpper, pos3.Z);
16125
16126 // Corner 4 of 1x1 rectangle
16127 x = Util.Clamp<int>(xInt+1, 0, World.Heightmap.Width - 1);
16128 y = Util.Clamp<int>(yInt, 0, World.Heightmap.Height - 1);
16129 Vector3 pos4 = new Vector3(x, y, (float)World.Heightmap[x, y]);
16130 // Adjust bounding box
16131 zLower = Math.Min(zLower, pos4.Z);
16132 zUpper = Math.Max(zUpper, pos4.Z);
16133
16134 // Add triangle 1
16135 Tri triangle1 = new Tri();
16136 triangle1.p1 = pos1;
16137 triangle1.p2 = pos2;
16138 triangle1.p3 = pos3;
16139 triangles.Add(triangle1);
16140
16141 // Add triangle 2
16142 Tri triangle2 = new Tri();
16143 triangle2.p1 = pos3;
16144 triangle2.p2 = pos4;
16145 triangle2.p3 = pos1;
16146 triangles.Add(triangle2);
16147 }
16148
16149 /// <summary>
16150 /// Helper to get link number for a UUID.
16151 /// </summary>
16152 private int UUID2LinkNumber(SceneObjectPart part, UUID id)
16153 {
16154 SceneObjectGroup group = part.ParentGroup;
16155 if (group != null)
16156 {
16157 // Parse every link for UUID
16158 int linkCount = group.PrimCount + group.GetSittingAvatarsCount();
16159 for (int link = linkCount; link > 0; link--)
16160 {
16161 ISceneEntity entity = GetLinkEntity(part, link);
16162 // Return link number if UUID match
16163 if (entity != null && entity.UUID == id)
16164 return link;
16165 }
16166 }
16167 // Return link number 0 if no links or UUID matches
16168 return 0;
16169 }
16170
12682 public LSL_Integer llManageEstateAccess(int action, string avatar) 16171 public LSL_Integer llManageEstateAccess(int action, string avatar)
12683 { 16172 {
12684 m_host.AddScriptLPS(1); 16173 m_host.AddScriptLPS(1);
@@ -12751,8 +16240,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12751 public LSL_Integer llGetMemoryLimit() 16240 public LSL_Integer llGetMemoryLimit()
12752 { 16241 {
12753 m_host.AddScriptLPS(1); 16242 m_host.AddScriptLPS(1);
12754 // The value returned for LSO scripts in SL 16243 // The value returned for Mono scripts in SL
12755 return 16384; 16244 return 65536;
12756 } 16245 }
12757 16246
12758 public LSL_Integer llSetMemoryLimit(LSL_Integer limit) 16247 public LSL_Integer llSetMemoryLimit(LSL_Integer limit)
@@ -12765,15 +16254,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12765 public LSL_Integer llGetSPMaxMemory() 16254 public LSL_Integer llGetSPMaxMemory()
12766 { 16255 {
12767 m_host.AddScriptLPS(1); 16256 m_host.AddScriptLPS(1);
12768 // The value returned for LSO scripts in SL 16257 // The value returned for Mono scripts in SL
12769 return 16384; 16258 return 65536;
12770 } 16259 }
12771 16260
12772 public virtual LSL_Integer llGetUsedMemory() 16261 public virtual LSL_Integer llGetUsedMemory()
12773 { 16262 {
12774 m_host.AddScriptLPS(1); 16263 m_host.AddScriptLPS(1);
12775 // The value returned for LSO scripts in SL 16264 // The value returned for Mono scripts in SL
12776 return 16384; 16265 return 65536;
12777 } 16266 }
12778 16267
12779 public void llScriptProfiler(LSL_Integer flags) 16268 public void llScriptProfiler(LSL_Integer flags)
@@ -12788,12 +16277,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12788 // them from this region as they are completed 16277 // them from this region as they are completed
12789 // 16278 //
12790 16279
12791 public void llGetEnv(LSL_String name)
12792 {
12793 m_host.AddScriptLPS(1);
12794 NotImplemented("llGetEnv");
12795 }
12796
12797 public void llSetSoundQueueing(int queue) 16280 public void llSetSoundQueueing(int queue)
12798 { 16281 {
12799 m_host.AddScriptLPS(1); 16282 m_host.AddScriptLPS(1);
@@ -12933,7 +16416,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12933 new LSL_String(replydata) }, 16416 new LSL_String(replydata) },
12934 new DetectParams[0])); 16417 new DetectParams[0]));
12935 } 16418 }
12936 }); 16419 }, null, "LSL_Api.llTransferLindenDollars");
12937 16420
12938 return txn.ToString(); 16421 return txn.ToString();
12939 } 16422 }
@@ -13907,10 +17390,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
13907 public DateTime lastRef; 17390 public DateTime lastRef;
13908 } 17391 }
13909 17392
13910 protected static Dictionary<UUID, Notecard> m_Notecards = 17393 private static Dictionary<UUID, Notecard> m_Notecards =
13911 new Dictionary<UUID, Notecard>(); 17394 new Dictionary<UUID, Notecard>();
13912 17395
13913 public static void Cache(UUID assetID, string text) 17396 public static void Cache(UUID assetID, byte[] text)
13914 { 17397 {
13915 CheckCache(); 17398 CheckCache();
13916 17399
@@ -13921,7 +17404,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
13921 17404
13922 Notecard nc = new Notecard(); 17405 Notecard nc = new Notecard();
13923 nc.lastRef = DateTime.Now; 17406 nc.lastRef = DateTime.Now;
13924 nc.text = SLUtil.ParseNotecardToList(text).ToArray(); 17407 try
17408 {
17409 nc.text = SLUtil.ParseNotecardToArray(text);
17410 }
17411 catch(SLUtil.NotANotecardFormatException)
17412 {
17413 nc.text = new string[0];
17414 }
13925 m_Notecards[assetID] = nc; 17415 m_Notecards[assetID] = nc;
13926 } 17416 }
13927 } 17417 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
index b13a5ae..e5e43f8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
@@ -63,7 +63,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
63 internal IScriptModuleComms m_comms = null; 63 internal IScriptModuleComms m_comms = null;
64 64
65 public void Initialize( 65 public void Initialize(
66 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle) 66 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item)
67 { 67 {
68 m_ScriptEngine = scriptEngine; 68 m_ScriptEngine = scriptEngine;
69 m_host = host; 69 m_host = host;
@@ -265,169 +265,438 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
265 int idx = 0; 265 int idx = 0;
266 while (idx < rules.Length) 266 while (idx < rules.Length)
267 { 267 {
268 uint rule = (uint)rules.GetLSLIntegerItem(idx); 268 uint rule;
269
270 try
271 {
272 rule = (uint)rules.GetLSLIntegerItem(idx);
273 }
274 catch (InvalidCastException)
275 {
276 throw new InvalidCastException(string.Format("Error running rule type: arg #{0} - parameter type must be integer", idx));
277 }
278
269 LSL_Types.Quaternion iQ; 279 LSL_Types.Quaternion iQ;
270 LSL_Types.Vector3 iV; 280 LSL_Types.Vector3 iV;
271 switch (rule) 281 switch (rule)
272 { 282 {
273 case (int)ScriptBaseClass.WL_SUN_MOON_POSITION: 283 case (int)ScriptBaseClass.WL_SUN_MOON_POSITION:
274 idx++; 284 idx++;
275 wl.sunMoonPosition = (float)rules.GetLSLFloatItem(idx); 285 try
286 {
287 wl.sunMoonPosition = (float)rules.GetLSLFloatItem(idx);
288 }
289 catch (InvalidCastException)
290 {
291 throw new InvalidCastException(string.Format("Error running rule WL_SUN_MOON_POSITION: arg #{0} - parameter 1 must be float", idx));
292 }
276 break; 293 break;
277 case (int)ScriptBaseClass.WL_AMBIENT: 294 case (int)ScriptBaseClass.WL_AMBIENT:
278 idx++; 295 idx++;
279 iQ = rules.GetQuaternionItem(idx); 296 try
297 {
298 iQ = rules.GetQuaternionItem(idx);
299 }
300 catch (InvalidCastException)
301 {
302 throw new InvalidCastException(string.Format("Error running rule WL_AMBIENT: arg #{0} - parameter 1 must be rotation", idx));
303 }
280 wl.ambient = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); 304 wl.ambient = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
281 break; 305 break;
282 case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION: 306 case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION:
283 idx++; 307 idx++;
284 iV = rules.GetVector3Item(idx); 308 try
309 {
310 iV = rules.GetVector3Item(idx);
311 }
312 catch (InvalidCastException)
313 {
314 throw new InvalidCastException(string.Format("Error running rule WL_BIG_WAVE_DIRECTION: arg #{0} - parameter 1 must be vector", idx));
315 }
285 wl.bigWaveDirection = new Vector2((float)iV.x, (float)iV.y); 316 wl.bigWaveDirection = new Vector2((float)iV.x, (float)iV.y);
286 break; 317 break;
287 case (int)ScriptBaseClass.WL_BLUE_DENSITY: 318 case (int)ScriptBaseClass.WL_BLUE_DENSITY:
288 idx++; 319 idx++;
289 iQ = rules.GetQuaternionItem(idx); 320 try
321 {
322 iQ = rules.GetQuaternionItem(idx);
323 }
324 catch (InvalidCastException)
325 {
326 throw new InvalidCastException(string.Format("Error running rule WL_BLUE_DENSITY: arg #{0} - parameter 1 must be rotation", idx));
327 }
290 wl.blueDensity = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); 328 wl.blueDensity = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
291 break; 329 break;
292 case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER: 330 case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER:
293 idx++; 331 idx++;
294 wl.blurMultiplier = (float)rules.GetLSLFloatItem(idx); 332 try
333 {
334 wl.blurMultiplier = (float)rules.GetLSLFloatItem(idx);
335 }
336 catch (InvalidCastException)
337 {
338 throw new InvalidCastException(string.Format("Error running rule WL_BLUR_MULTIPLIER: arg #{0} - parameter 1 must be float", idx));
339 }
295 break; 340 break;
296 case (int)ScriptBaseClass.WL_CLOUD_COLOR: 341 case (int)ScriptBaseClass.WL_CLOUD_COLOR:
297 idx++; 342 idx++;
298 iQ = rules.GetQuaternionItem(idx); 343 try
344 {
345 iQ = rules.GetQuaternionItem(idx);
346 }
347 catch (InvalidCastException)
348 {
349 throw new InvalidCastException(string.Format("Error running rule WL_CLOUD_COLOR: arg #{0} - parameter 1 must be rotation", idx));
350 }
299 wl.cloudColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); 351 wl.cloudColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
300 break; 352 break;
301 case (int)ScriptBaseClass.WL_CLOUD_COVERAGE: 353 case (int)ScriptBaseClass.WL_CLOUD_COVERAGE:
302 idx++; 354 idx++;
303 wl.cloudCoverage = (float)rules.GetLSLFloatItem(idx); 355 try
356 {
357 wl.cloudCoverage = (float)rules.GetLSLFloatItem(idx);
358 }
359 catch (InvalidCastException)
360 {
361 throw new InvalidCastException(string.Format("Error running rule WL_CLOUD_COVERAGE: arg #{0} - parameter 1 must be float", idx));
362 }
304 break; 363 break;
305 case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY: 364 case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
306 idx++; 365 idx++;
307 iV = rules.GetVector3Item(idx); 366 try
367 {
368 iV = rules.GetVector3Item(idx);
369 }
370 catch (InvalidCastException)
371 {
372 throw new InvalidCastException(string.Format("Error running rule WL_CLOUD_DETAIL_XY_DENSITY: arg #{0} - parameter 1 must be vector", idx));
373 }
308 wl.cloudDetailXYDensity = iV; 374 wl.cloudDetailXYDensity = iV;
309 break; 375 break;
310 case (int)ScriptBaseClass.WL_CLOUD_SCALE: 376 case (int)ScriptBaseClass.WL_CLOUD_SCALE:
311 idx++; 377 idx++;
312 wl.cloudScale = (float)rules.GetLSLFloatItem(idx); 378 try
379 {
380 wl.cloudScale = (float)rules.GetLSLFloatItem(idx);
381 }
382 catch (InvalidCastException)
383 {
384 throw new InvalidCastException(string.Format("Error running rule WL_CLOUD_SCALE: arg #{0} - parameter 1 must be float", idx));
385 }
313 break; 386 break;
314 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X: 387 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X:
315 idx++; 388 idx++;
316 wl.cloudScrollX = (float)rules.GetLSLFloatItem(idx); 389 try
390 {
391 wl.cloudScrollX = (float)rules.GetLSLFloatItem(idx);
392 }
393 catch (InvalidCastException)
394 {
395 throw new InvalidCastException(string.Format("Error running rule WL_CLOUD_SCROLL_X: arg #{0} - parameter 1 must be float", idx));
396 }
317 break; 397 break;
318 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK: 398 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK:
319 idx++; 399 idx++;
320 wl.cloudScrollXLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; 400 try
401 {
402 wl.cloudScrollXLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
403 }
404 catch (InvalidCastException)
405 {
406 throw new InvalidCastException(string.Format("Error running rule WL_CLOUD_SCROLL_Y_LOCK: arg #{0} - parameter 1 must be integer", idx));
407 }
321 break; 408 break;
322 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y: 409 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y:
323 idx++; 410 idx++;
324 wl.cloudScrollY = (float)rules.GetLSLFloatItem(idx); 411 try
412 {
413 wl.cloudScrollY = (float)rules.GetLSLFloatItem(idx);
414 }
415 catch (InvalidCastException)
416 {
417 throw new InvalidCastException(string.Format("Error running rule WL_CLOUD_SCROLL_Y: arg #{0} - parameter 1 must be float", idx));
418 }
325 break; 419 break;
326 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK: 420 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK:
327 idx++; 421 idx++;
328 wl.cloudScrollYLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; 422 try
423 {
424 wl.cloudScrollYLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
425 }
426 catch (InvalidCastException)
427 {
428 throw new InvalidCastException(string.Format("Error running rule WL_CLOUD_SCROLL_Y_LOCK: arg #{0} - parameter 1 must be integer", idx));
429 }
329 break; 430 break;
330 case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY: 431 case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
331 idx++; 432 idx++;
332 iV = rules.GetVector3Item(idx); 433 try
434 {
435 iV = rules.GetVector3Item(idx);
436 }
437 catch (InvalidCastException)
438 {
439 throw new InvalidCastException(string.Format("Error running rule WL_CLOUD_XY_DENSITY: arg #{0} - parameter 1 must be vector", idx));
440 }
333 wl.cloudXYDensity = iV; 441 wl.cloudXYDensity = iV;
334 break; 442 break;
335 case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER: 443 case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
336 idx++; 444 idx++;
337 wl.densityMultiplier = (float)rules.GetLSLFloatItem(idx); 445 try
446 {
447 wl.densityMultiplier = (float)rules.GetLSLFloatItem(idx);
448 }
449 catch (InvalidCastException)
450 {
451 throw new InvalidCastException(string.Format("Error running rule WL_DENSITY_MULTIPLIER: arg #{0} - parameter 1 must be float", idx));
452 }
338 break; 453 break;
339 case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER: 454 case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER:
340 idx++; 455 idx++;
341 wl.distanceMultiplier = (float)rules.GetLSLFloatItem(idx); 456 try
457 {
458 wl.distanceMultiplier = (float)rules.GetLSLFloatItem(idx);
459 }
460 catch (InvalidCastException)
461 {
462 throw new InvalidCastException(string.Format("Error running rule WL_DISTANCE_MULTIPLIER: arg #{0} - parameter 1 must be float", idx));
463 }
342 break; 464 break;
343 case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS: 465 case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS:
344 idx++; 466 idx++;
345 wl.drawClassicClouds = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; 467 try
468 {
469 wl.drawClassicClouds = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
470 }
471 catch (InvalidCastException)
472 {
473 throw new InvalidCastException(string.Format("Error running rule WL_DRAW_CLASSIC_CLOUDS: arg #{0} - parameter 1 must be integer", idx));
474 }
346 break; 475 break;
347 case (int)ScriptBaseClass.WL_EAST_ANGLE: 476 case (int)ScriptBaseClass.WL_EAST_ANGLE:
348 idx++; 477 idx++;
349 wl.eastAngle = (float)rules.GetLSLFloatItem(idx); 478 try
479 {
480 wl.eastAngle = (float)rules.GetLSLFloatItem(idx);
481 }
482 catch (InvalidCastException)
483 {
484 throw new InvalidCastException(string.Format("Error running rule WL_EAST_ANGLE: arg #{0} - parameter 1 must be float", idx));
485 }
350 break; 486 break;
351 case (int)ScriptBaseClass.WL_FRESNEL_OFFSET: 487 case (int)ScriptBaseClass.WL_FRESNEL_OFFSET:
352 idx++; 488 idx++;
353 wl.fresnelOffset = (float)rules.GetLSLFloatItem(idx); 489 try
490 {
491 wl.fresnelOffset = (float)rules.GetLSLFloatItem(idx);
492 }
493 catch (InvalidCastException)
494 {
495 throw new InvalidCastException(string.Format("Error running rule WL_FRESNEL_OFFSET: arg #{0} - parameter 1 must be float", idx));
496 }
354 break; 497 break;
355 case (int)ScriptBaseClass.WL_FRESNEL_SCALE: 498 case (int)ScriptBaseClass.WL_FRESNEL_SCALE:
356 idx++; 499 idx++;
357 wl.fresnelScale = (float)rules.GetLSLFloatItem(idx); 500 try
501 {
502 wl.fresnelScale = (float)rules.GetLSLFloatItem(idx);
503 }
504 catch (InvalidCastException)
505 {
506 throw new InvalidCastException(string.Format("Error running rule WL_FRESNEL_SCALE: arg #{0} - parameter 1 must be float", idx));
507 }
358 break; 508 break;
359 case (int)ScriptBaseClass.WL_HAZE_DENSITY: 509 case (int)ScriptBaseClass.WL_HAZE_DENSITY:
360 idx++; 510 idx++;
361 wl.hazeDensity = (float)rules.GetLSLFloatItem(idx); 511 try
512 {
513 wl.hazeDensity = (float)rules.GetLSLFloatItem(idx);
514 }
515 catch (InvalidCastException)
516 {
517 throw new InvalidCastException(string.Format("Error running rule WL_HAZE_DENSITY: arg #{0} - parameter 1 must be float", idx));
518 }
362 break; 519 break;
363 case (int)ScriptBaseClass.WL_HAZE_HORIZON: 520 case (int)ScriptBaseClass.WL_HAZE_HORIZON:
364 idx++; 521 idx++;
365 wl.hazeHorizon = (float)rules.GetLSLFloatItem(idx); 522 try
523 {
524 wl.hazeHorizon = (float)rules.GetLSLFloatItem(idx);
525 }
526 catch (InvalidCastException)
527 {
528 throw new InvalidCastException(string.Format("Error running rule WL_HAZE_HORIZON: arg #{0} - parameter 1 must be float", idx));
529 }
366 break; 530 break;
367 case (int)ScriptBaseClass.WL_HORIZON: 531 case (int)ScriptBaseClass.WL_HORIZON:
368 idx++; 532 idx++;
369 iQ = rules.GetQuaternionItem(idx); 533 try
534 {
535 iQ = rules.GetQuaternionItem(idx);
536 }
537 catch (InvalidCastException)
538 {
539 throw new InvalidCastException(string.Format("Error running rule WL_HORIZON: arg #{0} - parameter 1 must be rotation", idx));
540 }
370 wl.horizon = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); 541 wl.horizon = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
371 break; 542 break;
372 case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION: 543 case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION:
373 idx++; 544 idx++;
374 iV = rules.GetVector3Item(idx); 545 try
546 {
547 iV = rules.GetVector3Item(idx);
548 }
549 catch (InvalidCastException)
550 {
551 throw new InvalidCastException(string.Format("Error running rule WL_LITTLE_WAVE_DIRECTION: arg #{0} - parameter 1 must be vector", idx));
552 }
375 wl.littleWaveDirection = new Vector2((float)iV.x, (float)iV.y); 553 wl.littleWaveDirection = new Vector2((float)iV.x, (float)iV.y);
376 break; 554 break;
377 case (int)ScriptBaseClass.WL_MAX_ALTITUDE: 555 case (int)ScriptBaseClass.WL_MAX_ALTITUDE:
378 idx++; 556 idx++;
379 wl.maxAltitude = (ushort)rules.GetLSLIntegerItem(idx).value; 557 try
558 {
559 wl.maxAltitude = (ushort)rules.GetLSLIntegerItem(idx).value;
560 }
561 catch (InvalidCastException)
562 {
563 throw new InvalidCastException(string.Format("Error running rule WL_MAX_ALTITUDE: arg #{0} - parameter 1 must be integer", idx));
564 }
380 break; 565 break;
381 case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE: 566 case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE:
382 idx++; 567 idx++;
383 wl.normalMapTexture = new UUID(rules.GetLSLStringItem(idx).m_string); 568 try
569 {
570 wl.normalMapTexture = new UUID(rules.GetLSLStringItem(idx).m_string);
571 }
572 catch (ArgumentException)
573 {
574 throw new InvalidCastException(string.Format("Error running rule WL_NORMAL_MAP_TEXTURE: arg #{0} - parameter 1 must be key", idx));
575 }
384 break; 576 break;
385 case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE: 577 case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
386 idx++; 578 idx++;
387 iV = rules.GetVector3Item(idx); 579 try
580 {
581 iV = rules.GetVector3Item(idx);
582 }
583 catch (InvalidCastException)
584 {
585 throw new InvalidCastException(string.Format("Error running rule WL_REFLECTION_WAVELET_SCALE: arg #{0} - parameter 1 must be vector", idx));
586 }
388 wl.reflectionWaveletScale = iV; 587 wl.reflectionWaveletScale = iV;
389 break; 588 break;
390 case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE: 589 case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
391 idx++; 590 idx++;
392 wl.refractScaleAbove = (float)rules.GetLSLFloatItem(idx); 591 try
592 {
593 wl.refractScaleAbove = (float)rules.GetLSLFloatItem(idx);
594 }
595 catch (InvalidCastException)
596 {
597 throw new InvalidCastException(string.Format("Error running rule WL_REFRACT_SCALE_ABOVE: arg #{0} - parameter 1 must be float", idx));
598 }
393 break; 599 break;
394 case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW: 600 case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW:
395 idx++; 601 idx++;
396 wl.refractScaleBelow = (float)rules.GetLSLFloatItem(idx); 602 try
603 {
604 wl.refractScaleBelow = (float)rules.GetLSLFloatItem(idx);
605 }
606 catch (InvalidCastException)
607 {
608 throw new InvalidCastException(string.Format("Error running rule WL_REFRACT_SCALE_BELOW: arg #{0} - parameter 1 must be float", idx));
609 }
397 break; 610 break;
398 case (int)ScriptBaseClass.WL_SCENE_GAMMA: 611 case (int)ScriptBaseClass.WL_SCENE_GAMMA:
399 idx++; 612 idx++;
400 wl.sceneGamma = (float)rules.GetLSLFloatItem(idx); 613 try
614 {
615 wl.sceneGamma = (float)rules.GetLSLFloatItem(idx);
616 }
617 catch (InvalidCastException)
618 {
619 throw new InvalidCastException(string.Format("Error running rule WL_SCENE_GAMMA: arg #{0} - parameter 1 must be float", idx));
620 }
401 break; 621 break;
402 case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS: 622 case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS:
403 idx++; 623 idx++;
404 wl.starBrightness = (float)rules.GetLSLFloatItem(idx); 624 try
625 {
626 wl.starBrightness = (float)rules.GetLSLFloatItem(idx);
627 }
628 catch (InvalidCastException)
629 {
630 throw new InvalidCastException(string.Format("Error running rule WL_STAR_BRIGHTNESS: arg #{0} - parameter 1 must be float", idx));
631 }
405 break; 632 break;
406 case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS: 633 case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS:
407 idx++; 634 idx++;
408 wl.sunGlowFocus = (float)rules.GetLSLFloatItem(idx); 635 try
636 {
637 wl.sunGlowFocus = (float)rules.GetLSLFloatItem(idx);
638 }
639 catch (InvalidCastException)
640 {
641 throw new InvalidCastException(string.Format("Error running rule WL_SUN_GLOW_FOCUS: arg #{0} - parameter 1 must be float", idx));
642 }
409 break; 643 break;
410 case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE: 644 case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE:
411 idx++; 645 idx++;
412 wl.sunGlowSize = (float)rules.GetLSLFloatItem(idx); 646 try
647 {
648 wl.sunGlowSize = (float)rules.GetLSLFloatItem(idx);
649 }
650 catch (InvalidCastException)
651 {
652 throw new InvalidCastException(string.Format("Error running rule WL_SUN_GLOW_SIZE: arg #{0} - parameter 1 must be float", idx));
653 }
413 break; 654 break;
414 case (int)ScriptBaseClass.WL_SUN_MOON_COLOR: 655 case (int)ScriptBaseClass.WL_SUN_MOON_COLOR:
415 idx++; 656 idx++;
416 iQ = rules.GetQuaternionItem(idx); 657 iQ = rules.GetQuaternionItem(idx);
417 wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); 658 try
659 {
660 wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
661 }
662 catch (InvalidCastException)
663 {
664 throw new InvalidCastException(string.Format("Error running rule WL_SUN_MOON_COLOR: arg #{0} - parameter 1 must be rotation", idx));
665 }
418 break; 666 break;
419 case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER: 667 case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER:
420 idx++; 668 idx++;
421 wl.underwaterFogModifier = (float)rules.GetLSLFloatItem(idx); 669 try
670 {
671 wl.underwaterFogModifier = (float)rules.GetLSLFloatItem(idx);
672 }
673 catch (InvalidCastException)
674 {
675 throw new InvalidCastException(string.Format("Error running rule WL_UNDERWATER_FOG_MODIFIER: arg #{0} - parameter 1 must be float", idx));
676 }
422 break; 677 break;
423 case (int)ScriptBaseClass.WL_WATER_COLOR: 678 case (int)ScriptBaseClass.WL_WATER_COLOR:
424 idx++; 679 idx++;
425 iV = rules.GetVector3Item(idx); 680 try
681 {
682 iV = rules.GetVector3Item(idx);
683 }
684 catch (InvalidCastException)
685 {
686 throw new InvalidCastException(string.Format("Error running rule WL_WATER_COLOR: arg #{0} - parameter 1 must be vector", idx));
687 }
426 wl.waterColor = iV; 688 wl.waterColor = iV;
427 break; 689 break;
428 case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT: 690 case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
429 idx++; 691 idx++;
430 wl.waterFogDensityExponent = (float)rules.GetLSLFloatItem(idx); 692 try
693 {
694 wl.waterFogDensityExponent = (float)rules.GetLSLFloatItem(idx);
695 }
696 catch (InvalidCastException)
697 {
698 throw new InvalidCastException(string.Format("Error running rule WL_WATER_FOG_DENSITY_EXPONENT: arg #{0} - parameter 1 must be float", idx));
699 }
431 break; 700 break;
432 } 701 }
433 idx++; 702 idx++;
@@ -464,7 +733,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
464 733
465 if (LightShareModule.EnableWindlight) 734 if (LightShareModule.EnableWindlight)
466 { 735 {
467 RegionLightShareData wl = getWindlightProfileFromRules(rules); 736 RegionLightShareData wl;
737 try
738 {
739 wl = getWindlightProfileFromRules(rules);
740 }
741 catch(InvalidCastException e)
742 {
743 LSShoutError(e.Message);
744 return 0;
745 }
468 wl.valid = true; 746 wl.valid = true;
469 m_host.ParentGroup.Scene.StoreWindlightProfile(wl); 747 m_host.ParentGroup.Scene.StoreWindlightProfile(wl);
470 success = 1; 748 success = 1;
@@ -532,8 +810,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
532 m_host.AddScriptLPS(1); 810 m_host.AddScriptLPS(1);
533 811
534 if (LightShareModule.EnableWindlight) 812 if (LightShareModule.EnableWindlight)
535 { 813 {
536 RegionLightShareData wl = getWindlightProfileFromRules(rules); 814 RegionLightShareData wl;
815 try
816 {
817 wl = getWindlightProfileFromRules(rules);
818 }
819 catch(InvalidCastException e)
820 {
821 LSShoutError(e.Message);
822 return 0;
823 }
537 World.EventManager.TriggerOnSendNewWindlightProfileTargeted(wl, new UUID(target.m_string)); 824 World.EventManager.TriggerOnSendNewWindlightProfileTargeted(wl, new UUID(target.m_string));
538 success = 1; 825 success = 1;
539 } 826 }
@@ -546,4 +833,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
546 return success; 833 return success;
547 } 834 }
548 } 835 }
549} \ No newline at end of file 836}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
index edcdfbc..7bd4fa7 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
@@ -66,7 +66,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
66 internal IScriptModuleComms m_comms = null; 66 internal IScriptModuleComms m_comms = null;
67 67
68 public void Initialize( 68 public void Initialize(
69 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle) 69 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item)
70 { 70 {
71 m_ScriptEngine = scriptEngine; 71 m_ScriptEngine = scriptEngine;
72 m_host = host; 72 m_host = host;
@@ -420,7 +420,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
420 { 420 {
421 if (type == typeof(object[])) 421 if (type == typeof(object[]))
422 { 422 {
423 object[] plist = (lslparm as LSL_List).Data; 423 object[] plist = ((LSL_List)lslparm).Data;
424 object[] result = new object[plist.Length]; 424 object[] result = new object[plist.Length];
425 for (int i = 0; i < plist.Length; i++) 425 for (int i = 0; i < plist.Length; i++)
426 { 426 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 01d90e7..5d8f0f6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -63,6 +63,7 @@ using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
63using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; 63using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
64using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; 64using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
65using PermissionMask = OpenSim.Framework.PermissionMask; 65using PermissionMask = OpenSim.Framework.PermissionMask;
66using OpenSim.Services.Connectors.Hypergrid;
66 67
67namespace OpenSim.Region.ScriptEngine.Shared.Api 68namespace OpenSim.Region.ScriptEngine.Shared.Api
68{ 69{
@@ -145,7 +146,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
145 protected IUrlModule m_UrlModule = null; 146 protected IUrlModule m_UrlModule = null;
146 147
147 public void Initialize( 148 public void Initialize(
148 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle) 149 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item)
149 { 150 {
150 m_ScriptEngine = scriptEngine; 151 m_ScriptEngine = scriptEngine;
151 m_host = host; 152 m_host = host;
@@ -155,7 +156,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
155 m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>(); 156 m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>();
156 157
157 if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false)) 158 if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
159 {
158 m_OSFunctionsEnabled = true; 160 m_OSFunctionsEnabled = true;
161 // m_log.Warn("[OSSL] OSSL FUNCTIONS ENABLED");
162 }
159 163
160 m_ScriptDelayFactor = 164 m_ScriptDelayFactor =
161 m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f); 165 m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f);
@@ -799,9 +803,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
799 803
800 // We will launch the teleport on a new thread so that when the script threads are terminated 804 // We will launch the teleport on a new thread so that when the script threads are terminated
801 // before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting. 805 // before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting.
802 Util.FireAndForget(o => World.RequestTeleportLocation( 806 Util.FireAndForget(
803 presence.ControllingClient, regionName, position, 807 o => World.RequestTeleportLocation(
804 lookat, (uint)TPFlags.ViaLocation)); 808 presence.ControllingClient, regionName, position,
809 lookat, (uint)TPFlags.ViaLocation),
810 null, "OSSL_Api.TeleportAgentByRegionCoords");
805 811
806 ScriptSleep(5000); 812 ScriptSleep(5000);
807 813
@@ -823,6 +829,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
823 private void TeleportAgent(string agent, int regionX, int regionY, 829 private void TeleportAgent(string agent, int regionX, int regionY,
824 LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions) 830 LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions)
825 { 831 {
832<<<<<<< HEAD
833 // ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize));
834=======
835>>>>>>> avn/ubitvar
826 ulong regionHandle = Util.RegionLocToHandle((uint)regionX, (uint)regionY); 836 ulong regionHandle = Util.RegionLocToHandle((uint)regionX, (uint)regionY);
827 837
828 m_host.AddScriptLPS(1); 838 m_host.AddScriptLPS(1);
@@ -844,9 +854,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
844 854
845 // We will launch the teleport on a new thread so that when the script threads are terminated 855 // We will launch the teleport on a new thread so that when the script threads are terminated
846 // before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting. 856 // before teleport in ScriptInstance.GetXMLState(), we don't end up aborting the one doing the teleporting.
847 Util.FireAndForget(o => World.RequestTeleportLocation( 857 Util.FireAndForget(
848 presence.ControllingClient, regionHandle, 858 o => World.RequestTeleportLocation(
849 position, lookat, (uint)TPFlags.ViaLocation)); 859 presence.ControllingClient, regionHandle,
860 position, lookat, (uint)TPFlags.ViaLocation),
861 null, "OSSL_Api.TeleportAgentByRegionName");
850 862
851 ScriptSleep(5000); 863 ScriptSleep(5000);
852 864
@@ -881,6 +893,59 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
881 TeleportAgent(m_host.OwnerID.ToString(), regionX, regionY, position, lookat, true); 893 TeleportAgent(m_host.OwnerID.ToString(), regionX, regionY, position, lookat, true);
882 } 894 }
883 895
896 ///<summary>
897 /// Allows a script IN the target prim to force an avatar to sit on it using normal methods
898 /// as if called by the client.
899 /// Silent fail if agent (or target if overloaded) not found.
900 /// Does work if passed key (or keys if overloaded).
901 /// </summary>
902 /// <param name="avatar"></param>
903 public void osForceOtherSit(string avatar)
904 {
905 CheckThreatLevel(ThreatLevel.VeryHigh, "osForceOtherSit");
906
907 m_host.AddScriptLPS(1);
908
909 ForceSit(avatar, m_host.UUID);
910 }
911
912 /// <summary>
913 /// Overload method of osForceOtherSit(string avatar) to allow a script NOT in the target prim to force
914 /// an avatar to sit on the target prim using normal methods as if called by the client.
915 /// </summary>
916 /// <param name="avatar"></param>
917 /// <param name="target"></param>
918 public void osForceOtherSit(string avatar, string target)
919 {
920 CheckThreatLevel(ThreatLevel.VeryHigh, "osForceOtherSit");
921
922 m_host.AddScriptLPS(1);
923
924 UUID targetID = new UUID(target);
925
926 ForceSit(avatar, targetID);
927 }
928
929 public void ForceSit(string avatar, UUID targetID)
930 {
931 UUID agentID;
932
933 if (!UUID.TryParse(avatar, out agentID))
934 return;
935
936 ScenePresence presence = World.GetScenePresence(agentID);
937
938 SceneObjectPart part = World.GetSceneObjectPart(targetID);
939
940 if (presence != null &&
941 part != null &&
942 part.SitTargetAvatar == UUID.Zero)
943 presence.HandleAgentRequestSit(presence.ControllingClient,
944 agentID,
945 targetID,
946 part.SitTargetPosition);
947 }
948
884 // Functions that get information from the agent itself. 949 // Functions that get information from the agent itself.
885 // 950 //
886 // osGetAgentIP - this is used to determine the IP address of 951 // osGetAgentIP - this is used to determine the IP address of
@@ -1254,7 +1319,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1254 World.RegionInfo.EstateSettings.UseGlobalTime = !sunFixed; 1319 World.RegionInfo.EstateSettings.UseGlobalTime = !sunFixed;
1255 World.RegionInfo.EstateSettings.SunPosition = sunHour; 1320 World.RegionInfo.EstateSettings.SunPosition = sunHour;
1256 World.RegionInfo.EstateSettings.FixedSun = sunFixed; 1321 World.RegionInfo.EstateSettings.FixedSun = sunFixed;
1257 World.RegionInfo.EstateSettings.Save(); 1322 World.EstateDataService.StoreEstateSettings(World.RegionInfo.EstateSettings);
1258 1323
1259 World.EventManager.TriggerEstateToolsSunUpdate(World.RegionInfo.RegionHandle); 1324 World.EventManager.TriggerEstateToolsSunUpdate(World.RegionInfo.RegionHandle);
1260 } 1325 }
@@ -1578,6 +1643,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1578 } 1643 }
1579 } 1644 }
1580 1645
1646 public LSL_Integer osCheckODE()
1647 {
1648 m_host.AddScriptLPS(1);
1649 LSL_Integer ret = 0; // false
1650 if (m_ScriptEngine.World.PhysicsScene != null)
1651 {
1652 string physEngine = m_ScriptEngine.World.PhysicsScene.EngineType;
1653 if (physEngine == "OpenDynamicsEngine")
1654 {
1655 ret = 1; // true
1656 }
1657 }
1658 return ret;
1659 }
1660
1581 public string osGetPhysicsEngineType() 1661 public string osGetPhysicsEngineType()
1582 { 1662 {
1583 // High because it can be used to target attacks to known weaknesses 1663 // High because it can be used to target attacks to known weaknesses
@@ -1776,13 +1856,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1776 // Create new asset 1856 // Create new asset
1777 AssetBase asset = new AssetBase(UUID.Random(), name, (sbyte)AssetType.Notecard, m_host.OwnerID.ToString()); 1857 AssetBase asset = new AssetBase(UUID.Random(), name, (sbyte)AssetType.Notecard, m_host.OwnerID.ToString());
1778 asset.Description = description; 1858 asset.Description = description;
1859 byte[] a;
1860 byte[] b;
1861 byte[] c;
1862
1863 b = Util.UTF8.GetBytes(data);
1864
1865 a = Util.UTF8.GetBytes(
1866 "Linden text version 2\n{\nLLEmbeddedItems version 1\n{\ncount 0\n}\nText length " + b.Length.ToString() + "\n");
1779 1867
1780 int textLength = data.Length; 1868 c = Util.UTF8.GetBytes("}");
1781 data
1782 = "Linden text version 2\n{\nLLEmbeddedItems version 1\n{\ncount 0\n}\nText length "
1783 + textLength.ToString() + "\n" + data + "}\n";
1784 1869
1785 asset.Data = Util.UTF8.GetBytes(data); 1870 byte[] d = new byte[a.Length + b.Length + c.Length];
1871 Buffer.BlockCopy(a, 0, d, 0, a.Length);
1872 Buffer.BlockCopy(b, 0, d, a.Length, b.Length);
1873 Buffer.BlockCopy(c, 0, d, a.Length + b.Length, c.Length);
1874
1875 asset.Data = d;
1786 World.AssetService.Store(asset); 1876 World.AssetService.Store(asset);
1787 1877
1788 // Create Task Entry 1878 // Create Task Entry
@@ -1889,8 +1979,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1889 } 1979 }
1890 } 1980 }
1891 1981
1892 string data = Encoding.UTF8.GetString(a.Data); 1982 NotecardCache.Cache(assetID, a.Data);
1893 NotecardCache.Cache(assetID, data);
1894 }; 1983 };
1895 1984
1896 return assetID; 1985 return assetID;
@@ -2002,15 +2091,51 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2002 CheckThreatLevel(ThreatLevel.Low, "osAvatarName2Key"); 2091 CheckThreatLevel(ThreatLevel.Low, "osAvatarName2Key");
2003 m_host.AddScriptLPS(1); 2092 m_host.AddScriptLPS(1);
2004 2093
2005 UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, firstname, lastname); 2094 IUserManagement userManager = World.RequestModuleInterface<IUserManagement>();
2006 if (null == account) 2095 if (userManager == null)
2007 { 2096 {
2008 return UUID.Zero.ToString(); 2097 OSSLShoutError("osAvatarName2Key: UserManagement module not available");
2098 return string.Empty;
2099 }
2100
2101 // Check if the user is already cached
2102
2103 UUID userID = userManager.GetUserIdByName(firstname, lastname);
2104 if (userID != UUID.Zero)
2105 return userID.ToString();
2106
2107 // Query for the user
2108
2109 String realFirstName; String realLastName; String serverURI;
2110 if (Util.ParseForeignAvatarName(firstname, lastname, out realFirstName, out realLastName, out serverURI))
2111 {
2112 try
2113 {
2114 UserAgentServiceConnector userConnection = new UserAgentServiceConnector(serverURI, true);
2115
2116 if (userConnection != null)
2117 {
2118 userID = userConnection.GetUUID(realFirstName, realLastName);
2119 if (userID != UUID.Zero)
2120 {
2121 userManager.AddUser(userID, realFirstName, realLastName, serverURI);
2122 return userID.ToString();
2123 }
2124 }
2125 }
2126 catch (Exception /*e*/)
2127 {
2128 // m_log.Warn("[osAvatarName2Key] UserAgentServiceConnector - Unable to connect to destination grid ", e);
2129 }
2009 } 2130 }
2010 else 2131 else
2011 { 2132 {
2012 return account.PrincipalID.ToString(); 2133 UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, firstname, lastname);
2134 if (account != null)
2135 return account.PrincipalID.ToString();
2013 } 2136 }
2137
2138 return UUID.Zero.ToString();
2014 } 2139 }
2015 2140
2016 public string osKey2Name(string id) 2141 public string osKey2Name(string id)
@@ -2023,19 +2148,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2023 if (UUID.TryParse(id, out key)) 2148 if (UUID.TryParse(id, out key))
2024 { 2149 {
2025 UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, key); 2150 UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, key);
2026 if (null == account) 2151 if (account != null)
2027 {
2028 return "";
2029 }
2030 else
2031 {
2032 return account.Name; 2152 return account.Name;
2153
2154 if (m_ScriptEngine.World.GridUserService != null)
2155 {
2156 GridUserInfo uInfo = m_ScriptEngine.World.GridUserService.GetGridUserInfo(key.ToString());
2157
2158 if (uInfo != null)
2159 {
2160 UUID userUUID; String gridURL; String firstName; String lastName; String tmp;
2161
2162 if (Util.ParseUniversalUserIdentifier(uInfo.UserID, out userUUID, out gridURL, out firstName, out lastName, out tmp))
2163 {
2164 string grid = new Uri(gridURL).Authority;
2165 return firstName + "." + lastName + " @" + grid;
2166 }
2167 }
2033 } 2168 }
2034 } 2169 }
2035 else 2170
2036 { 2171 return "";
2037 return "";
2038 }
2039 } 2172 }
2040 2173
2041 private enum InfoType 2174 private enum InfoType
@@ -2224,6 +2357,39 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2224 return retval; 2357 return retval;
2225 } 2358 }
2226 2359
2360 public string osGetAvatarHomeURI(string uuid)
2361 {
2362 CheckThreatLevel(ThreatLevel.Low, "osGetAvatarHomeURI");
2363 m_host.AddScriptLPS(1);
2364
2365 IUserManagement userManager = m_ScriptEngine.World.RequestModuleInterface<IUserManagement>();
2366 string returnValue = "";
2367
2368 if (userManager != null)
2369 {
2370 returnValue = userManager.GetUserServerURL(new UUID(uuid), "HomeURI");
2371 }
2372
2373 if (returnValue == "")
2374 {
2375 IConfigSource config = m_ScriptEngine.ConfigSource;
2376 returnValue = Util.GetConfigVarFromSections<string>(config, "HomeURI",
2377 new string[] { "Startup", "Hypergrid" }, String.Empty);
2378
2379 if (!string.IsNullOrEmpty(returnValue))
2380 return returnValue;
2381
2382 // Legacy. Remove soon!
2383 if (config.Configs["LoginService"] != null)
2384 returnValue = config.Configs["LoginService"].GetString("SRV_HomeURI", returnValue);
2385
2386 if (String.IsNullOrEmpty(returnValue))
2387 returnValue = GridUserInfo(InfoType.Home);
2388 }
2389
2390 return returnValue;
2391 }
2392
2227 public LSL_String osFormatString(string str, LSL_List strings) 2393 public LSL_String osFormatString(string str, LSL_List strings)
2228 { 2394 {
2229 CheckThreatLevel(ThreatLevel.VeryLow, "osFormatString"); 2395 CheckThreatLevel(ThreatLevel.VeryLow, "osFormatString");
@@ -2345,14 +2511,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2345 // on the ILSL_Api interface. 2511 // on the ILSL_Api interface.
2346 LSL_Api LSL_Api = (LSL_Api)m_LSL_Api; 2512 LSL_Api LSL_Api = (LSL_Api)m_LSL_Api;
2347 LSL_List retVal = new LSL_List(); 2513 LSL_List retVal = new LSL_List();
2348 LSL_List remaining = null; 2514 LSL_List remaining = new LSL_List();
2349 List<SceneObjectPart> parts = LSL_Api.GetLinkParts(linknumber); 2515 List<SceneObjectPart> parts = LSL_Api.GetLinkParts(linknumber);
2350 foreach (SceneObjectPart part in parts) 2516 foreach (SceneObjectPart part in parts)
2351 { 2517 {
2352 remaining = LSL_Api.GetPrimParams(part, rules, ref retVal); 2518 remaining = LSL_Api.GetPrimParams(part, rules, ref retVal);
2353 } 2519 }
2354 2520
2355 while (remaining != null && remaining.Length > 2) 2521 while (remaining.Length > 2)
2356 { 2522 {
2357 linknumber = remaining.GetLSLIntegerItem(0); 2523 linknumber = remaining.GetLSLIntegerItem(0);
2358 rules = remaining.GetSublist(1, -1); 2524 rules = remaining.GetSublist(1, -1);
@@ -2364,6 +2530,36 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2364 return retVal; 2530 return retVal;
2365 } 2531 }
2366 2532
2533 public void osForceCreateLink(string target, int parent)
2534 {
2535 CheckThreatLevel(ThreatLevel.VeryLow, "osForceCreateLink");
2536
2537 m_host.AddScriptLPS(1);
2538
2539 InitLSL();
2540 ((LSL_Api)m_LSL_Api).CreateLink(target, parent);
2541 }
2542
2543 public void osForceBreakLink(int linknum)
2544 {
2545 CheckThreatLevel(ThreatLevel.VeryLow, "osForceBreakLink");
2546
2547 m_host.AddScriptLPS(1);
2548
2549 InitLSL();
2550 ((LSL_Api)m_LSL_Api).BreakLink(linknum);
2551 }
2552
2553 public void osForceBreakAllLinks()
2554 {
2555 CheckThreatLevel(ThreatLevel.VeryLow, "osForceBreakAllLinks");
2556
2557 m_host.AddScriptLPS(1);
2558
2559 InitLSL();
2560 ((LSL_Api)m_LSL_Api).BreakAllLinks();
2561 }
2562
2367 public LSL_Integer osIsNpc(LSL_Key npc) 2563 public LSL_Integer osIsNpc(LSL_Key npc)
2368 { 2564 {
2369 CheckThreatLevel(ThreatLevel.None, "osIsNpc"); 2565 CheckThreatLevel(ThreatLevel.None, "osIsNpc");
@@ -2942,6 +3138,51 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2942 3138
2943 return SaveAppearanceToNotecard(avatarId, notecard); 3139 return SaveAppearanceToNotecard(avatarId, notecard);
2944 } 3140 }
3141
3142 /// <summary>
3143 /// Get the gender as specified in avatar appearance for a given avatar key
3144 /// </summary>
3145 /// <param name="rawAvatarId"></param>
3146 /// <returns>"male" or "female" or "unknown"</returns>
3147 public LSL_String osGetGender(LSL_Key rawAvatarId)
3148 {
3149 CheckThreatLevel(ThreatLevel.None, "osGetGender");
3150 m_host.AddScriptLPS(1);
3151
3152 UUID avatarId;
3153 if (!UUID.TryParse(rawAvatarId, out avatarId))
3154 return new LSL_String("unknown");
3155
3156 ScenePresence sp = World.GetScenePresence(avatarId);
3157
3158 if (sp == null || sp.IsChildAgent || sp.Appearance == null || sp.Appearance.VisualParams == null)
3159 return new LSL_String("unknown");
3160
3161 // find the index of "shape" parameter "male"
3162 int vpShapeMaleIndex = 0;
3163 bool indexFound = false;
3164 VisualParam param = new VisualParam();
3165 foreach(var vpEntry in VisualParams.Params)
3166 {
3167 param = vpEntry.Value;
3168 if (param.Name == "male" && param.Wearable == "shape")
3169 {
3170 indexFound = true;
3171 break;
3172 }
3173
3174 if (param.Group == 0)
3175 vpShapeMaleIndex++;
3176 }
3177
3178 if (!indexFound)
3179 return new LSL_String("unknown");
3180
3181 float vpShapeMale = Utils.ByteToFloat(sp.Appearance.VisualParams[vpShapeMaleIndex], param.MinValue, param.MaxValue);
3182
3183 bool isMale = vpShapeMale > 0.5f;
3184 return new LSL_String(isMale ? "male" : "female");
3185 }
2945 3186
2946 /// <summary> 3187 /// <summary>
2947 /// Get current region's map texture UUID 3188 /// Get current region's map texture UUID
@@ -3024,9 +3265,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3024 } 3265 }
3025 else 3266 else
3026 { 3267 {
3268<<<<<<< HEAD
3269 Scene scene = m_ScriptEngine.World;
3270 GridRegion region = scene.GridService.GetRegionByUUID(UUID.Zero, World.RegionInfo.RegionID);
3271 return new LSL_Vector((float)region.RegionSizeX, (float)region.RegionSizeX, Constants.RegionHeight);
3272=======
3027 return new LSL_Vector((float)World.RegionInfo.RegionSizeX, 3273 return new LSL_Vector((float)World.RegionInfo.RegionSizeX,
3028 (float)World.RegionInfo.RegionSizeY, 3274 (float)World.RegionInfo.RegionSizeY,
3029 (float)World.RegionInfo.RegionSizeZ ); 3275 (float)World.RegionInfo.RegionSizeZ );
3276>>>>>>> avn/ubitvar
3030 } 3277 }
3031 } 3278 }
3032 3279
@@ -3401,7 +3648,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3401 3648
3402 public void osForceAttachToOtherAvatarFromInventory(string rawAvatarId, string itemName, int attachmentPoint) 3649 public void osForceAttachToOtherAvatarFromInventory(string rawAvatarId, string itemName, int attachmentPoint)
3403 { 3650 {
3404 CheckThreatLevel(ThreatLevel.Severe, "osForceAttachToOtherAvatarFromInventory"); 3651 CheckThreatLevel(ThreatLevel.VeryHigh, "osForceAttachToOtherAvatarFromInventory");
3405 3652
3406 m_host.AddScriptLPS(1); 3653 m_host.AddScriptLPS(1);
3407 3654
@@ -3445,14 +3692,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3445 if (sp == null) 3692 if (sp == null)
3446 return; 3693 return;
3447 3694
3448 InventoryItemBase newItem = World.MoveTaskInventoryItem(sp.UUID, UUID.Zero, m_host, item.ItemID); 3695 string message;
3696 InventoryItemBase newItem = World.MoveTaskInventoryItem(sp.UUID, UUID.Zero, m_host, item.ItemID, out message);
3449 3697
3450 if (newItem == null) 3698 if (newItem == null)
3451 { 3699 {
3452 m_log.ErrorFormat( 3700 m_log.ErrorFormat(
3453 "[OSSL API]: Could not create user inventory item {0} for {1}, attach point {2} in {3}", 3701 "[OSSL API]: Could not create user inventory item {0} for {1}, attach point {2} in {3}: {4}",
3454 itemName, m_host.Name, attachmentPoint, World.Name); 3702 itemName, m_host.Name, attachmentPoint, World.Name, message);
3455 3703 ((LSL_Api)m_LSL_Api).llSay(0, message);
3456 return; 3704 return;
3457 } 3705 }
3458 3706
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Properties/AssemblyInfo.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Properties/AssemblyInfo.cs
index 9137c69..4708473 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.8.0.*")] 32[assembly: AssemblyVersion("0.8.2.*")]
33 33
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
index b642a9c..a3bb7d6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
@@ -124,6 +124,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
124 LSL_String llGetCreator(); 124 LSL_String llGetCreator();
125 LSL_String llGetDate(); 125 LSL_String llGetDate();
126 LSL_Float llGetEnergy(); 126 LSL_Float llGetEnergy();
127 LSL_String llGetEnv(LSL_String name);
127 LSL_Vector llGetForce(); 128 LSL_Vector llGetForce();
128 LSL_Integer llGetFreeMemory(); 129 LSL_Integer llGetFreeMemory();
129 LSL_Integer llGetUsedMemory(); 130 LSL_Integer llGetUsedMemory();
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index d80d389..ddd7630 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -259,6 +259,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
259 259
260 string osGetScriptEngineName(); 260 string osGetScriptEngineName();
261 string osGetSimulatorVersion(); 261 string osGetSimulatorVersion();
262 LSL_Integer osCheckODE();
262 string osGetPhysicsEngineType(); 263 string osGetPhysicsEngineType();
263 Hashtable osParseJSON(string JSON); 264 Hashtable osParseJSON(string JSON);
264 265
@@ -281,6 +282,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
281 string osGetGridGatekeeperURI(); 282 string osGetGridGatekeeperURI();
282 string osGetGridCustom(string key); 283 string osGetGridCustom(string key);
283 284
285 string osGetAvatarHomeURI(string uuid);
286
284 LSL_String osFormatString(string str, LSL_List strings); 287 LSL_String osFormatString(string str, LSL_List strings);
285 LSL_List osMatchString(string src, string pattern, int start); 288 LSL_List osMatchString(string src, string pattern, int start);
286 LSL_String osReplaceString(string src, string pattern, string replace, int count, int start); 289 LSL_String osReplaceString(string src, string pattern, string replace, int count, int start);
@@ -293,6 +296,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
293 LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules); 296 LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules);
294 297
295 /// <summary> 298 /// <summary>
299 /// Identical to llCreateLink() but does not require permission from the owner.
300 /// </summary>
301 /// <param name='target'></param>
302 /// <param name='parent'></param>
303 void osForceCreateLink(string target, int parent);
304
305 /// <summary>
306 /// Identical to llBreakLink() but does not require permission from the owner.
307 /// </summary>
308 /// <param name='linknum'></param>
309 void osForceBreakLink(int linknum);
310
311 /// <summary>
312 /// Identical to llBreakAllLinks() but does not require permission from the owner.
313 /// </summary>
314 void osForceBreakAllLinks();
315
316 /// <summary>
296 /// Check if the given key is an npc 317 /// Check if the given key is an npc
297 /// </summary> 318 /// </summary>
298 /// <param name="npc"></param> 319 /// <param name="npc"></param>
@@ -333,6 +354,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
333 LSL_Key osOwnerSaveAppearance(string notecard); 354 LSL_Key osOwnerSaveAppearance(string notecard);
334 LSL_Key osAgentSaveAppearance(key agentId, string notecard); 355 LSL_Key osAgentSaveAppearance(key agentId, string notecard);
335 356
357 key osGetGender(LSL_Key rawAvatarId);
336 key osGetMapTexture(); 358 key osGetMapTexture();
337 key osGetRegionMapTexture(string regionName); 359 key osGetRegionMapTexture(string regionName);
338 LSL_List osGetRegionStats(); 360 LSL_List osGetRegionStats();
@@ -344,6 +366,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
344 LSL_Float osGetHealth(string avatar); 366 LSL_Float osGetHealth(string avatar);
345 void osCauseHealing(string avatar, double healing); 367 void osCauseHealing(string avatar, double healing);
346 void osCauseDamage(string avatar, double damage); 368 void osCauseDamage(string avatar, double damage);
369 void osForceOtherSit(string avatar);
370 void osForceOtherSit(string avatar, string target);
347 LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules); 371 LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules);
348 void osSetPrimitiveParams(LSL_Key prim, LSL_List rules); 372 void osSetPrimitiveParams(LSL_Key prim, LSL_List rules);
349 void osSetProjectionParams(bool projection, LSL_Key texture, double fov, double focus, double amb); 373 void osSetProjectionParams(bool projection, LSL_Key texture, double fov, double focus, double amb);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs
index 943d7a2..1cc2cfb 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Executor.cs
@@ -78,6 +78,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
78 touch = 8, 78 touch = 8,
79 touch_end = 536870912, 79 touch_end = 536870912,
80 touch_start = 2097152, 80 touch_start = 2097152,
81 transaction_result = 33554432,
81 object_rez = 4194304 82 object_rez = 4194304
82 } 83 }
83 84
@@ -237,6 +238,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
237 m_eventFlagsMap.Add("touch", scriptEvents.touch); 238 m_eventFlagsMap.Add("touch", scriptEvents.touch);
238 m_eventFlagsMap.Add("touch_end", scriptEvents.touch_end); 239 m_eventFlagsMap.Add("touch_end", scriptEvents.touch_end);
239 m_eventFlagsMap.Add("touch_start", scriptEvents.touch_start); 240 m_eventFlagsMap.Add("touch_start", scriptEvents.touch_start);
241 m_eventFlagsMap.Add("transaction_result", scriptEvents.transaction_result);
240 m_eventFlagsMap.Add("object_rez", scriptEvents.object_rez); 242 m_eventFlagsMap.Add("object_rez", scriptEvents.object_rez);
241 } 243 }
242 } 244 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index 0e22ff3..158acc6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -48,6 +48,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
48 public const int STATUS_DIE_AT_EDGE = 128; 48 public const int STATUS_DIE_AT_EDGE = 128;
49 public const int STATUS_RETURN_AT_EDGE = 256; 49 public const int STATUS_RETURN_AT_EDGE = 256;
50 public const int STATUS_CAST_SHADOWS = 512; 50 public const int STATUS_CAST_SHADOWS = 512;
51 public const int STATUS_BLOCK_GRAB_OBJECT = 1024;
51 52
52 public const int AGENT = 1; 53 public const int AGENT = 1;
53 public const int AGENT_BY_LEGACY_NAME = 1; 54 public const int AGENT_BY_LEGACY_NAME = 1;
@@ -251,6 +252,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
251 public const int ATTACH_HUD_BOTTOM_LEFT = 36; 252 public const int ATTACH_HUD_BOTTOM_LEFT = 36;
252 public const int ATTACH_HUD_BOTTOM = 37; 253 public const int ATTACH_HUD_BOTTOM = 37;
253 public const int ATTACH_HUD_BOTTOM_RIGHT = 38; 254 public const int ATTACH_HUD_BOTTOM_RIGHT = 38;
255 public const int ATTACH_NECK = 39;
256 public const int ATTACH_AVATAR_CENTER = 40;
254 257
255 #region osMessageAttachments constants 258 #region osMessageAttachments constants
256 259
@@ -411,6 +414,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
411 public const int PRIM_POS_LOCAL = 33; 414 public const int PRIM_POS_LOCAL = 33;
412 public const int PRIM_LINK_TARGET = 34; 415 public const int PRIM_LINK_TARGET = 34;
413 public const int PRIM_SLICE = 35; 416 public const int PRIM_SLICE = 35;
417 public const int PRIM_SPECULAR = 36;
418 public const int PRIM_NORMAL = 37;
419 public const int PRIM_ALPHA_MODE = 38;
414 public const int PRIM_TEXGEN_DEFAULT = 0; 420 public const int PRIM_TEXGEN_DEFAULT = 0;
415 public const int PRIM_TEXGEN_PLANAR = 1; 421 public const int PRIM_TEXGEN_PLANAR = 1;
416 422
@@ -593,6 +599,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
593 public const int OBJECT_PHYSICS = 21; 599 public const int OBJECT_PHYSICS = 21;
594 public const int OBJECT_PHANTOM = 22; 600 public const int OBJECT_PHANTOM = 22;
595 public const int OBJECT_TEMP_ON_REZ = 23; 601 public const int OBJECT_TEMP_ON_REZ = 23;
602 public const int OBJECT_RENDER_WEIGHT = 24;
603 public const int OBJECT_HOVER_HEIGHT = 25;
604 public const int OBJECT_BODY_SHAPE_TYPE = 26;
605 public const int OBJECT_LAST_OWNER_ID = 27;
596 606
597 // Pathfinding types 607 // Pathfinding types
598 public const int OPT_OTHER = -1; 608 public const int OPT_OTHER = -1;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
index 5047162..2745637 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
@@ -466,6 +466,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
466 return m_LSL_Functions.llGetEnergy(); 466 return m_LSL_Functions.llGetEnergy();
467 } 467 }
468 468
469 public LSL_String llGetEnv(LSL_String name)
470 {
471 return m_LSL_Functions.llGetEnv(name);
472 }
473
469 public LSL_Vector llGetForce() 474 public LSL_Vector llGetForce()
470 { 475 {
471 return m_LSL_Functions.llGetForce(); 476 return m_LSL_Functions.llGetForce();
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 8666421..5fdbf9d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -420,6 +420,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
420 return m_OSSL_Functions.osGetScriptEngineName(); 420 return m_OSSL_Functions.osGetScriptEngineName();
421 } 421 }
422 422
423 public LSL_Integer osCheckODE()
424 {
425 return m_OSSL_Functions.osCheckODE();
426 }
427
423 public string osGetPhysicsEngineType() 428 public string osGetPhysicsEngineType()
424 { 429 {
425 return m_OSSL_Functions.osGetPhysicsEngineType(); 430 return m_OSSL_Functions.osGetPhysicsEngineType();
@@ -500,6 +505,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
500 return m_OSSL_Functions.osGetGridCustom(key); 505 return m_OSSL_Functions.osGetGridCustom(key);
501 } 506 }
502 507
508 public string osGetAvatarHomeURI(string uuid)
509 {
510 return m_OSSL_Functions.osGetAvatarHomeURI(uuid);
511 }
512
503 public LSL_String osFormatString(string str, LSL_List strings) 513 public LSL_String osFormatString(string str, LSL_List strings)
504 { 514 {
505 return m_OSSL_Functions.osFormatString(str, strings); 515 return m_OSSL_Functions.osFormatString(str, strings);
@@ -537,6 +547,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
537 return m_OSSL_Functions.osGetLinkPrimitiveParams(linknumber, rules); 547 return m_OSSL_Functions.osGetLinkPrimitiveParams(linknumber, rules);
538 } 548 }
539 549
550 public void osForceCreateLink(string target, int parent)
551 {
552 m_OSSL_Functions.osForceCreateLink(target, parent);
553 }
554
555 public void osForceBreakLink(int linknum)
556 {
557 m_OSSL_Functions.osForceBreakLink(linknum);
558 }
559
560 public void osForceBreakAllLinks()
561 {
562 m_OSSL_Functions.osForceBreakAllLinks();
563 }
564
540 public LSL_Integer osIsNpc(LSL_Key npc) 565 public LSL_Integer osIsNpc(LSL_Key npc)
541 { 566 {
542 return m_OSSL_Functions.osIsNpc(npc); 567 return m_OSSL_Functions.osIsNpc(npc);
@@ -714,6 +739,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
714 if (Position.y > ((int)Constants.RegionSize - 1)) 739 if (Position.y > ((int)Constants.RegionSize - 1))
715 Position.y = ((int)Constants.RegionSize - 1); 740 Position.y = ((int)Constants.RegionSize - 1);
716 */ 741 */
742<<<<<<< HEAD
743 if (Position.z > Constants.RegionHeight)
744 Position.z = Constants.RegionHeight;
745=======
746>>>>>>> avn/ubitvar
717 if (Position.x < 0) 747 if (Position.x < 0)
718 Position.x = 0; 748 Position.x = 0;
719 if (Position.y < 0) 749 if (Position.y < 0)
@@ -845,6 +875,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
845 } 875 }
846 } 876 }
847 877
878 public string osGetGender(LSL_Key rawAvatarId)
879 {
880 return m_OSSL_Functions.osGetGender(rawAvatarId);
881 }
882
848 public key osGetMapTexture() 883 public key osGetMapTexture()
849 { 884 {
850 return m_OSSL_Functions.osGetMapTexture(); 885 return m_OSSL_Functions.osGetMapTexture();
@@ -899,6 +934,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
899 { 934 {
900 m_OSSL_Functions.osCauseHealing(avatar, healing); 935 m_OSSL_Functions.osCauseHealing(avatar, healing);
901 } 936 }
937
938 public void osForceOtherSit(string avatar)
939 {
940 m_OSSL_Functions.osForceOtherSit(avatar);
941 }
942
943 public void osForceOtherSit(string avatar, string target)
944 {
945 m_OSSL_Functions.osForceOtherSit(avatar, target);
946 }
902 947
903 public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules) 948 public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules)
904 { 949 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Atom.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Atom.cs
deleted file mode 100644
index 27ab04e..0000000
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Atom.cs
+++ /dev/null
@@ -1,218 +0,0 @@
1/*
2 * Copyright (C) 2007-2008, Jeff Thompson
3 *
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31using System;
32using System.Collections.Generic;
33using System.Text;
34
35namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
36{
37 public class Atom : IUnifiable
38 {
39 private static Dictionary<string, Atom> _atomStore = new Dictionary<string, Atom>();
40 public readonly string _name;
41 public readonly Atom _module;
42
43 /// <summary>
44 /// You should not call this constructor, but use Atom.a instead.
45 /// </summary>
46 /// <param name="name"></param>
47 /// <param name="module"></param>
48 private Atom(string name, Atom module)
49 {
50 _name = name;
51 _module = module;
52 }
53
54 /// <summary>
55 /// Return the unique Atom object for name where module is null. You should use this to create
56 /// an Atom instead of calling the Atom constructor.
57 /// </summary>
58 /// <param name="name"></param>
59 /// <returns></returns>
60 public static Atom a(string name)
61 {
62 Atom atom;
63 if (!_atomStore.TryGetValue(name, out atom))
64 {
65 atom = new Atom(name, null);
66 _atomStore[name] = atom;
67 }
68 return atom;
69 }
70
71 /// <summary>
72 /// Return an Atom object with the name and module. If module is null or Atom.NIL,
73 /// this behaves like Atom.a(name) and returns the unique object where the module is null.
74 /// If module is not null or Atom.NIL, this may or may not be the same object as another Atom
75 /// with the same name and module.
76 /// </summary>
77 /// <param name="name"></param>
78 /// <param name="module"></param>
79 /// <returns></returns>
80 public static Atom a(string name, Atom module)
81 {
82 if (module == null || module == Atom.NIL)
83 return a(name);
84 return new Atom(name, module);
85 }
86
87 /// <summary>
88 /// If Obj is an Atom unify its _module with Module. If the Atom's _module is null, use Atom.NIL.
89 /// </summary>
90 /// <param name="Atom"></param>
91 /// <param name="Module"></param>
92 /// <returns></returns>
93 public static IEnumerable<bool> module(object Obj, object Module)
94 {
95 Obj = YP.getValue(Obj);
96 if (Obj is Atom)
97 {
98 if (((Atom)Obj)._module == null)
99 return YP.unify(Module, Atom.NIL);
100 else
101 return YP.unify(Module, ((Atom)Obj)._module);
102 }
103 return YP.fail();
104 }
105
106 public static readonly Atom NIL = Atom.a("[]");
107 public static readonly Atom DOT = Atom.a(".");
108 public static readonly Atom F = Atom.a("f");
109 public static readonly Atom SLASH = Atom.a("/");
110 public static readonly Atom HAT = Atom.a("^");
111 public static readonly Atom RULE = Atom.a(":-");
112
113 public IEnumerable<bool> unify(object arg)
114 {
115 arg = YP.getValue(arg);
116 if (arg is Atom)
117 return Equals(arg) ? YP.succeed() : YP.fail();
118 else if (arg is Variable)
119 return ((Variable)arg).unify(this);
120 else
121 return YP.fail();
122 }
123
124 public void addUniqueVariables(List<Variable> variableSet)
125 {
126 // Atom does not contain variables.
127 }
128
129 public object makeCopy(Variable.CopyStore copyStore)
130 {
131 // Atom does not contain variables that need to be copied.
132 return this;
133 }
134
135 public bool termEqual(object term)
136 {
137 return Equals(YP.getValue(term));
138 }
139
140 public bool ground()
141 {
142 // Atom is always ground.
143 return true;
144 }
145
146 public override bool Equals(object obj)
147 {
148 if (obj is Atom)
149 {
150 if (_module == null && ((Atom)obj)._module == null)
151 // When _declaringClass is null, we always use an identical object from _atomStore.
152 return this == obj;
153 // Otherwise, ignore _declaringClass and do a normal string compare on the _name.
154 return _name == ((Atom)obj)._name;
155 }
156 return false;
157 }
158
159 public override string ToString()
160 {
161 return _name;
162 }
163
164 public override int GetHashCode()
165 {
166 // Debug: need to check _declaringClass.
167 return _name.GetHashCode();
168 }
169
170 public string toQuotedString()
171 {
172 if (_name.Length == 0)
173 return "''";
174 else if (this == Atom.NIL)
175 return "[]";
176
177 StringBuilder result = new StringBuilder(_name.Length);
178 bool useQuotes = false;
179 foreach (char c in _name)
180 {
181 int cInt = (int)c;
182 if (c == '\'')
183 {
184 result.Append("''");
185 useQuotes = true;
186 }
187 else if (c == '_' || cInt >= (int)'a' && cInt <= (int)'z' ||
188 cInt >= (int)'A' && cInt <= (int)'Z' || cInt >= (int)'0' && cInt <= (int)'9')
189 result.Append(c);
190 else
191 {
192 // Debug: Need to handle non-printable chars.
193 result.Append(c);
194 useQuotes = true;
195 }
196 }
197
198 if (!useQuotes && (int)_name[0] >= (int)'a' && (int)_name[0] <= (int)'z')
199 return result.ToString();
200 else
201 {
202 // Surround in single quotes.
203 result.Append('\'');
204 return "'" + result;
205 }
206 }
207
208 /// <summary>
209 /// Return true if _name is lexicographically less than atom._name.
210 /// </summary>
211 /// <param name="atom"></param>
212 /// <returns></returns>
213 public bool lessThan(Atom atom)
214 {
215 return _name.CompareTo(atom._name) < 0;
216 }
217 }
218}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/BagofAnswers.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/BagofAnswers.cs
deleted file mode 100644
index bbf1a5b..0000000
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/BagofAnswers.cs
+++ /dev/null
@@ -1,239 +0,0 @@
1/*
2 * Copyright (C) 2007-2008, Jeff Thompson
3 *
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31using System;
32using System.Collections;
33using System.Collections.Generic;
34
35namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
36{
37 /// <summary>
38 /// A BagofAnswers holds answers for bagof and setof.
39 /// </summary>
40 public class BagofAnswers
41 {
42 private object _template;
43 private Variable[] _freeVariables;
44 private Dictionary<object[], List<object>> _bagForFreeVariables;
45 private List<object> _findallBagArray;
46 private static TermArrayEqualityComparer _termArrayEqualityComparer =
47 new TermArrayEqualityComparer();
48
49 /// <summary>
50 /// To get the free variables, split off any existential qualifiers from Goal such as the X in
51 /// "X ^ f(Y)", get the set of unbound variables in Goal that are not qualifiers, then remove
52 /// the unbound variables that are qualifiers as well as the unbound variables in Template.
53 /// </summary>
54 /// <param name="Template"></param>
55 /// <param name="Goal"></param>
56 public BagofAnswers(object Template, object Goal)
57 {
58 _template = Template;
59
60 // First get the set of variables that are not free variables.
61 List<Variable> variableSet = new List<Variable>();
62 YP.addUniqueVariables(Template, variableSet);
63 object UnqualifiedGoal = YP.getValue(Goal);
64 while (UnqualifiedGoal is Functor2 && ((Functor2)UnqualifiedGoal)._name == Atom.HAT)
65 {
66 YP.addUniqueVariables(((Functor2)UnqualifiedGoal)._arg1, variableSet);
67 UnqualifiedGoal = YP.getValue(((Functor2)UnqualifiedGoal)._arg2);
68 }
69
70 // Remember how many non-free variables there are so we can find the unique free variables
71 // that are added.
72 int nNonFreeVariables = variableSet.Count;
73 YP.addUniqueVariables(UnqualifiedGoal, variableSet);
74 int nFreeVariables = variableSet.Count - nNonFreeVariables;
75 if (nFreeVariables == 0)
76 {
77 // There were no free variables added, so we won't waste time with _bagForFreeVariables.
78 _freeVariables = null;
79 _findallBagArray = new List<object>();
80 }
81 else
82 {
83 // Copy the free variables.
84 _freeVariables = new Variable[nFreeVariables];
85 for (int i = 0; i < nFreeVariables; ++i)
86 _freeVariables[i] = variableSet[i + nNonFreeVariables];
87
88 _bagForFreeVariables = new Dictionary<object[], List<object>>(_termArrayEqualityComparer);
89 }
90 }
91
92 public void add()
93 {
94 if (_freeVariables == null)
95 // The goal has bound the values in _template but we don't bother with _freeVariables.
96 _findallBagArray.Add(YP.makeCopy(_template, new Variable.CopyStore()));
97 else
98 {
99 // The goal has bound the values in _template and _freeVariables.
100 // Find the entry for this set of _freeVariables values.
101 object[] freeVariableValues = new object[_freeVariables.Length];
102 for (int i = 0; i < _freeVariables.Length; ++i)
103 freeVariableValues[i] = YP.getValue(_freeVariables[i]);
104 List<object> bagArray;
105 if (!_bagForFreeVariables.TryGetValue(freeVariableValues, out bagArray))
106 {
107 bagArray = new List<object>();
108 _bagForFreeVariables[freeVariableValues] = bagArray;
109 }
110
111 // Now copy the template and add to the bag for the freeVariables values.
112 bagArray.Add(YP.makeCopy(_template, new Variable.CopyStore()));
113 }
114 }
115
116 // disable warning on l1, don't see how we can
117 // code this differently
118 #pragma warning disable 0168, 0219
119
120 /// <summary>
121 /// For each result, unify the _freeVariables and unify bagArrayVariable with the associated bag.
122 /// </summary>
123 /// <param name="bagArrayVariable">this is unified with the List<object> of matches for template that
124 /// corresponds to the bindings for freeVariables. Be very careful: this does not unify with a Prolog
125 /// list.</param>
126 /// <returns></returns>
127 public IEnumerable<bool> resultArray(Variable bagArrayVariable)
128 {
129 if (_freeVariables == null)
130 {
131 // No unbound free variables, so we only filled one bag. If empty, bagof fails.
132 if (_findallBagArray.Count > 0)
133 {
134 foreach (bool l1 in bagArrayVariable.unify(_findallBagArray))
135 yield return false;
136 }
137 }
138 else
139 {
140 foreach (KeyValuePair<object[], List<object>> valuesAndBag in _bagForFreeVariables)
141 {
142 foreach (bool l1 in YP.unifyArrays(_freeVariables, valuesAndBag.Key))
143 {
144 foreach (bool l2 in bagArrayVariable.unify(valuesAndBag.Value))
145 yield return false;
146 }
147 // Debug: Should we free memory of the answers already returned?
148 }
149 }
150 }
151
152 /// <summary>
153 /// For each result, unify the _freeVariables and unify Bag with the associated bag.
154 /// </summary>
155 /// <param name="Bag"></param>
156 /// <returns></returns>
157 public IEnumerable<bool> result(object Bag)
158 {
159 Variable bagArrayVariable = new Variable();
160 foreach (bool l1 in resultArray(bagArrayVariable))
161 {
162 foreach (bool l2 in YP.unify(Bag, ListPair.make((List<object>)bagArrayVariable.getValue())))
163 yield return false;
164 }
165 }
166
167 /// <summary>
168 /// For each result, unify the _freeVariables and unify Bag with the associated bag which is sorted
169 /// with duplicates removed, as in setof.
170 /// </summary>
171 /// <param name="Bag"></param>
172 /// <returns></returns>
173 public IEnumerable<bool> resultSet(object Bag)
174 {
175 Variable bagArrayVariable = new Variable();
176 foreach (bool l1 in resultArray(bagArrayVariable))
177 {
178 List<object> bagArray = (List<object>)bagArrayVariable.getValue();
179 YP.sortArray(bagArray);
180 foreach (bool l2 in YP.unify(Bag, ListPair.makeWithoutRepeatedTerms(bagArray)))
181 yield return false;
182 }
183 }
184
185 public static IEnumerable<bool> bagofArray
186 (object Template, object Goal, IEnumerable<bool> goalIterator, Variable bagArrayVariable)
187 {
188 BagofAnswers bagOfAnswers = new BagofAnswers(Template, Goal);
189 foreach (bool l1 in goalIterator)
190 bagOfAnswers.add();
191 return bagOfAnswers.resultArray(bagArrayVariable);
192 }
193
194 public static IEnumerable<bool> bagof
195 (object Template, object Goal, IEnumerable<bool> goalIterator, object Bag)
196 {
197 BagofAnswers bagOfAnswers = new BagofAnswers(Template, Goal);
198 foreach (bool l1 in goalIterator)
199 bagOfAnswers.add();
200 return bagOfAnswers.result(Bag);
201 }
202
203 public static IEnumerable<bool> setof
204 (object Template, object Goal, IEnumerable<bool> goalIterator, object Bag)
205 {
206 BagofAnswers bagOfAnswers = new BagofAnswers(Template, Goal);
207 foreach (bool l1 in goalIterator)
208 bagOfAnswers.add();
209 return bagOfAnswers.resultSet(Bag);
210 }
211 #pragma warning restore 0168, 0219
212
213 /// <summary>
214 /// A TermArrayEqualityComparer implements IEqualityComparer to compare two object arrays using YP.termEqual.
215 /// </summary>
216 private class TermArrayEqualityComparer : IEqualityComparer<object[]>
217 {
218 public bool Equals(object[] array1, object[] array2)
219 {
220 if (array1.Length != array2.Length)
221 return false;
222 for (int i = 0; i < array1.Length; ++i)
223 {
224 if (!YP.termEqual(array1[i], array2[i]))
225 return false;
226 }
227 return true;
228 }
229
230 public int GetHashCode(object[] array)
231 {
232 int hashCode = 0;
233 for (int i = 0; i < array.Length; ++i)
234 hashCode ^= array[i].GetHashCode();
235 return hashCode;
236 }
237 }
238 }
239}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/FindallAnswers.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/FindallAnswers.cs
deleted file mode 100644
index fb9569e..0000000
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/FindallAnswers.cs
+++ /dev/null
@@ -1,108 +0,0 @@
1/*
2 * Copyright (C) 2007-2008, Jeff Thompson
3 *
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31using System;
32using System.Collections;
33using System.Collections.Generic;
34
35namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
36{
37 /// <summary>
38 /// A FindallAnswers holds answers for findall.
39 /// </summary>
40 public class FindallAnswers
41 {
42 private object _template;
43 private List<object> _bagArray;
44
45 public FindallAnswers(object Template)
46 {
47 _template = Template;
48 _bagArray = new List<object>();
49 }
50
51 public void add()
52 {
53 _bagArray.Add(YP.makeCopy(_template, new Variable.CopyStore()));
54 }
55
56 public List<object> resultArray()
57 {
58 return _bagArray;
59 }
60
61 /// <summary>
62 /// Unify Bag with the result. This frees the internal answers, so you can only call this once.
63 /// </summary>
64 /// <param name="Bag"></param>
65 /// <returns></returns>
66 public IEnumerable<bool> result(object Bag)
67 {
68 object result = ListPair.make(_bagArray);
69 // Try to free the memory.
70 _bagArray = null;
71 return YP.unify(Bag, result);
72 }
73
74 // disable warning on l1, don't see how we can
75 // code this differently
76 #pragma warning disable 0168, 0219
77
78 /// <summary>
79 /// This is a simplified findall when the goal is a single call.
80 /// </summary>
81 /// <param name="Template"></param>
82 /// <param name="goal"></param>
83 /// <param name="Bag"></param>
84 /// <returns></returns>
85 public static IEnumerable<bool> findall(object Template, IEnumerable<bool> goal, object Bag)
86 {
87 FindallAnswers findallAnswers = new FindallAnswers(Template);
88 foreach (bool l1 in goal)
89 findallAnswers.add();
90 return findallAnswers.result(Bag);
91 }
92
93 /// <summary>
94 /// Like findall, except return an array of the results.
95 /// </summary>
96 /// <param name="template"></param>
97 /// <param name="goal"></param>
98 /// <returns></returns>
99 public static List<object> findallArray(object Template, IEnumerable<bool> goal)
100 {
101 FindallAnswers findallAnswers = new FindallAnswers(Template);
102 foreach (bool l1 in goal)
103 findallAnswers.add();
104 return findallAnswers.resultArray();
105 }
106 #pragma warning restore 0168, 0219
107 }
108}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor.cs
deleted file mode 100644
index 4d65f5b..0000000
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor.cs
+++ /dev/null
@@ -1,196 +0,0 @@
1/*
2 * Copyright (C) 2007-2008, Jeff Thompson
3 *
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31using System;
32using System.Collections.Generic;
33
34namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
35{
36 public class Functor : IUnifiable
37 {
38 public readonly Atom _name;
39 public readonly object[] _args;
40
41 public Functor(Atom name, object[] args)
42 {
43 if (args.Length <= 3)
44 {
45 if (args.Length == 0)
46 throw new Exception("For arity 0 functor, just use name as an Atom");
47 else if (args.Length == 1)
48 throw new Exception("For arity 1 functor, use Functor1");
49 else if (args.Length == 2)
50 throw new Exception("For arity 2 functor, use Functor2");
51 else if (args.Length == 3)
52 throw new Exception("For arity 3 functor, use Functor3");
53 else
54 // (This shouldn't happen, but include it for completeness.
55 throw new Exception("Cannot create a Functor of arity " + args.Length);
56 }
57
58 _name = name;
59 _args = args;
60 }
61
62 public Functor(string name, object[] args)
63 : this(Atom.a(name), args)
64 {
65 }
66
67 /// <summary>
68 /// Return an Atom, Functor1, Functor2, Functor3 or Functor depending on the
69 /// length of args.
70 /// Note that this is different than the Functor constructor which requires
71 /// the length of args to be greater than 3.
72 /// </summary>
73 /// <param name="name"></param>
74 /// <param name="args"></param>
75 /// <returns></returns>
76 public static object make(Atom name, object[] args)
77 {
78 if (args.Length <= 0)
79 return name;
80 else if (args.Length == 1)
81 return new Functor1(name, args[0]);
82 else if (args.Length == 2)
83 return new Functor2(name, args[0], args[1]);
84 else if (args.Length == 3)
85 return new Functor3(name, args[0], args[1], args[2]);
86 else
87 return new Functor(name, args);
88 }
89
90 /// <summary>
91 /// Call the main make, first converting name to an Atom.
92 /// </summary>
93 /// <param name="name"></param>
94 /// <param name="args"></param>
95 /// <returns></returns>
96 public static object make(string name, object[] args)
97 {
98 return make(Atom.a(name), args);
99 }
100
101 /// <summary>
102 /// If arg is another Functor, then succeed (yield once) if this and arg have the
103 /// same name and all functor args unify, otherwise fail (don't yield).
104 /// If arg is a Variable, then call its unify to unify with this.
105 /// Otherwise fail (don't yield).
106 /// </summary>
107 /// <param name="arg"></param>
108 /// <returns></returns>
109 public IEnumerable<bool> unify(object arg)
110 {
111 arg = YP.getValue(arg);
112 if (arg is Functor)
113 {
114 Functor argFunctor = (Functor)arg;
115 if (_name.Equals(argFunctor._name))
116 return YP.unifyArrays(_args, argFunctor._args);
117 else
118 return YP.fail();
119 }
120 else if (arg is Variable)
121 return ((Variable)arg).unify(this);
122 else
123 return YP.fail();
124 }
125
126 public override string ToString()
127 {
128 string result = _name + "(" + YP.getValue(_args[0]);
129 for (int i = 1; i < _args.Length; ++i)
130 result += ", " + YP.getValue(_args[i]);
131 result += ")";
132 return result;
133 }
134
135 public bool termEqual(object term)
136 {
137 term = YP.getValue(term);
138 if (term is Functor)
139 {
140 Functor termFunctor = (Functor)term;
141 if (_name.Equals(termFunctor._name) && _args.Length == termFunctor._args.Length)
142 {
143 for (int i = 0; i < _args.Length; ++i)
144 {
145 if (!YP.termEqual(_args[i], termFunctor._args[i]))
146 return false;
147 }
148 return true;
149 }
150 }
151 return false;
152 }
153
154 public bool lessThan(Functor functor)
155 {
156 // Do the equal check first since it is faster.
157 if (!_name.Equals(functor._name))
158 return _name.lessThan(functor._name);
159
160 if (_args.Length != functor._args.Length)
161 return _args.Length < functor._args.Length;
162
163 for (int i = 0; i < _args.Length; ++i)
164 {
165 if (!YP.termEqual(_args[i], functor._args[i]))
166 return YP.termLessThan(_args[i], functor._args[i]);
167 }
168
169 return false;
170 }
171
172 public bool ground()
173 {
174 for (int i = 0; i < _args.Length; ++i)
175 {
176 if (!YP.ground(_args[i]))
177 return false;
178 }
179 return true;
180 }
181
182 public void addUniqueVariables(List<Variable> variableSet)
183 {
184 for (int i = 0; i < _args.Length; ++i)
185 YP.addUniqueVariables(_args[i], variableSet);
186 }
187
188 public object makeCopy(Variable.CopyStore copyStore)
189 {
190 object[] argsCopy = new object[_args.Length];
191 for (int i = 0; i < _args.Length; ++i)
192 argsCopy[i] = YP.makeCopy(_args[i], copyStore);
193 return new Functor(_name, argsCopy);
194 }
195 }
196}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor1.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor1.cs
deleted file mode 100644
index 80d98b1..0000000
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor1.cs
+++ /dev/null
@@ -1,124 +0,0 @@
1/*
2 * Copyright (C) 2007-2008, Jeff Thompson
3 *
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31using System;
32using System.Collections.Generic;
33
34namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
35{
36 public class Functor1 : IUnifiable
37 {
38 public readonly Atom _name;
39 public readonly object _arg1;
40
41 public Functor1(Atom name, object arg1)
42 {
43 _name = name;
44 _arg1 = arg1;
45 }
46
47 public Functor1(string name, object arg1)
48 : this(Atom.a(name), arg1)
49 {
50 }
51
52 // disable warning on l1, don't see how we can
53 // code this differently
54 #pragma warning disable 0168, 0219
55 /// <summary>
56 /// If arg is another Functor1, then succeed (yield once) if this and arg have the
57 /// same name and the functor args unify, otherwise fail (don't yield).
58 /// If arg is a Variable, then call its unify to unify with this.
59 /// Otherwise fail (don't yield).
60 /// </summary>
61 /// <param name="arg"></param>
62 /// <returns></returns>
63 public IEnumerable<bool> unify(object arg)
64 {
65 arg = YP.getValue(arg);
66 if (arg is Functor1)
67 {
68 Functor1 argFunctor = (Functor1)arg;
69 if (_name.Equals(argFunctor._name))
70 {
71 foreach (bool l1 in YP.unify(_arg1, argFunctor._arg1))
72 yield return false;
73 }
74 }
75 else if (arg is Variable)
76 {
77 foreach (bool l1 in ((Variable)arg).unify(this))
78 yield return false;
79 }
80 }
81 #pragma warning restore 0168, 0219
82
83
84 public override string ToString()
85 {
86 return _name + "(" + YP.getValue(_arg1) + ")";
87 }
88
89 public bool termEqual(object term)
90 {
91 term = YP.getValue(term);
92 if (term is Functor1)
93 {
94 Functor1 termFunctor = (Functor1)term;
95 return _name.Equals(termFunctor._name) && YP.termEqual(_arg1, termFunctor._arg1);
96 }
97 return false;
98 }
99
100 public bool lessThan(Functor1 functor)
101 {
102 // Do the equal check first since it is faster.
103 if (!_name.Equals(functor._name))
104 return _name.lessThan(functor._name);
105
106 return YP.termLessThan(_arg1, functor._arg1);
107 }
108
109 public bool ground()
110 {
111 return YP.ground(_arg1);
112 }
113
114 public void addUniqueVariables(List<Variable> variableSet)
115 {
116 YP.addUniqueVariables(_arg1, variableSet);
117 }
118
119 public object makeCopy(Variable.CopyStore copyStore)
120 {
121 return new Functor1(_name, YP.makeCopy(_arg1, copyStore));
122 }
123 }
124}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor2.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor2.cs
deleted file mode 100644
index 4c501d6..0000000
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor2.cs
+++ /dev/null
@@ -1,163 +0,0 @@
1/*
2 * Copyright (C) 2007-2008, Jeff Thompson
3 *
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31using System;
32using System.Collections.Generic;
33
34namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
35{
36 public class Functor2 : IUnifiable
37 {
38 public readonly Atom _name;
39 public readonly object _arg1;
40 public readonly object _arg2;
41
42 public Functor2(Atom name, object arg1, object arg2)
43 {
44 _name = name;
45 _arg1 = arg1;
46 _arg2 = arg2;
47 }
48
49 public Functor2(string name, object arg1, object arg2)
50 : this(Atom.a(name), arg1, arg2)
51 {
52 }
53
54 // disable warning on l1, don't see how we can
55 // code this differently
56 #pragma warning disable 0168, 0219
57 /// If arg is another Functor2, then succeed (yield once) if this and arg have the
58 /// same name and all functor args unify, otherwise fail (don't yield).
59 /// If arg is a Variable, then call its unify to unify with this.
60 /// Otherwise fail (don't yield).
61 public IEnumerable<bool> unify(object arg)
62 {
63 arg = YP.getValue(arg);
64 if (arg is Functor2)
65 {
66 Functor2 argFunctor = (Functor2)arg;
67 if (_name.Equals(argFunctor._name))
68 {
69 foreach (bool l1 in YP.unify(_arg1, argFunctor._arg1))
70 {
71 foreach (bool l2 in YP.unify(_arg2, argFunctor._arg2))
72 yield return false;
73 }
74 }
75 }
76 else if (arg is Variable)
77 {
78 foreach (bool l1 in ((Variable)arg).unify(this))
79 yield return false;
80 }
81 }
82 #pragma warning restore 0168, 0219
83
84
85 public override string ToString()
86 {
87 if (_name == Atom.DOT)
88 return listPairToString(this);
89 else
90 return _name + "(" + YP.getValue(_arg1) + ", " + YP.getValue(_arg2) + ")";
91 }
92
93 public bool termEqual(object term)
94 {
95 term = YP.getValue(term);
96 if (term is Functor2)
97 {
98 Functor2 termFunctor = (Functor2)term;
99 return _name.Equals(termFunctor._name) && YP.termEqual(_arg1, termFunctor._arg1)
100 && YP.termEqual(_arg2, termFunctor._arg2);
101 }
102 return false;
103 }
104
105 public bool lessThan(Functor2 functor)
106 {
107 // Do the equal check first since it is faster.
108 if (!_name.Equals(functor._name))
109 return _name.lessThan(functor._name);
110
111 if (!YP.termEqual(_arg1, functor._arg1))
112 return YP.termLessThan(_arg1, functor._arg1);
113
114 return YP.termLessThan(_arg2, functor._arg2);
115 }
116
117 public bool ground()
118 {
119 return YP.ground(_arg1) && YP.ground(_arg2);
120 }
121
122 public void addUniqueVariables(List<Variable> variableSet)
123 {
124 YP.addUniqueVariables(_arg1, variableSet);
125 YP.addUniqueVariables(_arg2, variableSet);
126 }
127
128 public object makeCopy(Variable.CopyStore copyStore)
129 {
130 return new Functor2(_name, YP.makeCopy(_arg1, copyStore),
131 YP.makeCopy(_arg2, copyStore));
132 }
133
134 private static string listPairToString(Functor2 listPair)
135 {
136 string result = "[";
137 while (true)
138 {
139 object head = YP.getValue(listPair._arg1);
140 object tail = YP.getValue(listPair._arg2);
141 if (tail == (object)Atom.NIL)
142 {
143 result += head;
144 break;
145 }
146 else if (tail is Functor2 && ((Functor2)tail)._name == Atom.DOT)
147 {
148 result += head + ", ";
149 listPair = (Functor2)tail;
150 // Loop again.
151 }
152 else
153 {
154 // The list is not terminated with NIL.
155 result += head + "|" + tail;
156 break;
157 }
158 }
159 result += "]";
160 return result;
161 }
162 }
163}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor3.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor3.cs
deleted file mode 100644
index 94e39c4..0000000
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor3.cs
+++ /dev/null
@@ -1,141 +0,0 @@
1/*
2 * Copyright (C) 2007-2008, Jeff Thompson
3 *
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31using System;
32using System.Collections.Generic;
33
34namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
35{
36 public class Functor3 : IUnifiable
37 {
38 public readonly Atom _name;
39 public readonly object _arg1;
40 public readonly object _arg2;
41 public readonly object _arg3;
42
43 public Functor3(Atom name, object arg1, object arg2, object arg3)
44 {
45 _name = name;
46 _arg1 = arg1;
47 _arg2 = arg2;
48 _arg3 = arg3;
49 }
50
51 public Functor3(string name, object arg1, object arg2, object arg3)
52 : this(Atom.a(name), arg1, arg2, arg3)
53 {
54 }
55
56 // disable warning on l1, don't see how we can
57 // code this differently
58 #pragma warning disable 0168, 0219
59 /// If arg is another Functor3, then succeed (yield once) if this and arg have the
60 /// same name and all functor args unify, otherwise fail (don't yield).
61 /// If arg is a Variable, then call its unify to unify with this.
62 /// Otherwise fail (don't yield).
63 public IEnumerable<bool> unify(object arg)
64 {
65 arg = YP.getValue(arg);
66 if (arg is Functor3)
67 {
68 Functor3 argFunctor = (Functor3)arg;
69 if (_name.Equals(argFunctor._name))
70 {
71 foreach (bool l1 in YP.unify(_arg1, argFunctor._arg1))
72 {
73 foreach (bool l2 in YP.unify(_arg2, argFunctor._arg2))
74 {
75 foreach (bool l3 in YP.unify(_arg3, argFunctor._arg3))
76 yield return false;
77 }
78 }
79 }
80 }
81 else if (arg is Variable)
82 {
83 foreach (bool l1 in ((Variable)arg).unify(this))
84 yield return false;
85 }
86 }
87 #pragma warning restore 0168, 0219
88
89 public override string ToString()
90 {
91 return _name + "(" + YP.getValue(_arg1) + ", " + YP.getValue(_arg2) + ", " +
92 YP.getValue(_arg3) + ")";
93 }
94
95 public bool termEqual(object term)
96 {
97 term = YP.getValue(term);
98 if (term is Functor3)
99 {
100 Functor3 termFunctor = (Functor3)term;
101 return _name.Equals(termFunctor._name) && YP.termEqual(_arg1, termFunctor._arg1)
102 && YP.termEqual(_arg2, termFunctor._arg2)
103 && YP.termEqual(_arg3, termFunctor._arg3);
104 }
105 return false;
106 }
107
108 public bool lessThan(Functor3 functor)
109 {
110 // Do the equal check first since it is faster.
111 if (!_name.Equals(functor._name))
112 return _name.lessThan(functor._name);
113
114 if (!YP.termEqual(_arg1, functor._arg1))
115 return YP.termLessThan(_arg1, functor._arg1);
116
117 if (!YP.termEqual(_arg2, functor._arg2))
118 return YP.termLessThan(_arg2, functor._arg2);
119
120 return YP.termLessThan(_arg3, functor._arg3);
121 }
122
123 public bool ground()
124 {
125 return YP.ground(_arg1) && YP.ground(_arg2) && YP.ground(_arg3);
126 }
127
128 public void addUniqueVariables(List<Variable> variableSet)
129 {
130 YP.addUniqueVariables(_arg1, variableSet);
131 YP.addUniqueVariables(_arg2, variableSet);
132 YP.addUniqueVariables(_arg3, variableSet);
133 }
134
135 public object makeCopy(Variable.CopyStore copyStore)
136 {
137 return new Functor3(_name, YP.makeCopy(_arg1, copyStore),
138 YP.makeCopy(_arg2, copyStore), YP.makeCopy(_arg3, copyStore));
139 }
140 }
141}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/IndexedAnswers.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/IndexedAnswers.cs
deleted file mode 100644
index 09a9a08..0000000
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/IndexedAnswers.cs
+++ /dev/null
@@ -1,385 +0,0 @@
1/*
2 * Copyright (C) 2007-2008, Jeff Thompson
3 *
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31using System;
32using System.Collections;
33using System.Collections.Generic;
34
35namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
36{
37 /// <summary>
38 /// An IndexedAnswers holds answers to a query based on the values of index arguments.
39 /// </summary>
40 public class IndexedAnswers : YP.IClause
41 {
42 private int _arity;
43 // addAnswer adds the answer here and indexes it later.
44 private List<object[]> _allAnswers = new List<object[]>();
45 // The key has the arity of answers with non-null values for each indexed arg. The value
46 // is a list of the matching answers. The signature is implicit in the pattern on non-null index args.
47 private Dictionary<HashedList, List<object[]>> _indexedAnswers =
48 new Dictionary<HashedList, List<object[]>>();
49 // Keeps track of whether we have started adding entries to _indexedAnswers for the signature.
50 private Dictionary<int, object> _gotAnswersForSignature = new Dictionary<int, object>();
51 private const int MAX_INDEX_ARGS = 31;
52
53 public IndexedAnswers(int arity)
54 {
55 _arity = arity;
56 }
57
58 /// <summary>
59 /// Append the answer to the list and update the indexes, if any.
60 /// Elements of answer must be ground, since arguments with unbound variables make this
61 /// into a dynamic rule which we don't index.
62 /// </summary>
63 /// <param name="answer"></param>
64 public void addAnswer(object[] answer)
65 {
66 addOrPrependAnswer(answer, false);
67 }
68
69 /// <summary>
70 /// Prepend the answer to the list and clear the indexes so that they must be re-computed
71 /// on the next call to match. (Only addAnswer will maintain the indexes while adding answers.)
72 /// Elements of answer must be ground, since arguments with unbound variables make this
73 /// into a dynamic rule which we don't index.
74 /// </summary>
75 /// <param name="answer"></param>
76 public void prependAnswer(object[] answer)
77 {
78 addOrPrependAnswer(answer, true);
79 }
80
81 /// <summary>
82 /// Do the work of addAnswer or prependAnswer.
83 /// </summary>
84 /// <param name="answer"></param>
85 private void addOrPrependAnswer(object[] answer, bool prepend)
86 {
87 if (answer.Length != _arity)
88 return;
89
90 // Store a copy of the answer array.
91 object[] answerCopy = new object[answer.Length];
92 Variable.CopyStore copyStore = new Variable.CopyStore();
93 for (int i = 0; i < answer.Length; ++i)
94 answerCopy[i] = YP.makeCopy(answer[i], copyStore);
95 if (copyStore.getNUniqueVariables() > 0)
96 throw new InvalidOperationException
97 ("Elements of answer must be ground, but found " + copyStore.getNUniqueVariables() +
98 " unbound variables");
99
100 if (prepend)
101 {
102 _allAnswers.Insert(0, answerCopy);
103 clearIndexes();
104 }
105 else
106 {
107 _allAnswers.Add(answerCopy);
108 // If match has already indexed answers for a signature, we need to add
109 // this to the existing indexed answers.
110 foreach (int signature in _gotAnswersForSignature.Keys)
111 indexAnswerForSignature(answerCopy, signature);
112 }
113 }
114
115 private void indexAnswerForSignature(object[] answer, int signature)
116 {
117 // First find out which of the answer values can be used as an index.
118 object[] indexValues = new object[answer.Length];
119 for (int i = 0; i < answer.Length; ++i)
120 {
121 // We limit the number of indexed args in a 32-bit signature.
122 if (i >= MAX_INDEX_ARGS)
123 indexValues[i] = null;
124 else
125 indexValues[i] = getIndexValue(YP.getValue(answer[i]));
126 }
127
128 // We need an entry in indexArgs from indexValues for each 1 bit in signature.
129 HashedList indexArgs = new HashedList(indexValues.Length);
130 for (int i = 0; i < indexValues.Length; ++i)
131 {
132 if ((signature & (1 << i)) == 0)
133 indexArgs.Add(null);
134 else
135 {
136 if (indexValues[i] == null)
137 // The signature wants an index value here, but we don't have one so
138 // we can't add it as an answer for this signature.
139 return;
140 else
141 indexArgs.Add(indexValues[i]);
142 }
143 }
144
145 // Add the answer to the answers list for indexArgs, creating the entry if needed.
146 List<object[]> answers;
147 if (!_indexedAnswers.TryGetValue(indexArgs, out answers))
148 {
149 answers = new List<object[]>();
150 _indexedAnswers[indexArgs] = answers;
151 }
152 answers.Add(answer);
153 }
154
155 public IEnumerable<bool> match(object[] arguments)
156 {
157 if (arguments.Length != _arity)
158 yield break;
159
160 // Set up indexArgs, up to arg position MAX_INDEX_ARGS. The signature has a 1 bit for
161 // each non-null index arg.
162 HashedList indexArgs = new HashedList(arguments.Length);
163 bool gotAllIndexArgs = true;
164 int signature = 0;
165 for (int i = 0; i < arguments.Length; ++i)
166 {
167 object indexValue = null;
168 if (i < MAX_INDEX_ARGS)
169 {
170 // We limit the number of args in a 32-bit signature.
171 indexValue = getIndexValue(YP.getValue(arguments[i]));
172 if (indexValue != null)
173 signature += (1 << i);
174 }
175 if (indexValue == null)
176 gotAllIndexArgs = false;
177 indexArgs.Add(indexValue);
178 }
179
180 List<object[]> answers;
181 if (signature == 0)
182 // No index args, so we have to match from _allAnswers.
183 answers = _allAnswers;
184 else
185 {
186 if (!_gotAnswersForSignature.ContainsKey(signature))
187 {
188 // We need to create the entry in _indexedAnswers.
189 foreach (object[] answer in _allAnswers)
190 indexAnswerForSignature(answer, signature);
191 // Mark that we did this signature.
192 _gotAnswersForSignature[signature] = null;
193 }
194 if (!_indexedAnswers.TryGetValue(indexArgs, out answers))
195 yield break;
196 }
197
198 if (gotAllIndexArgs)
199 {
200 // All the arguments were already bound, so we don't need to do bindings.
201 yield return false;
202 yield break;
203 }
204
205 // Find matches in answers.
206 IEnumerator<bool>[] iterators = new IEnumerator<bool>[arguments.Length];
207 // Debug: If the caller asserts another answer into this same predicate during yield, the iterator
208 // over clauses will be corrupted. Should we take the time to copy answers?
209 foreach (object[] answer in answers)
210 {
211 bool gotMatch = true;
212 int nIterators = 0;
213 // Try to bind all the arguments.
214 for (int i = 0; i < arguments.Length; ++i)
215 {
216 if (indexArgs[i] != null)
217 // We already matched this argument by looking up _indexedAnswers.
218 continue;
219
220 IEnumerator<bool> iterator = YP.unify(arguments[i], answer[i]).GetEnumerator();
221 iterators[nIterators++] = iterator;
222 // MoveNext() is true if YP.unify succeeds.
223 if (!iterator.MoveNext())
224 {
225 gotMatch = false;
226 break;
227 }
228 }
229 int z = 0;
230 try
231 {
232 if (gotMatch)
233 yield return false;
234 }
235 finally
236 {
237 // Manually finalize all the iterators.
238 for (z = 0; z < nIterators; ++z)
239 iterators[z].Dispose();
240 }
241 }
242 }
243
244 public IEnumerable<bool> clause(object Head, object Body)
245 {
246 Head = YP.getValue(Head);
247 if (Head is Variable)
248 throw new PrologException("instantiation_error", "Head is an unbound variable");
249 object[] arguments = YP.getFunctorArgs(Head);
250
251 // We always match Head from _allAnswers, and the Body is Atom.a("true").
252 #pragma warning disable 0168, 0219
253 foreach (bool l1 in YP.unify(Body, Atom.a("true")))
254 {
255 // The caller can assert another answer into this same predicate during yield, so we have to
256 // make a copy of the answers.
257 foreach (object[] answer in _allAnswers.ToArray())
258 {
259 foreach (bool l2 in YP.unifyArrays(arguments, answer))
260 yield return false;
261 }
262 }
263 #pragma warning restore 0168, 0219
264 }
265
266 public IEnumerable<bool> retract(object Head, object Body)
267 {
268 Head = YP.getValue(Head);
269 if (Head is Variable)
270 throw new PrologException("instantiation_error", "Head is an unbound variable");
271 object[] arguments = YP.getFunctorArgs(Head);
272
273 // We always match Head from _allAnswers, and the Body is Atom.a("true").
274 #pragma warning disable 0168, 0219
275 foreach (bool l1 in YP.unify(Body, Atom.a("true")))
276 {
277 // The caller can assert another answer into this same predicate during yield, so we have to
278 // make a copy of the answers.
279 foreach (object[] answer in _allAnswers.ToArray())
280 {
281 foreach (bool l2 in YP.unifyArrays(arguments, answer))
282 {
283 _allAnswers.Remove(answer);
284 clearIndexes();
285 yield return false;
286 }
287 }
288 }
289 #pragma warning restore 0168, 0219
290 }
291
292 /// <summary>
293 /// After retracting or prepending an answer in _allAnswers, the indexes are invalid, so clear them.
294 /// </summary>
295 private void clearIndexes()
296 {
297 _indexedAnswers.Clear();
298 _gotAnswersForSignature.Clear();
299 }
300
301 /// <summary>
302 /// A HashedList extends an ArrayList with methods to get a hash and to check equality
303 /// based on the elements of the list.
304 /// </summary>
305 public class HashedList : ArrayList
306 {
307 private bool _gotHashCode = false;
308 private int _hashCode;
309
310 public HashedList()
311 : base()
312 {
313 }
314
315 public HashedList(int capacity)
316 : base(capacity)
317 {
318 }
319
320 public HashedList(ICollection c)
321 : base(c)
322 {
323 }
324
325 // Debug: Should override all the other methods that change this.
326 public override int Add(object value)
327 {
328 _gotHashCode = false;
329 return base.Add(value);
330 }
331
332 public override int GetHashCode()
333 {
334 if (!_gotHashCode)
335 {
336 int hashCode = 1;
337 foreach (object obj in this)
338 hashCode = 31 * hashCode + (obj == null ? 0 : obj.GetHashCode());
339 _hashCode = hashCode;
340 _gotHashCode = true;
341 }
342 return _hashCode;
343 }
344
345 public override bool Equals(object obj)
346 {
347 if (!(obj is ArrayList))
348 return false;
349
350 ArrayList objList = (ArrayList)obj;
351 if (objList.Count != Count)
352 return false;
353
354 for (int i = 0; i < Count; ++i)
355 {
356 object value = objList[i];
357 if (value == null)
358 {
359 if (this[i] != null)
360 return false;
361 }
362 else
363 {
364 if (!value.Equals(this[i]))
365 return false;
366 }
367 }
368 return true;
369 }
370 }
371
372 /// <summary>
373 /// If we keep an index on value, return the value, or null if we don't index it.
374 /// </summary>
375 /// <param name="value">the term to examine. Assume you already called YP.getValue(value)</param>
376 /// <returns></returns>
377 public static object getIndexValue(object value)
378 {
379 if (value is Atom || value is string || value is Int32 || value is DateTime)
380 return value;
381 else
382 return null;
383 }
384 }
385}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/ListPair.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/ListPair.cs
deleted file mode 100644
index daac0ba..0000000
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/ListPair.cs
+++ /dev/null
@@ -1,166 +0,0 @@
1/*
2 * Copyright (C) 2007-2008, Jeff Thompson
3 *
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31using System;
32using System.Collections.Generic;
33
34namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
35{
36 public class ListPair : Functor2
37 {
38 public ListPair(object head, object tail) : base(Atom.DOT, head, tail)
39 {
40 }
41
42 public static object make(List<object> list)
43 {
44 if (list.Count <= 0)
45 return Atom.NIL;
46
47 object result = Atom.NIL;
48 // Start from the end.
49 for (int i = list.Count - 1; i >= 0; --i)
50 result = new ListPair(list[i], result);
51 return result;
52 }
53
54 public static object make(object[] array)
55 {
56 if (array.Length <= 0)
57 return Atom.NIL;
58
59 object result = Atom.NIL;
60 // Start from the end.
61 for (int i = array.Length - 1; i >= 0; --i)
62 result = new ListPair(array[i], result);
63 return result;
64 }
65
66 /// <summary>
67 /// Return a ListPair version of array, where repeated elements
68 /// (according to YP.termEqual) are removed.
69 /// </summary>
70 /// <param name="array"></param>
71 /// <returns></returns>
72 public static object makeWithoutRepeatedTerms(object[] array)
73 {
74 if (array.Length <= 0)
75 return Atom.NIL;
76
77 // Start from the end.
78 object previousTerm = array[array.Length - 1];
79 object result = new ListPair(previousTerm, Atom.NIL);
80 for (int i = array.Length - 2; i >= 0; --i)
81 {
82 object term = array[i];
83 if (YP.termEqual(term, previousTerm))
84 continue;
85 result = new ListPair(term, result);
86 previousTerm = term;
87 }
88 return result;
89 }
90
91 /// <summary>
92 /// Return a ListPair version of array, where repeated elements
93 /// (according to YP.termEqual) are removed.
94 /// </summary>
95 /// <param name="array"></param>
96 /// <returns></returns>
97 public static object makeWithoutRepeatedTerms(List<object> array)
98 {
99 if (array.Count <= 0)
100 return Atom.NIL;
101
102 // Start from the end.
103 object previousTerm = array[array.Count - 1];
104 object result = new ListPair(previousTerm, Atom.NIL);
105 for (int i = array.Count - 2; i >= 0; --i)
106 {
107 object term = array[i];
108 if (YP.termEqual(term, previousTerm))
109 continue;
110 result = new ListPair(term, result);
111 previousTerm = term;
112 }
113 return result;
114 }
115
116 public static object make(object element1)
117 {
118 return new ListPair(element1, Atom.NIL);
119 }
120
121 public static object make(object element1, object element2)
122 {
123 return new ListPair(element1, new ListPair(element2, Atom.NIL));
124 }
125
126 public static object make(object element1, object element2, object element3)
127 {
128 return new ListPair(element1,
129 new ListPair(element2, new ListPair(element3, Atom.NIL)));
130 }
131
132 /// <summary>
133 /// Return an array of the elements in list or null if it is not
134 /// a proper list. If list is Atom.NIL, return an array of zero elements.
135 /// If the list or one of the tails of the list is Variable, raise an instantiation_error.
136 /// This does not call YP.getValue on each element.
137 /// </summary>
138 /// <param name="list"></param>
139 /// <returns></returns>
140 public static object[] toArray(object list)
141 {
142 list = YP.getValue(list);
143 if (list.Equals(Atom.NIL))
144 return new object[0];
145
146 List<object> result = new List<object>();
147 object element = list;
148 while (true) {
149 if (element == Atom.NIL)
150 break;
151 if (element is Variable)
152 throw new PrologException(Atom.a("instantiation_error"),
153 "List tail is an unbound variable");
154 if (!(element is Functor2 && ((Functor2)element)._name == Atom.DOT))
155 // Not a proper list.
156 return null;
157 result.Add(((Functor2)element)._arg1);
158 element = YP.getValue(((Functor2)element)._arg2);
159 }
160
161 if (result.Count <= 0)
162 return null;
163 return result.ToArray();
164 }
165 }
166}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Parser.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Parser.cs
deleted file mode 100644
index 34010e7..0000000
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Parser.cs
+++ /dev/null
@@ -1,4575 +0,0 @@
1/*
2 * Copyright (C) 2007-2008, Jeff Thompson
3 *
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31using System;
32using System.Collections.Generic;
33
34 // disable warning on l1, don't see how we can
35 // code this differently
36 #pragma warning disable 0168, 0219, 0162
37
38namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
39{
40 public class Parser
41 {
42 public static IEnumerable<bool> read_term2(object Term, object Options)
43 {
44 Variable Answer = new Variable();
45 Variable Variables = new Variable();
46 foreach (bool l1 in read_termOptions(Options, Variables))
47 {
48 foreach (bool l2 in portable_read3(Answer, Variables, new Variable()))
49 {
50 foreach (bool l3 in remove_pos(Answer, Term))
51 yield return false;
52 }
53 }
54 }
55
56 public static IEnumerable<bool> read_term3(object Input, object Term, object Options)
57 {
58 Variable SaveInput = new Variable();
59 Variable Answer = new Variable();
60 Variable Variables = new Variable();
61 foreach (bool l1 in read_termOptions(Options, Variables))
62 {
63 foreach (bool l2 in YP.current_input(SaveInput))
64 {
65 try
66 {
67 YP.see(Input);
68 foreach (bool l3 in portable_read3(Answer, Variables, new Variable()))
69 {
70 foreach (bool l4 in remove_pos(Answer, Term))
71 yield return false;
72 }
73 }
74 finally
75 {
76 YP.see(SaveInput);
77 }
78 }
79 }
80 }
81
82 /// <summary>
83 /// For read_term, check if Options has variable_names(Variables).
84 /// Otherwise, ignore Options.
85 /// </summary>
86 /// <param name="Options"></param>
87 /// <param name="Variables"></param>
88 /// <returns></returns>
89 private static IEnumerable<bool> read_termOptions(object Options, object Variables)
90 {
91 Options = YP.getValue(Options);
92 if (Options is Variable)
93 throw new PrologException(Atom.a("instantiation_error"), "Options is an unbound variable");
94 // First try to match Options = [variable_names(Variables)]
95 foreach (bool l1 in YP.unify(Options, ListPair.make(new Functor1("variable_names", Variables))))
96 {
97 yield return false;
98 yield break;
99 }
100 // Default: Ignore Options.
101 yield return false;
102 }
103
104 public static IEnumerable<bool> read1(object Term)
105 {
106 return read_term2(Term, Atom.NIL);
107 }
108
109 public static IEnumerable<bool> read2(object Input, object Term)
110 {
111 return read_term3(Input, Term, Atom.NIL);
112 }
113
114 public static IEnumerable<bool> formatError(object Output, object Format, object Arguments)
115 {
116 // Debug: Simple implementation for now.
117 YP.write(Format);
118 YP.write(Arguments);
119 YP.nl();
120 yield return false;
121 }
122
123
124 // Debug: Hand-modify this central predicate to do tail recursion.
125 public static IEnumerable<bool> read_tokens(object arg1, object arg2, object arg3)
126 {
127 bool repeat = true;
128 while (repeat)
129 {
130 repeat = false;
131 {
132 object C1 = arg1;
133 object Dict = arg2;
134 object Tokens = arg3;
135 Variable C2 = new Variable();
136 if (YP.lessThanOrEqual(C1, new ListPair(32, Atom.NIL)))
137 {
138 if (YP.greaterThanOrEqual(C1, 0))
139 {
140 foreach (bool l4 in YP.get_code(C2))
141 {
142#if false
143 foreach (bool l5 in read_tokens(C2, Dict, Tokens))
144 {
145 yield return false;
146 }
147#endif
148 arg1 = YP.getValue(C2);
149 arg2 = YP.getValue(Dict);
150 arg3 = YP.getValue(Tokens);
151 repeat = true;
152 }
153 }
154 goto cutIf1;
155 }
156 if (YP.greaterThanOrEqual(C1, new ListPair(97, Atom.NIL)))
157 {
158 if (YP.lessThanOrEqual(C1, new ListPair(122, Atom.NIL)))
159 {
160 foreach (bool l4 in read_identifier(C1, Dict, Tokens))
161 {
162 yield return false;
163 }
164 goto cutIf2;
165 }
166 }
167 if (YP.greaterThanOrEqual(C1, new ListPair(65, Atom.NIL)))
168 {
169 if (YP.lessThanOrEqual(C1, new ListPair(90, Atom.NIL)))
170 {
171 foreach (bool l4 in read_variable(C1, Dict, Tokens))
172 {
173 yield return false;
174 }
175 goto cutIf3;
176 }
177 }
178 if (YP.greaterThanOrEqual(C1, new ListPair(48, Atom.NIL)))
179 {
180 if (YP.lessThanOrEqual(C1, new ListPair(57, Atom.NIL)))
181 {
182 foreach (bool l4 in read_number(C1, Dict, Tokens))
183 {
184 yield return false;
185 }
186 goto cutIf4;
187 }
188 }
189 if (YP.lessThan(C1, 127))
190 {
191 foreach (bool l3 in read_special(C1, Dict, Tokens))
192 {
193 yield return false;
194 }
195 goto cutIf5;
196 }
197 if (YP.lessThanOrEqual(C1, 160))
198 {
199 foreach (bool l3 in YP.get_code(C2))
200 {
201#if false
202 foreach (bool l4 in read_tokens(C2, Dict, Tokens))
203 {
204 yield return false;
205 }
206#endif
207 arg1 = YP.getValue(C2);
208 arg2 = YP.getValue(Dict);
209 arg3 = YP.getValue(Tokens);
210 repeat = true;
211 }
212 goto cutIf6;
213 }
214 if (YP.greaterThanOrEqual(C1, 223))
215 {
216 if (YP.notEqual(C1, 247))
217 {
218 foreach (bool l4 in read_identifier(C1, Dict, Tokens))
219 {
220 yield return false;
221 }
222 goto cutIf7;
223 }
224 }
225 if (YP.greaterThanOrEqual(C1, 192))
226 {
227 if (YP.notEqual(C1, 215))
228 {
229 foreach (bool l4 in read_variable(C1, Dict, Tokens))
230 {
231 yield return false;
232 }
233 goto cutIf8;
234 }
235 }
236 if (YP.notEqual(C1, 170))
237 {
238 if (YP.notEqual(C1, 186))
239 {
240 foreach (bool l4 in read_symbol(C1, Dict, Tokens))
241 {
242 yield return false;
243 }
244 goto cutIf9;
245 }
246 }
247 foreach (bool l2 in read_identifier(C1, Dict, Tokens))
248 {
249 yield return false;
250 }
251 cutIf9:
252 cutIf8:
253 cutIf7:
254 cutIf6:
255 cutIf5:
256 cutIf4:
257 cutIf3:
258 cutIf2:
259 cutIf1:
260 { }
261 }
262 }
263 }
264
265 // Compiler output follows.
266
267 class YPInnerClass { }
268 // static Type getDeclaringClass() { return typeof(YPInnerClass).DeclaringType; }
269
270 public static IEnumerable<bool> parseInput(object TermList)
271 {
272 {
273 Variable TermAndVariables = new Variable();
274 FindallAnswers findallAnswers1 = new FindallAnswers(TermAndVariables);
275 foreach (bool l2 in parseInputHelper(TermAndVariables))
276 {
277 findallAnswers1.add();
278 }
279 foreach (bool l2 in findallAnswers1.result(TermList))
280 {
281 yield return false;
282 }
283 }
284 }
285
286 public static IEnumerable<bool> parseInputHelper(object arg1)
287 {
288 {
289 Variable Term = new Variable();
290 Variable Variables = new Variable();
291 Variable Answer = new Variable();
292 Variable x4 = new Variable();
293 foreach (bool l2 in YP.unify(arg1, new Functor2("f", Term, Variables)))
294 {
295 foreach (bool l3 in YP.repeat())
296 {
297 foreach (bool l4 in portable_read3(Answer, Variables, x4))
298 {
299 foreach (bool l5 in remove_pos(Answer, Term))
300 {
301 if (YP.termEqual(Term, Atom.a("end_of_file")))
302 {
303 yield break;
304 goto cutIf1;
305 }
306 yield return false;
307 cutIf1:
308 { }
309 }
310 }
311 }
312 }
313 }
314 }
315
316 public static IEnumerable<bool> clear_errors()
317 {
318 {
319 yield return false;
320 }
321 }
322
323 public static IEnumerable<bool> remove_pos(object arg1, object arg2)
324 {
325 {
326 Variable X = new Variable();
327 foreach (bool l2 in YP.unify(arg1, X))
328 {
329 foreach (bool l3 in YP.unify(arg2, X))
330 {
331 if (YP.var(X))
332 {
333 yield return true;
334 yield break;
335 }
336 }
337 }
338 }
339 {
340 object X = arg2;
341 Variable _Pos = new Variable();
342 Variable _Name = new Variable();
343 foreach (bool l2 in YP.unify(arg1, new Functor3("$VAR", _Pos, _Name, X)))
344 {
345 if (YP.var(X))
346 {
347 yield return true;
348 yield break;
349 }
350 }
351 }
352 {
353 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
354 {
355 foreach (bool l3 in YP.unify(arg2, Atom.NIL))
356 {
357 yield return true;
358 yield break;
359 }
360 }
361 }
362 {
363 Variable H = new Variable();
364 Variable T = new Variable();
365 Variable NH = new Variable();
366 Variable NT = new Variable();
367 foreach (bool l2 in YP.unify(arg1, new ListPair(H, T)))
368 {
369 foreach (bool l3 in YP.unify(arg2, new ListPair(NH, NT)))
370 {
371 foreach (bool l4 in remove_pos(H, NH))
372 {
373 foreach (bool l5 in remove_pos(T, NT))
374 {
375 yield return false;
376 }
377 }
378 yield break;
379 }
380 }
381 }
382 {
383 Variable A = new Variable();
384 Variable B = new Variable();
385 Variable NA = new Variable();
386 Variable NB = new Variable();
387 foreach (bool l2 in YP.unify(arg1, new Functor2(",", A, B)))
388 {
389 foreach (bool l3 in YP.unify(arg2, new Functor2(",", NA, NB)))
390 {
391 foreach (bool l4 in remove_pos(A, NA))
392 {
393 foreach (bool l5 in remove_pos(B, NB))
394 {
395 yield return false;
396 }
397 }
398 yield break;
399 }
400 }
401 }
402 {
403 Variable Atom_1 = new Variable();
404 Variable _F = new Variable();
405 foreach (bool l2 in YP.unify(arg1, Atom_1))
406 {
407 foreach (bool l3 in YP.unify(arg2, Atom_1))
408 {
409 foreach (bool l4 in YP.functor(Atom_1, _F, 0))
410 {
411 yield return false;
412 }
413 }
414 }
415 }
416 {
417 object Term = arg1;
418 object NewTerm = arg2;
419 Variable Func = new Variable();
420 Variable _Pos = new Variable();
421 Variable Args = new Variable();
422 Variable NArgs = new Variable();
423 if (YP.nonvar(Term))
424 {
425 foreach (bool l3 in YP.univ(Term, new ListPair(Func, new ListPair(_Pos, Args))))
426 {
427 foreach (bool l4 in remove_pos(Args, NArgs))
428 {
429 foreach (bool l5 in YP.univ(NewTerm, new ListPair(Func, NArgs)))
430 {
431 yield return false;
432 }
433 }
434 }
435 }
436 }
437 }
438
439 public static IEnumerable<bool> portable_read_position(object Term, object PosTerm, object Syntax)
440 {
441 {
442 foreach (bool l2 in portable_read(PosTerm, Syntax))
443 {
444 foreach (bool l3 in remove_pos(PosTerm, Term))
445 {
446 yield return false;
447 }
448 }
449 }
450 }
451
452 public static IEnumerable<bool> portable_read(object Answer, object Syntax)
453 {
454 {
455 Variable Tokens = new Variable();
456 Variable ParseTokens = new Variable();
457 foreach (bool l2 in read_tokens1(Tokens))
458 {
459 foreach (bool l3 in remove_comments(Tokens, ParseTokens, Syntax))
460 {
461 foreach (bool l4 in parse2(ParseTokens, Answer))
462 {
463 yield return false;
464 }
465 }
466 }
467 }
468 }
469
470 public static IEnumerable<bool> portable_read3(object Answer, object Variables, object Syntax)
471 {
472 {
473 Variable Tokens = new Variable();
474 Variable ParseTokens = new Variable();
475 foreach (bool l2 in read_tokens2(Tokens, Variables))
476 {
477 foreach (bool l3 in remove_comments(Tokens, ParseTokens, Syntax))
478 {
479 foreach (bool l4 in parse2(ParseTokens, Answer))
480 {
481 yield return false;
482 }
483 }
484 }
485 }
486 }
487
488 public static IEnumerable<bool> remove_comments(object arg1, object arg2, object arg3)
489 {
490 {
491 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
492 {
493 foreach (bool l3 in YP.unify(arg2, Atom.NIL))
494 {
495 foreach (bool l4 in YP.unify(arg3, Atom.NIL))
496 {
497 yield return false;
498 }
499 }
500 }
501 }
502 {
503 object Ys = arg2;
504 Variable S = new Variable();
505 Variable E = new Variable();
506 Variable Xs = new Variable();
507 Variable Zs = new Variable();
508 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("comment", S, E), Xs)))
509 {
510 foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("comment", S, E), Zs)))
511 {
512 foreach (bool l4 in remove_comments(Xs, Ys, Zs))
513 {
514 yield return false;
515 }
516 yield break;
517 }
518 }
519 }
520 {
521 Variable Pos = new Variable();
522 Variable Xs = new Variable();
523 Variable Ys = new Variable();
524 Variable Pos2 = new Variable();
525 Variable Zs = new Variable();
526 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("/", Atom.a("["), Pos), Xs)))
527 {
528 foreach (bool l3 in YP.unify(arg2, new ListPair(Atom.a("["), Ys)))
529 {
530 foreach (bool l4 in YP.unify(arg3, new ListPair(new Functor2("list", Pos, Pos2), Zs)))
531 {
532 foreach (bool l5 in YP.unify(Pos2, YP.add(Pos, 1)))
533 {
534 foreach (bool l6 in remove_comments(Xs, Ys, Zs))
535 {
536 yield return false;
537 }
538 }
539 yield break;
540 }
541 }
542 }
543 }
544 {
545 Variable Pos = new Variable();
546 Variable Xs = new Variable();
547 Variable Ys = new Variable();
548 Variable Pos2 = new Variable();
549 Variable Zs = new Variable();
550 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("/", Atom.a("]"), Pos), Xs)))
551 {
552 foreach (bool l3 in YP.unify(arg2, new ListPair(Atom.a("]"), Ys)))
553 {
554 foreach (bool l4 in YP.unify(arg3, new ListPair(new Functor2("list", Pos, Pos2), Zs)))
555 {
556 foreach (bool l5 in YP.unify(Pos2, YP.add(Pos, 1)))
557 {
558 foreach (bool l6 in remove_comments(Xs, Ys, Zs))
559 {
560 yield return false;
561 }
562 }
563 yield break;
564 }
565 }
566 }
567 }
568 {
569 object Zs = arg3;
570 Variable Token = new Variable();
571 Variable Xs = new Variable();
572 Variable Ys = new Variable();
573 foreach (bool l2 in YP.unify(arg1, new ListPair(Token, Xs)))
574 {
575 foreach (bool l3 in YP.unify(arg2, new ListPair(Token, Ys)))
576 {
577 foreach (bool l4 in remove_comments(Xs, Ys, Zs))
578 {
579 yield return false;
580 }
581 }
582 }
583 }
584 }
585
586 public static IEnumerable<bool> expect(object Token, object arg2, object arg3)
587 {
588 {
589 object Rest = arg3;
590 foreach (bool l2 in YP.unify(arg2, new ListPair(Token, Rest)))
591 {
592 yield return true;
593 yield break;
594 }
595 }
596 {
597 object S0 = arg2;
598 object x3 = arg3;
599 foreach (bool l2 in syntax_error(ListPair.make(new object[] { Token, Atom.a("or"), Atom.a("operator"), Atom.a("expected") }), S0))
600 {
601 yield return false;
602 }
603 }
604 }
605
606 public static IEnumerable<bool> parse2(object Tokens, object Answer)
607 {
608 {
609 Variable Term = new Variable();
610 Variable LeftOver = new Variable();
611 foreach (bool l2 in clear_errors())
612 {
613 foreach (bool l3 in parse(Tokens, 1200, Term, LeftOver))
614 {
615 foreach (bool l4 in all_read(LeftOver))
616 {
617 foreach (bool l5 in YP.unify(Answer, Term))
618 {
619 yield return false;
620 }
621 yield break;
622 }
623 }
624 foreach (bool l3 in syntax_error(Tokens))
625 {
626 yield return false;
627 }
628 }
629 }
630 }
631
632 public static IEnumerable<bool> all_read(object arg1)
633 {
634 {
635 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
636 {
637 yield return false;
638 }
639 }
640 {
641 Variable Token = new Variable();
642 Variable S = new Variable();
643 foreach (bool l2 in YP.unify(arg1, new ListPair(Token, S)))
644 {
645 foreach (bool l3 in syntax_error(ListPair.make(new object[] { Atom.a("operator"), Atom.a("expected"), Atom.a("after"), Atom.a("expression") }), new ListPair(Token, S)))
646 {
647 yield return false;
648 }
649 }
650 }
651 }
652
653 public static IEnumerable<bool> parse(object arg1, object arg2, object arg3, object arg4)
654 {
655 {
656 object x1 = arg2;
657 object x2 = arg3;
658 object x3 = arg4;
659 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
660 {
661 foreach (bool l3 in syntax_error(new ListPair(Atom.a("expression"), new ListPair(Atom.a("expected"), Atom.NIL)), Atom.NIL))
662 {
663 yield return false;
664 }
665 }
666 }
667 {
668 object Precedence = arg2;
669 object Term = arg3;
670 object LeftOver = arg4;
671 Variable Token = new Variable();
672 Variable RestTokens = new Variable();
673 foreach (bool l2 in YP.unify(arg1, new ListPair(Token, RestTokens)))
674 {
675 foreach (bool l3 in parse5(Token, RestTokens, Precedence, Term, LeftOver))
676 {
677 yield return false;
678 }
679 }
680 }
681 }
682
683 public static IEnumerable<bool> parse5(object arg1, object arg2, object arg3, object arg4, object arg5)
684 {
685 {
686 object S0 = arg2;
687 object x2 = arg3;
688 object x3 = arg4;
689 object x4 = arg5;
690 foreach (bool l2 in YP.unify(arg1, Atom.a("}")))
691 {
692 foreach (bool l3 in cannot_start(Atom.a("}"), S0))
693 {
694 yield return false;
695 }
696 }
697 }
698 {
699 object S0 = arg2;
700 object x2 = arg3;
701 object x3 = arg4;
702 object x4 = arg5;
703 foreach (bool l2 in YP.unify(arg1, Atom.a("]")))
704 {
705 foreach (bool l3 in cannot_start(Atom.a("]"), S0))
706 {
707 yield return false;
708 }
709 }
710 }
711 {
712 object S0 = arg2;
713 object x2 = arg3;
714 object x3 = arg4;
715 object x4 = arg5;
716 foreach (bool l2 in YP.unify(arg1, Atom.a(")")))
717 {
718 foreach (bool l3 in cannot_start(Atom.a(")"), S0))
719 {
720 yield return false;
721 }
722 }
723 }
724 {
725 object S0 = arg2;
726 object x2 = arg3;
727 object x3 = arg4;
728 object x4 = arg5;
729 foreach (bool l2 in YP.unify(arg1, Atom.a(",")))
730 {
731 foreach (bool l3 in cannot_start(Atom.a(","), S0))
732 {
733 yield return false;
734 }
735 }
736 }
737 {
738 object S0 = arg2;
739 object x2 = arg3;
740 object x3 = arg4;
741 object x4 = arg5;
742 foreach (bool l2 in YP.unify(arg1, Atom.a("|")))
743 {
744 foreach (bool l3 in cannot_start(Atom.a("|"), S0))
745 {
746 yield return false;
747 }
748 }
749 }
750 {
751 object S0 = arg2;
752 object Precedence = arg3;
753 object Answer = arg4;
754 object S = arg5;
755 Variable Codes = new Variable();
756 Variable Term = new Variable();
757 Variable A = new Variable();
758 foreach (bool l2 in YP.unify(arg1, new Functor1("string", Codes)))
759 {
760 foreach (bool l3 in YP.current_prolog_flag(Atom.a("double_quotes"), Atom.a("atom")))
761 {
762 foreach (bool l4 in YP.atom_codes(Term, Codes))
763 {
764 foreach (bool l5 in exprtl0(S0, Term, Precedence, Answer, S))
765 {
766 yield return false;
767 }
768 }
769 goto cutIf1;
770 }
771 foreach (bool l3 in YP.current_prolog_flag(Atom.a("double_quotes"), Atom.a("chars")))
772 {
773 foreach (bool l4 in YP.atom_codes(A, Codes))
774 {
775 foreach (bool l5 in YP.atom_chars(A, Term))
776 {
777 foreach (bool l6 in exprtl0(S0, Term, Precedence, Answer, S))
778 {
779 yield return false;
780 }
781 }
782 }
783 goto cutIf2;
784 }
785 foreach (bool l3 in YP.unify(Term, Codes))
786 {
787 foreach (bool l4 in exprtl0(S0, Term, Precedence, Answer, S))
788 {
789 yield return false;
790 }
791 }
792 cutIf2:
793 cutIf1:
794 { }
795 }
796 }
797 {
798 object S0 = arg2;
799 object Precedence = arg3;
800 object Answer = arg4;
801 object S = arg5;
802 Variable Number = new Variable();
803 foreach (bool l2 in YP.unify(arg1, new Functor1("number", Number)))
804 {
805 foreach (bool l3 in exprtl0(S0, Number, Precedence, Answer, S))
806 {
807 yield return false;
808 }
809 }
810 }
811 {
812 object Precedence = arg3;
813 object Answer = arg4;
814 object S = arg5;
815 Variable S1 = new Variable();
816 foreach (bool l2 in YP.unify(arg1, Atom.a("[")))
817 {
818 foreach (bool l3 in YP.unify(arg2, new ListPair(Atom.a("]"), S1)))
819 {
820 foreach (bool l4 in read_atom(new Functor2("/", Atom.NIL, 0), S1, Precedence, Answer, S))
821 {
822 yield return false;
823 }
824 yield break;
825 }
826 }
827 }
828 {
829 object S1 = arg2;
830 object Precedence = arg3;
831 object Answer = arg4;
832 object S = arg5;
833 Variable Arg1 = new Variable();
834 Variable S2 = new Variable();
835 Variable RestArgs = new Variable();
836 Variable S3 = new Variable();
837 foreach (bool l2 in YP.unify(arg1, Atom.a("[")))
838 {
839 foreach (bool l3 in parse(S1, 999, Arg1, S2))
840 {
841 foreach (bool l4 in read_list(S2, RestArgs, S3))
842 {
843 foreach (bool l5 in exprtl0(S3, new ListPair(Arg1, RestArgs), Precedence, Answer, S))
844 {
845 yield return false;
846 }
847 yield break;
848 }
849 }
850 }
851 }
852 {
853 object S1 = arg2;
854 object Precedence = arg3;
855 object Answer = arg4;
856 object S = arg5;
857 Variable Term = new Variable();
858 Variable S2 = new Variable();
859 Variable S3 = new Variable();
860 foreach (bool l2 in YP.unify(arg1, Atom.a("(")))
861 {
862 foreach (bool l3 in parse(S1, 1200, Term, S2))
863 {
864 foreach (bool l4 in expect(Atom.a(")"), S2, S3))
865 {
866 foreach (bool l5 in exprtl0(S3, Term, Precedence, Answer, S))
867 {
868 yield return false;
869 }
870 yield break;
871 }
872 }
873 }
874 }
875 {
876 object S1 = arg2;
877 object Precedence = arg3;
878 object Answer = arg4;
879 object S = arg5;
880 Variable Term = new Variable();
881 Variable S2 = new Variable();
882 Variable S3 = new Variable();
883 foreach (bool l2 in YP.unify(arg1, Atom.a(" (")))
884 {
885 foreach (bool l3 in parse(S1, 1200, Term, S2))
886 {
887 foreach (bool l4 in expect(Atom.a(")"), S2, S3))
888 {
889 foreach (bool l5 in exprtl0(S3, Term, Precedence, Answer, S))
890 {
891 yield return false;
892 }
893 yield break;
894 }
895 }
896 }
897 }
898 {
899 object Precedence = arg3;
900 object Answer = arg4;
901 object S = arg5;
902 Variable _Pos = new Variable();
903 Variable S1 = new Variable();
904 foreach (bool l2 in YP.unify(arg1, new Functor2("/", Atom.a("{"), _Pos)))
905 {
906 foreach (bool l3 in YP.unify(arg2, new ListPair(Atom.a("}"), S1)))
907 {
908 foreach (bool l4 in read_atom(Atom.a("{}"), S1, Precedence, Answer, S))
909 {
910 yield return false;
911 }
912 yield break;
913 }
914 }
915 }
916 {
917 object S1 = arg2;
918 object Precedence = arg3;
919 object Answer = arg4;
920 object S = arg5;
921 Variable Pos = new Variable();
922 Variable Term = new Variable();
923 Variable S2 = new Variable();
924 Variable S3 = new Variable();
925 foreach (bool l2 in YP.unify(arg1, new Functor2("/", Atom.a("{"), Pos)))
926 {
927 foreach (bool l3 in parse(S1, 1200, Term, S2))
928 {
929 foreach (bool l4 in expect(Atom.a("}"), S2, S3))
930 {
931 foreach (bool l5 in exprtl0(S3, new Functor2("{}", Pos, Term), Precedence, Answer, S))
932 {
933 yield return false;
934 }
935 yield break;
936 }
937 }
938 }
939 }
940 {
941 object Precedence = arg3;
942 object Answer = arg4;
943 object S = arg5;
944 Variable Variable_1 = new Variable();
945 Variable Name = new Variable();
946 Variable Pos = new Variable();
947 Variable S1 = new Variable();
948 Variable Arg1 = new Variable();
949 Variable S2 = new Variable();
950 Variable RestArgs = new Variable();
951 Variable S3 = new Variable();
952 Variable Term = new Variable();
953 foreach (bool l2 in YP.unify(arg1, new Functor3("var", Variable_1, Name, Pos)))
954 {
955 foreach (bool l3 in YP.unify(arg2, new ListPair(Atom.a("("), S1)))
956 {
957 foreach (bool l4 in parse(S1, 999, Arg1, S2))
958 {
959 foreach (bool l5 in read_args(S2, RestArgs, S3))
960 {
961 foreach (bool l6 in YP.univ(Term, new ListPair(Atom.a("call"), new ListPair(new Functor3("$VAR", Pos, Name, Variable_1), new ListPair(Arg1, RestArgs)))))
962 {
963 foreach (bool l7 in exprtl0(S3, Term, Precedence, Answer, S))
964 {
965 yield return false;
966 }
967 }
968 yield break;
969 }
970 }
971 yield break;
972 }
973 }
974 }
975 {
976 object S0 = arg2;
977 object Precedence = arg3;
978 object Answer = arg4;
979 object S = arg5;
980 Variable Variable_1 = new Variable();
981 Variable Name = new Variable();
982 Variable Pos = new Variable();
983 foreach (bool l2 in YP.unify(arg1, new Functor3("var", Variable_1, Name, Pos)))
984 {
985 foreach (bool l3 in exprtl0(S0, new Functor3("$VAR", Pos, Name, Variable_1), Precedence, Answer, S))
986 {
987 yield return false;
988 }
989 }
990 }
991 {
992 object S0 = arg2;
993 object Precedence = arg3;
994 object Answer = arg4;
995 object S = arg5;
996 Variable Atom_1 = new Variable();
997 Variable P = new Variable();
998 foreach (bool l2 in YP.unify(arg1, new Functor2("atom", Atom_1, P)))
999 {
1000 foreach (bool l3 in read_atom(new Functor2("/", Atom_1, P), S0, Precedence, Answer, S))
1001 {
1002 yield return false;
1003 }
1004 }
1005 }
1006 }
1007
1008 public static IEnumerable<bool> read_atom(object arg1, object arg2, object Precedence, object Answer, object S)
1009 {
1010 {
1011 Variable _Pos = new Variable();
1012 Variable Number = new Variable();
1013 Variable S1 = new Variable();
1014 Variable Negative = new Variable();
1015 foreach (bool l2 in YP.unify(arg1, new Functor2("/", Atom.a("-"), _Pos)))
1016 {
1017 foreach (bool l3 in YP.unify(arg2, new ListPair(new Functor1("number", Number), S1)))
1018 {
1019 foreach (bool l4 in YP.unify(Negative, YP.negate(Number)))
1020 {
1021 foreach (bool l5 in exprtl0(S1, Negative, Precedence, Answer, S))
1022 {
1023 yield return false;
1024 }
1025 }
1026 yield break;
1027 }
1028 }
1029 }
1030 {
1031 Variable Functor_1 = new Variable();
1032 Variable Pos = new Variable();
1033 Variable S1 = new Variable();
1034 Variable Arg1 = new Variable();
1035 Variable S2 = new Variable();
1036 Variable RestArgs = new Variable();
1037 Variable S3 = new Variable();
1038 Variable Term = new Variable();
1039 foreach (bool l2 in YP.unify(arg1, new Functor2("/", Functor_1, Pos)))
1040 {
1041 foreach (bool l3 in YP.unify(arg2, new ListPair(Atom.a("("), S1)))
1042 {
1043 foreach (bool l4 in parse(S1, 999, Arg1, S2))
1044 {
1045 foreach (bool l5 in read_args(S2, RestArgs, S3))
1046 {
1047 foreach (bool l6 in YP.univ(Term, new ListPair(Functor_1, new ListPair(Pos, new ListPair(Arg1, RestArgs)))))
1048 {
1049 foreach (bool l7 in exprtl0(S3, Term, Precedence, Answer, S))
1050 {
1051 yield return false;
1052 }
1053 }
1054 yield break;
1055 }
1056 }
1057 yield break;
1058 }
1059 }
1060 }
1061 {
1062 object S0 = arg2;
1063 Variable Op = new Variable();
1064 Variable Pos = new Variable();
1065 Variable Oprec = new Variable();
1066 Variable Aprec = new Variable();
1067 Variable Flag = new Variable();
1068 Variable Term = new Variable();
1069 Variable Arg = new Variable();
1070 Variable S1 = new Variable();
1071 foreach (bool l2 in YP.unify(arg1, new Functor2("/", Op, Pos)))
1072 {
1073 foreach (bool l3 in prefixop(Op, Oprec, Aprec))
1074 {
1075 foreach (bool l4 in possible_right_operand(S0, Flag))
1076 {
1077 if (YP.lessThan(Flag, 0))
1078 {
1079 foreach (bool l6 in YP.univ(Term, new ListPair(Op, new ListPair(Pos, Atom.NIL))))
1080 {
1081 foreach (bool l7 in exprtl0(S0, Term, Precedence, Answer, S))
1082 {
1083 yield return false;
1084 }
1085 }
1086 goto cutIf1;
1087 }
1088 if (YP.greaterThan(Oprec, Precedence))
1089 {
1090 foreach (bool l6 in syntax_error(ListPair.make(new object[] { Atom.a("prefix"), Atom.a("operator"), Op, Atom.a("in"), Atom.a("context"), Atom.a("with"), Atom.a("precedence"), Precedence }), S0))
1091 {
1092 yield return false;
1093 }
1094 goto cutIf2;
1095 }
1096 if (YP.greaterThan(Flag, 0))
1097 {
1098 foreach (bool l6 in parse(S0, Aprec, Arg, S1))
1099 {
1100 foreach (bool l7 in YP.univ(Term, ListPair.make(new object[] { Op, Pos, Arg })))
1101 {
1102 foreach (bool l8 in exprtl(S1, Oprec, Term, Precedence, Answer, S))
1103 {
1104 yield return false;
1105 }
1106 }
1107 yield break;
1108 }
1109 goto cutIf3;
1110 }
1111 foreach (bool l5 in peepop(S0, S1))
1112 {
1113 foreach (bool l6 in prefix_is_atom(S1, Oprec))
1114 {
1115 foreach (bool l7 in exprtl(S1, Oprec, new Functor2("/", Op, Pos), Precedence, Answer, S))
1116 {
1117 yield return false;
1118 }
1119 }
1120 }
1121 foreach (bool l5 in parse(S0, Aprec, Arg, S1))
1122 {
1123 foreach (bool l6 in YP.univ(Term, ListPair.make(new object[] { Op, Pos, Arg })))
1124 {
1125 foreach (bool l7 in exprtl(S1, Oprec, Term, Precedence, Answer, S))
1126 {
1127 yield return false;
1128 }
1129 }
1130 yield break;
1131 }
1132 cutIf3:
1133 cutIf2:
1134 cutIf1:
1135 { }
1136 }
1137 yield break;
1138 }
1139 }
1140 }
1141 {
1142 object S0 = arg2;
1143 Variable Atom_1 = new Variable();
1144 Variable Pos = new Variable();
1145 Variable Term = new Variable();
1146 foreach (bool l2 in YP.unify(arg1, new Functor2("/", Atom_1, Pos)))
1147 {
1148 foreach (bool l3 in YP.univ(Term, new ListPair(Atom_1, new ListPair(Pos, Atom.NIL))))
1149 {
1150 foreach (bool l4 in exprtl0(S0, Term, Precedence, Answer, S))
1151 {
1152 yield return false;
1153 }
1154 }
1155 }
1156 }
1157 }
1158
1159 public static IEnumerable<bool> cannot_start(object Token, object S0)
1160 {
1161 {
1162 foreach (bool l2 in syntax_error(ListPair.make(new object[] { Token, Atom.a("cannot"), Atom.a("start"), Atom.a("an"), Atom.a("expression") }), S0))
1163 {
1164 yield return false;
1165 }
1166 }
1167 }
1168
1169 public static IEnumerable<bool> read_args(object arg1, object arg2, object arg3)
1170 {
1171 {
1172 object S = arg3;
1173 Variable S1 = new Variable();
1174 Variable Term = new Variable();
1175 Variable Rest = new Variable();
1176 Variable S2 = new Variable();
1177 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a(","), S1)))
1178 {
1179 foreach (bool l3 in YP.unify(arg2, new ListPair(Term, Rest)))
1180 {
1181 foreach (bool l4 in parse(S1, 999, Term, S2))
1182 {
1183 foreach (bool l5 in read_args(S2, Rest, S))
1184 {
1185 yield return false;
1186 }
1187 yield break;
1188 }
1189 yield break;
1190 }
1191 }
1192 }
1193 {
1194 object S = arg3;
1195 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a(")"), S)))
1196 {
1197 foreach (bool l3 in YP.unify(arg2, Atom.NIL))
1198 {
1199 yield return true;
1200 yield break;
1201 }
1202 }
1203 }
1204 {
1205 object S = arg1;
1206 object x2 = arg2;
1207 object x3 = arg3;
1208 foreach (bool l2 in syntax_error(ListPair.make(new object[] { Atom.a(", or )"), Atom.a("expected"), Atom.a("in"), Atom.a("arguments") }), S))
1209 {
1210 yield return false;
1211 }
1212 }
1213 }
1214
1215 public static IEnumerable<bool> read_list(object arg1, object arg2, object arg3)
1216 {
1217 {
1218 object x1 = arg2;
1219 object x2 = arg3;
1220 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
1221 {
1222 foreach (bool l3 in syntax_error(ListPair.make(new object[] { Atom.a(", | or ]"), Atom.a("expected"), Atom.a("in"), Atom.a("list") }), Atom.NIL))
1223 {
1224 yield return false;
1225 }
1226 }
1227 }
1228 {
1229 object Rest = arg2;
1230 object S = arg3;
1231 Variable Token = new Variable();
1232 Variable S1 = new Variable();
1233 foreach (bool l2 in YP.unify(arg1, new ListPair(Token, S1)))
1234 {
1235 foreach (bool l3 in read_list4(Token, S1, Rest, S))
1236 {
1237 yield return false;
1238 }
1239 }
1240 }
1241 }
1242
1243 public static IEnumerable<bool> read_list4(object arg1, object arg2, object arg3, object arg4)
1244 {
1245 {
1246 object S1 = arg2;
1247 object S = arg4;
1248 Variable Term = new Variable();
1249 Variable Rest = new Variable();
1250 Variable S2 = new Variable();
1251 foreach (bool l2 in YP.unify(arg1, Atom.a(",")))
1252 {
1253 foreach (bool l3 in YP.unify(arg3, new ListPair(Term, Rest)))
1254 {
1255 foreach (bool l4 in parse(S1, 999, Term, S2))
1256 {
1257 foreach (bool l5 in read_list(S2, Rest, S))
1258 {
1259 yield return false;
1260 }
1261 yield break;
1262 }
1263 yield break;
1264 }
1265 }
1266 }
1267 {
1268 object S1 = arg2;
1269 object Rest = arg3;
1270 object S = arg4;
1271 Variable S2 = new Variable();
1272 foreach (bool l2 in YP.unify(arg1, Atom.a("|")))
1273 {
1274 foreach (bool l3 in parse(S1, 999, Rest, S2))
1275 {
1276 foreach (bool l4 in expect(Atom.a("]"), S2, S))
1277 {
1278 yield return false;
1279 }
1280 yield break;
1281 }
1282 yield break;
1283 }
1284 }
1285 {
1286 Variable S1 = new Variable();
1287 foreach (bool l2 in YP.unify(arg1, Atom.a("]")))
1288 {
1289 foreach (bool l3 in YP.unify(arg2, S1))
1290 {
1291 foreach (bool l4 in YP.unify(arg3, Atom.NIL))
1292 {
1293 foreach (bool l5 in YP.unify(arg4, S1))
1294 {
1295 yield return true;
1296 yield break;
1297 }
1298 }
1299 }
1300 }
1301 }
1302 {
1303 object Token = arg1;
1304 object S1 = arg2;
1305 object x3 = arg3;
1306 object x4 = arg4;
1307 foreach (bool l2 in syntax_error(ListPair.make(new object[] { Atom.a(", | or ]"), Atom.a("expected"), Atom.a("in"), Atom.a("list") }), new ListPair(Token, S1)))
1308 {
1309 yield return false;
1310 }
1311 }
1312 }
1313
1314 public static IEnumerable<bool> possible_right_operand(object arg1, object arg2)
1315 {
1316 {
1317 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
1318 {
1319 foreach (bool l3 in YP.unify(arg2, -1))
1320 {
1321 yield return false;
1322 }
1323 }
1324 }
1325 {
1326 object Flag = arg2;
1327 Variable H = new Variable();
1328 Variable T = new Variable();
1329 foreach (bool l2 in YP.unify(arg1, new ListPair(H, T)))
1330 {
1331 foreach (bool l3 in possible_right_operand3(H, Flag, T))
1332 {
1333 yield return false;
1334 }
1335 }
1336 }
1337 }
1338
1339 public static IEnumerable<bool> possible_right_operand3(object arg1, object arg2, object arg3)
1340 {
1341 {
1342 object x4 = arg3;
1343 Variable x1 = new Variable();
1344 Variable x2 = new Variable();
1345 Variable x3 = new Variable();
1346 foreach (bool l2 in YP.unify(arg1, new Functor3("var", x1, x2, x3)))
1347 {
1348 foreach (bool l3 in YP.unify(arg2, 1))
1349 {
1350 yield return false;
1351 }
1352 }
1353 }
1354 {
1355 object x2 = arg3;
1356 Variable x1 = new Variable();
1357 foreach (bool l2 in YP.unify(arg1, new Functor1("number", x1)))
1358 {
1359 foreach (bool l3 in YP.unify(arg2, 1))
1360 {
1361 yield return false;
1362 }
1363 }
1364 }
1365 {
1366 object x2 = arg3;
1367 Variable x1 = new Variable();
1368 foreach (bool l2 in YP.unify(arg1, new Functor1("string", x1)))
1369 {
1370 foreach (bool l3 in YP.unify(arg2, 1))
1371 {
1372 yield return false;
1373 }
1374 }
1375 }
1376 {
1377 object x1 = arg3;
1378 foreach (bool l2 in YP.unify(arg1, Atom.a(" (")))
1379 {
1380 foreach (bool l3 in YP.unify(arg2, 1))
1381 {
1382 yield return false;
1383 }
1384 }
1385 }
1386 {
1387 object x1 = arg3;
1388 foreach (bool l2 in YP.unify(arg1, Atom.a("(")))
1389 {
1390 foreach (bool l3 in YP.unify(arg2, 0))
1391 {
1392 yield return false;
1393 }
1394 }
1395 }
1396 {
1397 object x1 = arg3;
1398 foreach (bool l2 in YP.unify(arg1, Atom.a(")")))
1399 {
1400 foreach (bool l3 in YP.unify(arg2, -1))
1401 {
1402 yield return false;
1403 }
1404 }
1405 }
1406 {
1407 Variable x1 = new Variable();
1408 foreach (bool l2 in YP.unify(arg1, Atom.a("[")))
1409 {
1410 foreach (bool l3 in YP.unify(arg2, 0))
1411 {
1412 foreach (bool l4 in YP.unify(arg3, new ListPair(Atom.a("]"), x1)))
1413 {
1414 yield return true;
1415 yield break;
1416 }
1417 }
1418 }
1419 }
1420 {
1421 object x1 = arg3;
1422 foreach (bool l2 in YP.unify(arg1, Atom.a("[")))
1423 {
1424 foreach (bool l3 in YP.unify(arg2, 1))
1425 {
1426 yield return false;
1427 }
1428 }
1429 }
1430 {
1431 object x1 = arg3;
1432 foreach (bool l2 in YP.unify(arg1, Atom.a("]")))
1433 {
1434 foreach (bool l3 in YP.unify(arg2, -1))
1435 {
1436 yield return false;
1437 }
1438 }
1439 }
1440 {
1441 Variable x1 = new Variable();
1442 foreach (bool l2 in YP.unify(arg1, Atom.a("{")))
1443 {
1444 foreach (bool l3 in YP.unify(arg2, 0))
1445 {
1446 foreach (bool l4 in YP.unify(arg3, new ListPair(Atom.a("}"), x1)))
1447 {
1448 yield return true;
1449 yield break;
1450 }
1451 }
1452 }
1453 }
1454 {
1455 object x1 = arg3;
1456 foreach (bool l2 in YP.unify(arg1, Atom.a("{")))
1457 {
1458 foreach (bool l3 in YP.unify(arg2, 1))
1459 {
1460 yield return false;
1461 }
1462 }
1463 }
1464 {
1465 object x1 = arg3;
1466 foreach (bool l2 in YP.unify(arg1, Atom.a("}")))
1467 {
1468 foreach (bool l3 in YP.unify(arg2, -1))
1469 {
1470 yield return false;
1471 }
1472 }
1473 }
1474 {
1475 object x1 = arg3;
1476 foreach (bool l2 in YP.unify(arg1, Atom.a(",")))
1477 {
1478 foreach (bool l3 in YP.unify(arg2, -1))
1479 {
1480 yield return false;
1481 }
1482 }
1483 }
1484 {
1485 object x1 = arg3;
1486 foreach (bool l2 in YP.unify(arg1, Atom.a("|")))
1487 {
1488 foreach (bool l3 in YP.unify(arg2, -1))
1489 {
1490 yield return false;
1491 }
1492 }
1493 }
1494 {
1495 object x3 = arg3;
1496 Variable x1 = new Variable();
1497 Variable x2 = new Variable();
1498 foreach (bool l2 in YP.unify(arg1, new Functor2("atom", x1, x2)))
1499 {
1500 foreach (bool l3 in YP.unify(arg2, 0))
1501 {
1502 yield return false;
1503 }
1504 }
1505 }
1506 }
1507
1508 public static IEnumerable<bool> peepop(object arg1, object arg2)
1509 {
1510 {
1511 Variable F = new Variable();
1512 Variable Pos = new Variable();
1513 Variable S1 = new Variable();
1514 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("atom", F, Pos), new ListPair(Atom.a("("), S1))))
1515 {
1516 foreach (bool l3 in YP.unify(arg2, new ListPair(new Functor2("atom", F, Pos), new ListPair(Atom.a("("), S1))))
1517 {
1518 yield return true;
1519 yield break;
1520 }
1521 }
1522 }
1523 {
1524 Variable F = new Variable();
1525 Variable Pos = new Variable();
1526 Variable S1 = new Variable();
1527 Variable L = new Variable();
1528 Variable P = new Variable();
1529 Variable R = new Variable();
1530 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("atom", F, Pos), S1)))
1531 {
1532 foreach (bool l3 in YP.unify(arg2, new ListPair(new Functor(Atom.a("infixop", Atom.a("")), new object[] { new Functor2("/", F, Pos), L, P, R }), S1)))
1533 {
1534 foreach (bool l4 in infixop(F, L, P, R))
1535 {
1536 yield return false;
1537 }
1538 }
1539 }
1540 }
1541 {
1542 Variable F = new Variable();
1543 Variable Pos = new Variable();
1544 Variable S1 = new Variable();
1545 Variable L = new Variable();
1546 Variable P = new Variable();
1547 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("atom", F, Pos), S1)))
1548 {
1549 foreach (bool l3 in YP.unify(arg2, new ListPair(new Functor3(Atom.a("postfixop", Atom.a("")), new Functor2("/", F, Pos), L, P), S1)))
1550 {
1551 foreach (bool l4 in postfixop(F, L, P))
1552 {
1553 yield return false;
1554 }
1555 }
1556 }
1557 }
1558 {
1559 Variable S0 = new Variable();
1560 foreach (bool l2 in YP.unify(arg1, S0))
1561 {
1562 foreach (bool l3 in YP.unify(arg2, S0))
1563 {
1564 yield return false;
1565 }
1566 }
1567 }
1568 }
1569
1570 public static IEnumerable<bool> prefix_is_atom(object arg1, object arg2)
1571 {
1572 {
1573 object Precedence = arg2;
1574 Variable Token = new Variable();
1575 Variable x2 = new Variable();
1576 foreach (bool l2 in YP.unify(arg1, new ListPair(Token, x2)))
1577 {
1578 foreach (bool l3 in prefix_is_atom(Token, Precedence))
1579 {
1580 yield return false;
1581 }
1582 }
1583 }
1584 {
1585 object P = arg2;
1586 Variable x1 = new Variable();
1587 Variable L = new Variable();
1588 Variable x3 = new Variable();
1589 Variable x4 = new Variable();
1590 foreach (bool l2 in YP.unify(arg1, new Functor(Atom.a("infixop", Atom.a("")), new object[] { x1, L, x3, x4 })))
1591 {
1592 if (YP.greaterThanOrEqual(L, P))
1593 {
1594 yield return false;
1595 }
1596 }
1597 }
1598 {
1599 object P = arg2;
1600 Variable x1 = new Variable();
1601 Variable L = new Variable();
1602 Variable x3 = new Variable();
1603 foreach (bool l2 in YP.unify(arg1, new Functor3(Atom.a("postfixop", Atom.a("")), x1, L, x3)))
1604 {
1605 if (YP.greaterThanOrEqual(L, P))
1606 {
1607 yield return false;
1608 }
1609 }
1610 }
1611 {
1612 object x1 = arg2;
1613 foreach (bool l2 in YP.unify(arg1, Atom.a(")")))
1614 {
1615 yield return false;
1616 }
1617 }
1618 {
1619 object x1 = arg2;
1620 foreach (bool l2 in YP.unify(arg1, Atom.a("]")))
1621 {
1622 yield return false;
1623 }
1624 }
1625 {
1626 object x1 = arg2;
1627 foreach (bool l2 in YP.unify(arg1, Atom.a("}")))
1628 {
1629 yield return false;
1630 }
1631 }
1632 {
1633 object P = arg2;
1634 foreach (bool l2 in YP.unify(arg1, Atom.a("|")))
1635 {
1636 if (YP.greaterThanOrEqual(1100, P))
1637 {
1638 yield return false;
1639 }
1640 }
1641 }
1642 {
1643 object P = arg2;
1644 foreach (bool l2 in YP.unify(arg1, Atom.a(",")))
1645 {
1646 if (YP.greaterThanOrEqual(1000, P))
1647 {
1648 yield return false;
1649 }
1650 }
1651 }
1652 {
1653 object x1 = arg2;
1654 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
1655 {
1656 yield return false;
1657 }
1658 }
1659 }
1660
1661 public static IEnumerable<bool> exprtl0(object arg1, object arg2, object arg3, object arg4, object arg5)
1662 {
1663 {
1664 object x2 = arg3;
1665 Variable Term = new Variable();
1666 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
1667 {
1668 foreach (bool l3 in YP.unify(arg2, Term))
1669 {
1670 foreach (bool l4 in YP.unify(arg4, Term))
1671 {
1672 foreach (bool l5 in YP.unify(arg5, Atom.NIL))
1673 {
1674 yield return false;
1675 }
1676 }
1677 }
1678 }
1679 }
1680 {
1681 object Term = arg2;
1682 object Precedence = arg3;
1683 object Answer = arg4;
1684 object S = arg5;
1685 Variable Token = new Variable();
1686 Variable S1 = new Variable();
1687 foreach (bool l2 in YP.unify(arg1, new ListPair(Token, S1)))
1688 {
1689 foreach (bool l3 in exprtl0_6(Token, Term, Precedence, Answer, S, S1))
1690 {
1691 yield return false;
1692 }
1693 }
1694 }
1695 }
1696
1697 public static IEnumerable<bool> exprtl0_6(object arg1, object arg2, object arg3, object arg4, object arg5, object arg6)
1698 {
1699 {
1700 object x2 = arg3;
1701 object S1 = arg6;
1702 Variable Term = new Variable();
1703 foreach (bool l2 in YP.unify(arg1, Atom.a("}")))
1704 {
1705 foreach (bool l3 in YP.unify(arg2, Term))
1706 {
1707 foreach (bool l4 in YP.unify(arg4, Term))
1708 {
1709 foreach (bool l5 in YP.unify(arg5, new ListPair(Atom.a("}"), S1)))
1710 {
1711 yield return false;
1712 }
1713 }
1714 }
1715 }
1716 }
1717 {
1718 object x2 = arg3;
1719 object S1 = arg6;
1720 Variable Term = new Variable();
1721 foreach (bool l2 in YP.unify(arg1, Atom.a("]")))
1722 {
1723 foreach (bool l3 in YP.unify(arg2, Term))
1724 {
1725 foreach (bool l4 in YP.unify(arg4, Term))
1726 {
1727 foreach (bool l5 in YP.unify(arg5, new ListPair(Atom.a("]"), S1)))
1728 {
1729 yield return false;
1730 }
1731 }
1732 }
1733 }
1734 }
1735 {
1736 object x2 = arg3;
1737 object S1 = arg6;
1738 Variable Term = new Variable();
1739 foreach (bool l2 in YP.unify(arg1, Atom.a(")")))
1740 {
1741 foreach (bool l3 in YP.unify(arg2, Term))
1742 {
1743 foreach (bool l4 in YP.unify(arg4, Term))
1744 {
1745 foreach (bool l5 in YP.unify(arg5, new ListPair(Atom.a(")"), S1)))
1746 {
1747 yield return false;
1748 }
1749 }
1750 }
1751 }
1752 }
1753 {
1754 object Term = arg2;
1755 object Precedence = arg3;
1756 object Answer = arg4;
1757 object S = arg5;
1758 object S1 = arg6;
1759 Variable Next = new Variable();
1760 Variable S2 = new Variable();
1761 foreach (bool l2 in YP.unify(arg1, Atom.a(",")))
1762 {
1763 if (YP.greaterThanOrEqual(Precedence, 1000))
1764 {
1765 foreach (bool l4 in parse(S1, 1000, Next, S2))
1766 {
1767 foreach (bool l5 in exprtl(S2, 1000, new Functor2(",", Term, Next), Precedence, Answer, S))
1768 {
1769 yield return false;
1770 }
1771 yield break;
1772 }
1773 goto cutIf1;
1774 }
1775 foreach (bool l3 in YP.unify(Answer, Term))
1776 {
1777 foreach (bool l4 in YP.unify(S, new ListPair(Atom.a(","), S1)))
1778 {
1779 yield return false;
1780 }
1781 }
1782 cutIf1:
1783 { }
1784 }
1785 }
1786 {
1787 object Term = arg2;
1788 object Precedence = arg3;
1789 object Answer = arg4;
1790 object S = arg5;
1791 object S1 = arg6;
1792 Variable Next = new Variable();
1793 Variable S2 = new Variable();
1794 foreach (bool l2 in YP.unify(arg1, Atom.a("|")))
1795 {
1796 if (YP.greaterThanOrEqual(Precedence, 1100))
1797 {
1798 foreach (bool l4 in parse(S1, 1100, Next, S2))
1799 {
1800 foreach (bool l5 in exprtl(S2, 1100, new Functor2(";", Term, Next), Precedence, Answer, S))
1801 {
1802 yield return false;
1803 }
1804 yield break;
1805 }
1806 goto cutIf2;
1807 }
1808 foreach (bool l3 in YP.unify(Answer, Term))
1809 {
1810 foreach (bool l4 in YP.unify(S, new ListPair(Atom.a("|"), S1)))
1811 {
1812 yield return false;
1813 }
1814 }
1815 cutIf2:
1816 { }
1817 }
1818 }
1819 {
1820 object x2 = arg2;
1821 object x3 = arg3;
1822 object x4 = arg4;
1823 object x5 = arg5;
1824 object S1 = arg6;
1825 Variable S = new Variable();
1826 foreach (bool l2 in YP.unify(arg1, new Functor1("string", S)))
1827 {
1828 foreach (bool l3 in cannot_follow(Atom.a("chars"), new Functor1("string", S), S1))
1829 {
1830 yield return false;
1831 }
1832 }
1833 }
1834 {
1835 object x2 = arg2;
1836 object x3 = arg3;
1837 object x4 = arg4;
1838 object x5 = arg5;
1839 object S1 = arg6;
1840 Variable N = new Variable();
1841 foreach (bool l2 in YP.unify(arg1, new Functor1("number", N)))
1842 {
1843 foreach (bool l3 in cannot_follow(Atom.a("number"), new Functor1("number", N), S1))
1844 {
1845 yield return false;
1846 }
1847 }
1848 }
1849 {
1850 object Term = arg2;
1851 object Precedence = arg3;
1852 object Answer = arg4;
1853 object S = arg5;
1854 Variable S1 = new Variable();
1855 foreach (bool l2 in YP.unify(arg1, Atom.a("{")))
1856 {
1857 foreach (bool l3 in YP.unify(arg6, new ListPair(Atom.a("}"), S1)))
1858 {
1859 foreach (bool l4 in exprtl0_atom(Atom.a("{}"), Term, Precedence, Answer, S, S1))
1860 {
1861 yield return false;
1862 }
1863 yield break;
1864 }
1865 }
1866 }
1867 {
1868 object x1 = arg2;
1869 object x2 = arg3;
1870 object x3 = arg4;
1871 object x4 = arg5;
1872 object S1 = arg6;
1873 foreach (bool l2 in YP.unify(arg1, Atom.a("{")))
1874 {
1875 foreach (bool l3 in cannot_follow(Atom.a("brace"), Atom.a("{"), S1))
1876 {
1877 yield return false;
1878 }
1879 }
1880 }
1881 {
1882 object Term = arg2;
1883 object Precedence = arg3;
1884 object Answer = arg4;
1885 object S = arg5;
1886 Variable S1 = new Variable();
1887 foreach (bool l2 in YP.unify(arg1, Atom.a("[")))
1888 {
1889 foreach (bool l3 in YP.unify(arg6, new ListPair(Atom.a("]"), S1)))
1890 {
1891 foreach (bool l4 in exprtl0_atom(Atom.NIL, Term, Precedence, Answer, S, S1))
1892 {
1893 yield return false;
1894 }
1895 yield break;
1896 }
1897 }
1898 }
1899 {
1900 object x1 = arg2;
1901 object x2 = arg3;
1902 object x3 = arg4;
1903 object x4 = arg5;
1904 object S1 = arg6;
1905 foreach (bool l2 in YP.unify(arg1, Atom.a("[")))
1906 {
1907 foreach (bool l3 in cannot_follow(Atom.a("bracket"), Atom.a("["), S1))
1908 {
1909 yield return false;
1910 }
1911 }
1912 }
1913 {
1914 object x1 = arg2;
1915 object x2 = arg3;
1916 object x3 = arg4;
1917 object x4 = arg5;
1918 object S1 = arg6;
1919 foreach (bool l2 in YP.unify(arg1, Atom.a("(")))
1920 {
1921 foreach (bool l3 in cannot_follow(Atom.a("parenthesis"), Atom.a("("), S1))
1922 {
1923 yield return false;
1924 }
1925 }
1926 }
1927 {
1928 object x1 = arg2;
1929 object x2 = arg3;
1930 object x3 = arg4;
1931 object x4 = arg5;
1932 object S1 = arg6;
1933 foreach (bool l2 in YP.unify(arg1, Atom.a(" (")))
1934 {
1935 foreach (bool l3 in cannot_follow(Atom.a("parenthesis"), Atom.a("("), S1))
1936 {
1937 yield return false;
1938 }
1939 }
1940 }
1941 {
1942 object x4 = arg2;
1943 object x5 = arg3;
1944 object x6 = arg4;
1945 object x7 = arg5;
1946 object S1 = arg6;
1947 Variable A = new Variable();
1948 Variable B = new Variable();
1949 Variable P = new Variable();
1950 foreach (bool l2 in YP.unify(arg1, new Functor3("var", A, B, P)))
1951 {
1952 foreach (bool l3 in cannot_follow(Atom.a("variable"), new Functor3("var", A, B, P), S1))
1953 {
1954 yield return false;
1955 }
1956 }
1957 }
1958 {
1959 object Term = arg2;
1960 object Precedence = arg3;
1961 object Answer = arg4;
1962 object S = arg5;
1963 object S1 = arg6;
1964 Variable F = new Variable();
1965 Variable P = new Variable();
1966 foreach (bool l2 in YP.unify(arg1, new Functor2("atom", F, P)))
1967 {
1968 foreach (bool l3 in exprtl0_atom(new Functor2("/", F, P), Term, Precedence, Answer, S, S1))
1969 {
1970 yield return false;
1971 }
1972 }
1973 }
1974 }
1975
1976 public static IEnumerable<bool> exprtl0_atom(object arg1, object arg2, object arg3, object arg4, object arg5, object S1)
1977 {
1978 {
1979 object Term = arg2;
1980 object Precedence = arg3;
1981 object Answer = arg4;
1982 object S = arg5;
1983 Variable F = new Variable();
1984 Variable Pos = new Variable();
1985 Variable L1 = new Variable();
1986 Variable O1 = new Variable();
1987 Variable R1 = new Variable();
1988 Variable L2 = new Variable();
1989 Variable O2 = new Variable();
1990 foreach (bool l2 in YP.unify(arg1, new Functor2("/", F, Pos)))
1991 {
1992 foreach (bool l3 in ambigop(F, Precedence, L1, O1, R1, L2, O2))
1993 {
1994 foreach (bool l4 in prefix_is_atom(S1, Precedence))
1995 {
1996 foreach (bool l5 in exprtl(new ListPair(new Functor3(Atom.a("postfixop", Atom.a("")), new Functor2("/", F, Pos), L2, O2), S1), 0, Term, Precedence, Answer, S))
1997 {
1998 yield return false;
1999 }
2000 yield break;
2001 }
2002 foreach (bool l4 in exprtl(new ListPair(new Functor(Atom.a("infixop", Atom.a("")), new object[] { new Functor2("/", F, Pos), L1, O1, R1 }), S1), 0, Term, Precedence, Answer, S))
2003 {
2004 yield return false;
2005 }
2006 foreach (bool l4 in exprtl(new ListPair(new Functor3(Atom.a("postfixop", Atom.a("")), new Functor2("/", F, Pos), L2, O2), S1), 0, Term, Precedence, Answer, S))
2007 {
2008 yield return false;
2009 }
2010 yield break;
2011 }
2012 }
2013 }
2014 {
2015 object Term = arg2;
2016 object Precedence = arg3;
2017 object Answer = arg4;
2018 object S = arg5;
2019 Variable F = new Variable();
2020 Variable Pos = new Variable();
2021 Variable L1 = new Variable();
2022 Variable O1 = new Variable();
2023 Variable R1 = new Variable();
2024 foreach (bool l2 in YP.unify(arg1, new Functor2("/", F, Pos)))
2025 {
2026 foreach (bool l3 in infixop(F, L1, O1, R1))
2027 {
2028 foreach (bool l4 in exprtl(new ListPair(new Functor(Atom.a("infixop", Atom.a("")), new object[] { new Functor2("/", F, Pos), L1, O1, R1 }), S1), 0, Term, Precedence, Answer, S))
2029 {
2030 yield return false;
2031 }
2032 yield break;
2033 }
2034 }
2035 }
2036 {
2037 object Term = arg2;
2038 object Precedence = arg3;
2039 object Answer = arg4;
2040 object S = arg5;
2041 Variable F = new Variable();
2042 Variable Pos = new Variable();
2043 Variable L2 = new Variable();
2044 Variable O2 = new Variable();
2045 foreach (bool l2 in YP.unify(arg1, new Functor2("/", F, Pos)))
2046 {
2047 foreach (bool l3 in postfixop(F, L2, O2))
2048 {
2049 foreach (bool l4 in exprtl(new ListPair(new Functor3(Atom.a("postfixop", Atom.a("")), new Functor2("/", F, Pos), L2, O2), S1), 0, Term, Precedence, Answer, S))
2050 {
2051 yield return false;
2052 }
2053 yield break;
2054 }
2055 }
2056 }
2057 {
2058 object X = arg1;
2059 object x2 = arg2;
2060 object x3 = arg3;
2061 object x4 = arg4;
2062 object x5 = arg5;
2063 Variable x7 = new Variable();
2064 foreach (bool l2 in syntax_error(ListPair.make(new object[] { new Functor2("-", Atom.a("non"), Atom.a("operator")), X, Atom.a("follows"), Atom.a("expression") }), new ListPair(new Functor2("atom", X, x7), S1)))
2065 {
2066 yield return false;
2067 }
2068 yield break;
2069 }
2070 }
2071
2072 public static IEnumerable<bool> cannot_follow(object Type, object Token, object Tokens)
2073 {
2074 {
2075 foreach (bool l2 in syntax_error(ListPair.make(new object[] { Type, Atom.a("follows"), Atom.a("expression") }), new ListPair(Token, Tokens)))
2076 {
2077 yield return false;
2078 }
2079 }
2080 }
2081
2082 public static IEnumerable<bool> exprtl(object arg1, object arg2, object arg3, object arg4, object arg5, object arg6)
2083 {
2084 {
2085 object x1 = arg2;
2086 object x3 = arg4;
2087 Variable Term = new Variable();
2088 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
2089 {
2090 foreach (bool l3 in YP.unify(arg3, Term))
2091 {
2092 foreach (bool l4 in YP.unify(arg5, Term))
2093 {
2094 foreach (bool l5 in YP.unify(arg6, Atom.NIL))
2095 {
2096 yield return false;
2097 }
2098 }
2099 }
2100 }
2101 }
2102 {
2103 object C = arg2;
2104 object Term = arg3;
2105 object Precedence = arg4;
2106 object Answer = arg5;
2107 object S = arg6;
2108 Variable Token = new Variable();
2109 Variable Tokens = new Variable();
2110 foreach (bool l2 in YP.unify(arg1, new ListPair(Token, Tokens)))
2111 {
2112 foreach (bool l3 in exprtl_7(Token, C, Term, Precedence, Answer, S, Tokens))
2113 {
2114 yield return false;
2115 }
2116 }
2117 }
2118 }
2119
2120 public static IEnumerable<bool> exprtl_7(object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7)
2121 {
2122 {
2123 object C = arg2;
2124 object Term = arg3;
2125 object Precedence = arg4;
2126 object Answer = arg5;
2127 object S = arg6;
2128 object S1 = arg7;
2129 Variable F = new Variable();
2130 Variable Pos = new Variable();
2131 Variable L = new Variable();
2132 Variable O = new Variable();
2133 Variable R = new Variable();
2134 Variable Other = new Variable();
2135 Variable S2 = new Variable();
2136 Variable Expr = new Variable();
2137 foreach (bool l2 in YP.unify(arg1, new Functor(Atom.a("infixop", Atom.a("")), new object[] { new Functor2("/", F, Pos), L, O, R })))
2138 {
2139 if (YP.greaterThanOrEqual(Precedence, O))
2140 {
2141 if (YP.lessThanOrEqual(C, L))
2142 {
2143 foreach (bool l5 in parse(S1, R, Other, S2))
2144 {
2145 foreach (bool l6 in YP.univ(Expr, ListPair.make(new object[] { F, Pos, Term, Other })))
2146 {
2147 foreach (bool l7 in exprtl(S2, O, Expr, Precedence, Answer, S))
2148 {
2149 yield return false;
2150 }
2151 }
2152 }
2153 yield break;
2154 }
2155 }
2156 }
2157 }
2158 {
2159 object C = arg2;
2160 object Term = arg3;
2161 object Precedence = arg4;
2162 object Answer = arg5;
2163 object S = arg6;
2164 object S1 = arg7;
2165 Variable F = new Variable();
2166 Variable Pos = new Variable();
2167 Variable L = new Variable();
2168 Variable O = new Variable();
2169 Variable Expr = new Variable();
2170 Variable S2 = new Variable();
2171 foreach (bool l2 in YP.unify(arg1, new Functor3(Atom.a("postfixop", Atom.a("")), new Functor2("/", F, Pos), L, O)))
2172 {
2173 if (YP.greaterThanOrEqual(Precedence, O))
2174 {
2175 if (YP.lessThanOrEqual(C, L))
2176 {
2177 foreach (bool l5 in YP.univ(Expr, ListPair.make(new object[] { F, Pos, Term })))
2178 {
2179 foreach (bool l6 in peepop(S1, S2))
2180 {
2181 foreach (bool l7 in exprtl(S2, O, Expr, Precedence, Answer, S))
2182 {
2183 yield return false;
2184 }
2185 }
2186 }
2187 yield break;
2188 }
2189 }
2190 }
2191 }
2192 {
2193 object C = arg2;
2194 object Term = arg3;
2195 object Precedence = arg4;
2196 object Answer = arg5;
2197 object S = arg6;
2198 object S1 = arg7;
2199 Variable Next = new Variable();
2200 Variable S2 = new Variable();
2201 foreach (bool l2 in YP.unify(arg1, Atom.a(",")))
2202 {
2203 if (YP.greaterThanOrEqual(Precedence, 1000))
2204 {
2205 if (YP.lessThan(C, 1000))
2206 {
2207 foreach (bool l5 in parse(S1, 1000, Next, S2))
2208 {
2209 foreach (bool l6 in exprtl(S2, 1000, new Functor2(",", Term, Next), Precedence, Answer, S))
2210 {
2211 yield return false;
2212 }
2213 }
2214 yield break;
2215 }
2216 }
2217 }
2218 }
2219 {
2220 object C = arg2;
2221 object Term = arg3;
2222 object Precedence = arg4;
2223 object Answer = arg5;
2224 object S = arg6;
2225 object S1 = arg7;
2226 Variable Next = new Variable();
2227 Variable S2 = new Variable();
2228 foreach (bool l2 in YP.unify(arg1, Atom.a("|")))
2229 {
2230 if (YP.greaterThanOrEqual(Precedence, 1100))
2231 {
2232 if (YP.lessThan(C, 1100))
2233 {
2234 foreach (bool l5 in parse(S1, 1100, Next, S2))
2235 {
2236 foreach (bool l6 in exprtl(S2, 1100, new Functor2(";", Term, Next), Precedence, Answer, S))
2237 {
2238 yield return false;
2239 }
2240 }
2241 yield break;
2242 }
2243 }
2244 }
2245 }
2246 {
2247 object Token = arg1;
2248 object x2 = arg2;
2249 object x4 = arg4;
2250 object Tokens = arg7;
2251 Variable Term = new Variable();
2252 foreach (bool l2 in YP.unify(arg3, Term))
2253 {
2254 foreach (bool l3 in YP.unify(arg5, Term))
2255 {
2256 foreach (bool l4 in YP.unify(arg6, new ListPair(Token, Tokens)))
2257 {
2258 yield return false;
2259 }
2260 }
2261 }
2262 }
2263 }
2264
2265 public static IEnumerable<bool> syntax_error(object _Message, object _List)
2266 {
2267 {
2268 yield break;
2269 }
2270 foreach (bool l1 in YP.fail())
2271 {
2272 yield return false;
2273 }
2274 }
2275
2276 public static IEnumerable<bool> syntax_error(object _List)
2277 {
2278 {
2279 yield break;
2280 }
2281 foreach (bool l1 in YP.fail())
2282 {
2283 yield return false;
2284 }
2285 }
2286
2287 public static IEnumerable<bool> prefixop(object F, object O, object Q)
2288 {
2289 {
2290 foreach (bool l2 in YP.current_op(O, Atom.a("fx"), F))
2291 {
2292 foreach (bool l3 in YP.unify(Q, YP.subtract(O, 1)))
2293 {
2294 yield return false;
2295 }
2296 goto cutIf1;
2297 }
2298 foreach (bool l2 in YP.current_op(O, Atom.a("fy"), F))
2299 {
2300 foreach (bool l3 in YP.unify(Q, O))
2301 {
2302 yield return false;
2303 }
2304 goto cutIf2;
2305 }
2306 cutIf2:
2307 cutIf1:
2308 { }
2309 }
2310 }
2311
2312 public static IEnumerable<bool> postfixop(object F, object P, object O)
2313 {
2314 {
2315 foreach (bool l2 in YP.current_op(O, Atom.a("xf"), F))
2316 {
2317 foreach (bool l3 in YP.unify(P, YP.subtract(O, 1)))
2318 {
2319 yield return false;
2320 }
2321 goto cutIf1;
2322 }
2323 foreach (bool l2 in YP.current_op(O, Atom.a("yf"), F))
2324 {
2325 foreach (bool l3 in YP.unify(P, O))
2326 {
2327 yield return false;
2328 }
2329 goto cutIf2;
2330 }
2331 cutIf2:
2332 cutIf1:
2333 { }
2334 }
2335 }
2336
2337 public static IEnumerable<bool> infixop(object F, object P, object O, object Q)
2338 {
2339 {
2340 foreach (bool l2 in YP.current_op(O, Atom.a("xfy"), F))
2341 {
2342 foreach (bool l3 in YP.unify(P, YP.subtract(O, 1)))
2343 {
2344 foreach (bool l4 in YP.unify(Q, O))
2345 {
2346 yield return false;
2347 }
2348 }
2349 goto cutIf1;
2350 }
2351 foreach (bool l2 in YP.current_op(O, Atom.a("xfx"), F))
2352 {
2353 foreach (bool l3 in YP.unify(P, YP.subtract(O, 1)))
2354 {
2355 foreach (bool l4 in YP.unify(Q, P))
2356 {
2357 yield return false;
2358 }
2359 }
2360 goto cutIf2;
2361 }
2362 foreach (bool l2 in YP.current_op(O, Atom.a("yfx"), F))
2363 {
2364 foreach (bool l3 in YP.unify(Q, YP.subtract(O, 1)))
2365 {
2366 foreach (bool l4 in YP.unify(P, O))
2367 {
2368 yield return false;
2369 }
2370 }
2371 goto cutIf3;
2372 }
2373 cutIf3:
2374 cutIf2:
2375 cutIf1:
2376 { }
2377 }
2378 }
2379
2380 public static IEnumerable<bool> ambigop(object F, object Precedence, object L1, object O1, object R1, object L2, object O2)
2381 {
2382 {
2383 foreach (bool l2 in postfixop(F, L2, O2))
2384 {
2385 if (YP.lessThanOrEqual(O2, Precedence))
2386 {
2387 foreach (bool l4 in infixop(F, L1, O1, R1))
2388 {
2389 if (YP.lessThanOrEqual(O1, Precedence))
2390 {
2391 yield return false;
2392 }
2393 }
2394 }
2395 }
2396 }
2397 }
2398
2399 public static IEnumerable<bool> read_tokens1(object arg1)
2400 {
2401 {
2402 object TokenList = arg1;
2403 Variable C1 = new Variable();
2404 Variable _X = new Variable();
2405 Variable ListOfTokens = new Variable();
2406 foreach (bool l2 in YP.get_code(C1))
2407 {
2408 foreach (bool l3 in read_tokens(C1, _X, ListOfTokens))
2409 {
2410 foreach (bool l4 in YP.unify(TokenList, ListOfTokens))
2411 {
2412 yield return false;
2413 }
2414 yield break;
2415 }
2416 }
2417 }
2418 {
2419 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("atom", Atom.a("end_of_file"), 0), Atom.NIL)))
2420 {
2421 yield return false;
2422 }
2423 }
2424 }
2425
2426 public static IEnumerable<bool> read_tokens2(object arg1, object arg2)
2427 {
2428 {
2429 object TokenList = arg1;
2430 object Dictionary = arg2;
2431 Variable C1 = new Variable();
2432 Variable Dict = new Variable();
2433 Variable ListOfTokens = new Variable();
2434 foreach (bool l2 in YP.get_code(C1))
2435 {
2436 foreach (bool l3 in read_tokens(C1, Dict, ListOfTokens))
2437 {
2438 foreach (bool l4 in terminate_list(Dict))
2439 {
2440 foreach (bool l5 in YP.unify(Dictionary, Dict))
2441 {
2442 foreach (bool l6 in YP.unify(TokenList, ListOfTokens))
2443 {
2444 yield return false;
2445 }
2446 }
2447 yield break;
2448 }
2449 }
2450 }
2451 }
2452 {
2453 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("atom", Atom.a("end_of_file"), 0), Atom.NIL)))
2454 {
2455 foreach (bool l3 in YP.unify(arg2, Atom.NIL))
2456 {
2457 yield return false;
2458 }
2459 }
2460 }
2461 }
2462
2463 public static IEnumerable<bool> terminate_list(object arg1)
2464 {
2465 {
2466 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
2467 {
2468 yield return false;
2469 }
2470 }
2471 {
2472 Variable x1 = new Variable();
2473 Variable Tail = new Variable();
2474 foreach (bool l2 in YP.unify(arg1, new ListPair(x1, Tail)))
2475 {
2476 foreach (bool l3 in terminate_list(Tail))
2477 {
2478 yield return false;
2479 }
2480 }
2481 }
2482 }
2483
2484 public static IEnumerable<bool> read_special(object arg1, object Dict, object arg3)
2485 {
2486 {
2487 object Tokens = arg3;
2488 foreach (bool l2 in YP.unify(arg1, 95))
2489 {
2490 foreach (bool l3 in read_variable(95, Dict, Tokens))
2491 {
2492 yield return false;
2493 }
2494 }
2495 }
2496 {
2497 object Tokens = arg3;
2498 foreach (bool l2 in YP.unify(arg1, 247))
2499 {
2500 foreach (bool l3 in read_symbol(247, Dict, Tokens))
2501 {
2502 yield return false;
2503 }
2504 }
2505 }
2506 {
2507 object Tokens = arg3;
2508 foreach (bool l2 in YP.unify(arg1, 215))
2509 {
2510 foreach (bool l3 in read_symbol(215, Dict, Tokens))
2511 {
2512 yield return false;
2513 }
2514 }
2515 }
2516 {
2517 Variable StartPos = new Variable();
2518 Variable EndPos = new Variable();
2519 Variable Tokens = new Variable();
2520 Variable Ch = new Variable();
2521 Variable NextCh = new Variable();
2522 foreach (bool l2 in YP.unify(arg1, 37))
2523 {
2524 foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("comment", StartPos, EndPos), Tokens)))
2525 {
2526 foreach (bool l4 in get_current_position(StartPos))
2527 {
2528 foreach (bool l5 in YP.repeat())
2529 {
2530 foreach (bool l6 in YP.get_code(Ch))
2531 {
2532 if (YP.lessThan(Ch, new ListPair(32, Atom.NIL)))
2533 {
2534 if (YP.notEqual(Ch, 9))
2535 {
2536 if (YP.termNotEqual(Ch, -1))
2537 {
2538 foreach (bool l10 in get_current_position(EndPos))
2539 {
2540 foreach (bool l11 in YP.get_code(NextCh))
2541 {
2542 foreach (bool l12 in read_tokens(NextCh, Dict, Tokens))
2543 {
2544 yield return false;
2545 }
2546 }
2547 }
2548 }
2549 yield break;
2550 }
2551 }
2552 }
2553 }
2554 }
2555 }
2556 }
2557 }
2558 {
2559 object T = arg3;
2560 Variable C2 = new Variable();
2561 Variable StartPos = new Variable();
2562 Variable EndPos = new Variable();
2563 Variable Tokens = new Variable();
2564 Variable StartPos1 = new Variable();
2565 Variable NextCh = new Variable();
2566 Variable Chars = new Variable();
2567 foreach (bool l2 in YP.unify(arg1, 47))
2568 {
2569 foreach (bool l3 in YP.get_code(C2))
2570 {
2571 if (YP.equal(C2, new ListPair(42, Atom.NIL)))
2572 {
2573 foreach (bool l5 in YP.unify(T, new ListPair(new Functor2("comment", StartPos, EndPos), Tokens)))
2574 {
2575 foreach (bool l6 in get_current_position(StartPos1))
2576 {
2577 foreach (bool l7 in YP.unify(StartPos, YP.subtract(StartPos1, 1)))
2578 {
2579 foreach (bool l8 in read_solidus(32, NextCh))
2580 {
2581 foreach (bool l9 in get_current_position(EndPos))
2582 {
2583 foreach (bool l10 in read_tokens(NextCh, Dict, Tokens))
2584 {
2585 yield return false;
2586 }
2587 }
2588 }
2589 }
2590 }
2591 }
2592 goto cutIf1;
2593 }
2594 foreach (bool l4 in YP.unify(T, Tokens))
2595 {
2596 foreach (bool l5 in rest_symbol(C2, Chars, NextCh))
2597 {
2598 foreach (bool l6 in read_after_atom4(NextCh, Dict, Tokens, new ListPair(47, Chars)))
2599 {
2600 yield return false;
2601 }
2602 }
2603 }
2604 cutIf1:
2605 { }
2606 }
2607 }
2608 }
2609 {
2610 Variable Pos = new Variable();
2611 Variable Tokens = new Variable();
2612 Variable NextCh = new Variable();
2613 foreach (bool l2 in YP.unify(arg1, 33))
2614 {
2615 foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("atom", Atom.a("!"), Pos), Tokens)))
2616 {
2617 foreach (bool l4 in get_current_position(Pos))
2618 {
2619 foreach (bool l5 in YP.get_code(NextCh))
2620 {
2621 foreach (bool l6 in read_after_atom(NextCh, Dict, Tokens))
2622 {
2623 yield return false;
2624 }
2625 }
2626 }
2627 }
2628 }
2629 }
2630 {
2631 Variable Tokens = new Variable();
2632 Variable NextCh = new Variable();
2633 foreach (bool l2 in YP.unify(arg1, 40))
2634 {
2635 foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a(" ("), Tokens)))
2636 {
2637 foreach (bool l4 in YP.get_code(NextCh))
2638 {
2639 foreach (bool l5 in read_tokens(NextCh, Dict, Tokens))
2640 {
2641 yield return false;
2642 }
2643 }
2644 }
2645 }
2646 }
2647 {
2648 Variable Tokens = new Variable();
2649 Variable NextCh = new Variable();
2650 foreach (bool l2 in YP.unify(arg1, 41))
2651 {
2652 foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a(")"), Tokens)))
2653 {
2654 foreach (bool l4 in YP.get_code(NextCh))
2655 {
2656 foreach (bool l5 in read_tokens(NextCh, Dict, Tokens))
2657 {
2658 yield return false;
2659 }
2660 }
2661 }
2662 }
2663 }
2664 {
2665 Variable Tokens = new Variable();
2666 Variable NextCh = new Variable();
2667 foreach (bool l2 in YP.unify(arg1, 44))
2668 {
2669 foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a(","), Tokens)))
2670 {
2671 foreach (bool l4 in YP.get_code(NextCh))
2672 {
2673 foreach (bool l5 in read_tokens(NextCh, Dict, Tokens))
2674 {
2675 yield return false;
2676 }
2677 }
2678 }
2679 }
2680 }
2681 {
2682 Variable Pos = new Variable();
2683 Variable Tokens = new Variable();
2684 Variable NextCh = new Variable();
2685 foreach (bool l2 in YP.unify(arg1, 59))
2686 {
2687 foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("atom", Atom.a(";"), Pos), Tokens)))
2688 {
2689 foreach (bool l4 in get_current_position(Pos))
2690 {
2691 foreach (bool l5 in YP.get_code(NextCh))
2692 {
2693 foreach (bool l6 in read_after_atom(NextCh, Dict, Tokens))
2694 {
2695 yield return false;
2696 }
2697 }
2698 }
2699 }
2700 }
2701 }
2702 {
2703 Variable Pos = new Variable();
2704 Variable Tokens = new Variable();
2705 Variable NextCh = new Variable();
2706 foreach (bool l2 in YP.unify(arg1, 91))
2707 {
2708 foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("/", Atom.a("["), Pos), Tokens)))
2709 {
2710 foreach (bool l4 in get_current_position(Pos))
2711 {
2712 foreach (bool l5 in YP.get_code(NextCh))
2713 {
2714 foreach (bool l6 in read_tokens(NextCh, Dict, Tokens))
2715 {
2716 yield return false;
2717 }
2718 }
2719 }
2720 }
2721 }
2722 }
2723 {
2724 Variable Pos = new Variable();
2725 Variable Tokens = new Variable();
2726 Variable NextCh = new Variable();
2727 foreach (bool l2 in YP.unify(arg1, 93))
2728 {
2729 foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("/", Atom.a("]"), Pos), Tokens)))
2730 {
2731 foreach (bool l4 in get_current_position(Pos))
2732 {
2733 foreach (bool l5 in YP.get_code(NextCh))
2734 {
2735 foreach (bool l6 in read_after_atom(NextCh, Dict, Tokens))
2736 {
2737 yield return false;
2738 }
2739 }
2740 }
2741 }
2742 }
2743 }
2744 {
2745 Variable Pos = new Variable();
2746 Variable Tokens = new Variable();
2747 Variable NextCh = new Variable();
2748 foreach (bool l2 in YP.unify(arg1, 123))
2749 {
2750 foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("/", Atom.a("{"), Pos), Tokens)))
2751 {
2752 foreach (bool l4 in get_current_position(Pos))
2753 {
2754 foreach (bool l5 in YP.get_code(NextCh))
2755 {
2756 foreach (bool l6 in read_tokens(NextCh, Dict, Tokens))
2757 {
2758 yield return false;
2759 }
2760 }
2761 }
2762 }
2763 }
2764 }
2765 {
2766 Variable Tokens = new Variable();
2767 Variable NextCh = new Variable();
2768 foreach (bool l2 in YP.unify(arg1, 124))
2769 {
2770 foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a("|"), Tokens)))
2771 {
2772 foreach (bool l4 in YP.get_code(NextCh))
2773 {
2774 foreach (bool l5 in read_tokens(NextCh, Dict, Tokens))
2775 {
2776 yield return false;
2777 }
2778 }
2779 }
2780 }
2781 }
2782 {
2783 Variable Tokens = new Variable();
2784 Variable NextCh = new Variable();
2785 foreach (bool l2 in YP.unify(arg1, 125))
2786 {
2787 foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a("}"), Tokens)))
2788 {
2789 foreach (bool l4 in YP.get_code(NextCh))
2790 {
2791 foreach (bool l5 in read_after_atom(NextCh, Dict, Tokens))
2792 {
2793 yield return false;
2794 }
2795 }
2796 }
2797 }
2798 }
2799 {
2800 object Tokens = arg3;
2801 Variable NextCh = new Variable();
2802 foreach (bool l2 in YP.unify(arg1, 46))
2803 {
2804 foreach (bool l3 in YP.get_code(NextCh))
2805 {
2806 foreach (bool l4 in read_fullstop(NextCh, Dict, Tokens))
2807 {
2808 yield return false;
2809 }
2810 }
2811 }
2812 }
2813 {
2814 Variable Chars = new Variable();
2815 Variable Tokens = new Variable();
2816 Variable NextCh = new Variable();
2817 foreach (bool l2 in YP.unify(arg1, 34))
2818 {
2819 foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor1("string", Chars), Tokens)))
2820 {
2821 foreach (bool l4 in read_string(Chars, 34, NextCh))
2822 {
2823 foreach (bool l5 in read_tokens(NextCh, Dict, Tokens))
2824 {
2825 yield return false;
2826 }
2827 }
2828 }
2829 }
2830 }
2831 {
2832 object Tokens = arg3;
2833 Variable Chars = new Variable();
2834 Variable NextCh = new Variable();
2835 foreach (bool l2 in YP.unify(arg1, 39))
2836 {
2837 foreach (bool l3 in read_string(Chars, 39, NextCh))
2838 {
2839 foreach (bool l4 in read_after_atom4(NextCh, Dict, Tokens, Chars))
2840 {
2841 yield return false;
2842 }
2843 }
2844 }
2845 }
2846 {
2847 object Tokens = arg3;
2848 foreach (bool l2 in YP.unify(arg1, 35))
2849 {
2850 foreach (bool l3 in read_symbol(35, Dict, Tokens))
2851 {
2852 yield return false;
2853 }
2854 }
2855 }
2856 {
2857 object Tokens = arg3;
2858 foreach (bool l2 in YP.unify(arg1, 36))
2859 {
2860 foreach (bool l3 in read_symbol(36, Dict, Tokens))
2861 {
2862 yield return false;
2863 }
2864 }
2865 }
2866 {
2867 object Tokens = arg3;
2868 foreach (bool l2 in YP.unify(arg1, 38))
2869 {
2870 foreach (bool l3 in read_symbol(38, Dict, Tokens))
2871 {
2872 yield return false;
2873 }
2874 }
2875 }
2876 {
2877 object Tokens = arg3;
2878 foreach (bool l2 in YP.unify(arg1, 42))
2879 {
2880 foreach (bool l3 in read_symbol(42, Dict, Tokens))
2881 {
2882 yield return false;
2883 }
2884 }
2885 }
2886 {
2887 object Tokens = arg3;
2888 foreach (bool l2 in YP.unify(arg1, 43))
2889 {
2890 foreach (bool l3 in read_symbol(43, Dict, Tokens))
2891 {
2892 yield return false;
2893 }
2894 }
2895 }
2896 {
2897 object Tokens = arg3;
2898 foreach (bool l2 in YP.unify(arg1, 45))
2899 {
2900 foreach (bool l3 in read_symbol(45, Dict, Tokens))
2901 {
2902 yield return false;
2903 }
2904 }
2905 }
2906 {
2907 object Tokens = arg3;
2908 foreach (bool l2 in YP.unify(arg1, 58))
2909 {
2910 foreach (bool l3 in read_symbol(58, Dict, Tokens))
2911 {
2912 yield return false;
2913 }
2914 }
2915 }
2916 {
2917 object Tokens = arg3;
2918 foreach (bool l2 in YP.unify(arg1, 60))
2919 {
2920 foreach (bool l3 in read_symbol(60, Dict, Tokens))
2921 {
2922 yield return false;
2923 }
2924 }
2925 }
2926 {
2927 object Tokens = arg3;
2928 foreach (bool l2 in YP.unify(arg1, 61))
2929 {
2930 foreach (bool l3 in read_symbol(61, Dict, Tokens))
2931 {
2932 yield return false;
2933 }
2934 }
2935 }
2936 {
2937 object Tokens = arg3;
2938 foreach (bool l2 in YP.unify(arg1, 62))
2939 {
2940 foreach (bool l3 in read_symbol(62, Dict, Tokens))
2941 {
2942 yield return false;
2943 }
2944 }
2945 }
2946 {
2947 object Tokens = arg3;
2948 foreach (bool l2 in YP.unify(arg1, 63))
2949 {
2950 foreach (bool l3 in read_symbol(63, Dict, Tokens))
2951 {
2952 yield return false;
2953 }
2954 }
2955 }
2956 {
2957 object Tokens = arg3;
2958 foreach (bool l2 in YP.unify(arg1, 64))
2959 {
2960 foreach (bool l3 in read_symbol(64, Dict, Tokens))
2961 {
2962 yield return false;
2963 }
2964 }
2965 }
2966 {
2967 object Tokens = arg3;
2968 foreach (bool l2 in YP.unify(arg1, 92))
2969 {
2970 foreach (bool l3 in read_symbol(92, Dict, Tokens))
2971 {
2972 yield return false;
2973 }
2974 }
2975 }
2976 {
2977 object Tokens = arg3;
2978 foreach (bool l2 in YP.unify(arg1, 94))
2979 {
2980 foreach (bool l3 in read_symbol(94, Dict, Tokens))
2981 {
2982 yield return false;
2983 }
2984 }
2985 }
2986 {
2987 object Tokens = arg3;
2988 foreach (bool l2 in YP.unify(arg1, 96))
2989 {
2990 foreach (bool l3 in read_symbol(96, Dict, Tokens))
2991 {
2992 yield return false;
2993 }
2994 }
2995 }
2996 {
2997 object Tokens = arg3;
2998 foreach (bool l2 in YP.unify(arg1, 126))
2999 {
3000 foreach (bool l3 in read_symbol(126, Dict, Tokens))
3001 {
3002 yield return false;
3003 }
3004 }
3005 }
3006 }
3007
3008 public static IEnumerable<bool> read_symbol(object C1, object Dict, object Tokens)
3009 {
3010 {
3011 Variable C2 = new Variable();
3012 Variable Chars = new Variable();
3013 Variable NextCh = new Variable();
3014 foreach (bool l2 in YP.get_code(C2))
3015 {
3016 foreach (bool l3 in rest_symbol(C2, Chars, NextCh))
3017 {
3018 foreach (bool l4 in read_after_atom4(NextCh, Dict, Tokens, new ListPair(C1, Chars)))
3019 {
3020 yield return false;
3021 }
3022 }
3023 }
3024 }
3025 }
3026
3027 public static IEnumerable<bool> rest_symbol(object arg1, object arg2, object arg3)
3028 {
3029 {
3030 object C2 = arg1;
3031 object LastCh = arg3;
3032 Variable Chars = new Variable();
3033 Variable NextCh = new Variable();
3034 foreach (bool l2 in YP.unify(arg2, new ListPair(C2, Chars)))
3035 {
3036 if (YP.greaterThan(C2, 160))
3037 {
3038 if (YP.lessThan(C2, 192))
3039 {
3040 if (YP.notEqual(C2, 186))
3041 {
3042 if (YP.notEqual(C2, 170))
3043 {
3044 foreach (bool l7 in YP.get_code(NextCh))
3045 {
3046 foreach (bool l8 in rest_symbol(NextCh, Chars, LastCh))
3047 {
3048 yield return false;
3049 }
3050 }
3051 yield break;
3052 }
3053 }
3054 }
3055 goto cutIf1;
3056 }
3057 foreach (bool l3 in symbol_char(C2))
3058 {
3059 foreach (bool l4 in YP.get_code(NextCh))
3060 {
3061 foreach (bool l5 in rest_symbol(NextCh, Chars, LastCh))
3062 {
3063 yield return false;
3064 }
3065 }
3066 yield break;
3067 }
3068 cutIf1:
3069 { }
3070 }
3071 }
3072 {
3073 Variable C2 = new Variable();
3074 foreach (bool l2 in YP.unify(arg1, C2))
3075 {
3076 foreach (bool l3 in YP.unify(arg2, Atom.NIL))
3077 {
3078 foreach (bool l4 in YP.unify(arg3, C2))
3079 {
3080 yield return false;
3081 }
3082 }
3083 }
3084 }
3085 }
3086
3087 public static IEnumerable<bool> symbol_char(object arg1)
3088 {
3089 {
3090 foreach (bool l2 in YP.unify(arg1, 35))
3091 {
3092 yield return false;
3093 }
3094 }
3095 {
3096 foreach (bool l2 in YP.unify(arg1, 36))
3097 {
3098 yield return false;
3099 }
3100 }
3101 {
3102 foreach (bool l2 in YP.unify(arg1, 38))
3103 {
3104 yield return false;
3105 }
3106 }
3107 {
3108 foreach (bool l2 in YP.unify(arg1, 42))
3109 {
3110 yield return false;
3111 }
3112 }
3113 {
3114 foreach (bool l2 in YP.unify(arg1, 43))
3115 {
3116 yield return false;
3117 }
3118 }
3119 {
3120 foreach (bool l2 in YP.unify(arg1, 45))
3121 {
3122 yield return false;
3123 }
3124 }
3125 {
3126 foreach (bool l2 in YP.unify(arg1, 46))
3127 {
3128 yield return false;
3129 }
3130 }
3131 {
3132 foreach (bool l2 in YP.unify(arg1, 47))
3133 {
3134 yield return false;
3135 }
3136 }
3137 {
3138 foreach (bool l2 in YP.unify(arg1, 58))
3139 {
3140 yield return false;
3141 }
3142 }
3143 {
3144 foreach (bool l2 in YP.unify(arg1, 60))
3145 {
3146 yield return false;
3147 }
3148 }
3149 {
3150 foreach (bool l2 in YP.unify(arg1, 61))
3151 {
3152 yield return false;
3153 }
3154 }
3155 {
3156 foreach (bool l2 in YP.unify(arg1, 62))
3157 {
3158 yield return false;
3159 }
3160 }
3161 {
3162 foreach (bool l2 in YP.unify(arg1, 63))
3163 {
3164 yield return false;
3165 }
3166 }
3167 {
3168 foreach (bool l2 in YP.unify(arg1, 64))
3169 {
3170 yield return false;
3171 }
3172 }
3173 {
3174 foreach (bool l2 in YP.unify(arg1, 92))
3175 {
3176 yield return false;
3177 }
3178 }
3179 {
3180 foreach (bool l2 in YP.unify(arg1, 94))
3181 {
3182 yield return false;
3183 }
3184 }
3185 {
3186 foreach (bool l2 in YP.unify(arg1, 96))
3187 {
3188 yield return false;
3189 }
3190 }
3191 {
3192 foreach (bool l2 in YP.unify(arg1, 126))
3193 {
3194 yield return false;
3195 }
3196 }
3197 }
3198
3199 public static IEnumerable<bool> get_current_position(object Pos)
3200 {
3201 {
3202 foreach (bool l2 in YP.unify(Pos, 0))
3203 {
3204 yield return false;
3205 }
3206 }
3207 }
3208
3209 public static IEnumerable<bool> read_after_atom4(object Ch, object Dict, object arg3, object Chars)
3210 {
3211 {
3212 Variable Atom_1 = new Variable();
3213 Variable Pos = new Variable();
3214 Variable Tokens = new Variable();
3215 foreach (bool l2 in YP.unify(arg3, new ListPair(new Functor2("atom", Atom_1, Pos), Tokens)))
3216 {
3217 foreach (bool l3 in YP.unify(Pos, 0))
3218 {
3219 foreach (bool l4 in YP.atom_codes(Atom_1, Chars))
3220 {
3221 foreach (bool l5 in read_after_atom(Ch, Dict, Tokens))
3222 {
3223 yield return false;
3224 }
3225 }
3226 }
3227 }
3228 }
3229 }
3230
3231 public static IEnumerable<bool> read_after_atom(object arg1, object Dict, object arg3)
3232 {
3233 {
3234 Variable Tokens = new Variable();
3235 Variable NextCh = new Variable();
3236 foreach (bool l2 in YP.unify(arg1, 40))
3237 {
3238 foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a("("), Tokens)))
3239 {
3240 foreach (bool l4 in YP.get_code(NextCh))
3241 {
3242 foreach (bool l5 in read_tokens(NextCh, Dict, Tokens))
3243 {
3244 yield return false;
3245 }
3246 }
3247 yield break;
3248 }
3249 }
3250 }
3251 {
3252 object Ch = arg1;
3253 object Tokens = arg3;
3254 foreach (bool l2 in read_tokens(Ch, Dict, Tokens))
3255 {
3256 yield return false;
3257 }
3258 }
3259 }
3260
3261 public static IEnumerable<bool> read_string(object Chars, object Quote, object NextCh)
3262 {
3263 {
3264 Variable Ch = new Variable();
3265 Variable Char = new Variable();
3266 Variable Next = new Variable();
3267 foreach (bool l2 in YP.get_code(Ch))
3268 {
3269 foreach (bool l3 in read_char(Ch, Quote, Char, Next))
3270 {
3271 foreach (bool l4 in rest_string5(Char, Next, Chars, Quote, NextCh))
3272 {
3273 yield return false;
3274 }
3275 }
3276 }
3277 }
3278 }
3279
3280 public static IEnumerable<bool> rest_string5(object arg1, object arg2, object arg3, object arg4, object arg5)
3281 {
3282 {
3283 object _X = arg4;
3284 Variable NextCh = new Variable();
3285 foreach (bool l2 in YP.unify(arg1, -1))
3286 {
3287 foreach (bool l3 in YP.unify(arg2, NextCh))
3288 {
3289 foreach (bool l4 in YP.unify(arg3, Atom.NIL))
3290 {
3291 foreach (bool l5 in YP.unify(arg5, NextCh))
3292 {
3293 yield return true;
3294 yield break;
3295 }
3296 }
3297 }
3298 }
3299 }
3300 {
3301 object Char = arg1;
3302 object Next = arg2;
3303 object Quote = arg4;
3304 object NextCh = arg5;
3305 Variable Chars = new Variable();
3306 Variable Char2 = new Variable();
3307 Variable Next2 = new Variable();
3308 foreach (bool l2 in YP.unify(arg3, new ListPair(Char, Chars)))
3309 {
3310 foreach (bool l3 in read_char(Next, Quote, Char2, Next2))
3311 {
3312 foreach (bool l4 in rest_string5(Char2, Next2, Chars, Quote, NextCh))
3313 {
3314 yield return false;
3315 }
3316 }
3317 }
3318 }
3319 }
3320
3321 public static IEnumerable<bool> escape_char(object arg1, object arg2)
3322 {
3323 {
3324 foreach (bool l2 in YP.unify(arg1, 110))
3325 {
3326 foreach (bool l3 in YP.unify(arg2, 10))
3327 {
3328 yield return false;
3329 }
3330 }
3331 }
3332 {
3333 foreach (bool l2 in YP.unify(arg1, 78))
3334 {
3335 foreach (bool l3 in YP.unify(arg2, 10))
3336 {
3337 yield return false;
3338 }
3339 }
3340 }
3341 {
3342 foreach (bool l2 in YP.unify(arg1, 116))
3343 {
3344 foreach (bool l3 in YP.unify(arg2, 9))
3345 {
3346 yield return false;
3347 }
3348 }
3349 }
3350 {
3351 foreach (bool l2 in YP.unify(arg1, 84))
3352 {
3353 foreach (bool l3 in YP.unify(arg2, 9))
3354 {
3355 yield return false;
3356 }
3357 }
3358 }
3359 {
3360 foreach (bool l2 in YP.unify(arg1, 114))
3361 {
3362 foreach (bool l3 in YP.unify(arg2, 13))
3363 {
3364 yield return false;
3365 }
3366 }
3367 }
3368 {
3369 foreach (bool l2 in YP.unify(arg1, 82))
3370 {
3371 foreach (bool l3 in YP.unify(arg2, 13))
3372 {
3373 yield return false;
3374 }
3375 }
3376 }
3377 {
3378 foreach (bool l2 in YP.unify(arg1, 118))
3379 {
3380 foreach (bool l3 in YP.unify(arg2, 11))
3381 {
3382 yield return false;
3383 }
3384 }
3385 }
3386 {
3387 foreach (bool l2 in YP.unify(arg1, 86))
3388 {
3389 foreach (bool l3 in YP.unify(arg2, 11))
3390 {
3391 yield return false;
3392 }
3393 }
3394 }
3395 {
3396 foreach (bool l2 in YP.unify(arg1, 98))
3397 {
3398 foreach (bool l3 in YP.unify(arg2, 8))
3399 {
3400 yield return false;
3401 }
3402 }
3403 }
3404 {
3405 foreach (bool l2 in YP.unify(arg1, 66))
3406 {
3407 foreach (bool l3 in YP.unify(arg2, 8))
3408 {
3409 yield return false;
3410 }
3411 }
3412 }
3413 {
3414 foreach (bool l2 in YP.unify(arg1, 102))
3415 {
3416 foreach (bool l3 in YP.unify(arg2, 12))
3417 {
3418 yield return false;
3419 }
3420 }
3421 }
3422 {
3423 foreach (bool l2 in YP.unify(arg1, 70))
3424 {
3425 foreach (bool l3 in YP.unify(arg2, 12))
3426 {
3427 yield return false;
3428 }
3429 }
3430 }
3431 {
3432 foreach (bool l2 in YP.unify(arg1, 101))
3433 {
3434 foreach (bool l3 in YP.unify(arg2, 27))
3435 {
3436 yield return false;
3437 }
3438 }
3439 }
3440 {
3441 foreach (bool l2 in YP.unify(arg1, 69))
3442 {
3443 foreach (bool l3 in YP.unify(arg2, 27))
3444 {
3445 yield return false;
3446 }
3447 }
3448 }
3449 {
3450 foreach (bool l2 in YP.unify(arg1, 100))
3451 {
3452 foreach (bool l3 in YP.unify(arg2, 127))
3453 {
3454 yield return false;
3455 }
3456 }
3457 }
3458 {
3459 foreach (bool l2 in YP.unify(arg1, 68))
3460 {
3461 foreach (bool l3 in YP.unify(arg2, 127))
3462 {
3463 yield return false;
3464 }
3465 }
3466 }
3467 {
3468 foreach (bool l2 in YP.unify(arg1, 115))
3469 {
3470 foreach (bool l3 in YP.unify(arg2, 32))
3471 {
3472 yield return false;
3473 }
3474 }
3475 }
3476 {
3477 foreach (bool l2 in YP.unify(arg1, 83))
3478 {
3479 foreach (bool l3 in YP.unify(arg2, 32))
3480 {
3481 yield return false;
3482 }
3483 }
3484 }
3485 {
3486 foreach (bool l2 in YP.unify(arg1, 122))
3487 {
3488 foreach (bool l3 in YP.unify(arg2, -1))
3489 {
3490 yield return false;
3491 }
3492 }
3493 }
3494 {
3495 foreach (bool l2 in YP.unify(arg1, 90))
3496 {
3497 foreach (bool l3 in YP.unify(arg2, -1))
3498 {
3499 yield return false;
3500 }
3501 }
3502 }
3503 }
3504
3505 public static IEnumerable<bool> read_variable(object C1, object Dict, object arg3)
3506 {
3507 {
3508 Variable Var = new Variable();
3509 Variable Name = new Variable();
3510 Variable StartPos = new Variable();
3511 Variable Tokens = new Variable();
3512 Variable Chars = new Variable();
3513 Variable NextCh = new Variable();
3514 foreach (bool l2 in YP.unify(arg3, new ListPair(new Functor3("var", Var, Name, StartPos), Tokens)))
3515 {
3516 foreach (bool l3 in get_current_position(StartPos))
3517 {
3518 foreach (bool l4 in read_name(C1, Chars, NextCh))
3519 {
3520 foreach (bool l5 in YP.atom_codes(Name, Chars))
3521 {
3522 if (YP.termEqual(Name, Atom.a("_")))
3523 {
3524 foreach (bool l7 in read_after_atom(NextCh, Dict, Tokens))
3525 {
3526 yield return false;
3527 }
3528 goto cutIf1;
3529 }
3530 foreach (bool l6 in read_lookup(Dict, Name, Var))
3531 {
3532 foreach (bool l7 in read_after_atom(NextCh, Dict, Tokens))
3533 {
3534 yield return false;
3535 }
3536 }
3537 cutIf1:
3538 { }
3539 }
3540 }
3541 }
3542 }
3543 }
3544 }
3545
3546 public static IEnumerable<bool> read_lookup(object arg1, object Name, object Var)
3547 {
3548 {
3549 Variable N = new Variable();
3550 Variable V = new Variable();
3551 Variable L = new Variable();
3552 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("=", N, V), L)))
3553 {
3554 foreach (bool l3 in YP.unify(N, Name))
3555 {
3556 foreach (bool l4 in YP.unify(V, Var))
3557 {
3558 yield return false;
3559 }
3560 goto cutIf1;
3561 }
3562 foreach (bool l3 in read_lookup(L, Name, Var))
3563 {
3564 yield return false;
3565 }
3566 cutIf1:
3567 { }
3568 }
3569 }
3570 }
3571
3572 public static IEnumerable<bool> read_solidus(object Ch, object LastCh)
3573 {
3574 {
3575 Variable NextCh = new Variable();
3576 if (YP.equal(Ch, 42))
3577 {
3578 foreach (bool l3 in YP.get_code(NextCh))
3579 {
3580 if (YP.equal(NextCh, 47))
3581 {
3582 foreach (bool l5 in YP.get_code(LastCh))
3583 {
3584 yield return false;
3585 }
3586 goto cutIf2;
3587 }
3588 foreach (bool l4 in read_solidus(NextCh, LastCh))
3589 {
3590 yield return false;
3591 }
3592 cutIf2:
3593 { }
3594 }
3595 goto cutIf1;
3596 }
3597 if (YP.notEqual(Ch, -1))
3598 {
3599 foreach (bool l3 in YP.get_code(NextCh))
3600 {
3601 foreach (bool l4 in read_solidus(NextCh, LastCh))
3602 {
3603 yield return false;
3604 }
3605 }
3606 goto cutIf3;
3607 }
3608 foreach (bool l2 in YP.unify(LastCh, Ch))
3609 {
3610 foreach (bool l3 in formatError(Atom.a("user_error"), Atom.a("~N** end of file in /*comment~n"), Atom.NIL))
3611 {
3612 yield return false;
3613 }
3614 }
3615 cutIf3:
3616 cutIf1:
3617 { }
3618 }
3619 }
3620
3621 public static IEnumerable<bool> read_identifier(object C1, object Dict, object Tokens)
3622 {
3623 {
3624 Variable Chars = new Variable();
3625 Variable NextCh = new Variable();
3626 foreach (bool l2 in read_name(C1, Chars, NextCh))
3627 {
3628 foreach (bool l3 in read_after_atom4(NextCh, Dict, Tokens, Chars))
3629 {
3630 yield return false;
3631 }
3632 }
3633 }
3634 }
3635
3636 public static IEnumerable<bool> read_name(object C1, object arg2, object LastCh)
3637 {
3638 {
3639 Variable Chars = new Variable();
3640 Variable C2 = new Variable();
3641 foreach (bool l2 in YP.unify(arg2, new ListPair(C1, Chars)))
3642 {
3643 foreach (bool l3 in YP.get_code(C2))
3644 {
3645 if (YP.greaterThanOrEqual(C2, new ListPair(97, Atom.NIL)))
3646 {
3647 if (YP.lessThanOrEqual(C2, new ListPair(122, Atom.NIL)))
3648 {
3649 foreach (bool l6 in read_name(C2, Chars, LastCh))
3650 {
3651 yield return false;
3652 }
3653 goto cutIf2;
3654 }
3655 if (YP.lessThan(C2, 192))
3656 {
3657 if (YP.notEqual(YP.bitwiseOr(C2, 16), 186))
3658 {
3659 foreach (bool l7 in YP.unify(Chars, Atom.NIL))
3660 {
3661 foreach (bool l8 in YP.unify(LastCh, C2))
3662 {
3663 yield return false;
3664 }
3665 }
3666 goto cutIf3;
3667 }
3668 }
3669 if (YP.equal(YP.bitwiseOr(C2, 32), 247))
3670 {
3671 foreach (bool l6 in YP.unify(Chars, Atom.NIL))
3672 {
3673 foreach (bool l7 in YP.unify(LastCh, C2))
3674 {
3675 yield return false;
3676 }
3677 }
3678 goto cutIf4;
3679 }
3680 foreach (bool l5 in read_name(C2, Chars, LastCh))
3681 {
3682 yield return false;
3683 }
3684 cutIf4:
3685 cutIf3:
3686 cutIf2:
3687 goto cutIf1;
3688 }
3689 if (YP.greaterThanOrEqual(C2, new ListPair(65, Atom.NIL)))
3690 {
3691 if (YP.greaterThan(C2, new ListPair(90, Atom.NIL)))
3692 {
3693 if (YP.notEqual(C2, new ListPair(95, Atom.NIL)))
3694 {
3695 foreach (bool l7 in YP.unify(Chars, Atom.NIL))
3696 {
3697 foreach (bool l8 in YP.unify(LastCh, C2))
3698 {
3699 yield return false;
3700 }
3701 }
3702 goto cutIf6;
3703 }
3704 }
3705 foreach (bool l5 in read_name(C2, Chars, LastCh))
3706 {
3707 yield return false;
3708 }
3709 cutIf6:
3710 goto cutIf5;
3711 }
3712 if (YP.greaterThanOrEqual(C2, new ListPair(48, Atom.NIL)))
3713 {
3714 if (YP.lessThanOrEqual(C2, new ListPair(57, Atom.NIL)))
3715 {
3716 foreach (bool l6 in read_name(C2, Chars, LastCh))
3717 {
3718 yield return false;
3719 }
3720 goto cutIf7;
3721 }
3722 }
3723 foreach (bool l4 in YP.unify(Chars, Atom.NIL))
3724 {
3725 foreach (bool l5 in YP.unify(LastCh, C2))
3726 {
3727 yield return false;
3728 }
3729 }
3730 cutIf7:
3731 cutIf5:
3732 cutIf1:
3733 { }
3734 }
3735 }
3736 }
3737 }
3738
3739 public static IEnumerable<bool> read_fullstop(object Ch, object Dict, object Tokens)
3740 {
3741 {
3742 Variable Number = new Variable();
3743 Variable Tokens1 = new Variable();
3744 Variable Chars = new Variable();
3745 Variable NextCh = new Variable();
3746 if (YP.lessThanOrEqual(Ch, new ListPair(57, Atom.NIL)))
3747 {
3748 if (YP.greaterThanOrEqual(Ch, new ListPair(48, Atom.NIL)))
3749 {
3750 foreach (bool l4 in YP.unify(Tokens, new ListPair(new Functor1("number", Number), Tokens1)))
3751 {
3752 foreach (bool l5 in read_float(Number, Dict, Tokens1, new ListPair(48, Atom.NIL), Ch))
3753 {
3754 yield return false;
3755 }
3756 }
3757 goto cutIf1;
3758 }
3759 }
3760 if (YP.greaterThan(Ch, new ListPair(32, Atom.NIL)))
3761 {
3762 foreach (bool l3 in rest_symbol(Ch, Chars, NextCh))
3763 {
3764 foreach (bool l4 in read_after_atom4(NextCh, Dict, Tokens, new ListPair(46, Chars)))
3765 {
3766 yield return false;
3767 }
3768 }
3769 goto cutIf2;
3770 }
3771 if (YP.greaterThanOrEqual(Ch, 0))
3772 {
3773 foreach (bool l3 in YP.unify(Tokens, Atom.NIL))
3774 {
3775 yield return false;
3776 }
3777 goto cutIf3;
3778 }
3779 foreach (bool l2 in formatError(Atom.a("user_error"), Atom.a("~N** end of file just after full stop~n"), Atom.NIL))
3780 {
3781 }
3782 cutIf3:
3783 cutIf2:
3784 cutIf1:
3785 { }
3786 }
3787 }
3788
3789 public static IEnumerable<bool> read_float(object Number, object Dict, object Tokens, object Digits, object Digit)
3790 {
3791 {
3792 Variable Chars = new Variable();
3793 Variable Rest = new Variable();
3794 Variable NextCh = new Variable();
3795 foreach (bool l2 in prepend(Digits, Chars, Rest))
3796 {
3797 foreach (bool l3 in read_float4(Digit, Rest, NextCh, Chars))
3798 {
3799 foreach (bool l4 in YP.number_codes(Number, Chars))
3800 {
3801 foreach (bool l5 in read_tokens(NextCh, Dict, Tokens))
3802 {
3803 yield return false;
3804 }
3805 }
3806 }
3807 }
3808 }
3809 }
3810
3811 public static IEnumerable<bool> prepend(object arg1, object arg2, object arg3)
3812 {
3813 {
3814 object X = arg3;
3815 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
3816 {
3817 foreach (bool l3 in YP.unify(arg2, new ListPair(46, X)))
3818 {
3819 yield return false;
3820 }
3821 }
3822 }
3823 {
3824 object Y = arg3;
3825 Variable C = new Variable();
3826 Variable Cs = new Variable();
3827 Variable X = new Variable();
3828 foreach (bool l2 in YP.unify(arg1, new ListPair(C, Cs)))
3829 {
3830 foreach (bool l3 in YP.unify(arg2, new ListPair(C, X)))
3831 {
3832 foreach (bool l4 in prepend(Cs, X, Y))
3833 {
3834 yield return false;
3835 }
3836 }
3837 }
3838 }
3839 }
3840
3841 public static IEnumerable<bool> read_float4(object C1, object arg2, object NextCh, object Total)
3842 {
3843 {
3844 Variable Chars = new Variable();
3845 Variable C2 = new Variable();
3846 Variable C3 = new Variable();
3847 Variable C4 = new Variable();
3848 Variable More = new Variable();
3849 foreach (bool l2 in YP.unify(arg2, new ListPair(C1, Chars)))
3850 {
3851 foreach (bool l3 in YP.get_code(C2))
3852 {
3853 if (YP.greaterThanOrEqual(C2, new ListPair(48, Atom.NIL)))
3854 {
3855 if (YP.lessThanOrEqual(C2, new ListPair(57, Atom.NIL)))
3856 {
3857 foreach (bool l6 in read_float4(C2, Chars, NextCh, Total))
3858 {
3859 yield return false;
3860 }
3861 goto cutIf1;
3862 }
3863 }
3864 if (YP.equal(YP.bitwiseOr(C2, 32), new ListPair(101, Atom.NIL)))
3865 {
3866 foreach (bool l5 in YP.get_code(C3))
3867 {
3868 if (YP.equal(C3, new ListPair(45, Atom.NIL)))
3869 {
3870 foreach (bool l7 in YP.get_code(C4))
3871 {
3872 foreach (bool l8 in YP.unify(Chars, new ListPair(C2, new ListPair(45, More))))
3873 {
3874 if (YP.greaterThanOrEqual(C4, new ListPair(48, Atom.NIL)))
3875 {
3876 if (YP.lessThanOrEqual(C4, new ListPair(57, Atom.NIL)))
3877 {
3878 foreach (bool l11 in read_exponent(C4, More, NextCh))
3879 {
3880 yield return false;
3881 }
3882 goto cutIf4;
3883 }
3884 }
3885 foreach (bool l9 in YP.unify(More, Atom.NIL))
3886 {
3887 foreach (bool l10 in formatError(Atom.a("user_error"), Atom.a("~N** Missing exponent in ~s~n"), new ListPair(Total, Atom.NIL)))
3888 {
3889 }
3890 }
3891 foreach (bool l9 in YP.unify(More, new ListPair(48, Atom.NIL)))
3892 {
3893 foreach (bool l10 in YP.unify(NextCh, C4))
3894 {
3895 yield return false;
3896 }
3897 }
3898 cutIf4:
3899 { }
3900 }
3901 }
3902 goto cutIf3;
3903 }
3904 if (YP.equal(C3, new ListPair(43, Atom.NIL)))
3905 {
3906 foreach (bool l7 in YP.get_code(C4))
3907 {
3908 foreach (bool l8 in YP.unify(Chars, new ListPair(C2, More)))
3909 {
3910 if (YP.greaterThanOrEqual(C4, new ListPair(48, Atom.NIL)))
3911 {
3912 if (YP.lessThanOrEqual(C4, new ListPair(57, Atom.NIL)))
3913 {
3914 foreach (bool l11 in read_exponent(C4, More, NextCh))
3915 {
3916 yield return false;
3917 }
3918 goto cutIf6;
3919 }
3920 }
3921 foreach (bool l9 in YP.unify(More, Atom.NIL))
3922 {
3923 foreach (bool l10 in formatError(Atom.a("user_error"), Atom.a("~N** Missing exponent in ~s~n"), new ListPair(Total, Atom.NIL)))
3924 {
3925 }
3926 }
3927 foreach (bool l9 in YP.unify(More, new ListPair(48, Atom.NIL)))
3928 {
3929 foreach (bool l10 in YP.unify(NextCh, C4))
3930 {
3931 yield return false;
3932 }
3933 }
3934 cutIf6:
3935 { }
3936 }
3937 }
3938 goto cutIf5;
3939 }
3940 foreach (bool l6 in YP.unify(C4, C3))
3941 {
3942 foreach (bool l7 in YP.unify(Chars, new ListPair(C2, More)))
3943 {
3944 if (YP.greaterThanOrEqual(C4, new ListPair(48, Atom.NIL)))
3945 {
3946 if (YP.lessThanOrEqual(C4, new ListPair(57, Atom.NIL)))
3947 {
3948 foreach (bool l10 in read_exponent(C4, More, NextCh))
3949 {
3950 yield return false;
3951 }
3952 goto cutIf7;
3953 }
3954 }
3955 foreach (bool l8 in YP.unify(More, Atom.NIL))
3956 {
3957 foreach (bool l9 in formatError(Atom.a("user_error"), Atom.a("~N** Missing exponent in ~s~n"), new ListPair(Total, Atom.NIL)))
3958 {
3959 }
3960 }
3961 foreach (bool l8 in YP.unify(More, new ListPair(48, Atom.NIL)))
3962 {
3963 foreach (bool l9 in YP.unify(NextCh, C4))
3964 {
3965 yield return false;
3966 }
3967 }
3968 cutIf7:
3969 { }
3970 }
3971 }
3972 cutIf5:
3973 cutIf3:
3974 { }
3975 }
3976 goto cutIf2;
3977 }
3978 foreach (bool l4 in YP.unify(Chars, Atom.NIL))
3979 {
3980 foreach (bool l5 in YP.unify(NextCh, C2))
3981 {
3982 yield return false;
3983 }
3984 }
3985 cutIf2:
3986 cutIf1:
3987 { }
3988 }
3989 }
3990 }
3991 }
3992
3993 public static IEnumerable<bool> read_exponent(object C1, object arg2, object NextCh)
3994 {
3995 {
3996 Variable Chars = new Variable();
3997 Variable C2 = new Variable();
3998 foreach (bool l2 in YP.unify(arg2, new ListPair(C1, Chars)))
3999 {
4000 foreach (bool l3 in YP.get_code(C2))
4001 {
4002 if (YP.greaterThanOrEqual(C2, new ListPair(48, Atom.NIL)))
4003 {
4004 if (YP.lessThanOrEqual(C2, new ListPair(57, Atom.NIL)))
4005 {
4006 foreach (bool l6 in read_exponent(C2, Chars, NextCh))
4007 {
4008 yield return false;
4009 }
4010 goto cutIf1;
4011 }
4012 }
4013 foreach (bool l4 in YP.unify(Chars, Atom.NIL))
4014 {
4015 foreach (bool l5 in YP.unify(NextCh, C2))
4016 {
4017 yield return false;
4018 }
4019 }
4020 cutIf1:
4021 { }
4022 }
4023 }
4024 }
4025 }
4026
4027 public static IEnumerable<bool> read_number(object C1, object Dict, object arg3)
4028 {
4029 {
4030 Variable Number = new Variable();
4031 Variable Tokens = new Variable();
4032 Variable C2 = new Variable();
4033 Variable N = new Variable();
4034 Variable C = new Variable();
4035 Variable C3 = new Variable();
4036 Variable Digits = new Variable();
4037 foreach (bool l2 in YP.unify(arg3, new ListPair(new Functor1("number", Number), Tokens)))
4038 {
4039 foreach (bool l3 in read_number4(C1, C2, 0, N))
4040 {
4041 if (YP.equal(C2, 39))
4042 {
4043 if (YP.greaterThanOrEqual(N, 2))
4044 {
4045 if (YP.lessThanOrEqual(N, 36))
4046 {
4047 foreach (bool l7 in read_based(N, 0, Number, C))
4048 {
4049 foreach (bool l8 in read_tokens(C, Dict, Tokens))
4050 {
4051 yield return false;
4052 }
4053 }
4054 goto cutIf2;
4055 }
4056 }
4057 if (YP.equal(N, 0))
4058 {
4059 foreach (bool l6 in YP.get_code(C3))
4060 {
4061 foreach (bool l7 in read_char(C3, -1, Number, C))
4062 {
4063 foreach (bool l8 in read_tokens(C, Dict, Tokens))
4064 {
4065 yield return false;
4066 }
4067 }
4068 }
4069 goto cutIf3;
4070 }
4071 foreach (bool l5 in formatError(Atom.a("user_error"), Atom.a("~N** ~d' read as ~d '~n"), new ListPair(N, new ListPair(N, Atom.NIL))))
4072 {
4073 foreach (bool l6 in YP.unify(Number, N))
4074 {
4075 foreach (bool l7 in YP.unify(C, C2))
4076 {
4077 foreach (bool l8 in read_tokens(C, Dict, Tokens))
4078 {
4079 yield return false;
4080 }
4081 }
4082 }
4083 }
4084 cutIf3:
4085 cutIf2:
4086 goto cutIf1;
4087 }
4088 if (YP.equal(C2, 46))
4089 {
4090 foreach (bool l5 in YP.get_code(C3))
4091 {
4092 if (YP.greaterThanOrEqual(C3, new ListPair(48, Atom.NIL)))
4093 {
4094 if (YP.lessThanOrEqual(C3, new ListPair(57, Atom.NIL)))
4095 {
4096 foreach (bool l8 in YP.number_codes(N, Digits))
4097 {
4098 foreach (bool l9 in read_float(Number, Dict, Tokens, Digits, C3))
4099 {
4100 yield return false;
4101 }
4102 }
4103 goto cutIf5;
4104 }
4105 }
4106 foreach (bool l6 in YP.unify(Number, N))
4107 {
4108 foreach (bool l7 in read_fullstop(C3, Dict, Tokens))
4109 {
4110 yield return false;
4111 }
4112 }
4113 cutIf5:
4114 { }
4115 }
4116 goto cutIf4;
4117 }
4118 foreach (bool l4 in YP.unify(Number, N))
4119 {
4120 foreach (bool l5 in read_tokens(C2, Dict, Tokens))
4121 {
4122 yield return false;
4123 }
4124 }
4125 cutIf4:
4126 cutIf1:
4127 { }
4128 }
4129 }
4130 }
4131 }
4132
4133 public static IEnumerable<bool> read_number4(object C0, object C, object N0, object N)
4134 {
4135 {
4136 Variable N1 = new Variable();
4137 Variable C1 = new Variable();
4138 if (YP.greaterThanOrEqual(C0, new ListPair(48, Atom.NIL)))
4139 {
4140 if (YP.lessThanOrEqual(C0, new ListPair(57, Atom.NIL)))
4141 {
4142 foreach (bool l4 in YP.unify(N1, YP.add(YP.subtract(YP.multiply(N0, 10), new ListPair(48, Atom.NIL)), C0)))
4143 {
4144 foreach (bool l5 in YP.get_code(C1))
4145 {
4146 foreach (bool l6 in read_number4(C1, C, N1, N))
4147 {
4148 yield return false;
4149 }
4150 }
4151 }
4152 goto cutIf1;
4153 }
4154 }
4155 if (YP.equal(C0, 95))
4156 {
4157 foreach (bool l3 in YP.get_code(C1))
4158 {
4159 foreach (bool l4 in read_number4(C1, C, N0, N))
4160 {
4161 yield return false;
4162 }
4163 }
4164 goto cutIf2;
4165 }
4166 foreach (bool l2 in YP.unify(C, C0))
4167 {
4168 foreach (bool l3 in YP.unify(N, N0))
4169 {
4170 yield return false;
4171 }
4172 }
4173 cutIf2:
4174 cutIf1:
4175 { }
4176 }
4177 }
4178
4179 public static IEnumerable<bool> read_based(object Base, object N0, object N, object C)
4180 {
4181 {
4182 Variable C1 = new Variable();
4183 Variable Digit = new Variable();
4184 Variable N1 = new Variable();
4185 foreach (bool l2 in YP.get_code(C1))
4186 {
4187 if (YP.greaterThanOrEqual(C1, new ListPair(48, Atom.NIL)))
4188 {
4189 if (YP.lessThanOrEqual(C1, new ListPair(57, Atom.NIL)))
4190 {
4191 foreach (bool l5 in YP.unify(Digit, YP.subtract(C1, new ListPair(48, Atom.NIL))))
4192 {
4193 if (YP.lessThan(Digit, Base))
4194 {
4195 foreach (bool l7 in YP.unify(N1, YP.add(YP.multiply(N0, Base), Digit)))
4196 {
4197 foreach (bool l8 in read_based(Base, N1, N, C))
4198 {
4199 yield return false;
4200 }
4201 }
4202 goto cutIf2;
4203 }
4204 if (YP.equal(C1, new ListPair(95, Atom.NIL)))
4205 {
4206 foreach (bool l7 in read_based(Base, N0, N, C))
4207 {
4208 yield return false;
4209 }
4210 goto cutIf3;
4211 }
4212 foreach (bool l6 in YP.unify(N, N0))
4213 {
4214 foreach (bool l7 in YP.unify(C, C1))
4215 {
4216 yield return false;
4217 }
4218 }
4219 cutIf3:
4220 cutIf2:
4221 { }
4222 }
4223 goto cutIf1;
4224 }
4225 }
4226 if (YP.greaterThanOrEqual(C1, new ListPair(65, Atom.NIL)))
4227 {
4228 if (YP.lessThanOrEqual(C1, new ListPair(90, Atom.NIL)))
4229 {
4230 foreach (bool l5 in YP.unify(Digit, YP.subtract(C1, YP.subtract(new ListPair(65, Atom.NIL), 10))))
4231 {
4232 if (YP.lessThan(Digit, Base))
4233 {
4234 foreach (bool l7 in YP.unify(N1, YP.add(YP.multiply(N0, Base), Digit)))
4235 {
4236 foreach (bool l8 in read_based(Base, N1, N, C))
4237 {
4238 yield return false;
4239 }
4240 }
4241 goto cutIf5;
4242 }
4243 if (YP.equal(C1, new ListPair(95, Atom.NIL)))
4244 {
4245 foreach (bool l7 in read_based(Base, N0, N, C))
4246 {
4247 yield return false;
4248 }
4249 goto cutIf6;
4250 }
4251 foreach (bool l6 in YP.unify(N, N0))
4252 {
4253 foreach (bool l7 in YP.unify(C, C1))
4254 {
4255 yield return false;
4256 }
4257 }
4258 cutIf6:
4259 cutIf5:
4260 { }
4261 }
4262 goto cutIf4;
4263 }
4264 }
4265 if (YP.greaterThanOrEqual(C1, new ListPair(97, Atom.NIL)))
4266 {
4267 if (YP.lessThanOrEqual(C1, new ListPair(122, Atom.NIL)))
4268 {
4269 foreach (bool l5 in YP.unify(Digit, YP.subtract(C1, YP.subtract(new ListPair(97, Atom.NIL), 10))))
4270 {
4271 if (YP.lessThan(Digit, Base))
4272 {
4273 foreach (bool l7 in YP.unify(N1, YP.add(YP.multiply(N0, Base), Digit)))
4274 {
4275 foreach (bool l8 in read_based(Base, N1, N, C))
4276 {
4277 yield return false;
4278 }
4279 }
4280 goto cutIf8;
4281 }
4282 if (YP.equal(C1, new ListPair(95, Atom.NIL)))
4283 {
4284 foreach (bool l7 in read_based(Base, N0, N, C))
4285 {
4286 yield return false;
4287 }
4288 goto cutIf9;
4289 }
4290 foreach (bool l6 in YP.unify(N, N0))
4291 {
4292 foreach (bool l7 in YP.unify(C, C1))
4293 {
4294 yield return false;
4295 }
4296 }
4297 cutIf9:
4298 cutIf8:
4299 { }
4300 }
4301 goto cutIf7;
4302 }
4303 }
4304 foreach (bool l3 in YP.unify(Digit, 99))
4305 {
4306 if (YP.lessThan(Digit, Base))
4307 {
4308 foreach (bool l5 in YP.unify(N1, YP.add(YP.multiply(N0, Base), Digit)))
4309 {
4310 foreach (bool l6 in read_based(Base, N1, N, C))
4311 {
4312 yield return false;
4313 }
4314 }
4315 goto cutIf10;
4316 }
4317 if (YP.equal(C1, new ListPair(95, Atom.NIL)))
4318 {
4319 foreach (bool l5 in read_based(Base, N0, N, C))
4320 {
4321 yield return false;
4322 }
4323 goto cutIf11;
4324 }
4325 foreach (bool l4 in YP.unify(N, N0))
4326 {
4327 foreach (bool l5 in YP.unify(C, C1))
4328 {
4329 yield return false;
4330 }
4331 }
4332 cutIf11:
4333 cutIf10:
4334 { }
4335 }
4336 cutIf7:
4337 cutIf4:
4338 cutIf1:
4339 { }
4340 }
4341 }
4342 }
4343
4344 public static IEnumerable<bool> read_char(object Char, object Quote, object Result, object Next)
4345 {
4346 {
4347 Variable C1 = new Variable();
4348 Variable C2 = new Variable();
4349 Variable C3 = new Variable();
4350 Variable Ch = new Variable();
4351 if (YP.equal(Char, 92))
4352 {
4353 foreach (bool l3 in YP.get_code(C1))
4354 {
4355 if (YP.lessThan(C1, 0))
4356 {
4357 foreach (bool l5 in formatError(Atom.a("user_error"), Atom.a("~N** end of file in ~cquoted~c~n"), new ListPair(Quote, new ListPair(Quote, Atom.NIL))))
4358 {
4359 foreach (bool l6 in YP.unify(Result, -1))
4360 {
4361 foreach (bool l7 in YP.unify(Next, C1))
4362 {
4363 yield return false;
4364 }
4365 }
4366 }
4367 goto cutIf2;
4368 }
4369 if (YP.lessThanOrEqual(C1, new ListPair(32, Atom.NIL)))
4370 {
4371 foreach (bool l5 in YP.get_code(C2))
4372 {
4373 foreach (bool l6 in read_char(C2, Quote, Result, Next))
4374 {
4375 yield return false;
4376 }
4377 }
4378 goto cutIf3;
4379 }
4380 if (YP.equal(YP.bitwiseOr(C1, 32), new ListPair(99, Atom.NIL)))
4381 {
4382 foreach (bool l5 in YP.get_code(C2))
4383 {
4384 foreach (bool l6 in read_char(C2, Quote, Result, Next))
4385 {
4386 yield return false;
4387 }
4388 }
4389 goto cutIf4;
4390 }
4391 if (YP.lessThanOrEqual(C1, new ListPair(55, Atom.NIL)))
4392 {
4393 if (YP.greaterThanOrEqual(C1, new ListPair(48, Atom.NIL)))
4394 {
4395 foreach (bool l6 in YP.get_code(C2))
4396 {
4397 if (YP.lessThanOrEqual(C2, new ListPair(55, Atom.NIL)))
4398 {
4399 if (YP.greaterThanOrEqual(C2, new ListPair(48, Atom.NIL)))
4400 {
4401 foreach (bool l9 in YP.get_code(C3))
4402 {
4403 if (YP.lessThanOrEqual(C3, new ListPair(55, Atom.NIL)))
4404 {
4405 if (YP.greaterThanOrEqual(C3, new ListPair(48, Atom.NIL)))
4406 {
4407 foreach (bool l12 in YP.get_code(Next))
4408 {
4409 foreach (bool l13 in YP.unify(Result, YP.subtract(YP.add(YP.multiply(YP.add(YP.multiply(C1, 8), C2), 8), C3), YP.multiply(73, new ListPair(48, Atom.NIL)))))
4410 {
4411 yield return false;
4412 }
4413 }
4414 goto cutIf7;
4415 }
4416 }
4417 foreach (bool l10 in YP.unify(Next, C3))
4418 {
4419 foreach (bool l11 in YP.unify(Result, YP.subtract(YP.add(YP.multiply(C1, 8), C2), YP.multiply(9, new ListPair(48, Atom.NIL)))))
4420 {
4421 yield return false;
4422 }
4423 }
4424 cutIf7:
4425 { }
4426 }
4427 goto cutIf6;
4428 }
4429 }
4430 foreach (bool l7 in YP.unify(Next, C2))
4431 {
4432 foreach (bool l8 in YP.unify(Result, YP.subtract(C1, new ListPair(48, Atom.NIL))))
4433 {
4434 yield return false;
4435 }
4436 }
4437 cutIf6:
4438 { }
4439 }
4440 goto cutIf5;
4441 }
4442 }
4443 if (YP.equal(C1, new ListPair(94, Atom.NIL)))
4444 {
4445 foreach (bool l5 in YP.get_code(C2))
4446 {
4447 if (YP.lessThan(C2, 0))
4448 {
4449 foreach (bool l7 in formatError(Atom.a("user_error"), Atom.a("~N** end of file in ~c..~c^..~c~n"), ListPair.make(new object[] { Quote, 92, Quote })))
4450 {
4451 foreach (bool l8 in YP.unify(Result, -1))
4452 {
4453 foreach (bool l9 in YP.unify(Next, C2))
4454 {
4455 yield return false;
4456 }
4457 }
4458 }
4459 goto cutIf9;
4460 }
4461 if (YP.equal(C2, new ListPair(63, Atom.NIL)))
4462 {
4463 foreach (bool l7 in YP.unify(Result, 127))
4464 {
4465 foreach (bool l8 in YP.get_code(Next))
4466 {
4467 yield return false;
4468 }
4469 }
4470 goto cutIf10;
4471 }
4472 foreach (bool l6 in YP.unify(Result, YP.bitwiseAnd(C2, 31)))
4473 {
4474 foreach (bool l7 in YP.get_code(Next))
4475 {
4476 yield return false;
4477 }
4478 }
4479 cutIf10:
4480 cutIf9:
4481 { }
4482 }
4483 goto cutIf8;
4484 }
4485 foreach (bool l4 in escape_char(C1, Result))
4486 {
4487 foreach (bool l5 in YP.get_code(Next))
4488 {
4489 yield return false;
4490 }
4491 goto cutIf11;
4492 }
4493 foreach (bool l4 in YP.unify(Result, C1))
4494 {
4495 foreach (bool l5 in YP.get_code(Next))
4496 {
4497 yield return false;
4498 }
4499 }
4500 cutIf11:
4501 cutIf8:
4502 cutIf5:
4503 cutIf4:
4504 cutIf3:
4505 cutIf2:
4506 { }
4507 }
4508 goto cutIf1;
4509 }
4510 if (YP.equal(Char, Quote))
4511 {
4512 foreach (bool l3 in YP.get_code(Ch))
4513 {
4514 if (YP.equal(Ch, Quote))
4515 {
4516 foreach (bool l5 in YP.unify(Result, Quote))
4517 {
4518 foreach (bool l6 in YP.get_code(Next))
4519 {
4520 yield return false;
4521 }
4522 }
4523 goto cutIf13;
4524 }
4525 foreach (bool l4 in YP.unify(Result, -1))
4526 {
4527 foreach (bool l5 in YP.unify(Next, Ch))
4528 {
4529 yield return false;
4530 }
4531 }
4532 cutIf13:
4533 { }
4534 }
4535 goto cutIf12;
4536 }
4537 if (YP.lessThan(Char, new ListPair(32, Atom.NIL)))
4538 {
4539 if (YP.notEqual(Char, 9))
4540 {
4541 if (YP.notEqual(Char, 10))
4542 {
4543 if (YP.notEqual(Char, 13))
4544 {
4545 foreach (bool l6 in YP.unify(Result, -1))
4546 {
4547 foreach (bool l7 in YP.unify(Next, Char))
4548 {
4549 foreach (bool l8 in formatError(Atom.a("user_error"), Atom.a("~N** Strange character ~d ends ~ctoken~c~n"), ListPair.make(new object[] { Char, Quote, Quote })))
4550 {
4551 yield return false;
4552 }
4553 }
4554 }
4555 goto cutIf14;
4556 }
4557 }
4558 }
4559 }
4560 foreach (bool l2 in YP.unify(Result, Char))
4561 {
4562 foreach (bool l3 in YP.get_code(Next))
4563 {
4564 yield return false;
4565 }
4566 }
4567 cutIf14:
4568 cutIf12:
4569 cutIf1:
4570 { }
4571 }
4572 }
4573 #pragma warning restore 0168, 0219, 0162
4574 }
4575}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/PrologException.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/PrologException.cs
deleted file mode 100644
index 9f5ae3d..0000000
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/PrologException.cs
+++ /dev/null
@@ -1,159 +0,0 @@
1/*
2 * Copyright (C) 2007-2008, Jeff Thompson
3 *
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31using System;
32
33namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
34{
35 /// <summary>
36 /// A PrologException is used as the exception thrown by YP.throw(Term).
37 /// </summary>
38 public class PrologException : Exception
39 {
40 public readonly object _term;
41
42 /// <summary>
43 /// Create a PrologException with the given Term. The printable exception message is the full Term.
44 /// </summary>
45 /// <param name="Term">the term of the exception</param>
46 public PrologException(object Term)
47 : base(YP.getValue(Term).ToString())
48 {
49 _term = YP.makeCopy(Term, new Variable.CopyStore());
50 }
51
52 /// <summary>
53 /// Create a PrologException where the Term is error(ErrorTerm, Message).
54 /// This uses YP.makeCopy to copy the ErrorTerm and Message so that they are valid after unbinding.
55 /// </summary>
56 /// <param name="ErrorTerm">the error term of the error</param>
57 /// <param name="Messsage">the message term of the error. If this is a string, it is converted to an
58 /// Atom so it can be used by Prolog code.
59 /// Message, converted to a string, is use as the printable exception message.
60 /// </param>
61 public PrologException(object ErrorTerm, object Message)
62 : base(YP.getValue(Message).ToString())
63 {
64 if (Message is string)
65 Message = Atom.a((string)Message);
66 _term = YP.makeCopy(new Functor2(Atom.a("error"), ErrorTerm, Message), new Variable.CopyStore());
67 }
68
69 public class TypeErrorInfo
70 {
71 public readonly Atom _Type;
72 public readonly object _Culprit;
73 public readonly object _Message;
74
75 public TypeErrorInfo(Atom Type, object Culprit, object Message)
76 {
77 _Type = Type;
78 _Culprit = Culprit;
79 _Message = Message;
80 }
81 }
82 /// <summary>
83 /// Return the TypeErrorInfo for this exception, or null if _term does not match
84 /// error(type_error(Type, Culprit), Message).
85 /// </summary>
86 /// <returns></returns>
87 public TypeErrorInfo getTypeErrorInfo()
88 {
89 if (!(_term is Functor2 && ((Functor2)_term)._name._name == "error"))
90 return null;
91 object errorTerm = ((Functor2)_term)._arg1;
92 if (!(errorTerm is Functor2 && ((Functor2)errorTerm)._name._name == "type_error"))
93 return null;
94 if (!(((Functor2)errorTerm)._arg1 is Atom))
95 return null;
96 return new TypeErrorInfo
97 ((Atom)((Functor2)errorTerm)._arg1, ((Functor2)errorTerm)._arg2, ((Functor2)_term)._arg2);
98 }
99
100 public class ExistenceErrorInfo
101 {
102 public readonly Atom _Type;
103 public readonly object _Culprit;
104 public readonly object _Message;
105
106 public ExistenceErrorInfo(Atom Type, object Culprit, object Message)
107 {
108 _Type = Type;
109 _Culprit = Culprit;
110 _Message = Message;
111 }
112
113 /// <summary>
114 /// If _Type is procedure and _Culprit is name/artity, return the name. Otherwise return null.
115 /// </summary>
116 /// <returns></returns>
117 public object getProcedureName()
118 {
119 if (!(_Type._name == "procedure" &&
120 _Culprit is Functor2 && ((Functor2)_Culprit)._name == Atom.SLASH))
121 return null;
122 return ((Functor2)_Culprit)._arg1;
123 }
124
125 /// <summary>
126 /// If _Type is procedure and _Culprit is name/arity and arity is an integer, return the arity.
127 /// Otherwise return -1.
128 /// </summary>
129 /// <returns></returns>
130 public int getProcedureArity()
131 {
132 if (!(_Type._name == "procedure" &&
133 _Culprit is Functor2 && ((Functor2)_Culprit)._name == Atom.SLASH))
134 return -1;
135 if (!(((Functor2)_Culprit)._arg2 is int))
136 return -1;
137 return (int)((Functor2)_Culprit)._arg2;
138 }
139 }
140 /// <summary>
141 /// Return the ExistenceErrorInfo for this exception, or null if _term does not match
142 /// error(existence_error(Type, Culprit), Message). If the returned ExistenceErrorInfo _Culprit is
143 /// procedure, you can use its getProcedureName and getProcedureArity.
144 /// </summary>
145 /// <returns></returns>
146 public ExistenceErrorInfo getExistenceErrorInfo()
147 {
148 if (!(_term is Functor2 && ((Functor2)_term)._name._name == "error"))
149 return null;
150 object errorTerm = ((Functor2)_term)._arg1;
151 if (!(errorTerm is Functor2 && ((Functor2)errorTerm)._name._name == "existence_error"))
152 return null;
153 if (!(((Functor2)errorTerm)._arg1 is Atom))
154 return null;
155 return new ExistenceErrorInfo
156 ((Atom)((Functor2)errorTerm)._arg1, ((Functor2)errorTerm)._arg2, ((Functor2)_term)._arg2);
157 }
158 }
159}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/UndefinedPredicateException.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/UndefinedPredicateException.cs
deleted file mode 100644
index 4b6112f..0000000
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/UndefinedPredicateException.cs
+++ /dev/null
@@ -1,62 +0,0 @@
1/*
2 * Copyright (C) 2007-2008, Jeff Thompson
3 *
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31using System;
32
33namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
34{
35 /// <summary>
36 /// An UndefinedPredicateException extends PrologException to create an existence_error exception.
37 /// </summary>
38 public class UndefinedPredicateException : PrologException
39 {
40 private Atom _predicateName;
41 private int _arity;
42
43 public UndefinedPredicateException(object message, Atom predicateName, int arity)
44 : base(new Functor2
45 (Atom.a("existence_error"), Atom.a("procedure"), new Functor2(Atom.a("/"), predicateName, arity)),
46 message)
47 {
48 _predicateName = predicateName;
49 _arity = arity;
50 }
51
52 public Atom PredicateName
53 {
54 get { return _predicateName; }
55 }
56
57 public int Arity
58 {
59 get { return _arity; }
60 }
61 }
62}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Variable.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Variable.cs
deleted file mode 100644
index ea5b7a6..0000000
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Variable.cs
+++ /dev/null
@@ -1,222 +0,0 @@
1/*
2 * Copyright (C) 2007-2008, Jeff Thompson
3 *
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31using System;
32using System.Collections;
33using System.Collections.Generic;
34
35namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
36{
37 public interface IUnifiable
38 {
39 IEnumerable<bool> unify(object arg);
40 void addUniqueVariables(List<Variable> variableSet);
41 object makeCopy(Variable.CopyStore copyStore);
42 bool termEqual(object term);
43 bool ground();
44 }
45
46 /// <summary>
47 /// A Variable is passed to a function so that it can be unified with
48 /// value or another Variable. See getValue and unify for details.
49 /// </summary>
50 public class Variable : IUnifiable
51 {
52 // Use _isBound separate from _value so that it can be bound to any value,
53 // including null.
54 private bool _isBound = false;
55 private object _value;
56
57 /// <summary>
58 /// If this Variable is unbound, then just return this Variable.
59 /// Otherwise, if this has been bound to a value with unify, return the value.
60 /// If the bound value is another Variable, this follows the "variable chain"
61 /// to the end and returns the final value, or the final Variable if it is unbound.
62 /// For more details, see http://yieldprolog.sourceforge.net/tutorial1.html
63 /// </summary>
64 /// <returns></returns>
65 public object getValue()
66 {
67 if (!_isBound)
68 return this;
69
70 object result = _value;
71 while (result is Variable)
72 {
73 if (!((Variable)result)._isBound)
74 return result;
75
76 // Keep following the Variable chain.
77 result = ((Variable)result)._value;
78 }
79
80 return result;
81 }
82
83 /// <summary>
84 /// If this Variable is bound, then just call YP.unify to unify this with arg.
85 /// (Note that if arg is an unbound Variable, then YP.unify will bind it to
86 /// this Variable's value.)
87 /// Otherwise, bind this Variable to YP.getValue(arg) and yield once. After the
88 /// yield, return this Variable to the unbound state.
89 /// For more details, see http://yieldprolog.sourceforge.net/tutorial1.html
90 /// </summary>
91 /// <param name="arg"></param>
92 /// <returns></returns>
93 public IEnumerable<bool> unify(object arg)
94 {
95 if (!_isBound)
96 {
97 _value = YP.getValue(arg);
98 if (_value == this)
99 // We are unifying this unbound variable with itself, so leave it unbound.
100 yield return false;
101 else
102 {
103 _isBound = true;
104 try
105 {
106 yield return false;
107 }
108 finally
109 {
110 // Remove the binding.
111 _isBound = false;
112 }
113 }
114 }
115 else
116 {
117 // disable warning on l1, don't see how we can
118 // code this differently
119 #pragma warning disable 0168, 0219
120 foreach (bool l1 in YP.unify(this, arg))
121 yield return false;
122 #pragma warning restore 0168, 0219
123 }
124 }
125
126 public override string ToString()
127 {
128 object value = getValue();
129 if (value == this)
130 return "_Variable";
131 else
132 return getValue().ToString();
133 }
134
135 /// <summary>
136 /// If bound, call YP.addUniqueVariables on the value. Otherwise, if this unbound
137 /// variable is not already in variableSet, add it.
138 /// </summary>
139 /// <param name="variableSet"></param>
140 public void addUniqueVariables(List<Variable> variableSet)
141 {
142 if (_isBound)
143 YP.addUniqueVariables(getValue(), variableSet);
144 else
145 {
146 if (variableSet.IndexOf(this) < 0)
147 variableSet.Add(this);
148 }
149 }
150
151 /// <summary>
152 /// If bound, return YP.makeCopy for the value, else return copyStore.getCopy(this).
153 /// However, if copyStore is null, just return this.
154 /// </summary>
155 /// <param name="copyStore"></param>
156 /// <returns></returns>
157 public object makeCopy(Variable.CopyStore copyStore)
158 {
159 if (_isBound)
160 return YP.makeCopy(getValue(), copyStore);
161 else
162 return copyStore == null ? this : copyStore.getCopy(this);
163 }
164
165 public bool termEqual(object term)
166 {
167 if (_isBound)
168 return YP.termEqual(getValue(), term);
169 else
170 return this == YP.getValue(term);
171 }
172
173 public bool ground()
174 {
175 if (_isBound)
176 // This is usually called by YP.ground which already did getValue, so this
177 // should never be reached, but check anyway.
178 return YP.ground(getValue());
179 else
180 return false;
181 }
182
183 /// <summary>
184 /// A CopyStore is used by makeCopy to track which Variable objects have
185 /// been copied.
186 /// </summary>
187 public class CopyStore
188 {
189 private List<Variable> _inVariableSet = new List<Variable>();
190 private List<Variable> _outVariableSet = new List<Variable>();
191
192 /// <summary>
193 /// If inVariable has already been copied, return its copy. Otherwise,
194 /// return a fresh Variable associated with inVariable.
195 /// </summary>
196 /// <param name="inVariable"></param>
197 /// <returns></returns>
198 public Variable getCopy(Variable inVariable)
199 {
200 int index = _inVariableSet.IndexOf(inVariable);
201 if (index >= 0)
202 return _outVariableSet[index];
203 else
204 {
205 Variable outVariable = new Variable();
206 _inVariableSet.Add(inVariable);
207 _outVariableSet.Add(outVariable);
208 return outVariable;
209 }
210 }
211
212 /// <summary>
213 /// Return the number of unique variables that have been copied.
214 /// </summary>
215 /// <returns></returns>
216 public int getNUniqueVariables()
217 {
218 return _inVariableSet.Count;
219 }
220 }
221 }
222}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YP.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YP.cs
deleted file mode 100644
index f2171dd..0000000
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YP.cs
+++ /dev/null
@@ -1,2701 +0,0 @@
1/*
2 * Copyright (C) 2007-2008, Jeff Thompson
3 *
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31using System;
32using System.Collections;
33using System.Collections.Generic;
34using System.IO;
35using System.Reflection;
36using System.Net.Sockets;
37using System.Text;
38using System.Text.RegularExpressions;
39using log4net;
40
41namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
42{
43 /// <summary>
44 /// YP has static methods for general functions in Yield Prolog such as <see cref="getValue"/>
45 /// and <see cref="unify"/>.
46 /// </summary>
47 public class YP
48 {
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50 private static Fail _fail = new Fail();
51 private static Repeat _repeat = new Repeat();
52 private static Dictionary<NameArity, List<IClause>> _predicatesStore =
53 new Dictionary<NameArity, List<IClause>>();
54 private static TextWriter _outputStream = System.Console.Out;
55 private static TextReader _inputStream = System.Console.In;
56 private static IndexedAnswers _operatorTable = null;
57 private static Dictionary<string, object> _prologFlags = new Dictionary<string, object>();
58 public const int MAX_ARITY = 255;
59
60 /// <summary>
61 /// An IClause is used so that dynamic predicates can call match.
62 /// </summary>
63 public interface IClause
64 {
65 IEnumerable<bool> match(object[] args);
66 IEnumerable<bool> clause(object Head, object Body);
67 }
68
69 /// <summary>
70 /// If value is a Variable, then return its getValue. Otherwise, just
71 /// return value. You should call YP.getValue on any object that
72 /// may be a Variable to get the value to pass to other functions in
73 /// your system that are not part of Yield Prolog, such as math functions
74 /// or file I/O.
75 /// For more details, see http://yieldprolog.sourceforge.net/tutorial1.html
76 /// </summary>
77 /// <param name="value"></param>
78 /// <returns></returns>
79 public static object getValue(object value)
80 {
81 if (value is Variable)
82 return ((Variable)value).getValue();
83 else
84 return value;
85 }
86
87 /// <summary>
88 /// If arg1 or arg2 is an object with a unify method (such as Variable or
89 /// Functor) then just call its unify with the other argument. The object's
90 /// unify method will bind the values or check for equals as needed.
91 /// Otherwise, both arguments are "normal" (atomic) values so if they
92 /// are equal then succeed (yield once), else fail (don't yield).
93 /// For more details, see http://yieldprolog.sourceforge.net/tutorial1.html
94 /// </summary>
95 /// <param name="arg1"></param>
96 /// <param name="arg2"></param>
97 /// <returns></returns>
98 public static IEnumerable<bool> unify(object arg1, object arg2)
99 {
100 arg1 = getValue(arg1);
101 arg2 = getValue(arg2);
102 if (arg1 is IUnifiable)
103 return ((IUnifiable)arg1).unify(arg2);
104 else if (arg2 is IUnifiable)
105 return ((IUnifiable)arg2).unify(arg1);
106 else
107 {
108 // Arguments are "normal" types.
109 if (arg1.Equals(arg2))
110 return new Succeed();
111 else
112 return _fail;
113 }
114 }
115
116 /// <summary>
117 /// This is used for the lookup key in _factStore.
118 /// </summary>
119 public struct NameArity
120 {
121 public readonly Atom _name;
122 public readonly int _arity;
123
124 public NameArity(Atom name, int arity)
125 {
126 _name = name;
127 _arity = arity;
128 }
129
130 public override bool Equals(object obj)
131 {
132 if (obj is NameArity)
133 {
134 NameArity nameArity = (NameArity)obj;
135 return nameArity._name.Equals(_name) && nameArity._arity.Equals(_arity);
136 }
137 else
138 {
139 return false;
140 }
141 }
142
143 public override int GetHashCode()
144 {
145 return _name.GetHashCode() ^ _arity.GetHashCode();
146 }
147 }
148
149 /// <summary>
150 /// Convert term to an int.
151 /// If term is a single-element List, use its first element
152 /// (to handle the char types like "a").
153 /// If can't convert, throw a PrologException for type_error evaluable (because this is only
154 /// called from arithmetic functions).
155 /// </summary>
156 /// <param name="term"></param>
157 /// <returns></returns>
158 public static int convertInt(object term)
159 {
160 term = YP.getValue(term);
161 if (term is Functor2 && ((Functor2)term)._name == Atom.DOT &&
162 YP.getValue(((Functor2)term)._arg2) == Atom.NIL)
163 // Assume it is a char type like "a".
164 term = YP.getValue(((Functor2)term)._arg1);
165 if (term is Variable)
166 throw new PrologException(Atom.a("instantiation_error"),
167 "Expected a number but the argument is an unbound variable");
168
169 try
170 {
171 return (int)term;
172 }
173 catch (InvalidCastException)
174 {
175 throw new PrologException
176 (new Functor2
177 ("type_error", Atom.a("evaluable"),
178 new Functor2(Atom.SLASH, getFunctorName(term), getFunctorArgs(term).Length)),
179 "Term must be an integer");
180 }
181 }
182
183 /// <summary>
184 /// Convert term to a double. This may convert an int to a double, etc.
185 /// If term is a single-element List, use its first element
186 /// (to handle the char types like "a").
187 /// If can't convert, throw a PrologException for type_error evaluable (because this is only
188 /// called from arithmetic functions).
189 /// </summary>
190 /// <param name="term"></param>
191 /// <returns></returns>
192 public static double convertDouble(object term)
193 {
194 term = YP.getValue(term);
195 if (term is Functor2 && ((Functor2)term)._name == Atom.DOT &&
196 YP.getValue(((Functor2)term)._arg2) == Atom.NIL)
197 // Assume it is a char type like "a".
198 term = YP.getValue(((Functor2)term)._arg1);
199 if (term is Variable)
200 throw new PrologException(Atom.a("instantiation_error"),
201 "Expected a number but the argument is an unbound variable");
202
203 try
204 {
205 return Convert.ToDouble(term);
206 }
207 catch (InvalidCastException)
208 {
209 throw new PrologException
210 (new Functor2
211 ("type_error", Atom.a("evaluable"),
212 new Functor2(Atom.SLASH, getFunctorName(term), getFunctorArgs(term).Length)),
213 "Term must be an integer");
214 }
215 }
216
217 /// <summary>
218 /// If term is an integer, set intTerm.
219 /// If term is a single-element List, use its first element
220 /// (to handle the char types like "a"). Return true for success, false if can't convert.
221 /// We use a success return value because throwing an exception is inefficient.
222 /// </summary>
223 /// <param name="term"></param>
224 /// <returns></returns>
225 public static bool getInt(object term, out int intTerm)
226 {
227 term = YP.getValue(term);
228 if (term is Functor2 && ((Functor2)term)._name == Atom.DOT &&
229 YP.getValue(((Functor2)term)._arg2) == Atom.NIL)
230 // Assume it is a char type like "a".
231 term = YP.getValue(((Functor2)term)._arg1);
232
233 if (term is int)
234 {
235 intTerm = (int)term;
236 return true;
237 }
238
239 intTerm = 0;
240 return false;
241 }
242
243 public static bool equal(object x, object y)
244 {
245 x = YP.getValue(x);
246 if (x is DateTime)
247 return (DateTime)x == (DateTime)YP.getValue(y);
248 // Assume convertDouble converts an int to a double perfectly.
249 return YP.convertDouble(x) == YP.convertDouble(y);
250 }
251
252 public static bool notEqual(object x, object y)
253 {
254 x = YP.getValue(x);
255 if (x is DateTime)
256 return (DateTime)x != (DateTime)YP.getValue(y);
257 // Assume convertDouble converts an int to a double perfectly.
258 return YP.convertDouble(x) != YP.convertDouble(y);
259 }
260
261 public static bool greaterThan(object x, object y)
262 {
263 x = YP.getValue(x);
264 if (x is DateTime)
265 return (DateTime)x > (DateTime)YP.getValue(y);
266 // Assume convertDouble converts an int to a double perfectly.
267 return YP.convertDouble(x) > YP.convertDouble(y);
268 }
269
270 public static bool lessThan(object x, object y)
271 {
272 x = YP.getValue(x);
273 if (x is DateTime)
274 return (DateTime)x < (DateTime)YP.getValue(y);
275 // Assume convertDouble converts an int to a double perfectly.
276 return YP.convertDouble(x) < YP.convertDouble(y);
277 }
278
279 public static bool greaterThanOrEqual(object x, object y)
280 {
281 x = YP.getValue(x);
282 if (x is DateTime)
283 return (DateTime)x >= (DateTime)YP.getValue(y);
284 // Assume convertDouble converts an int to a double perfectly.
285 return YP.convertDouble(x) >= YP.convertDouble(y);
286 }
287
288 public static bool lessThanOrEqual(object x, object y)
289 {
290 x = YP.getValue(x);
291 if (x is DateTime)
292 return (DateTime)x <= (DateTime)YP.getValue(y);
293 // Assume convertDouble converts an int to a double perfectly.
294 return YP.convertDouble(x) <= YP.convertDouble(y);
295 }
296
297 public static object negate(object x)
298 {
299 int intX;
300 if (getInt(x, out intX))
301 return -intX;
302 return -convertDouble(x);
303 }
304
305 public static object abs(object x)
306 {
307 int intX;
308 if (getInt(x, out intX))
309 return Math.Abs(intX);
310 return Math.Abs(convertDouble(x));
311 }
312
313 public static object sign(object x)
314 {
315 int intX;
316 if (getInt(x, out intX))
317 return Math.Sign(intX);
318 return Math.Sign(convertDouble(x));
319 }
320
321 // Use toFloat instead of float because it is a reserved keyword.
322 public static object toFloat(object x)
323 {
324 return convertDouble(x);
325 }
326
327 /// <summary>
328 /// The ISO standard returns an int.
329 /// </summary>
330 /// <param name="x"></param>
331 /// <returns></returns>
332 public static object floor(object x)
333 {
334 return (int)Math.Floor(convertDouble(x));
335 }
336
337 /// <summary>
338 /// The ISO standard returns an int.
339 /// </summary>
340 /// <param name="x"></param>
341 /// <returns></returns>
342 public static object truncate(object x)
343 {
344 return (int)Math.Truncate(convertDouble(x));
345 }
346
347 /// <summary>
348 /// The ISO standard returns an int.
349 /// </summary>
350 /// <param name="x"></param>
351 /// <returns></returns>
352 public static object round(object x)
353 {
354 return (int)Math.Round(convertDouble(x));
355 }
356
357 /// <summary>
358 /// The ISO standard returns an int.
359 /// </summary>
360 /// <param name="x"></param>
361 /// <returns></returns>
362 public static object ceiling(object x)
363 {
364 return (int)Math.Ceiling(convertDouble(x));
365 }
366
367 public static object sin(object x)
368 {
369 return Math.Sin(YP.convertDouble(x));
370 }
371
372 public static object cos(object x)
373 {
374 return Math.Cos(YP.convertDouble(x));
375 }
376
377 public static object atan(object x)
378 {
379 return Math.Atan(YP.convertDouble(x));
380 }
381
382 public static object exp(object x)
383 {
384 return Math.Exp(YP.convertDouble(x));
385 }
386
387 public static object log(object x)
388 {
389 return Math.Log(YP.convertDouble(x));
390 }
391
392 public static object sqrt(object x)
393 {
394 return Math.Sqrt(convertDouble(x));
395 }
396
397 public static object bitwiseComplement(object x)
398 {
399 return ~YP.convertInt(x);
400 }
401
402 public static object add(object x, object y)
403 {
404 int intX, intY;
405 if (getInt(x, out intX) && getInt(y, out intY))
406 return intX + intY;
407 return convertDouble(x) + convertDouble(y);
408 }
409
410 public static object subtract(object x, object y)
411 {
412 int intX, intY;
413 if (getInt(x, out intX) && getInt(y, out intY))
414 return intX - intY;
415 return convertDouble(x) - convertDouble(y);
416 }
417
418 public static object multiply(object x, object y)
419 {
420 int intX, intY;
421 if (getInt(x, out intX) && getInt(y, out intY))
422 return intX * intY;
423 return convertDouble(x) * convertDouble(y);
424 }
425
426 /// <summary>
427 /// Return floating point, even if both arguments are integer.
428 /// </summary>
429 /// <param name="x"></param>
430 /// <param name="y"></param>
431 /// <returns></returns>
432 public static object divide(object x, object y)
433 {
434 return convertDouble(x) / convertDouble(y);
435 }
436
437 public static object intDivide(object x, object y)
438 {
439 int intX, intY;
440 if (getInt(x, out intX) && getInt(y, out intY))
441 return intX / intY;
442 // Still allow passing a double, but treat as an int.
443 return (int)convertDouble(x) / (int)convertDouble(y);
444 }
445
446 public static object mod(object x, object y)
447 {
448 int intX, intY;
449 if (getInt(x, out intX) && getInt(y, out intY))
450 return intX % intY;
451 // Still allow passing a double, but treat as an int.
452 return (int)convertDouble(x) % (int)convertDouble(y);
453 }
454
455 public static object pow(object x, object y)
456 {
457 return Math.Pow(YP.convertDouble(x), YP.convertDouble(y));
458 }
459
460 public static object bitwiseShiftRight(object x, object y)
461 {
462 return YP.convertInt(x) >> YP.convertInt(y);
463 }
464
465 public static object bitwiseShiftLeft(object x, object y)
466 {
467 return YP.convertInt(x) << YP.convertInt(y);
468 }
469
470 public static object bitwiseAnd(object x, object y)
471 {
472 return YP.convertInt(x) & YP.convertInt(y);
473 }
474
475 public static object bitwiseOr(object x, object y)
476 {
477 return YP.convertInt(x) | YP.convertInt(y);
478 }
479
480 public static object min(object x, object y)
481 {
482 int intX, intY;
483 if (getInt(x, out intX) && getInt(y, out intY))
484 return Math.Min(intX, intY);
485 return Math.Min(convertDouble(x), convertDouble(y));
486 }
487
488 public static object max(object x, object y)
489 {
490 int intX, intY;
491 if (getInt(x, out intX) && getInt(y, out intY))
492 return Math.Max(intX, intY);
493 return Math.Max(convertDouble(x), convertDouble(y));
494 }
495
496 public static IEnumerable<bool> copy_term(object inTerm, object outTerm)
497 {
498 return YP.unify(outTerm, YP.makeCopy(inTerm, new Variable.CopyStore()));
499 }
500
501 public static void addUniqueVariables(object term, List<Variable> variableSet)
502 {
503 term = YP.getValue(term);
504 if (term is IUnifiable)
505 ((IUnifiable)term).addUniqueVariables(variableSet);
506 }
507
508 public static object makeCopy(object term, Variable.CopyStore copyStore)
509 {
510 term = YP.getValue(term);
511 if (term is IUnifiable)
512 return ((IUnifiable)term).makeCopy(copyStore);
513 else
514 // term is a "normal" type. Assume it is ground.
515 return term;
516 }
517
518 /// <summary>
519 /// Sort the array in place according to termLessThan. This does not remove duplicates
520 /// </summary>
521 /// <param name="array"></param>
522 public static void sortArray(object[] array)
523 {
524 Array.Sort(array, YP.compareTerms);
525 }
526
527 /// <summary>
528 /// Sort the array in place according to termLessThan. This does not remove duplicates
529 /// </summary>
530 /// <param name="array"></param>
531 public static void sortArray(List<object> array)
532 {
533 array.Sort(YP.compareTerms);
534 }
535
536 /// <summary>
537 /// Sort List according to termLessThan, remove duplicates and unify with Sorted.
538 /// </summary>
539 /// <param name="List"></param>
540 /// <param name="Sorted"></param>
541 /// <returns></returns>
542 public static IEnumerable<bool> sort(object List, object Sorted)
543 {
544 object[] array = ListPair.toArray(List);
545 if (array == null)
546 return YP.fail();
547 if (array.Length > 1)
548 sortArray(array);
549 return YP.unify(Sorted, ListPair.makeWithoutRepeatedTerms(array));
550 }
551
552 /// <summary>
553 /// Use YP.unify to unify each of the elements of the two arrays, and yield
554 /// once if they all unify.
555 /// </summary>
556 /// <param name="array1"></param>
557 /// <param name="array2"></param>
558 /// <returns></returns>
559 public static IEnumerable<bool> unifyArrays(object[] array1, object[] array2)
560 {
561 if (array1.Length != array2.Length)
562 yield break;
563
564 IEnumerator<bool>[] iterators = new IEnumerator<bool>[array1.Length];
565 bool gotMatch = true;
566 int nIterators = 0;
567 // Try to bind all the arguments.
568 for (int i = 0; i < array1.Length; ++i)
569 {
570 IEnumerator<bool> iterator = YP.unify(array1[i], array2[i]).GetEnumerator();
571 iterators[nIterators++] = iterator;
572 // MoveNext() is true if YP.unify succeeds.
573 if (!iterator.MoveNext())
574 {
575 gotMatch = false;
576 break;
577 }
578 }
579 int z = 0;
580 try
581 {
582 if (gotMatch)
583 yield return false;
584 }
585 finally
586 {
587 // Manually finalize all the iterators.
588 for (z = 0; z < nIterators; ++z)
589 iterators[z].Dispose();
590 }
591 }
592
593 /// <summary>
594 /// Return an iterator (which you can use in a for-in loop) which does
595 /// zero iterations. This returns a pre-existing iterator which is
596 /// more efficient than letting the compiler generate a new one.
597 /// </summary>
598 /// <returns></returns>
599 public static IEnumerable<bool> fail()
600 {
601 return _fail;
602 }
603
604 /// <summary>
605 /// Return an iterator (which you can use in a for-in loop) which does
606 /// one iteration. This returns a pre-existing iterator which is
607 /// more efficient than letting the compiler generate a new one.
608 /// </summary>
609 /// <returns></returns>
610 public static IEnumerable<bool> succeed()
611 {
612 return new Succeed();
613 }
614
615 /// <summary>
616 /// Return an iterator (which you can use in a for-in loop) which repeats
617 /// indefinitely. This returns a pre-existing iterator which is
618 /// more efficient than letting the compiler generate a new one.
619 /// </summary>
620 /// <returns></returns>
621 public static IEnumerable<bool> repeat()
622 {
623 return _repeat;
624 }
625
626 // disable warning on l1, don't see how we can
627 // code this differently
628 #pragma warning disable 0168, 0219
629 public static IEnumerable<bool> univ(object Term, object List)
630 {
631 Term = YP.getValue(Term);
632 List = YP.getValue(List);
633
634 if (nonvar(Term))
635 return YP.unify(new ListPair
636 (getFunctorName(Term), ListPair.make(getFunctorArgs(Term))), List);
637
638 Variable Name = new Variable();
639 Variable ArgList = new Variable();
640 foreach (bool l1 in new ListPair(Name, ArgList).unify(List))
641 {
642 object[] args = ListPair.toArray(ArgList);
643 if (args == null)
644 throw new PrologException
645 (new Functor2("type_error", Atom.a("list"), ArgList),
646 "Expected a list. Got: " + ArgList.getValue());
647 if (args.Length == 0)
648 // Return the Name, even if it is not an Atom.
649 return YP.unify(Term, Name);
650 if (args.Length > MAX_ARITY)
651 throw new PrologException
652 (new Functor1("representation_error", Atom.a("max_arity")),
653 "Functor arity " + args.Length + " may not be greater than " + MAX_ARITY);
654 if (!atom(Name))
655 throw new PrologException
656 (new Functor2("type_error", Atom.a("atom"), Name),
657 "Expected an atom. Got: " + Name.getValue());
658
659 return YP.unify(Term, Functor.make((Atom)YP.getValue(Name), args));
660 }
661
662 return YP.fail();
663 }
664
665 public static IEnumerable<bool> functor(object Term, object FunctorName, object Arity)
666 {
667 Term = YP.getValue(Term);
668 FunctorName = YP.getValue(FunctorName);
669 Arity = YP.getValue(Arity);
670
671 if (Term is Variable)
672 {
673 if (FunctorName is Variable)
674 throw new PrologException(Atom.a("instantiation_error"),
675 "Arg 2 FunctorName is an unbound variable");
676 if (Arity is Variable)
677 throw new PrologException(Atom.a("instantiation_error"),
678 "Arg 3 Arity is an unbound variable");
679 if (!(Arity is int))
680 throw new PrologException
681 (new Functor2("type_error", Atom.a("integer"), Arity), "Arity is not an integer");
682 if (!YP.atomic(FunctorName))
683 throw new PrologException
684 (new Functor2("type_error", Atom.a("atomic"), FunctorName), "FunctorName is not atomic");
685
686 if ((int)Arity < 0)
687 throw new PrologException
688 (new Functor2("domain_error", Atom.a("not_less_than_zero"), Arity),
689 "Arity may not be less than zero");
690 else if ((int)Arity == 0)
691 {
692 // Just unify Term with the atomic FunctorName.
693 foreach (bool l1 in YP.unify(Term, FunctorName))
694 yield return false;
695 }
696 else
697 {
698 if ((int)Arity > MAX_ARITY)
699 throw new PrologException
700 (new Functor1("representation_error", Atom.a("max_arity")),
701 "Functor arity " + Arity + " may not be greater than " + MAX_ARITY);
702 if (!(FunctorName is Atom))
703 throw new PrologException
704 (new Functor2("type_error", Atom.a("atom"), FunctorName), "FunctorName is not an atom");
705 // Construct a functor with unbound variables.
706 object[] args = new object[(int)Arity];
707 for (int i = 0; i < args.Length; ++i)
708 args[i] = new Variable();
709 foreach (bool l1 in YP.unify(Term, Functor.make((Atom)FunctorName, args)))
710 yield return false;
711 }
712 }
713 else
714 {
715 foreach (bool l1 in YP.unify(FunctorName, getFunctorName(Term)))
716 {
717 foreach (bool l2 in YP.unify(Arity, getFunctorArgs(Term).Length))
718 yield return false;
719 }
720 }
721 }
722
723 public static IEnumerable<bool> arg(object ArgNumber, object Term, object Value)
724 {
725 if (var(ArgNumber))
726 throw new PrologException(Atom.a("instantiation_error"), "Arg 1 ArgNumber is an unbound variable");
727 int argNumberInt;
728 if (!getInt(ArgNumber, out argNumberInt))
729 throw new PrologException
730 (new Functor2("type_error", Atom.a("integer"), ArgNumber), "Arg 1 ArgNumber must be integer");
731 if (argNumberInt < 0)
732 throw new PrologException
733 (new Functor2("domain_error", Atom.a("not_less_than_zero"), argNumberInt),
734 "ArgNumber may not be less than zero");
735
736 if (YP.var(Term))
737 throw new PrologException(Atom.a("instantiation_error"),
738 "Arg 2 Term is an unbound variable");
739 if (!YP.compound(Term))
740 throw new PrologException
741 (new Functor2("type_error", Atom.a("compound"), Term), "Arg 2 Term must be compound");
742
743 object[] termArgs = YP.getFunctorArgs(Term);
744 // Silently fail if argNumberInt is out of range.
745 if (argNumberInt >= 1 && argNumberInt <= termArgs.Length)
746 {
747 // The first ArgNumber is at 1, not 0.
748 foreach (bool l1 in YP.unify(Value, termArgs[argNumberInt - 1]))
749 yield return false;
750 }
751 }
752
753 public static bool termEqual(object Term1, object Term2)
754 {
755 Term1 = YP.getValue(Term1);
756 if (Term1 is IUnifiable)
757 return ((IUnifiable)Term1).termEqual(Term2);
758 return Term1.Equals(YP.getValue(Term2));
759 }
760
761 public static bool termNotEqual(object Term1, object Term2)
762 {
763 return !termEqual(Term1, Term2);
764 }
765
766 public static bool termLessThan(object Term1, object Term2)
767 {
768 Term1 = YP.getValue(Term1);
769 Term2 = YP.getValue(Term2);
770 int term1TypeCode = getTypeCode(Term1);
771 int term2TypeCode = getTypeCode(Term2);
772 if (term1TypeCode != term2TypeCode)
773 return term1TypeCode < term2TypeCode;
774
775 // The terms are the same type code.
776 if (term1TypeCode == -2)
777 {
778 // Variable.
779 // We always check for equality first because we want to be sure
780 // that less than returns false if the terms are equal, in
781 // case that the less than check really behaves like less than or equal.
782 if ((Variable)Term1 != (Variable)Term2)
783 // The hash code should be unique to a Variable object.
784 return Term1.GetHashCode() < Term2.GetHashCode();
785 return false;
786 }
787 if (term1TypeCode == 0)
788 return ((Atom)Term1)._name.CompareTo(((Atom)Term2)._name) < 0;
789 if (term1TypeCode == 1)
790 return ((Functor1)Term1).lessThan((Functor1)Term2);
791 if (term1TypeCode == 2)
792 return ((Functor2)Term1).lessThan((Functor2)Term2);
793 if (term1TypeCode == 3)
794 return ((Functor3)Term1).lessThan((Functor3)Term2);
795 if (term1TypeCode == 4)
796 return ((Functor)Term1).lessThan((Functor)Term2);
797
798 // Type code is -1 for general objects. First compare their type names.
799 // Note that this puts Double before Int32 as required by ISO Prolog.
800 string term1TypeName = Term1.GetType().ToString();
801 string term2TypeName = Term2.GetType().ToString();
802 if (term1TypeName != term2TypeName)
803 return term1TypeName.CompareTo(term2TypeName) < 0;
804
805 // The terms are the same type name.
806 if (Term1 is int)
807 return (int)Term1 < (int)Term2;
808 else if (Term1 is double)
809 return (double)Term1 < (double)Term2;
810 else if (Term1 is DateTime)
811 return (DateTime)Term1 < (DateTime)Term2;
812 else if (Term1 is String)
813 return ((String)Term1).CompareTo((String)Term2) < 0;
814 // Debug: Should we try arrays, etc.?
815
816 if (!Term1.Equals(Term2))
817 // Could be equal or greater than.
818 return Term1.GetHashCode() < Term2.GetHashCode();
819 return false;
820 }
821
822 /// <summary>
823 /// Type code is -2 if term is a Variable, 0 if it is an Atom,
824 /// 1 if it is a Functor1, 2 if it is a Functor2, 3 if it is a Functor3,
825 /// 4 if it is Functor.
826 /// Otherwise, type code is -1.
827 /// This does not call YP.getValue(term).
828 /// </summary>
829 /// <param name="term"></param>
830 /// <returns></returns>
831 private static int getTypeCode(object term)
832 {
833 if (term is Variable)
834 return -2;
835 else if (term is Atom)
836 return 0;
837 else if (term is Functor1)
838 return 1;
839 else if (term is Functor2)
840 return 2;
841 else if (term is Functor3)
842 return 3;
843 else if (term is Functor)
844 return 4;
845 else
846 return -1;
847 }
848
849 public static bool termLessThanOrEqual(object Term1, object Term2)
850 {
851 if (YP.termEqual(Term1, Term2))
852 return true;
853 return YP.termLessThan(Term1, Term2);
854 }
855
856 public static bool termGreaterThan(object Term1, object Term2)
857 {
858 return !YP.termLessThanOrEqual(Term1, Term2);
859 }
860
861 public static bool termGreaterThanOrEqual(object Term1, object Term2)
862 {
863 // termLessThan should ensure that it returns false if terms are equal,
864 // so that this would return true.
865 return !YP.termLessThan(Term1, Term2);
866 }
867
868 public static int compareTerms(object Term1, object Term2)
869 {
870 if (YP.termEqual(Term1, Term2))
871 return 0;
872 else if (YP.termLessThan(Term1, Term2))
873 return -1;
874 else
875 return 1;
876 }
877
878 public static bool ground(object Term)
879 {
880 Term = YP.getValue(Term);
881 if (Term is IUnifiable)
882 return ((IUnifiable)Term).ground();
883 return true;
884 }
885
886 public static IEnumerable<bool> current_op
887 (object Priority, object Specifier, object Operator)
888 {
889 if (_operatorTable == null)
890 {
891 // Initialize.
892 _operatorTable = new IndexedAnswers(3);
893 _operatorTable.addAnswer(new object[] { 1200, Atom.a("xfx"), Atom.a(":-") });
894 _operatorTable.addAnswer(new object[] { 1200, Atom.a("xfx"), Atom.a("-->") });
895 _operatorTable.addAnswer(new object[] { 1200, Atom.a("fx"), Atom.a(":-") });
896 _operatorTable.addAnswer(new object[] { 1200, Atom.a("fx"), Atom.a("?-") });
897 _operatorTable.addAnswer(new object[] { 1100, Atom.a("xfy"), Atom.a(";") });
898 _operatorTable.addAnswer(new object[] { 1050, Atom.a("xfy"), Atom.a("->") });
899 _operatorTable.addAnswer(new object[] { 1000, Atom.a("xfy"), Atom.a(",") });
900 _operatorTable.addAnswer(new object[] { 900, Atom.a("fy"), Atom.a("\\+") });
901 _operatorTable.addAnswer(new object[] { 700, Atom.a("xfx"), Atom.a("=") });
902 _operatorTable.addAnswer(new object[] { 700, Atom.a("xfx"), Atom.a("\\=") });
903 _operatorTable.addAnswer(new object[] { 700, Atom.a("xfx"), Atom.a("==") });
904 _operatorTable.addAnswer(new object[] { 700, Atom.a("xfx"), Atom.a("\\==") });
905 _operatorTable.addAnswer(new object[] { 700, Atom.a("xfx"), Atom.a("@<") });
906 _operatorTable.addAnswer(new object[] { 700, Atom.a("xfx"), Atom.a("@=<") });
907 _operatorTable.addAnswer(new object[] { 700, Atom.a("xfx"), Atom.a("@>") });
908 _operatorTable.addAnswer(new object[] { 700, Atom.a("xfx"), Atom.a("@>=") });
909 _operatorTable.addAnswer(new object[] { 700, Atom.a("xfx"), Atom.a("=..") });
910 _operatorTable.addAnswer(new object[] { 700, Atom.a("xfx"), Atom.a("is") });
911 _operatorTable.addAnswer(new object[] { 700, Atom.a("xfx"), Atom.a("=:=") });
912 _operatorTable.addAnswer(new object[] { 700, Atom.a("xfx"), Atom.a("=\\=") });
913 _operatorTable.addAnswer(new object[] { 700, Atom.a("xfx"), Atom.a("<") });
914 _operatorTable.addAnswer(new object[] { 700, Atom.a("xfx"), Atom.a("=<") });
915 _operatorTable.addAnswer(new object[] { 700, Atom.a("xfx"), Atom.a(">") });
916 _operatorTable.addAnswer(new object[] { 700, Atom.a("xfx"), Atom.a(">=") });
917 _operatorTable.addAnswer(new object[] { 600, Atom.a("xfy"), Atom.a(":") });
918 _operatorTable.addAnswer(new object[] { 500, Atom.a("yfx"), Atom.a("+") });
919 _operatorTable.addAnswer(new object[] { 500, Atom.a("yfx"), Atom.a("-") });
920 _operatorTable.addAnswer(new object[] { 500, Atom.a("yfx"), Atom.a("/\\") });
921 _operatorTable.addAnswer(new object[] { 500, Atom.a("yfx"), Atom.a("\\/") });
922 _operatorTable.addAnswer(new object[] { 400, Atom.a("yfx"), Atom.a("*") });
923 _operatorTable.addAnswer(new object[] { 400, Atom.a("yfx"), Atom.a("/") });
924 _operatorTable.addAnswer(new object[] { 400, Atom.a("yfx"), Atom.a("//") });
925 _operatorTable.addAnswer(new object[] { 400, Atom.a("yfx"), Atom.a("rem") });
926 _operatorTable.addAnswer(new object[] { 400, Atom.a("yfx"), Atom.a("mod") });
927 _operatorTable.addAnswer(new object[] { 400, Atom.a("yfx"), Atom.a("<<") });
928 _operatorTable.addAnswer(new object[] { 400, Atom.a("yfx"), Atom.a(">>") });
929 _operatorTable.addAnswer(new object[] { 200, Atom.a("xfx"), Atom.a("**") });
930 _operatorTable.addAnswer(new object[] { 200, Atom.a("xfy"), Atom.a("^") });
931 _operatorTable.addAnswer(new object[] { 200, Atom.a("fy"), Atom.a("-") });
932 _operatorTable.addAnswer(new object[] { 200, Atom.a("fy"), Atom.a("\\") });
933 // Debug: This is hacked in to run the Prolog test suite until we implement op/3.
934 _operatorTable.addAnswer(new object[] { 20, Atom.a("xfx"), Atom.a("<--") });
935 }
936
937 return _operatorTable.match(new object[] { Priority, Specifier, Operator });
938 }
939
940 public static IEnumerable<bool> atom_length(object atom, object Length)
941 {
942 atom = YP.getValue(atom);
943 Length = YP.getValue(Length);
944 if (atom is Variable)
945 throw new PrologException(Atom.a("instantiation_error"),
946 "Expected atom(Arg1) but it is an unbound variable");
947 if (!(atom is Atom))
948 throw new PrologException
949 (new Functor2("type_error", Atom.a("atom"), atom), "Arg 1 Atom is not an atom");
950 if (!(Length is Variable))
951 {
952 if (!(Length is int))
953 throw new PrologException
954 (new Functor2("type_error", Atom.a("integer"), Length), "Length must be var or integer");
955 if ((int)Length < 0)
956 throw new PrologException
957 (new Functor2("domain_error", Atom.a("not_less_than_zero"), Length),
958 "Length must not be less than zero");
959 }
960 return YP.unify(Length, ((Atom)atom)._name.Length);
961 }
962
963 public static IEnumerable<bool> atom_concat(object Start, object End, object Whole)
964 {
965 // Debug: Should we try to preserve the _declaringClass?
966 Start = YP.getValue(Start);
967 End = YP.getValue(End);
968 Whole = YP.getValue(Whole);
969 if (Whole is Variable)
970 {
971 if (Start is Variable)
972 throw new PrologException(Atom.a("instantiation_error"),
973 "Arg 1 Start and arg 3 Whole are both var");
974 if (End is Variable)
975 throw new PrologException(Atom.a("instantiation_error"),
976 "Arg 2 End and arg 3 Whole are both var");
977 if (!(Start is Atom))
978 throw new PrologException
979 (new Functor2("type_error", Atom.a("atom"), Start), "Arg 1 Start is not an atom");
980 if (!(End is Atom))
981 throw new PrologException
982 (new Functor2("type_error", Atom.a("atom"), End), "Arg 2 End is not an atom");
983
984 foreach (bool l1 in YP.unify(Whole, Atom.a(((Atom)Start)._name + ((Atom)End)._name)))
985 yield return false;
986 }
987 else
988 {
989 if (!(Whole is Atom))
990 throw new PrologException
991 (new Functor2("type_error", Atom.a("atom"), Whole), "Arg 3 Whole is not an atom");
992 bool gotStartLength = false;
993 int startLength = 0;
994 if (!(Start is Variable))
995 {
996 if (!(Start is Atom))
997 throw new PrologException
998 (new Functor2("type_error", Atom.a("atom"), Start), "Arg 1 Start is not var or atom");
999 startLength = ((Atom)Start)._name.Length;
1000 gotStartLength = true;
1001 }
1002
1003 bool gotEndLength = false;
1004 int endLength = 0;
1005 if (!(End is Variable))
1006 {
1007 if (!(End is Atom))
1008 throw new PrologException
1009 (new Functor2("type_error", Atom.a("atom"), End), "Arg 2 End is not var or atom");
1010 endLength = ((Atom)End)._name.Length;
1011 gotEndLength = true;
1012 }
1013
1014 // We are doing a search through all possible Start and End which concatenate to Whole.
1015 string wholeString = ((Atom)Whole)._name;
1016 for (int i = 0; i <= wholeString.Length; ++i)
1017 {
1018 // If we got either startLength or endLength, we know the lengths have to match so check
1019 // the lengths instead of constructing an Atom to do it.
1020 if (gotStartLength && startLength != i)
1021 continue;
1022 if (gotEndLength && endLength != wholeString.Length - i)
1023 continue;
1024 foreach (bool l1 in YP.unify(Start, Atom.a(wholeString.Substring(0, i))))
1025 {
1026 foreach (bool l2 in YP.unify(End, Atom.a(wholeString.Substring(i, wholeString.Length - i))))
1027 yield return false;
1028 }
1029 }
1030 }
1031 }
1032
1033 public static IEnumerable<bool> sub_atom
1034 (object atom, object Before, object Length, object After, object Sub_atom)
1035 {
1036 // Debug: Should we try to preserve the _declaringClass?
1037 atom = YP.getValue(atom);
1038 Before = YP.getValue(Before);
1039 Length = YP.getValue(Length);
1040 After = YP.getValue(After);
1041 Sub_atom = YP.getValue(Sub_atom);
1042 if (atom is Variable)
1043 throw new PrologException(Atom.a("instantiation_error"),
1044 "Expected atom(Arg1) but it is an unbound variable");
1045 if (!(atom is Atom))
1046 throw new PrologException
1047 (new Functor2("type_error", Atom.a("atom"), atom), "Arg 1 Atom is not an atom");
1048 if (!(Sub_atom is Variable))
1049 {
1050 if (!(Sub_atom is Atom))
1051 throw new PrologException
1052 (new Functor2("type_error", Atom.a("atom"), Sub_atom), "Sub_atom is not var or atom");
1053 }
1054
1055 bool beforeIsInt = false;
1056 bool lengthIsInt = false;
1057 bool afterIsInt = false;
1058 if (!(Before is Variable))
1059 {
1060 if (!(Before is int))
1061 throw new PrologException
1062 (new Functor2("type_error", Atom.a("integer"), Before), "Before must be var or integer");
1063 beforeIsInt = true;
1064 if ((int)Before < 0)
1065 throw new PrologException
1066 (new Functor2("domain_error", Atom.a("not_less_than_zero"), Before),
1067 "Before must not be less than zero");
1068 }
1069 if (!(Length is Variable))
1070 {
1071 if (!(Length is int))
1072 throw new PrologException
1073 (new Functor2("type_error", Atom.a("integer"), Length), "Length must be var or integer");
1074 lengthIsInt = true;
1075 if ((int)Length < 0)
1076 throw new PrologException
1077 (new Functor2("domain_error", Atom.a("not_less_than_zero"), Length),
1078 "Length must not be less than zero");
1079 }
1080 if (!(After is Variable))
1081 {
1082 if (!(After is int))
1083 throw new PrologException
1084 (new Functor2("type_error", Atom.a("integer"), After), "After must be var or integer");
1085 afterIsInt = true;
1086 if ((int)After < 0)
1087 throw new PrologException
1088 (new Functor2("domain_error", Atom.a("not_less_than_zero"), After),
1089 "After must not be less than zero");
1090 }
1091
1092 Atom atomAtom = (Atom)atom;
1093 int atomLength = atomAtom._name.Length;
1094 if (beforeIsInt && lengthIsInt)
1095 {
1096 // Special case: the caller is just trying to extract a substring, so do it quickly.
1097 int xAfter = atomLength - (int)Before - (int)Length;
1098 if (xAfter >= 0)
1099 {
1100 foreach (bool l1 in YP.unify(After, xAfter))
1101 {
1102 foreach (bool l2 in YP.unify
1103 (Sub_atom, Atom.a(atomAtom._name.Substring((int)Before, (int)Length))))
1104 yield return false;
1105 }
1106 }
1107 }
1108 else if (afterIsInt && lengthIsInt)
1109 {
1110 // Special case: the caller is just trying to extract a substring, so do it quickly.
1111 int xBefore = atomLength - (int)After - (int)Length;
1112 if (xBefore >= 0)
1113 {
1114 foreach (bool l1 in YP.unify(Before, xBefore))
1115 {
1116 foreach (bool l2 in YP.unify
1117 (Sub_atom, Atom.a(atomAtom._name.Substring(xBefore, (int)Length))))
1118 yield return false;
1119 }
1120 }
1121 }
1122 else
1123 {
1124 // We are underconstrained and doing a search, so go through all possibilities.
1125 for (int xBefore = 0; xBefore <= atomLength; ++xBefore)
1126 {
1127 foreach (bool l1 in YP.unify(Before, xBefore))
1128 {
1129 for (int xLength = 0; xLength <= (atomLength - xBefore); ++xLength)
1130 {
1131 foreach (bool l2 in YP.unify(Length, xLength))
1132 {
1133 foreach (bool l3 in YP.unify(After, atomLength - (xBefore + xLength)))
1134 {
1135 foreach (bool l4 in YP.unify
1136 (Sub_atom, Atom.a(atomAtom._name.Substring(xBefore, xLength))))
1137 yield return false;
1138 }
1139 }
1140 }
1141 }
1142 }
1143 }
1144 }
1145
1146 public static IEnumerable<bool> atom_chars(object atom, object List)
1147 {
1148 atom = YP.getValue(atom);
1149 List = YP.getValue(List);
1150
1151 if (atom is Variable)
1152 {
1153 if (List is Variable)
1154 throw new PrologException(Atom.a("instantiation_error"),
1155 "Arg 1 Atom and arg 2 List are both unbound variables");
1156 object[] codeArray = ListPair.toArray(List);
1157 if (codeArray == null)
1158 throw new PrologException
1159 (new Functor2("type_error", Atom.a("list"), List), "Arg 2 List is not a list");
1160
1161 char[] charArray = new char[codeArray.Length];
1162 for (int i = 0; i < codeArray.Length; ++i)
1163 {
1164 object listAtom = YP.getValue(codeArray[i]);
1165 if (listAtom is Variable)
1166 throw new PrologException(Atom.a("instantiation_error"),
1167 "Arg 2 List has an element which is an unbound variable");
1168 if (!(listAtom is Atom && ((Atom)listAtom)._name.Length == 1))
1169 throw new PrologException
1170 (new Functor2("type_error", Atom.a("character"), listAtom),
1171 "Arg 2 List has an element which is not a one character atom");
1172 charArray[i] = ((Atom)listAtom)._name[0];
1173 }
1174 return YP.unify(atom, Atom.a(new String(charArray)));
1175 }
1176 else
1177 {
1178 if (!(atom is Atom))
1179 throw new PrologException
1180 (new Functor2("type_error", Atom.a("atom"), atom), "Arg 1 Atom is not var or atom");
1181
1182 string atomString = ((Atom)atom)._name;
1183 object charList = Atom.NIL;
1184 // Start from the back to make the list.
1185 for (int i = atomString.Length - 1; i >= 0; --i)
1186 charList = new ListPair(Atom.a(atomString.Substring(i, 1)), charList);
1187 return YP.unify(List, charList);
1188 }
1189 }
1190
1191 public static IEnumerable<bool> atom_codes(object atom, object List)
1192 {
1193 atom = YP.getValue(atom);
1194 List = YP.getValue(List);
1195
1196 if (atom is Variable)
1197 {
1198 if (List is Variable)
1199 throw new PrologException(Atom.a("instantiation_error"),
1200 "Arg 1 Atom and arg 2 List are both unbound variables");
1201 object[] codeArray = ListPair.toArray(List);
1202 if (codeArray == null)
1203 throw new PrologException
1204 (new Functor2("type_error", Atom.a("list"), List), "Arg 2 List is not a list");
1205
1206 char[] charArray = new char[codeArray.Length];
1207 for (int i = 0; i < codeArray.Length; ++i)
1208 {
1209 int codeInt;
1210 if (!getInt(codeArray[i], out codeInt) || codeInt < 0)
1211 throw new PrologException
1212 (new Functor1("representation_error", Atom.a("character_code")),
1213 "Element of Arg 2 List is not a character code");
1214 charArray[i] = (char)codeInt;
1215 }
1216 return YP.unify(atom, Atom.a(new String(charArray)));
1217 }
1218 else
1219 {
1220 if (!(atom is Atom))
1221 throw new PrologException
1222 (new Functor2("type_error", Atom.a("atom"), atom), "Arg 1 Atom is not var or atom");
1223
1224 string atomString = ((Atom)atom)._name;
1225 object codeList = Atom.NIL;
1226 // Start from the back to make the list.
1227 for (int i = atomString.Length - 1; i >= 0; --i)
1228 codeList = new ListPair((int)atomString[i], codeList);
1229 return YP.unify(List, codeList);
1230 }
1231 }
1232
1233 public static IEnumerable<bool> number_chars(object Number, object List)
1234 {
1235 Number = YP.getValue(Number);
1236 List = YP.getValue(List);
1237
1238 if (Number is Variable)
1239 {
1240 if (List is Variable)
1241 throw new PrologException(Atom.a("instantiation_error"),
1242 "Arg 1 Number and arg 2 List are both unbound variables");
1243 object[] codeArray = ListPair.toArray(List);
1244 if (codeArray == null)
1245 throw new PrologException
1246 (new Functor2("type_error", Atom.a("list"), List), "Arg 2 List is not a list");
1247
1248 char[] charArray = new char[codeArray.Length];
1249 for (int i = 0; i < codeArray.Length; ++i)
1250 {
1251 object listAtom = YP.getValue(codeArray[i]);
1252 if (listAtom is Variable)
1253 throw new PrologException(Atom.a("instantiation_error"),
1254 "Arg 2 List has an element which is an unbound variable");
1255 if (!(listAtom is Atom && ((Atom)listAtom)._name.Length == 1))
1256 throw new PrologException
1257 (new Functor2("type_error", Atom.a("character"), listAtom),
1258 "Arg 2 List has an element which is not a one character atom");
1259 charArray[i] = ((Atom)listAtom)._name[0];
1260 }
1261 return YP.unify(Number, parseNumberString(charArray));
1262 }
1263 else
1264 {
1265 string numberString = null;
1266 // Try converting to an int first.
1267 int intNumber;
1268 if (YP.getInt(Number, out intNumber))
1269 numberString = intNumber.ToString();
1270 else
1271 {
1272 if (!YP.number(Number))
1273 throw new PrologException
1274 (new Functor2("type_error", Atom.a("number"), Number),
1275 "Arg 1 Number is not var or number");
1276 // We just checked, so convertDouble shouldn't throw an exception.
1277 numberString = YP.doubleToString(YP.convertDouble(Number));
1278 }
1279
1280 object charList = Atom.NIL;
1281 // Start from the back to make the list.
1282 for (int i = numberString.Length - 1; i >= 0; --i)
1283 charList = new ListPair(Atom.a(numberString.Substring(i, 1)), charList);
1284 return YP.unify(List, charList);
1285 }
1286 }
1287
1288 public static IEnumerable<bool> number_codes(object Number, object List)
1289 {
1290 Number = YP.getValue(Number);
1291 List = YP.getValue(List);
1292
1293 if (Number is Variable)
1294 {
1295 if (List is Variable)
1296 throw new PrologException(Atom.a("instantiation_error"),
1297 "Arg 1 Number and arg 2 List are both unbound variables");
1298 object[] codeArray = ListPair.toArray(List);
1299 if (codeArray == null)
1300 throw new PrologException
1301 (new Functor2("type_error", Atom.a("list"), List), "Arg 2 List is not a list");
1302
1303 char[] charArray = new char[codeArray.Length];
1304 for (int i = 0; i < codeArray.Length; ++i)
1305 {
1306 int codeInt;
1307 if (!getInt(codeArray[i], out codeInt) || codeInt < 0)
1308 throw new PrologException
1309 (new Functor1("representation_error", Atom.a("character_code")),
1310 "Element of Arg 2 List is not a character code");
1311 charArray[i] = (char)codeInt;
1312 }
1313 return YP.unify(Number, parseNumberString(charArray));
1314 }
1315 else
1316 {
1317 string numberString = null;
1318 // Try converting to an int first.
1319 int intNumber;
1320 if (YP.getInt(Number, out intNumber))
1321 numberString = intNumber.ToString();
1322 else
1323 {
1324 if (!YP.number(Number))
1325 throw new PrologException
1326 (new Functor2("type_error", Atom.a("number"), Number),
1327 "Arg 1 Number is not var or number");
1328 // We just checked, so convertDouble shouldn't throw an exception.
1329 numberString = YP.doubleToString(YP.convertDouble(Number));
1330 }
1331
1332 object codeList = Atom.NIL;
1333 // Start from the back to make the list.
1334 for (int i = numberString.Length - 1; i >= 0; --i)
1335 codeList = new ListPair((int)numberString[i], codeList);
1336 return YP.unify(List, codeList);
1337 }
1338 }
1339
1340 /// <summary>
1341 /// Used by number_chars and number_codes. Return the number in charArray or
1342 /// throw an exception if can't parse.
1343 /// </summary>
1344 /// <param name="numberString"></param>
1345 /// <returns></returns>
1346 private static object parseNumberString(char[] charArray)
1347 {
1348 string numberString = new String(charArray);
1349 if (charArray.Length == 3 && numberString.StartsWith("0'"))
1350 // This is a char code.
1351 return (int)charArray[2];
1352 if (numberString.StartsWith("0x"))
1353 {
1354 try
1355 {
1356 return Int32.Parse
1357 (numberString.Substring(2), System.Globalization.NumberStyles.AllowHexSpecifier);
1358 }
1359 catch (FormatException)
1360 {
1361 throw new PrologException
1362 (new Functor1("syntax_error", Atom.a("number_format: " + numberString)),
1363 "Arg 2 List is not a list for a hexadecimal number");
1364 }
1365 }
1366 // Debug: Is there a way in C# to ask if a string parses as int without throwing an exception?
1367 try
1368 {
1369 // Try an int first.
1370 return Convert.ToInt32(numberString);
1371 }
1372 catch (FormatException) { }
1373 try
1374 {
1375 return Convert.ToDouble(numberString);
1376 }
1377 catch (FormatException)
1378 {
1379 throw new PrologException
1380 (new Functor1("syntax_error", Atom.a("number_format: " + numberString)),
1381 "Arg 2 List is not a list for a number");
1382 }
1383 }
1384
1385 public static IEnumerable<bool> char_code(object Char, object Code)
1386 {
1387 Char = YP.getValue(Char);
1388 Code = YP.getValue(Code);
1389
1390 int codeInt = 0;
1391 if (!(Code is Variable))
1392 {
1393 // Get codeInt now so we type check it whether or not Char is Variable.
1394 if (!getInt(Code, out codeInt))
1395 throw new PrologException
1396 (new Functor2("type_error", Atom.a("integer"), Code),
1397 "Arg 2 Code is not var or a character code");
1398 if (codeInt < 0)
1399 throw new PrologException
1400 (new Functor1("representation_error", Atom.a("character_code")),
1401 "Arg 2 Code is not a character code");
1402 }
1403
1404 if (Char is Variable)
1405 {
1406 if (Code is Variable)
1407 throw new PrologException(Atom.a("instantiation_error"),
1408 "Arg 1 Char and arg 2 Code are both unbound variables");
1409
1410 return YP.unify(Char, Atom.a(new String(new char[] {(char)codeInt})));
1411 }
1412 else
1413 {
1414 if (!(Char is Atom) || ((Atom)Char)._name.Length != 1)
1415 throw new PrologException
1416 (new Functor2("type_error", Atom.a("character"), Char),
1417 "Arg 1 Char is not var or one-character atom");
1418
1419 if (Code is Variable)
1420 return YP.unify(Code, (int)((Atom)Char)._name[0]);
1421 else
1422 // Use codeInt to handle whether Code is supplied as, e.g., 97 or 0'a .
1423 return YP.unify(codeInt, (int)((Atom)Char)._name[0]);
1424 }
1425 }
1426
1427 /// <summary>
1428 /// If term is an Atom or functor type, return its name.
1429 /// Otherwise, return term.
1430 /// </summary>
1431 /// <param name="term"></param>
1432 /// <returns></returns>
1433 public static object getFunctorName(object term)
1434 {
1435 term = YP.getValue(term);
1436 if (term is Functor1)
1437 return ((Functor1)term)._name;
1438 else if (term is Functor2)
1439 return ((Functor2)term)._name;
1440 else if (term is Functor3)
1441 return ((Functor3)term)._name;
1442 else if (term is Functor)
1443 return ((Functor)term)._name;
1444 else
1445 return term;
1446 }
1447
1448 /// <summary>
1449 /// If term is an Atom or functor type, return an array of its args.
1450 /// Otherwise, return an empty array.
1451 /// </summary>
1452 /// <param name="term"></param>
1453 /// <returns></returns>
1454 public static object[] getFunctorArgs(object term)
1455 {
1456 term = YP.getValue(term);
1457 if (term is Functor1)
1458 {
1459 Functor1 functor = (Functor1)term;
1460 return new object[] { functor._arg1 };
1461 }
1462 else if (term is Functor2)
1463 {
1464 Functor2 functor = (Functor2)term;
1465 return new object[] { functor._arg1, functor._arg2 };
1466 }
1467 else if (term is Functor3)
1468 {
1469 Functor3 functor = (Functor3)term;
1470 return new object[] { functor._arg1, functor._arg2, functor._arg3 };
1471 }
1472 else if (term is Functor) {
1473 Functor functor = (Functor)term;
1474 return functor._args;
1475 }
1476 else
1477 return new object[0];
1478 }
1479
1480 public static bool var(object Term)
1481 {
1482 return YP.getValue(Term) is Variable;
1483 }
1484
1485 public static bool nonvar(object Term)
1486 {
1487 return !YP.var(Term);
1488 }
1489
1490 public static bool atom(object Term)
1491 {
1492 return YP.getValue(Term) is Atom;
1493 }
1494
1495 public static bool integer(object Term)
1496 {
1497 // Debug: Should exhaustively check for all integer types.
1498 return getValue(Term) is int;
1499 }
1500
1501 // Use isFloat instead of float because it is a reserved keyword.
1502 public static bool isFloat(object Term)
1503 {
1504 // Debug: Should exhaustively check for all float types.
1505 return getValue(Term) is double;
1506 }
1507
1508 public static bool number(object Term)
1509 {
1510 return YP.integer(Term) || YP.isFloat(Term);
1511 }
1512
1513 public static bool atomic(object Term)
1514 {
1515 return YP.atom(Term) || YP.number(Term);
1516 }
1517
1518 public static bool compound(object Term)
1519 {
1520 Term = getValue(Term);
1521 return Term is Functor1 || Term is Functor2 || Term is Functor3 || Term is Functor;
1522 }
1523
1524 /// <summary>
1525 /// If input is a TextReader, use it. If input is an Atom or String, create a StreamReader with the
1526 /// input as the filename. If input is a Prolog list, then read character codes from it.
1527 /// </summary>
1528 /// <param name="input"></param>
1529 public static void see(object input)
1530 {
1531 input = YP.getValue(input);
1532 if (input is Variable)
1533 throw new PrologException(Atom.a("instantiation_error"), "Arg is an unbound variable");
1534
1535 if (input == null)
1536 {
1537 _inputStream = null;
1538 return;
1539 }
1540 if (input is TextReader)
1541 {
1542 _inputStream = (TextReader)input;
1543 return;
1544 }
1545 else if (input is Atom)
1546 {
1547 _inputStream = new StreamReader(((Atom)input)._name);
1548 return;
1549 }
1550 else if (input is String)
1551 {
1552 _inputStream = new StreamReader((String)input);
1553 return;
1554 }
1555 else if (input is Functor2 && ((Functor2)input)._name == Atom.DOT)
1556 {
1557 _inputStream = new CodeListReader(input);
1558 return;
1559 }
1560 else
1561 throw new PrologException
1562 (new Functor2("domain_error", Atom.a("stream_or_alias"), input),
1563 "Input stream specifier not recognized");
1564 }
1565
1566 public static void seen()
1567 {
1568 if (_inputStream == null)
1569 return;
1570 if (_inputStream == Console.In)
1571 return;
1572 _inputStream.Close();
1573 _inputStream = Console.In;
1574 }
1575
1576 public static IEnumerable<bool> current_input(object Stream)
1577 {
1578 return YP.unify(Stream, _inputStream);
1579 }
1580
1581 /// <summary>
1582 /// If output is a TextWriter, use it. If output is an Atom or a String, create a StreamWriter
1583 /// with the input as the filename.
1584 /// </summary>
1585 /// <param name="output"></param>
1586 public static void tell(object output)
1587 {
1588 output = YP.getValue(output);
1589 if (output is Variable)
1590 throw new PrologException(Atom.a("instantiation_error"), "Arg is an unbound variable");
1591
1592 if (output == null)
1593 {
1594 _outputStream = null;
1595 return;
1596 }
1597 if (output is TextWriter)
1598 {
1599 _outputStream = (TextWriter)output;
1600 return;
1601 }
1602 else if (output is Atom)
1603 {
1604 _outputStream = new StreamWriter(((Atom)output)._name);
1605 return;
1606 }
1607 else if (output is String)
1608 {
1609 _outputStream = new StreamWriter((String)output);
1610 return;
1611 }
1612 else
1613 throw new PrologException
1614 (new Functor2("domain_error", Atom.a("stream_or_alias"), output),
1615 "Can't open stream for " + output);
1616 }
1617
1618 public static void told()
1619 {
1620 if (_outputStream == null)
1621 return;
1622 if (_outputStream == Console.Out)
1623 return;
1624 _outputStream.Close();
1625 _outputStream = Console.Out;
1626 }
1627
1628 public static IEnumerable<bool> current_output(object Stream)
1629 {
1630 return YP.unify(Stream, _outputStream);
1631 }
1632
1633 public static void write(object x)
1634 {
1635 if (_outputStream == null)
1636 return;
1637 x = YP.getValue(x);
1638 if (x is double)
1639 _outputStream.Write(doubleToString((double)x));
1640 else
1641 _outputStream.Write(x.ToString());
1642 }
1643
1644 /// <summary>
1645 /// Format x as a string, making sure that it won't parse as an int later. I.e., for 1.0, don't just
1646 /// use "1" which will parse as an int.
1647 /// </summary>
1648 /// <param name="x"></param>
1649 /// <returns></returns>
1650 private static string doubleToString(double x)
1651 {
1652 string xString = x.ToString();
1653 // Debug: Is there a way in C# to ask if a string parses as int without throwing an exception?
1654 try
1655 {
1656 Convert.ToInt32(xString);
1657 // The string will parse as an int, not a double, so re-format so that it does.
1658 // Use float if possible, else exponential if it would be too big.
1659 return x.ToString(x >= 100000.0 ? "E1" : "f1");
1660 }
1661 catch (FormatException)
1662 {
1663 // Assume it will parse as a double.
1664 }
1665 return xString;
1666 }
1667
1668 public static void put_code(object x)
1669 {
1670 if (_outputStream == null)
1671 return;
1672 if (var(x))
1673 throw new PrologException(Atom.a("instantiation_error"), "Arg 1 is an unbound variable");
1674 int xInt;
1675 if (!getInt(x, out xInt))
1676 throw new PrologException
1677 (new Functor2("type_error", Atom.a("integer"), x), "Arg 1 must be integer");
1678 _outputStream.Write((char)xInt);
1679 }
1680
1681 public static void nl()
1682 {
1683 if (_outputStream == null)
1684 return;
1685 _outputStream.WriteLine();
1686 }
1687
1688 public static IEnumerable<bool> get_code(object code)
1689 {
1690 if (_inputStream == null)
1691 return YP.unify(code, -1);
1692 else
1693 return YP.unify(code, _inputStream.Read());
1694 }
1695
1696 public static void asserta(object Term, Type declaringClass)
1697 {
1698 assertDynamic(Term, declaringClass, true);
1699 }
1700
1701 public static void assertz(object Term, Type declaringClass)
1702 {
1703 assertDynamic(Term, declaringClass, false);
1704 }
1705
1706 public static void assertDynamic(object Term, Type declaringClass, bool prepend)
1707 {
1708 Term = getValue(Term);
1709 if (Term is Variable)
1710 throw new PrologException("instantiation_error", "Term to assert is an unbound variable");
1711
1712 Variable.CopyStore copyStore = new Variable.CopyStore();
1713 object TermCopy = makeCopy(Term, copyStore);
1714 object Head, Body;
1715 if (TermCopy is Functor2 && ((Functor2)TermCopy)._name == Atom.RULE)
1716 {
1717 Head = YP.getValue(((Functor2)TermCopy)._arg1);
1718 Body = YP.getValue(((Functor2)TermCopy)._arg2);
1719 if (Head is Variable)
1720 throw new PrologException("instantiation_error", "Head to assert is an unbound variable");
1721 if (Body is Variable)
1722 throw new PrologException("instantiation_error", "Body to assert is an unbound variable");
1723 }
1724 else
1725 {
1726 Head = TermCopy;
1727 Body = Atom.a("true");
1728 }
1729
1730 Atom name = getFunctorName(Head) as Atom;
1731 if (name == null)
1732 // name is a non-Atom, such as a number.
1733 throw new PrologException
1734 (new Functor2("type_error", Atom.a("callable"), Head), "Term to assert is not callable");
1735 object[] args = getFunctorArgs(Head);
1736 if (isSystemPredicate(name, args.Length))
1737 throw new PrologException
1738 (new Functor3("permission_error", Atom.a("modify"), Atom.a("static_procedure"),
1739 new Functor2(Atom.SLASH, name, args.Length)),
1740 "Assert cannot modify static predicate " + name + "/" + args.Length);
1741
1742 if (copyStore.getNUniqueVariables() == 0 && Body == Atom.a("true"))
1743 {
1744 // This is a fact with no unbound variables
1745 // assertFact and prependFact use IndexedAnswers, so don't we don't need to compile.
1746 if (prepend)
1747 prependFact(name, args);
1748 else
1749 assertFact(name, args);
1750
1751 return;
1752 }
1753
1754 IClause clause = YPCompiler.compileAnonymousClause(Head, Body, declaringClass);
1755 // We expect clause to be a ClauseHeadAndBody (from Compiler.compileAnonymousFunction)
1756 // so we can set the Head and Body.
1757 if (clause is ClauseHeadAndBody)
1758 ((ClauseHeadAndBody)clause).setHeadAndBody(Head, Body);
1759
1760 // Add the clause to the entry in _predicatesStore.
1761 NameArity nameArity = new NameArity(name, args.Length);
1762 List<IClause> clauses;
1763 if (!_predicatesStore.TryGetValue(nameArity, out clauses))
1764 // Create an entry for the nameArity.
1765 _predicatesStore[nameArity] = (clauses = new List<IClause>());
1766
1767 if (prepend)
1768 clauses.Insert(0, clause);
1769 else
1770 clauses.Add(clause);
1771 }
1772
1773 private static bool isSystemPredicate(Atom name, int arity)
1774 {
1775 if (arity == 2 && (name == Atom.a(",") || name == Atom.a(";") || name == Atom.DOT))
1776 return true;
1777 // Use the same mapping to static predicates in YP as the compiler.
1778 foreach (bool l1 in YPCompiler.functorCallYPFunctionName(name, arity, new Variable()))
1779 return true;
1780 // Debug: Do we need to check if name._module is null?
1781 return false;
1782 }
1783
1784 /// <summary>
1785 /// Assert values at the end of the set of facts for the predicate with the
1786 /// name and with arity values.Length.
1787 /// </summary>
1788 /// <param name="name">must be an Atom</param>
1789 /// <param name="values">the array of arguments to the fact predicate.
1790 /// It is an error if an value has an unbound variable.</param>
1791 public static void assertFact(Atom name, object[] values)
1792 {
1793 NameArity nameArity = new NameArity(name, values.Length);
1794 List<IClause> clauses;
1795 IndexedAnswers indexedAnswers;
1796 if (!_predicatesStore.TryGetValue(nameArity, out clauses))
1797 {
1798 // Create an IndexedAnswers as the only clause of the predicate.
1799 _predicatesStore[nameArity] = (clauses = new List<IClause>());
1800 clauses.Add(indexedAnswers = new IndexedAnswers(values.Length));
1801 }
1802 else
1803 {
1804 indexedAnswers = null;
1805 if (clauses.Count >= 1)
1806 indexedAnswers = clauses[clauses.Count - 1] as IndexedAnswers;
1807 if (indexedAnswers == null)
1808 // The latest clause is not an IndexedAnswers, so add one.
1809 clauses.Add(indexedAnswers = new IndexedAnswers(values.Length));
1810 }
1811
1812 indexedAnswers.addAnswer(values);
1813 }
1814
1815 /// <summary>
1816 /// Assert values, prepending to the front of the set of facts for the predicate with the
1817 /// name and with arity values.Length.
1818 /// </summary>
1819 /// <param name="name">must be an Atom</param>
1820 /// <param name="values">the array of arguments to the fact predicate.
1821 /// It is an error if an value has an unbound variable.</param>
1822 public static void prependFact(Atom name, object[] values)
1823 {
1824 NameArity nameArity = new NameArity(name, values.Length);
1825 List<IClause> clauses;
1826 IndexedAnswers indexedAnswers;
1827 if (!_predicatesStore.TryGetValue(nameArity, out clauses))
1828 {
1829 // Create an IndexedAnswers as the only clause of the predicate.
1830 _predicatesStore[nameArity] = (clauses = new List<IClause>());
1831 clauses.Add(indexedAnswers = new IndexedAnswers(values.Length));
1832 }
1833 else
1834 {
1835 indexedAnswers = null;
1836 if (clauses.Count >= 1)
1837 indexedAnswers = clauses[0] as IndexedAnswers;
1838 if (indexedAnswers == null)
1839 // The first clause is not an IndexedAnswers, so prepend one.
1840 clauses.Insert(0, indexedAnswers = new IndexedAnswers(values.Length));
1841 }
1842
1843 indexedAnswers.prependAnswer(values);
1844 }
1845
1846 /// <summary>
1847 /// Match all clauses of the dynamic predicate with the name and with arity
1848 /// arguments.Length.
1849 /// If the predicate is not defined, return the result of YP.unknownPredicate.
1850 /// </summary>
1851 /// <param name="name">must be an Atom</param>
1852 /// <param name="arguments">an array of arity number of arguments</param>
1853 /// <returns>an iterator which you can use in foreach</returns>
1854 public static IEnumerable<bool> matchDynamic(Atom name, object[] arguments)
1855 {
1856 List<IClause> clauses;
1857 if (!_predicatesStore.TryGetValue(new NameArity(name, arguments.Length), out clauses))
1858 return unknownPredicate(name, arguments.Length,
1859 "Undefined dynamic predicate: " + name + "/" + arguments.Length);
1860
1861 if (clauses.Count == 1)
1862 // Usually there is only one clause, so return it without needing to wrap it in an iterator.
1863 return clauses[0].match(arguments);
1864 else
1865 return matchAllClauses(clauses, arguments);
1866 }
1867
1868 /// <summary>
1869 /// Call match(arguments) for each IClause in clauses. We make this a separate
1870 /// function so that matchDynamic itself does not need to be an iterator object.
1871 /// </summary>
1872 /// <param name="clauses"></param>
1873 /// <param name="arguments"></param>
1874 /// <returns></returns>
1875 private static IEnumerable<bool> matchAllClauses(List<IClause> clauses, object[] arguments)
1876 {
1877 // Debug: If the caller asserts another clause into this same predicate during yield, the iterator
1878 // over clauses will be corrupted. Should we take the time to copy clauses?
1879 foreach (IClause clause in clauses)
1880 {
1881 foreach (bool lastCall in clause.match(arguments))
1882 {
1883 yield return false;
1884 if (lastCall)
1885 // This happens after a cut in a clause.
1886 yield break;
1887 }
1888 }
1889 }
1890
1891 /// <summary>
1892 /// If _prologFlags["unknown"] is fail then return fail(), else if
1893 /// _prologFlags["unknown"] is warning then write the message to YP.write and
1894 /// return fail(), else throw a PrologException for existence_error. .
1895 /// </summary>
1896 /// <param name="name"></param>
1897 /// <param name="arity"></param>
1898 /// <param name="message"></param>
1899 /// <returns></returns>
1900 public static IEnumerable<bool> unknownPredicate(Atom name, int arity, string message)
1901 {
1902 establishPrologFlags();
1903
1904 if (_prologFlags["unknown"] == Atom.a("fail"))
1905 return fail();
1906 else if (_prologFlags["unknown"] == Atom.a("warning"))
1907 {
1908 write(message);
1909 nl();
1910 return fail();
1911 }
1912 else
1913 throw new PrologException
1914 (new Functor2
1915 (Atom.a("existence_error"), Atom.a("procedure"),
1916 new Functor2(Atom.SLASH, name, arity)), message);
1917 }
1918
1919 /// <summary>
1920 /// This is deprecated and just calls matchDynamic. This matches all clauses,
1921 /// not just the ones defined with assertFact.
1922 /// </summary>
1923 /// <param name="name"></param>
1924 /// <param name="arguments"></param>
1925 /// <returns></returns>
1926 public static IEnumerable<bool> matchFact(Atom name, object[] arguments)
1927 {
1928 return matchDynamic(name, arguments);
1929 }
1930
1931 public static IEnumerable<bool> clause(object Head, object Body)
1932 {
1933 Head = getValue(Head);
1934 Body = getValue(Body);
1935 if (Head is Variable)
1936 throw new PrologException("instantiation_error", "Head is an unbound variable");
1937
1938 Atom name = getFunctorName(Head) as Atom;
1939 if (name == null)
1940 // name is a non-Atom, such as a number.
1941 throw new PrologException
1942 (new Functor2("type_error", Atom.a("callable"), Head), "Head is not callable");
1943 object[] args = getFunctorArgs(Head);
1944 if (isSystemPredicate(name, args.Length))
1945 throw new PrologException
1946 (new Functor3("permission_error", Atom.a("access"), Atom.a("private_procedure"),
1947 new Functor2(Atom.SLASH, name, args.Length)),
1948 "clause cannot access private predicate " + name + "/" + args.Length);
1949 if (!(Body is Variable) && !(YP.getFunctorName(Body) is Atom))
1950 throw new PrologException
1951 (new Functor2("type_error", Atom.a("callable"), Body), "Body is not callable");
1952
1953 List<IClause> clauses;
1954 if (!_predicatesStore.TryGetValue(new NameArity(name, args.Length), out clauses))
1955 yield break;
1956 // The caller can assert another clause into this same predicate during yield, so we have to
1957 // make a copy of the clauses.
1958 foreach (IClause predicateClause in clauses.ToArray())
1959 {
1960 foreach (bool l1 in predicateClause.clause(Head, Body))
1961 yield return false;
1962 }
1963 }
1964
1965 public static IEnumerable<bool> retract(object Term)
1966 {
1967 Term = getValue(Term);
1968 if (Term is Variable)
1969 throw new PrologException("instantiation_error", "Term to retract is an unbound variable");
1970
1971 object Head, Body;
1972 if (Term is Functor2 && ((Functor2)Term)._name == Atom.RULE)
1973 {
1974 Head = YP.getValue(((Functor2)Term)._arg1);
1975 Body = YP.getValue(((Functor2)Term)._arg2);
1976 }
1977 else
1978 {
1979 Head = Term;
1980 Body = Atom.a("true");
1981 }
1982 if (Head is Variable)
1983 throw new PrologException("instantiation_error", "Head is an unbound variable");
1984
1985 Atom name = getFunctorName(Head) as Atom;
1986 if (name == null)
1987 // name is a non-Atom, such as a number.
1988 throw new PrologException
1989 (new Functor2("type_error", Atom.a("callable"), Head), "Head is not callable");
1990 object[] args = getFunctorArgs(Head);
1991 if (isSystemPredicate(name, args.Length))
1992 throw new PrologException
1993 (new Functor3("permission_error", Atom.a("modify"), Atom.a("static_procedure"),
1994 new Functor2(Atom.SLASH, name, args.Length)),
1995 "clause cannot access private predicate " + name + "/" + args.Length);
1996 if (!(Body is Variable) && !(YP.getFunctorName(Body) is Atom))
1997 throw new PrologException
1998 (new Functor2("type_error", Atom.a("callable"), Body), "Body is not callable");
1999
2000 List<IClause> clauses;
2001 if (!_predicatesStore.TryGetValue(new NameArity(name, args.Length), out clauses))
2002 yield break;
2003 // The caller can assert another clause into this same predicate during yield, so we have to
2004 // make a copy of the clauses.
2005 foreach (IClause predicateClause in clauses.ToArray())
2006 {
2007 if (predicateClause is IndexedAnswers)
2008 {
2009 // IndexedAnswers handles its own retract. Even if it removes all of its
2010 // answers, it is OK to leave it empty as one of the elements in clauses.
2011 foreach (bool l1 in ((IndexedAnswers)predicateClause).retract(Head, Body))
2012 yield return false;
2013 }
2014 else
2015 {
2016 foreach (bool l1 in predicateClause.clause(Head, Body))
2017 {
2018 clauses.Remove(predicateClause);
2019 yield return false;
2020 }
2021 }
2022 }
2023 }
2024
2025 /// <summary>
2026 /// This is deprecated for backward compatibility. You should use retractall.
2027 /// </summary>
2028 /// <param name="name">must be an Atom</param>
2029 /// <param name="arguments">an array of arity number of arguments</param>
2030 public static void retractFact(Atom name, object[] arguments)
2031 {
2032 retractall(Functor.make(name, arguments));
2033 }
2034
2035 /// <summary>
2036 /// Retract all dynamic clauses which unify with Head. If this matches all clauses in a predicate,
2037 /// the predicate is still defined. To completely remove the predicate, see abolish.
2038 /// </summary>
2039 /// <param name="Head"></param>
2040 public static void retractall(object Head)
2041 {
2042 object name = YP.getFunctorName(Head);
2043 object[] arguments = getFunctorArgs(Head);
2044 if (!(name is Atom))
2045 return;
2046 NameArity nameArity = new NameArity((Atom)name, arguments.Length);
2047 List<IClause> clauses;
2048 if (!_predicatesStore.TryGetValue(nameArity, out clauses))
2049 // Can't find, so ignore.
2050 return;
2051
2052 foreach (object arg in arguments)
2053 {
2054 if (!YP.var(arg))
2055 throw new InvalidOperationException
2056 ("Until matching retractall is supported, all arguments must be unbound to retract all clauses");
2057 }
2058 // Clear all clauses.
2059 _predicatesStore[nameArity] = new List<IClause>();
2060 }
2061
2062 /// <summary>
2063 /// If NameSlashArity is var, match with all the dynamic predicates using the
2064 /// Name/Artity form.
2065 /// If NameSlashArity is not var, check if the Name/Arity exists as a static or
2066 /// dynamic predicate.
2067 /// </summary>
2068 /// <param name="NameSlashArity"></param>
2069 /// <param name="declaringClass">if not null, used to resolve references to the default
2070 /// module Atom.a("")</param>
2071 /// <returns></returns>
2072 public static IEnumerable<bool> current_predicate(object NameSlashArity, Type declaringClass)
2073 {
2074 NameSlashArity = YP.getValue(NameSlashArity);
2075 // First check if Name and Arity are nonvar so we can do a direct lookup.
2076 if (YP.ground(NameSlashArity))
2077 {
2078 Functor2 NameArityFunctor = NameSlashArity as Functor2;
2079 if (!(NameArityFunctor != null && NameArityFunctor._name == Atom.SLASH))
2080 throw new PrologException
2081 (new Functor2("type_error", Atom.a("predicate_indicator"), NameSlashArity),
2082 "Must be a name/arity predicate indicator");
2083 object name = YP.getValue(NameArityFunctor._arg1);
2084 object arity = YP.getValue(NameArityFunctor._arg2);
2085 if (name is Variable || arity is Variable)
2086 throw new PrologException
2087 ("instantiation_error", "Predicate indicator name or arity is an unbound variable");
2088 if (!(name is Atom && arity is int))
2089 throw new PrologException
2090 (new Functor2("type_error", Atom.a("predicate_indicator"), NameSlashArity),
2091 "Must be a name/arity predicate indicator");
2092 if ((int)arity < 0)
2093 throw new PrologException
2094 (new Functor2("domain_error", Atom.a("not_less_than_zero"), arity),
2095 "Arity may not be less than zero");
2096
2097 if (YPCompiler.isCurrentPredicate((Atom)name, (int)arity, declaringClass))
2098 // The predicate is defined.
2099 yield return false;
2100 }
2101 else
2102 {
2103 foreach (NameArity key in _predicatesStore.Keys)
2104 {
2105 foreach (bool l1 in YP.unify
2106 (new Functor2(Atom.SLASH, key._name, key._arity), NameSlashArity))
2107 yield return false;
2108 }
2109 }
2110 }
2111
2112 /// <summary>
2113 /// Return true if the dynamic predicate store has an entry for the predicate
2114 /// with name and arity.
2115 /// </summary>
2116 /// <param name="name"></param>
2117 /// <param name="arity"></param>
2118 /// <returns></returns>
2119 public static bool isDynamicCurrentPredicate(Atom name, int arity)
2120 {
2121 return _predicatesStore.ContainsKey(new NameArity(name, arity));
2122 }
2123
2124 public static void abolish(object NameSlashArity)
2125 {
2126 NameSlashArity = YP.getValue(NameSlashArity);
2127 if (NameSlashArity is Variable)
2128 throw new PrologException
2129 ("instantiation_error", "Predicate indicator is an unbound variable");
2130 Functor2 NameArityFunctor = NameSlashArity as Functor2;
2131 if (!(NameArityFunctor != null && NameArityFunctor._name == Atom.SLASH))
2132 throw new PrologException
2133 (new Functor2("type_error", Atom.a("predicate_indicator"), NameSlashArity),
2134 "Must be a name/arity predicate indicator");
2135 object name = YP.getValue(NameArityFunctor._arg1);
2136 object arity = YP.getValue(NameArityFunctor._arg2);
2137 if (name is Variable || arity is Variable)
2138 throw new PrologException
2139 ("instantiation_error", "Predicate indicator name or arity is an unbound variable");
2140 if (!(name is Atom))
2141 throw new PrologException
2142 (new Functor2("type_error", Atom.a("atom"), name),
2143 "Predicate indicator name must be an atom");
2144 if (!(arity is int))
2145 throw new PrologException
2146 (new Functor2("type_error", Atom.a("integer"), arity),
2147 "Predicate indicator arity must be an integer");
2148 if ((int)arity < 0)
2149 throw new PrologException
2150 (new Functor2("domain_error", Atom.a("not_less_than_zero"), arity),
2151 "Arity may not be less than zero");
2152 if ((int)arity > MAX_ARITY)
2153 throw new PrologException
2154 (new Functor1("representation_error", Atom.a("max_arity")),
2155 "Arity may not be greater than " + MAX_ARITY);
2156
2157 if (isSystemPredicate((Atom)name, (int)arity))
2158 throw new PrologException
2159 (new Functor3("permission_error", Atom.a("modify"), Atom.a("static_procedure"),
2160 new Functor2(Atom.SLASH, name, arity)),
2161 "Abolish cannot modify static predicate " + name + "/" + arity);
2162 _predicatesStore.Remove(new NameArity((Atom)name, (int)arity));
2163 }
2164
2165 /// <summary>
2166 /// If Goal is a simple predicate, call YP.getFunctorName(Goal) using arguments from
2167 /// YP.getFunctorArgs(Goal). If not found, this throws a PrologException for existence_error.
2168 /// Otherwise, compile the goal as a single clause predicate and invoke it.
2169 /// </summary>
2170 /// <param name="Goal"></param>
2171 /// <param name="declaringClass">if not null, used to resolve references to the default
2172 /// module Atom.a("")</param>
2173 /// <returns></returns>
2174 public static IEnumerable<bool> getIterator(object Goal, Type declaringClass)
2175 {
2176 Atom name;
2177 object[] args;
2178 while (true)
2179 {
2180 Goal = YP.getValue(Goal);
2181 if (Goal is Variable)
2182 throw new PrologException("instantiation_error", "Goal to call is an unbound variable");
2183 name = YP.getFunctorName(Goal) as Atom;
2184 if (name == null)
2185 throw new PrologException
2186 (new Functor2("type_error", Atom.a("callable"), Goal), "Goal to call is not callable");
2187 args = YP.getFunctorArgs(Goal);
2188 if (name == Atom.HAT && args.Length == 2)
2189 // Assume this is called from a bagof operation. Skip the leading qualifiers.
2190 Goal = YP.getValue(((Functor2)Goal)._arg2);
2191 else
2192 break;
2193 }
2194
2195 IEnumerable<bool> simpleIterator = YPCompiler.getSimpleIterator(name, args, declaringClass);
2196 if (simpleIterator != null)
2197 // We don't need to compile since the goal is a simple predicate which we call directly.
2198 return simpleIterator;
2199
2200 // Compile the goal as a clause.
2201 List<Variable> variableSetList = new List<Variable>();
2202 addUniqueVariables(Goal, variableSetList);
2203 Variable[] variableSet = variableSetList.ToArray();
2204
2205 // Use Atom.F since it is ignored.
2206 return YPCompiler.compileAnonymousClause
2207 (Functor.make(Atom.F, variableSet), Goal, declaringClass).match(variableSet);
2208 }
2209
2210 public static void throwException(object Term)
2211 {
2212 throw new PrologException(Term);
2213 }
2214 /// <summary>
2215 /// This must be called by any function that uses YP._prologFlags to make sure
2216 /// the initial defaults are loaded.
2217 /// </summary>
2218 private static void establishPrologFlags()
2219 {
2220 if (_prologFlags.Count > 0)
2221 // Already established.
2222 return;
2223
2224 // List these in the order they appear in the ISO standard.
2225 _prologFlags["bounded"] = Atom.a("true");
2226 _prologFlags["max_integer"] = Int32.MaxValue;
2227 _prologFlags["min_integer"] = Int32.MinValue;
2228 _prologFlags["integer_rounding_function"] = Atom.a("toward_zero");
2229 _prologFlags["char_conversion"] = Atom.a("off");
2230 _prologFlags["debug"] = Atom.a("off");
2231 _prologFlags["max_arity"] = MAX_ARITY;
2232 _prologFlags["unknown"] = Atom.a("error");
2233 _prologFlags["double_quotes"] = Atom.a("codes");
2234 }
2235
2236 public static IEnumerable<bool> current_prolog_flag(object Key, object Value)
2237 {
2238 establishPrologFlags();
2239
2240 Key = YP.getValue(Key);
2241 Value = YP.getValue(Value);
2242
2243 if (Key is Variable)
2244 {
2245 // Bind all key values.
2246 foreach (string key in _prologFlags.Keys)
2247 {
2248 foreach (bool l1 in YP.unify(Key, Atom.a(key)))
2249 {
2250 foreach (bool l2 in YP.unify(Value, _prologFlags[key]))
2251 yield return false;
2252 }
2253 }
2254 }
2255 else
2256 {
2257 if (!(Key is Atom))
2258 throw new PrologException
2259 (new Functor2("type_error", Atom.a("atom"), Key), "Arg 1 Key is not an atom");
2260 if (!_prologFlags.ContainsKey(((Atom)Key)._name))
2261 throw new PrologException
2262 (new Functor2("domain_error", Atom.a("prolog_flag"), Key),
2263 "Arg 1 Key is not a recognized flag");
2264
2265 foreach (bool l1 in YP.unify(Value, _prologFlags[((Atom)Key)._name]))
2266 yield return false;
2267 }
2268 }
2269
2270 public static void set_prolog_flag(object Key, object Value)
2271 {
2272 establishPrologFlags();
2273
2274 Key = YP.getValue(Key);
2275 Value = YP.getValue(Value);
2276
2277 if (Key is Variable)
2278 throw new PrologException(Atom.a("instantiation_error"),
2279 "Arg 1 Key is an unbound variable");
2280 if (Value is Variable)
2281 throw new PrologException(Atom.a("instantiation_error"),
2282 "Arg 1 Key is an unbound variable");
2283 if (!(Key is Atom))
2284 throw new PrologException
2285 (new Functor2("type_error", Atom.a("atom"), Key), "Arg 1 Key is not an atom");
2286
2287 string keyName = ((Atom)Key)._name;
2288 if (!_prologFlags.ContainsKey(keyName))
2289 throw new PrologException
2290 (new Functor2("domain_error", Atom.a("prolog_flag"), Key),
2291 "Arg 1 Key " + Key + " is not a recognized flag");
2292
2293 bool valueIsOK = false;
2294 if (keyName == "char_conversion")
2295 valueIsOK = (Value == _prologFlags[keyName]);
2296 else if (keyName == "debug")
2297 valueIsOK = (Value == _prologFlags[keyName]);
2298 else if (keyName == "unknown")
2299 valueIsOK = (Value == Atom.a("fail") || Value == Atom.a("warning") ||
2300 Value == Atom.a("error"));
2301 else if (keyName == "double_quotes")
2302 valueIsOK = (Value == Atom.a("codes") || Value == Atom.a("chars") ||
2303 Value == Atom.a("atom"));
2304 else
2305 throw new PrologException
2306 (new Functor3("permission_error", Atom.a("modify"), Atom.a("flag"), Key),
2307 "May not modify Prolog flag " + Key);
2308
2309 if (!valueIsOK)
2310 throw new PrologException
2311 (new Functor2("domain_error", Atom.a("flag_value"), new Functor2("+", Key, Value)),
2312 "May not set arg 1 Key " + Key + " to arg 2 Value " + Value);
2313
2314 _prologFlags[keyName] = Value;
2315 }
2316 /// <summary>
2317 /// script_event calls hosting script with events as a callback method.
2318 /// </summary>
2319 /// <param name="script_event"></param>
2320 /// <param name="script_params"></param>
2321 /// <returns></returns>
2322 public static IEnumerable<bool> script_event(object script_event, object script_params)
2323 {
2324 // string function = ((Atom)YP.getValue(script_event))._name;
2325 object[] array = ListPair.toArray(script_params);
2326 if (array == null)
2327 yield return false; // return; // YP.fail();
2328 if (array.Length > 1)
2329 {
2330 //m_CmdManager.m_ScriptEngine.m_EventQueManager.AddToScriptQueue
2331 //(localID, itemID, function, array);
2332 // sortArray(array);
2333 }
2334 //return YP.unify(Sorted, ListPair.makeWithoutRepeatedTerms(array));
2335 yield return false;
2336 }
2337
2338 /* Non-prolog-ish functions for inline coding */
2339 public static string regexString(string inData, string inPattern, string presep,string postsep)
2340 {
2341 //string str=cycMessage;
2342 //string strMatch = @"\. \#\$(.*)\)";
2343 string results = "";
2344 for (Match m = Regex.Match(inData,inPattern); m.Success; m=m.NextMatch())
2345 {
2346 //m_log.Debug(m);
2347 results += presep+ m + postsep;
2348 }
2349 return results;
2350 }
2351
2352 public static string cycComm(object msgobj)
2353 {
2354 string cycInputString = msgobj.ToString();
2355 string cycOutputString="";
2356 TcpClient socketForServer;
2357
2358 try
2359 {
2360 socketForServer = new TcpClient("localHost", 3601);
2361 }
2362 catch
2363 {
2364 m_log.Error("Failed to connect to server at localhost:999");
2365 return "";
2366 }
2367
2368 NetworkStream networkStream = socketForServer.GetStream();
2369
2370 System.IO.StreamReader streamReader = new System.IO.StreamReader(networkStream);
2371
2372 System.IO.StreamWriter streamWriter = new System.IO.StreamWriter(networkStream);
2373
2374 try
2375 {
2376 // read the data from the host and display it
2377
2378 {
2379
2380 streamWriter.WriteLine(cycInputString);
2381 streamWriter.Flush();
2382
2383 cycOutputString = streamReader.ReadLine();
2384 m_log.Debug("Cycoutput:" + cycOutputString);
2385 //streamWriter.WriteLine("Client Message");
2386 //m_log.Debug("Client Message");
2387 streamWriter.Flush();
2388 }
2389
2390 }
2391 catch
2392 {
2393 m_log.Error("Exception reading from Server");
2394 return "";
2395 }
2396 // tidy up
2397 networkStream.Close();
2398 return cycOutputString;
2399
2400 }
2401 //public static void throwException(object Term)
2402 //{
2403 // throw new PrologException(Term);
2404 //}
2405 /// <summary>
2406 /// An enumerator that does zero loops.
2407 /// </summary>
2408 private class Fail : IEnumerator<bool>, IEnumerable<bool>
2409 {
2410 public bool MoveNext()
2411 {
2412 return false;
2413 }
2414
2415 public IEnumerator<bool> GetEnumerator()
2416 {
2417 return (IEnumerator<bool>)this;
2418 }
2419
2420 IEnumerator IEnumerable.GetEnumerator()
2421 {
2422 return GetEnumerator();
2423 }
2424
2425 public bool Current
2426 {
2427 get { return true; }
2428 }
2429
2430 object IEnumerator.Current
2431 {
2432 get { return true; }
2433 }
2434
2435 public void Dispose()
2436 {
2437 }
2438
2439 public void Reset()
2440 {
2441 throw new NotImplementedException();
2442 }
2443 }
2444
2445 /// <summary>
2446 /// An enumerator that does one iteration.
2447 /// </summary>
2448 private class Succeed : IEnumerator<bool>, IEnumerable<bool>
2449 {
2450 private bool _didIteration = false;
2451
2452 public bool MoveNext()
2453 {
2454 if (!_didIteration)
2455 {
2456 _didIteration = true;
2457 return true;
2458 }
2459 else
2460 return false;
2461 }
2462
2463 public IEnumerator<bool> GetEnumerator()
2464 {
2465 return (IEnumerator<bool>)this;
2466 }
2467
2468 IEnumerator IEnumerable.GetEnumerator()
2469 {
2470 return GetEnumerator();
2471 }
2472
2473 public bool Current
2474 {
2475 get { return false; }
2476 }
2477
2478 object IEnumerator.Current
2479 {
2480 get { return false; }
2481 }
2482
2483 public void Dispose()
2484 {
2485 }
2486
2487 public void Reset()
2488 {
2489 throw new NotImplementedException();
2490 }
2491 }
2492
2493 /// <summary>
2494 /// An enumerator that repeats forever.
2495 /// </summary>
2496 private class Repeat : IEnumerator<bool>, IEnumerable<bool>
2497 {
2498 public bool MoveNext()
2499 {
2500 return true;
2501 }
2502
2503 public IEnumerator<bool> GetEnumerator()
2504 {
2505 return (IEnumerator<bool>)this;
2506 }
2507
2508 IEnumerator IEnumerable.GetEnumerator()
2509 {
2510 return GetEnumerator();
2511 }
2512
2513 public bool Current
2514 {
2515 get { return false; }
2516 }
2517
2518 object IEnumerator.Current
2519 {
2520 get { return false; }
2521 }
2522
2523 public void Dispose()
2524 {
2525 }
2526
2527 public void Reset()
2528 {
2529 throw new NotImplementedException();
2530 }
2531 }
2532
2533 /// <summary>
2534 /// An enumerator that wraps another enumerator in order to catch a PrologException.
2535 /// </summary>
2536 public class Catch : IEnumerator<bool>, IEnumerable<bool>
2537 {
2538 private IEnumerator<bool> _enumerator;
2539 private PrologException _exception = null;
2540
2541 /// <summary>
2542 /// Call YP.getIterator(Goal, declaringClass) and save the returned iterator.
2543 /// If getIterator throws an exception, save it the same as MoveNext().
2544 /// </summary>
2545 /// <param name="Goal"></param>
2546 /// <param name="declaringClass"></param>
2547 public Catch(object Goal, Type declaringClass)
2548 {
2549 try
2550 {
2551 _enumerator = getIterator(Goal, declaringClass).GetEnumerator();
2552 }
2553 catch (PrologException exception)
2554 {
2555 // MoveNext() will check this.
2556 _exception = exception;
2557 }
2558 }
2559
2560 /// <summary>
2561 /// Call _enumerator.MoveNext(). If it throws a PrologException, set _exception
2562 /// and return false. After this returns false, call unifyExceptionOrThrow.
2563 /// </summary>
2564 /// <returns></returns>
2565 public bool MoveNext()
2566 {
2567 if (_exception != null)
2568 return false;
2569
2570 try
2571 {
2572 return _enumerator.MoveNext();
2573 }
2574 catch (PrologException exception)
2575 {
2576 _exception = exception;
2577 return false;
2578 }
2579 }
2580
2581 /// <summary>
2582 /// Call this after MoveNext() returns false to check for an exception. If
2583 /// MoveNext did not get a PrologException, don't yield.
2584 /// Otherwise, unify the exception with Catcher and yield so the caller can
2585 /// do the handler code. However, if can't unify with Catcher then throw the exception.
2586 /// </summary>
2587 /// <param name="Catcher"></param>
2588 /// <returns></returns>
2589 public IEnumerable<bool> unifyExceptionOrThrow(object Catcher)
2590 {
2591 if (_exception != null)
2592 {
2593 bool didUnify = false;
2594 foreach (bool l1 in YP.unify(_exception._term, Catcher))
2595 {
2596 didUnify = true;
2597 yield return false;
2598 }
2599 if (!didUnify)
2600 throw _exception;
2601 }
2602 }
2603
2604 public IEnumerator<bool> GetEnumerator()
2605 {
2606 return (IEnumerator<bool>)this;
2607 }
2608
2609 IEnumerator IEnumerable.GetEnumerator()
2610 {
2611 return GetEnumerator();
2612 }
2613
2614 public bool Current
2615 {
2616 get { return _enumerator.Current; }
2617 }
2618
2619 object IEnumerator.Current
2620 {
2621 get { return _enumerator.Current; }
2622 }
2623
2624 public void Dispose()
2625 {
2626 if (_enumerator != null)
2627 _enumerator.Dispose();
2628 }
2629
2630 public void Reset()
2631 {
2632 throw new NotImplementedException();
2633 }
2634 }
2635 #pragma warning restore 0168, 0219
2636 /// <summary>
2637 /// A ClauseHeadAndBody is used in Compiler.compileAnonymousFunction as a base class
2638 /// in order to implement YP.IClause. After creating the object, you must call setHeadAndBody.
2639 /// </summary>
2640 public class ClauseHeadAndBody
2641 {
2642 private object _Head;
2643 private object _Body;
2644
2645 public void setHeadAndBody(object Head, object Body)
2646 {
2647 _Head = Head;
2648 _Body = Body;
2649 }
2650
2651 public IEnumerable<bool> clause(object Head, object Body)
2652 {
2653 if (_Head == null || _Body == null)
2654 yield break;
2655
2656 #pragma warning disable 0168, 0219
2657 foreach (bool l1 in YP.unify(Head, _Head))
2658 {
2659 foreach (bool l2 in YP.unify(Body, _Body))
2660 yield return false;
2661 }
2662 #pragma warning restore 0168, 0219
2663 }
2664 }
2665
2666 /// <summary>
2667 /// CodeListReader extends TextReader and overrides Read to read the next code from
2668 /// the CodeList which is a Prolog list of integer character codes.
2669 /// </summary>
2670 public class CodeListReader : TextReader
2671 {
2672 private object _CodeList;
2673
2674 public CodeListReader(object CodeList)
2675 {
2676 _CodeList = YP.getValue(CodeList);
2677 }
2678
2679 /// <summary>
2680 /// If the head of _CodeList is an integer, return it and advance the list. Otherwise,
2681 /// return -1 for end of file.
2682 /// </summary>
2683 /// <returns></returns>
2684 public override int Read()
2685 {
2686 Functor2 CodeListPair = _CodeList as Functor2;
2687 int code;
2688 if (!(CodeListPair != null && CodeListPair._name == Atom.DOT &&
2689 getInt(CodeListPair._arg1, out code)))
2690 {
2691 _CodeList = Atom.NIL;
2692 return -1;
2693 }
2694
2695 // Advance.
2696 _CodeList = YP.getValue(CodeListPair._arg2);
2697 return code;
2698 }
2699 }
2700 }
2701}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YPCompiler.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YPCompiler.cs
deleted file mode 100644
index c6a6748..0000000
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YPCompiler.cs
+++ /dev/null
@@ -1,6382 +0,0 @@
1/*
2 * Copyright (C) 2007-2008, Jeff Thompson
3 *
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holder nor the names of its contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31using System;
32using System.IO;
33using System.Collections;
34using System.Collections.Generic;
35using System.Text;
36using System.CodeDom.Compiler;
37using System.Reflection;
38
39namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
40{
41 public class YPCompiler
42 {
43 private class CompilerState
44 {
45 public IndexedAnswers _pred = new IndexedAnswers(4);
46 public Dictionary<YP.NameArity, Atom> _moduleForNameArity = new Dictionary<YP.NameArity, Atom>();
47 public int _gensymCounter;
48 public bool _useFinalCutCode;
49 public Variable _finalCutCode;
50 public bool _codeUsesYield;
51 public Atom _determinism;
52 // a list of '='(Name, Variable)
53 public List<object> _variableNames;
54
55 // Make these static functions that explicitly take the State so Prolog can call it.
56
57 /// <summary>
58 /// Make a new CompilerState and bind it to State.
59 /// </summary>
60 /// <param name="State"></param>
61 /// <returns></returns>
62 public static IEnumerable<bool> make(object State)
63 {
64 return YP.unify(State, new CompilerState());
65 }
66
67 public static void assertPred(object State, object Pred, object Determinism)
68 {
69 State = YP.getValue(State);
70 object functorName = YP.getFunctorName(Pred);
71 object[] functorArgs = YP.getFunctorArgs(Pred);
72 // Debug: Should check if it's already asserted and is the same.
73 ((CompilerState)State)._pred.addAnswer
74 (new object[] { functorName, functorArgs.Length, Pred, YP.getValue(Determinism) });
75 }
76
77 public static void assertModuleForNameArity(object State, object Name, object Arity, object Module)
78 {
79 State = YP.getValue(State);
80 Name = YP.getValue(Name);
81 Arity = YP.getValue(Arity);
82 Module = YP.getValue(Module);
83 // If the Module Atom comes from the parser, it always has null _declaringClass.
84 if (Module is Atom && ((Atom)Module)._module == null && Name is Atom && Arity is int)
85 // Replace a previous entry if it exists.
86 ((CompilerState)State)._moduleForNameArity[new YP.NameArity((Atom)Name, (int)Arity)] =
87 (Atom)Module;
88 }
89
90 public static void startFunction(object State, object Head)
91 {
92 State = YP.getValue(State);
93 ((CompilerState)State)._gensymCounter = 0;
94 ((CompilerState)State)._useFinalCutCode = false;
95 ((CompilerState)State)._finalCutCode = new Variable();
96 ((CompilerState)State)._codeUsesYield = false;
97 if (CompilerState.isDetNoneOut(State, Head))
98 ((CompilerState)State)._determinism = Atom.a("detNoneOut");
99 else if (CompilerState.isSemidetNoneOut(State, Head))
100 ((CompilerState)State)._determinism = Atom.a("semidetNoneOut");
101 else
102 ((CompilerState)State)._determinism = Atom.a("nondet");
103 }
104
105 public static void setCodeUsesYield(object State)
106 {
107 State = YP.getValue(State);
108 ((CompilerState)State)._codeUsesYield = true;
109 }
110
111 public static bool codeUsesYield(object State)
112 {
113 State = YP.getValue(State);
114 return ((CompilerState)State)._codeUsesYield;
115 }
116
117 public static bool determinismEquals(object State, object Term)
118 {
119 State = YP.getValue(State);
120 return YP.termEqual(((CompilerState)State)._determinism, Term);
121 }
122
123 /// <summary>
124 /// Set _variableNames to a new list of (Name = Variable) for each unique variable in rule.
125 /// If the variable is in variableNameSuggestions, use it, otherwise use x1, x2, etc.
126 /// </summary>
127 /// <param name="State"></param>
128 /// <param name="rule"></param>
129 /// <param name="variableNameSuggestions"></param>
130 public static void newVariableNames(object State, object Rule, object VariableNameSuggestions)
131 {
132 State = YP.getValue(State);
133 List<Variable> variablesSet = new List<Variable>();
134 YP.addUniqueVariables(Rule, variablesSet);
135
136 ((CompilerState)State)._variableNames = new List<object>();
137 int xCounter = 0;
138 foreach (Variable variable in variablesSet)
139 ((CompilerState)State)._variableNames.Add
140 (new Functor2(Atom.a("="), makeVariableName(variable, VariableNameSuggestions, ++xCounter),
141 variable));
142 }
143
144 private static object makeVariableName(object variable, object variableNameSuggestions, int xCounter)
145 {
146 // Debug: should require named variables to start with _ or capital. Should
147 // check for duplicates and clashes with keywords.
148 for (object element = YP.getValue(variableNameSuggestions);
149 element is Functor2 && ((Functor2)element)._name == Atom.DOT;
150 element = YP.getValue(((Functor2)element)._arg2))
151 {
152 object suggestionPair = YP.getValue(((Functor2)element)._arg1);
153 if (sameVariable(variable, ((Functor2)suggestionPair)._arg2))
154 {
155 Atom suggestion = (Atom)YP.getValue(((Functor2)suggestionPair)._arg1);
156 if (suggestion.Equals(Atom.a("Atom")))
157 suggestion = Atom.a("Atom_1");
158 if (suggestion.Equals(Atom.a("Variable")))
159 suggestion = Atom.a("Variable_1");
160 if (suggestion.Equals(Atom.a("Functor")))
161 suggestion = Atom.a("Functor_1");
162 return suggestion;
163 }
164 }
165
166 return Atom.a("x" + xCounter);
167 }
168
169 /// <summary>
170 /// Unify Result with the name assigned by CompilerState.newVariableNames in State._variableNames
171 /// for variable.
172 /// </summary>
173 /// <param name="variable">a Variable</param>
174 /// <param name="State"></param>
175 /// <param name="Result">the assigned Name</param>
176 public static IEnumerable<bool> getVariableName(object State, object variable, object Result)
177 {
178 State = YP.getValue(State);
179 foreach (object variableInfo in ((CompilerState)State)._variableNames)
180 {
181 if (variableInfo is Functor2 && ((Functor2)variableInfo)._name.Equals(Atom.a("=")))
182 {
183 if (sameVariable(variable, ((Functor2)variableInfo)._arg2))
184 return YP.unify(Result, ((Functor2)variableInfo)._arg1);
185 }
186 }
187
188 // We set up names for all unique variables, so this should never happen.
189 throw new PrologException(Atom.a("Can't find entry in _variableNames"));
190 }
191
192 public static IEnumerable<bool> variableNamesList(object State, object VariableNamesList)
193 {
194 State = YP.getValue(State);
195 return YP.unify(VariableNamesList, ListPair.make(((CompilerState)State)._variableNames));
196 }
197
198 public static IEnumerable<bool> gensym(object State, object Base, object Symbol)
199 {
200 State = YP.getValue(State);
201 return YP.unify(Symbol, Atom.a(Base.ToString() + ++((CompilerState)State)._gensymCounter));
202 }
203
204 // disable warning on l1, don't see how we can
205 // code this differently
206 #pragma warning disable 0168, 0164, 0162, 0219
207 public static bool isDetNoneOut(object State, object Term)
208 {
209 State = YP.getValue(State);
210 object functorName = YP.getFunctorName(Term);
211 object[] functorArgs = YP.getFunctorArgs(Term);
212
213 Variable pred = new Variable();
214 foreach (bool l1 in ((CompilerState)State)._pred.match
215 (new object[] { functorName, functorArgs.Length, pred, Atom.a("det") }))
216 {
217 if (CompilerState.isNoneOut(YP.getFunctorArgs(pred.getValue())))
218 {
219 return true;
220 }
221 }
222
223 return false;
224 }
225
226 public static bool isSemidetNoneOut(object State, object Term)
227 {
228 State = YP.getValue(State);
229 object functorName = YP.getFunctorName(Term);
230 object[] functorArgs = YP.getFunctorArgs(Term);
231
232 Variable pred = new Variable();
233 foreach (bool l1 in ((CompilerState)State)._pred.match
234 (new object[] { functorName, functorArgs.Length, pred, Atom.a("semidet") }))
235 {
236 if (CompilerState.isNoneOut(YP.getFunctorArgs(pred.getValue())))
237 {
238 return true;
239 }
240 }
241
242 return false;
243 }
244 #pragma warning restore 0168, 0164, 0162, 0219
245
246 /// <summary>
247 /// Return false if any of args is out, otherwise true.
248 /// args is an array of ::(Type,Mode) where Mode is in or out.
249 /// </summary>
250 /// <param name="args"></param>
251 /// <returns></returns>
252 private static bool isNoneOut(object[] args)
253 {
254 foreach (object arg in args)
255 {
256 if (arg is Functor2 && ((Functor2)arg)._name == Atom.a("::") &&
257 ((Functor2)arg)._arg2 == Atom.a("out"))
258 return false;
259 }
260 return true;
261 }
262
263 public static bool nameArityHasModule(object State, object Name, object Arity, object Module)
264 {
265 State = YP.getValue(State);
266 Name = YP.getValue(Name);
267 Arity = YP.getValue(Arity);
268 Module = YP.getValue(Module);
269 if (Name is Atom && Arity is int)
270 {
271 Atom FoundModule;
272 if (!((CompilerState)State)._moduleForNameArity.TryGetValue
273 (new YP.NameArity((Atom)Name, (int)Arity), out FoundModule))
274 return false;
275 return FoundModule == Module;
276 }
277 return false;
278 }
279 }
280
281 // disable warning on l1, don't see how we can
282 // code this differently
283 #pragma warning disable 0168, 0219,0164,0162
284
285 /// <summary>
286 /// Use makeFunctionPseudoCode, convertFunctionCSharp and compileAnonymousFunction
287 /// to return an anonymous YP.IClause for the Head and Body of a rule clause.
288 /// </summary>
289 /// <param name="Head">a prolog term such as new Functor2("test1", X, Y).
290 /// Note that the name of the head is ignored.
291 /// </param>
292 /// <param name="Body">a prolog term such as
293 /// new Functor2(",", new Functor1(Atom.a("test2", Atom.a("")), X),
294 /// new Functor2("=", Y, X)).
295 /// This may not be null. (For a head-only clause, set the Body to Atom.a("true").
296 /// </param>
297 /// <param name="declaringClass">if not null, the code is compiled as a subclass of this class
298 /// to resolve references to the default module Atom.a("")</param>
299 /// <returns>a new YP.IClause object on which you can call match(object[] args) where
300 /// args length is the arity of the Head</returns>
301 public static YP.IClause compileAnonymousClause(object Head, object Body, Type declaringClass)
302 {
303 object[] args = YP.getFunctorArgs(Head);
304 // compileAnonymousFunction wants "function".
305 object Rule = new Functor2(Atom.RULE, Functor.make("function", args), Body);
306 object RuleList = ListPair.make(new Functor2(Atom.F, Rule, Atom.NIL));
307
308 StringWriter functionCode = new StringWriter();
309 Variable SaveOutputStream = new Variable();
310 foreach (bool l1 in YP.current_output(SaveOutputStream))
311 {
312 try
313 {
314 YP.tell(functionCode);
315 Variable PseudoCode = new Variable();
316 foreach (bool l2 in makeFunctionPseudoCode(RuleList, PseudoCode))
317 {
318 if (YP.termEqual(PseudoCode, Atom.a("getDeclaringClass")))
319 // Ignore getDeclaringClass since we have access to the one passed in.
320 continue;
321
322 convertFunctionCSharp(PseudoCode);
323 }
324 YP.told();
325 }
326 finally
327 {
328 // Restore after calling tell.
329 YP.tell(SaveOutputStream.getValue());
330 }
331 }
332 return YPCompiler.compileAnonymousFunction
333 (functionCode.ToString(), args.Length, declaringClass);
334 }
335
336 /// <summary>
337 /// Use CodeDomProvider to compile the functionCode and return a YP.ClauseHeadAndBody
338 /// which implements YP.IClause.
339 /// The function name must be "function" and have nArgs arguments.
340 /// </summary>
341 /// <param name="functionCode">the code for the iterator, such as
342 /// "public static IEnumerable<bool> function() { yield return false; }"
343 /// </param>
344 /// <param name="nArgs">the number of args in the function</param>
345 /// <param name="declaringClass">if not null, then use the functionCode inside a class which
346 /// inherits from contextClass, so that references in functionCode to methods in declaringClass don't
347 /// have to be qualified</param>
348 /// <returns>a new YP.IClause object on which you can call match(object[] args) where
349 /// args length is nArgs</returns>
350 public static YP.IClause compileAnonymousFunction(string functionCode, int nArgs, Type declaringClass)
351 {
352 CompilerParameters parameters = new CompilerParameters();
353 // This gets the location of the System assembly.
354 parameters.ReferencedAssemblies.Add(typeof(System.Int32).Assembly.Location);
355 // This gets the location of this assembly which also has YieldProlog.YP, etc.
356 parameters.ReferencedAssemblies.Add(typeof(YPCompiler).Assembly.Location);
357 if (declaringClass != null)
358 parameters.ReferencedAssemblies.Add(declaringClass.Assembly.Location);
359 parameters.GenerateInMemory = true;
360
361 StringBuilder sourceCode = new StringBuilder();
362 sourceCode.Append(@"
363using System;
364using System.Collections.Generic;
365using OpenSim.Region.ScriptEngine.Shared.YieldProlog;
366
367namespace Temporary {
368 public class Temporary : YP.ClauseHeadAndBody, YP.IClause {");
369 if (declaringClass == null)
370 // We don't extend a class with getDeclaringClass, so define it.
371 sourceCode.Append(@"
372 public class Inner {
373 public static System.Type getDeclaringClass() { return null; }
374");
375 else
376 sourceCode.Append(@"
377 public class Inner : " + declaringClass.FullName + @" {
378");
379 sourceCode.Append(functionCode);
380 // Basically, match applies the args to function.
381 sourceCode.Append(@"
382 }
383 public IEnumerable<bool> match(object[] args) {
384 return Inner.function(");
385 if (nArgs >= 1)
386 sourceCode.Append("args[0]");
387 for (int i = 1; i < nArgs; ++i)
388 sourceCode.Append(", args[" + i + "]");
389 sourceCode.Append(@");
390 }
391 }
392}
393");
394
395 CompilerResults results = CodeDomProvider.CreateProvider
396 ("CSharp").CompileAssemblyFromSource(parameters, sourceCode.ToString());
397 if (results.Errors.Count > 0)
398 throw new Exception("Error evaluating code: " + results.Errors[0]);
399
400 // Return a new Temporary.Temporary object.
401 return (YP.IClause)results.CompiledAssembly.GetType
402 ("Temporary.Temporary").GetConstructor(Type.EmptyTypes).Invoke(null);
403 }
404
405 /// <summary>
406 /// If the functor with name and args can be called directly as determined by
407 /// functorCallFunctionName, then call it and return its iterator. If the predicate is
408 /// dynamic and undefined, or if static and the method cannot be found, return
409 /// the result of YP.unknownPredicate.
410 /// This returns null if the functor has a special form than needs to be compiled
411 /// (including ,/2 and ;/2).
412 /// </summary>
413 /// <param name="name"></param>
414 /// <param name="args"></param>
415 /// <param name="declaringClass">used to resolve references to the default
416 /// module Atom.a(""). If a declaringClass is needed to resolve the reference but it is
417 /// null, this throws a PrologException for existence_error</param>
418 /// <returns></returns>
419 public static IEnumerable<bool> getSimpleIterator(Atom name, object[] args, Type declaringClass)
420 {
421 CompilerState state = new CompilerState();
422 Variable FunctionName = new Variable();
423 foreach (bool l1 in functorCallFunctionName(state, name, args.Length, FunctionName))
424 {
425 Atom functionNameAtom = ((Atom)FunctionName.getValue());
426 if (functionNameAtom == Atom.NIL)
427 // name is for a dynamic predicate.
428 return YP.matchDynamic(name, args);
429
430 string methodName = functionNameAtom._name;
431 // Set the default for the method to call.
432 Type methodClass = declaringClass;
433
434 bool checkMode = false;
435 if (methodName.StartsWith("YP."))
436 {
437 // Assume we only check mode in calls to standard Prolog predicates in YP.
438 checkMode = true;
439
440 // Use the method in class YP.
441 methodName = methodName.Substring(3);
442 methodClass = typeof(YP);
443 }
444 if (methodName.Contains("."))
445 // We don't support calling inner classes, etc.
446 return null;
447
448 if (methodClass == null)
449 return YP.unknownPredicate
450 (name, args.Length,
451 "Cannot find predicate function for: " + name + "/" + args.Length +
452 " because declaringClass is null. Set declaringClass to the class containing " +
453 methodName);
454 try
455 {
456 if (checkMode)
457 {
458 assertYPPred(state);
459 object functor = Functor.make(name, args);
460 if (CompilerState.isDetNoneOut(state, functor))
461 {
462 methodClass.InvokeMember
463 (methodName, BindingFlags.InvokeMethod, null, null, args);
464 return YP.succeed();
465 }
466 if (CompilerState.isSemidetNoneOut(state, functor))
467 {
468 if ((bool)methodClass.InvokeMember
469 (methodName, BindingFlags.InvokeMethod, null, null, args))
470 return YP.succeed();
471 else
472 return YP.fail();
473 }
474
475 }
476 return (IEnumerable<bool>)methodClass.InvokeMember
477 (methodName, BindingFlags.InvokeMethod, null, null, args);
478 }
479 catch (TargetInvocationException exception)
480 {
481 throw exception.InnerException;
482 }
483 catch (MissingMethodException)
484 {
485 return YP.unknownPredicate
486 (name, args.Length,
487 "Cannot find predicate function " + methodName + " for " + name + "/" + args.Length +
488 " in " + methodClass.FullName);
489 }
490 }
491
492 return null;
493 }
494
495 /// <summary>
496 /// Return true if there is a dynamic or static predicate with name and arity.
497 /// This returns false for built-in predicates.
498 /// </summary>
499 /// <param name="name"></param>
500 /// <param name="arity"></param>
501 /// <param name="declaringClass">used to resolve references to the default
502 /// module Atom.a(""). If a declaringClass is needed to resolve the reference but it is
503 /// null, return false</param>
504 /// <returns></returns>
505 public static bool isCurrentPredicate(Atom name, int arity, Type declaringClass)
506 {
507 CompilerState state = new CompilerState();
508 Variable FunctionName = new Variable();
509 foreach (bool l1 in functorCallFunctionName(state, name, arity, FunctionName))
510 {
511 Atom functionNameAtom = ((Atom)FunctionName.getValue());
512 if (functionNameAtom == Atom.NIL)
513 // name is for a dynamic predicate.
514 return YP.isDynamicCurrentPredicate(name, arity);
515
516 string methodName = functionNameAtom._name;
517
518 if (methodName.StartsWith("YP."))
519 // current_predicate/1 should fail for built-ins.
520 return false;
521 if (methodName.Contains("."))
522 // We don't support calling inner classes, etc.
523 return false;
524 if (declaringClass == null)
525 return false;
526
527 foreach (MemberInfo member in declaringClass.GetMember(methodName))
528 {
529 MethodInfo method = member as MethodInfo;
530 if (method == null)
531 continue;
532 if ((method.Attributes | MethodAttributes.Static) == 0)
533 // Not a static method.
534 continue;
535 if (method.GetParameters().Length == arity)
536 return true;
537 }
538 }
539
540 return false;
541 }
542
543 // Compiler output follows.
544
545 public class YPInnerClass { }
546 public static System.Type getDeclaringClass() { return typeof(YPInnerClass).DeclaringType; }
547
548 public static void repeatWrite(object arg1, object N)
549 {
550 {
551 object _Value = arg1;
552 if (YP.termEqual(N, 0))
553 {
554 return;
555 }
556 }
557 {
558 object Value = arg1;
559 Variable NextN = new Variable();
560 YP.write(Value);
561 foreach (bool l2 in YP.unify(NextN, YP.subtract(N, 1)))
562 {
563 repeatWrite(Value, NextN);
564 return;
565 }
566 }
567 }
568
569 public static bool sameVariable(object Variable1, object Variable2)
570 {
571 {
572 if (YP.var(Variable1))
573 {
574 if (YP.var(Variable2))
575 {
576 if (YP.termEqual(Variable1, Variable2))
577 {
578 return true;
579 }
580 }
581 }
582 }
583 return false;
584 }
585
586 public static IEnumerable<bool> makeFunctionPseudoCode(object RuleList, object FunctionCode)
587 {
588 {
589 Variable State = new Variable();
590 foreach (bool l2 in CompilerState.make(State))
591 {
592 assertYPPred(State);
593 processCompilerDirectives(RuleList, State);
594 foreach (bool l3 in YP.unify(FunctionCode, Atom.a("getDeclaringClass")))
595 {
596 yield return false;
597 }
598 foreach (bool l3 in makeFunctionPseudoCode3(RuleList, State, FunctionCode))
599 {
600 yield return false;
601 }
602 }
603 }
604 }
605
606 public static void assertYPPred(object State)
607 {
608 {
609 CompilerState.assertPred(State, Atom.a("nl"), Atom.a("det"));
610 CompilerState.assertPred(State, new Functor1("write", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("det"));
611 CompilerState.assertPred(State, new Functor1("put_code", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("det"));
612 CompilerState.assertPred(State, new Functor1("see", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("det"));
613 CompilerState.assertPred(State, Atom.a("seen"), Atom.a("det"));
614 CompilerState.assertPred(State, new Functor1("tell", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("det"));
615 CompilerState.assertPred(State, Atom.a("told"), Atom.a("det"));
616 CompilerState.assertPred(State, new Functor1("throw", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("det"));
617 CompilerState.assertPred(State, new Functor1("abolish", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("det"));
618 CompilerState.assertPred(State, new Functor1("retractall", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("det"));
619 CompilerState.assertPred(State, new Functor2("set_prolog_flag", new Functor2("::", Atom.a("univ"), Atom.a("in")), new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("det"));
620 CompilerState.assertPred(State, new Functor1("var", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet"));
621 CompilerState.assertPred(State, new Functor1("nonvar", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet"));
622 CompilerState.assertPred(State, new Functor1("atom", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet"));
623 CompilerState.assertPred(State, new Functor1("integer", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet"));
624 CompilerState.assertPred(State, new Functor1("float", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet"));
625 CompilerState.assertPred(State, new Functor1("number", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet"));
626 CompilerState.assertPred(State, new Functor1("atomic", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet"));
627 CompilerState.assertPred(State, new Functor1("compound", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet"));
628 CompilerState.assertPred(State, new Functor2("==", new Functor2("::", Atom.a("univ"), Atom.a("in")), new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet"));
629 CompilerState.assertPred(State, new Functor2("\\==", new Functor2("::", Atom.a("univ"), Atom.a("in")), new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet"));
630 CompilerState.assertPred(State, new Functor2("@<", new Functor2("::", Atom.a("univ"), Atom.a("in")), new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet"));
631 CompilerState.assertPred(State, new Functor2("@=<", new Functor2("::", Atom.a("univ"), Atom.a("in")), new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet"));
632 CompilerState.assertPred(State, new Functor2("@>", new Functor2("::", Atom.a("univ"), Atom.a("in")), new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet"));
633 CompilerState.assertPred(State, new Functor2("@>=", new Functor2("::", Atom.a("univ"), Atom.a("in")), new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet"));
634 return;
635 }
636 }
637
638 public static void processCompilerDirectives(object arg1, object arg2)
639 {
640 {
641 object _State = arg2;
642 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
643 {
644 return;
645 }
646 }
647 {
648 object State = arg2;
649 Variable Pred = new Variable();
650 Variable Determinism = new Variable();
651 Variable x3 = new Variable();
652 Variable RestRules = new Variable();
653 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("f", new Functor1(":-", new Functor1("pred", new Functor2("is", Pred, Determinism))), x3), RestRules)))
654 {
655 CompilerState.assertPred(State, Pred, Determinism);
656 processCompilerDirectives(RestRules, State);
657 return;
658 }
659 }
660 {
661 object State = arg2;
662 Variable Module = new Variable();
663 Variable PredicateList = new Variable();
664 Variable x3 = new Variable();
665 Variable RestRules = new Variable();
666 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("f", new Functor1(":-", new Functor2("import", Module, PredicateList)), x3), RestRules)))
667 {
668 foreach (bool l3 in importPredicateList(State, Module, PredicateList))
669 {
670 processCompilerDirectives(RestRules, State);
671 return;
672 }
673 }
674 }
675 {
676 object State = arg2;
677 Variable x1 = new Variable();
678 Variable x2 = new Variable();
679 Variable RestRules = new Variable();
680 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("f", new Functor1(":-", x1), x2), RestRules)))
681 {
682 processCompilerDirectives(RestRules, State);
683 return;
684 }
685 }
686 {
687 object State = arg2;
688 Variable Head = new Variable();
689 Variable _Body = new Variable();
690 Variable x3 = new Variable();
691 Variable RestRules = new Variable();
692 Variable Name = new Variable();
693 Variable Arity = new Variable();
694 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("f", new Functor2(":-", Head, _Body), x3), RestRules)))
695 {
696 foreach (bool l3 in YP.functor(Head, Name, Arity))
697 {
698 CompilerState.assertModuleForNameArity(State, Name, Arity, Atom.a(""));
699 processCompilerDirectives(RestRules, State);
700 return;
701 }
702 }
703 }
704 {
705 object State = arg2;
706 Variable Fact = new Variable();
707 Variable x2 = new Variable();
708 Variable RestRules = new Variable();
709 Variable Name = new Variable();
710 Variable Arity = new Variable();
711 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("f", Fact, x2), RestRules)))
712 {
713 foreach (bool l3 in YP.functor(Fact, Name, Arity))
714 {
715 CompilerState.assertModuleForNameArity(State, Name, Arity, Atom.a(""));
716 processCompilerDirectives(RestRules, State);
717 return;
718 }
719 }
720 }
721 {
722 object State = arg2;
723 Variable x1 = new Variable();
724 Variable RestRules = new Variable();
725 foreach (bool l2 in YP.unify(arg1, new ListPair(x1, RestRules)))
726 {
727 processCompilerDirectives(RestRules, State);
728 return;
729 }
730 }
731 }
732
733 public static IEnumerable<bool> importPredicateList(object arg1, object arg2, object arg3)
734 {
735 {
736 object _State = arg1;
737 object _Module = arg2;
738 foreach (bool l2 in YP.unify(arg3, Atom.NIL))
739 {
740 yield return true;
741 yield break;
742 }
743 }
744 {
745 object State = arg1;
746 object Module = arg2;
747 Variable Name = new Variable();
748 Variable Arity = new Variable();
749 Variable Rest = new Variable();
750 foreach (bool l2 in YP.unify(arg3, new ListPair(new Functor2("/", Name, Arity), Rest)))
751 {
752 CompilerState.assertModuleForNameArity(State, Name, Arity, Module);
753 foreach (bool l3 in importPredicateList(State, Module, Rest))
754 {
755 yield return true;
756 yield break;
757 }
758 }
759 }
760 {
761 object State = arg1;
762 object Module = arg2;
763 Variable x3 = new Variable();
764 Variable Rest = new Variable();
765 foreach (bool l2 in YP.unify(arg3, new ListPair(x3, Rest)))
766 {
767 foreach (bool l3 in importPredicateList(State, Module, Rest))
768 {
769 yield return true;
770 yield break;
771 }
772 }
773 }
774 }
775
776 public static IEnumerable<bool> makeFunctionPseudoCode3(object RuleList, object State, object FunctionCode)
777 {
778 {
779 Variable SamePredicateRuleList = new Variable();
780 Variable RestRules = new Variable();
781 foreach (bool l2 in samePredicateRuleList(RuleList, SamePredicateRuleList, RestRules))
782 {
783 if (YP.termNotEqual(SamePredicateRuleList, Atom.NIL))
784 {
785 foreach (bool l4 in compileSamePredicateFunction(SamePredicateRuleList, State, FunctionCode))
786 {
787 yield return false;
788 }
789 foreach (bool l4 in makeFunctionPseudoCode3(RestRules, State, FunctionCode))
790 {
791 yield return false;
792 }
793 }
794 }
795 }
796 }
797
798 public static IEnumerable<bool> compileSamePredicateFunction(object SamePredicateRuleList, object State, object FunctionCode)
799 {
800 {
801 Variable FirstRule = new Variable();
802 Variable x5 = new Variable();
803 Variable x6 = new Variable();
804 Variable x7 = new Variable();
805 Variable Head = new Variable();
806 Variable x9 = new Variable();
807 Variable ArgAssignments = new Variable();
808 Variable Calls = new Variable();
809 Variable Rule = new Variable();
810 Variable VariableNameSuggestions = new Variable();
811 Variable ClauseBag = new Variable();
812 Variable Name = new Variable();
813 Variable ArgsList = new Variable();
814 Variable FunctionArgNames = new Variable();
815 Variable MergedArgName = new Variable();
816 Variable ArgName = new Variable();
817 Variable MergedArgNames = new Variable();
818 Variable FunctionArgs = new Variable();
819 Variable BodyCode = new Variable();
820 Variable ReturnType = new Variable();
821 Variable BodyWithReturn = new Variable();
822 foreach (bool l2 in YP.unify(new ListPair(new Functor2("f", FirstRule, x5), x6), SamePredicateRuleList))
823 {
824 foreach (bool l3 in YP.unify(FirstRule, new Functor1(":-", x7)))
825 {
826 goto cutIf1;
827 }
828 foreach (bool l3 in YP.unify(new Functor2(":-", Head, x9), FirstRule))
829 {
830 CompilerState.startFunction(State, Head);
831 FindallAnswers findallAnswers3 = new FindallAnswers(new Functor2("f", ArgAssignments, Calls));
832 foreach (bool l4 in member(new Functor2("f", Rule, VariableNameSuggestions), SamePredicateRuleList))
833 {
834 foreach (bool l5 in compileBodyWithHeadBindings(Rule, VariableNameSuggestions, State, ArgAssignments, Calls))
835 {
836 findallAnswers3.add();
837 }
838 }
839 foreach (bool l4 in findallAnswers3.result(ClauseBag))
840 {
841 foreach (bool l5 in YP.univ(Head, new ListPair(Name, ArgsList)))
842 {
843 foreach (bool l6 in getFunctionArgNames(ArgsList, 1, FunctionArgNames))
844 {
845 FindallAnswers findallAnswers4 = new FindallAnswers(MergedArgName);
846 foreach (bool l7 in member(ArgName, FunctionArgNames))
847 {
848 foreach (bool l8 in argAssignedAll(ArgName, ClauseBag, MergedArgName))
849 {
850 findallAnswers4.add();
851 goto cutIf5;
852 }
853 foreach (bool l8 in YP.unify(MergedArgName, ArgName))
854 {
855 findallAnswers4.add();
856 }
857 cutIf5:
858 { }
859 }
860 foreach (bool l7 in findallAnswers4.result(MergedArgNames))
861 {
862 foreach (bool l8 in maplist_arg(MergedArgNames, FunctionArgs))
863 {
864 foreach (bool l9 in maplist_compileClause(ClauseBag, MergedArgNames, BodyCode))
865 {
866 if (CompilerState.determinismEquals(State, Atom.a("detNoneOut")))
867 {
868 foreach (bool l11 in YP.unify(ReturnType, Atom.a("void")))
869 {
870 if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut")))
871 {
872 foreach (bool l13 in append(BodyCode, new ListPair(Atom.a("returnfalse"), Atom.NIL), BodyWithReturn))
873 {
874 foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
875 {
876 yield return false;
877 }
878 }
879 goto cutIf7;
880 }
881 if (CompilerState.determinismEquals(State, Atom.a("detNoneOut")))
882 {
883 foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode))
884 {
885 foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
886 {
887 yield return false;
888 }
889 }
890 goto cutIf8;
891 }
892 if (CompilerState.codeUsesYield(State))
893 {
894 foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode))
895 {
896 foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
897 {
898 yield return false;
899 }
900 }
901 goto cutIf9;
902 }
903 foreach (bool l12 in append(BodyCode, new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.fail"), Atom.NIL), new ListPair(Atom.a("yieldfalse"), Atom.NIL)), Atom.NIL), BodyWithReturn))
904 {
905 foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
906 {
907 yield return false;
908 }
909 }
910 cutIf9:
911 cutIf8:
912 cutIf7:
913 { }
914 }
915 goto cutIf6;
916 }
917 if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut")))
918 {
919 foreach (bool l11 in YP.unify(ReturnType, Atom.a("bool")))
920 {
921 if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut")))
922 {
923 foreach (bool l13 in append(BodyCode, new ListPair(Atom.a("returnfalse"), Atom.NIL), BodyWithReturn))
924 {
925 foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
926 {
927 yield return false;
928 }
929 }
930 goto cutIf11;
931 }
932 if (CompilerState.determinismEquals(State, Atom.a("detNoneOut")))
933 {
934 foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode))
935 {
936 foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
937 {
938 yield return false;
939 }
940 }
941 goto cutIf12;
942 }
943 if (CompilerState.codeUsesYield(State))
944 {
945 foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode))
946 {
947 foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
948 {
949 yield return false;
950 }
951 }
952 goto cutIf13;
953 }
954 foreach (bool l12 in append(BodyCode, new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.fail"), Atom.NIL), new ListPair(Atom.a("yieldfalse"), Atom.NIL)), Atom.NIL), BodyWithReturn))
955 {
956 foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
957 {
958 yield return false;
959 }
960 }
961 cutIf13:
962 cutIf12:
963 cutIf11:
964 { }
965 }
966 goto cutIf10;
967 }
968 foreach (bool l10 in YP.unify(ReturnType, Atom.a("IEnumerable<bool>")))
969 {
970 if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut")))
971 {
972 foreach (bool l12 in append(BodyCode, new ListPair(Atom.a("returnfalse"), Atom.NIL), BodyWithReturn))
973 {
974 foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
975 {
976 yield return false;
977 }
978 }
979 goto cutIf14;
980 }
981 if (CompilerState.determinismEquals(State, Atom.a("detNoneOut")))
982 {
983 foreach (bool l12 in YP.unify(BodyWithReturn, BodyCode))
984 {
985 foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
986 {
987 yield return false;
988 }
989 }
990 goto cutIf15;
991 }
992 if (CompilerState.codeUsesYield(State))
993 {
994 foreach (bool l12 in YP.unify(BodyWithReturn, BodyCode))
995 {
996 foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
997 {
998 yield return false;
999 }
1000 }
1001 goto cutIf16;
1002 }
1003 foreach (bool l11 in append(BodyCode, new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.fail"), Atom.NIL), new ListPair(Atom.a("yieldfalse"), Atom.NIL)), Atom.NIL), BodyWithReturn))
1004 {
1005 foreach (bool l12 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
1006 {
1007 yield return false;
1008 }
1009 }
1010 cutIf16:
1011 cutIf15:
1012 cutIf14:
1013 { }
1014 }
1015 cutIf10:
1016 cutIf6:
1017 { }
1018 }
1019 }
1020 }
1021 }
1022 }
1023 }
1024 goto cutIf2;
1025 }
1026 foreach (bool l3 in YP.unify(Head, FirstRule))
1027 {
1028 CompilerState.startFunction(State, Head);
1029 FindallAnswers findallAnswers17 = new FindallAnswers(new Functor2("f", ArgAssignments, Calls));
1030 foreach (bool l4 in member(new Functor2("f", Rule, VariableNameSuggestions), SamePredicateRuleList))
1031 {
1032 foreach (bool l5 in compileBodyWithHeadBindings(Rule, VariableNameSuggestions, State, ArgAssignments, Calls))
1033 {
1034 findallAnswers17.add();
1035 }
1036 }
1037 foreach (bool l4 in findallAnswers17.result(ClauseBag))
1038 {
1039 foreach (bool l5 in YP.univ(Head, new ListPair(Name, ArgsList)))
1040 {
1041 foreach (bool l6 in getFunctionArgNames(ArgsList, 1, FunctionArgNames))
1042 {
1043 FindallAnswers findallAnswers18 = new FindallAnswers(MergedArgName);
1044 foreach (bool l7 in member(ArgName, FunctionArgNames))
1045 {
1046 foreach (bool l8 in argAssignedAll(ArgName, ClauseBag, MergedArgName))
1047 {
1048 findallAnswers18.add();
1049 goto cutIf19;
1050 }
1051 foreach (bool l8 in YP.unify(MergedArgName, ArgName))
1052 {
1053 findallAnswers18.add();
1054 }
1055 cutIf19:
1056 { }
1057 }
1058 foreach (bool l7 in findallAnswers18.result(MergedArgNames))
1059 {
1060 foreach (bool l8 in maplist_arg(MergedArgNames, FunctionArgs))
1061 {
1062 foreach (bool l9 in maplist_compileClause(ClauseBag, MergedArgNames, BodyCode))
1063 {
1064 if (CompilerState.determinismEquals(State, Atom.a("detNoneOut")))
1065 {
1066 foreach (bool l11 in YP.unify(ReturnType, Atom.a("void")))
1067 {
1068 if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut")))
1069 {
1070 foreach (bool l13 in append(BodyCode, new ListPair(Atom.a("returnfalse"), Atom.NIL), BodyWithReturn))
1071 {
1072 foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
1073 {
1074 yield return false;
1075 }
1076 }
1077 goto cutIf21;
1078 }
1079 if (CompilerState.determinismEquals(State, Atom.a("detNoneOut")))
1080 {
1081 foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode))
1082 {
1083 foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
1084 {
1085 yield return false;
1086 }
1087 }
1088 goto cutIf22;
1089 }
1090 if (CompilerState.codeUsesYield(State))
1091 {
1092 foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode))
1093 {
1094 foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
1095 {
1096 yield return false;
1097 }
1098 }
1099 goto cutIf23;
1100 }
1101 foreach (bool l12 in append(BodyCode, new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.fail"), Atom.NIL), new ListPair(Atom.a("yieldfalse"), Atom.NIL)), Atom.NIL), BodyWithReturn))
1102 {
1103 foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
1104 {
1105 yield return false;
1106 }
1107 }
1108 cutIf23:
1109 cutIf22:
1110 cutIf21:
1111 { }
1112 }
1113 goto cutIf20;
1114 }
1115 if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut")))
1116 {
1117 foreach (bool l11 in YP.unify(ReturnType, Atom.a("bool")))
1118 {
1119 if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut")))
1120 {
1121 foreach (bool l13 in append(BodyCode, new ListPair(Atom.a("returnfalse"), Atom.NIL), BodyWithReturn))
1122 {
1123 foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
1124 {
1125 yield return false;
1126 }
1127 }
1128 goto cutIf25;
1129 }
1130 if (CompilerState.determinismEquals(State, Atom.a("detNoneOut")))
1131 {
1132 foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode))
1133 {
1134 foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
1135 {
1136 yield return false;
1137 }
1138 }
1139 goto cutIf26;
1140 }
1141 if (CompilerState.codeUsesYield(State))
1142 {
1143 foreach (bool l13 in YP.unify(BodyWithReturn, BodyCode))
1144 {
1145 foreach (bool l14 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
1146 {
1147 yield return false;
1148 }
1149 }
1150 goto cutIf27;
1151 }
1152 foreach (bool l12 in append(BodyCode, new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.fail"), Atom.NIL), new ListPair(Atom.a("yieldfalse"), Atom.NIL)), Atom.NIL), BodyWithReturn))
1153 {
1154 foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
1155 {
1156 yield return false;
1157 }
1158 }
1159 cutIf27:
1160 cutIf26:
1161 cutIf25:
1162 { }
1163 }
1164 goto cutIf24;
1165 }
1166 foreach (bool l10 in YP.unify(ReturnType, Atom.a("IEnumerable<bool>")))
1167 {
1168 if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut")))
1169 {
1170 foreach (bool l12 in append(BodyCode, new ListPair(Atom.a("returnfalse"), Atom.NIL), BodyWithReturn))
1171 {
1172 foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
1173 {
1174 yield return false;
1175 }
1176 }
1177 goto cutIf28;
1178 }
1179 if (CompilerState.determinismEquals(State, Atom.a("detNoneOut")))
1180 {
1181 foreach (bool l12 in YP.unify(BodyWithReturn, BodyCode))
1182 {
1183 foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
1184 {
1185 yield return false;
1186 }
1187 }
1188 goto cutIf29;
1189 }
1190 if (CompilerState.codeUsesYield(State))
1191 {
1192 foreach (bool l12 in YP.unify(BodyWithReturn, BodyCode))
1193 {
1194 foreach (bool l13 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
1195 {
1196 yield return false;
1197 }
1198 }
1199 goto cutIf30;
1200 }
1201 foreach (bool l11 in append(BodyCode, new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.fail"), Atom.NIL), new ListPair(Atom.a("yieldfalse"), Atom.NIL)), Atom.NIL), BodyWithReturn))
1202 {
1203 foreach (bool l12 in YP.unify(FunctionCode, new Functor("function", new object[] { ReturnType, Name, FunctionArgs, BodyWithReturn })))
1204 {
1205 yield return false;
1206 }
1207 }
1208 cutIf30:
1209 cutIf29:
1210 cutIf28:
1211 { }
1212 }
1213 cutIf24:
1214 cutIf20:
1215 { }
1216 }
1217 }
1218 }
1219 }
1220 }
1221 }
1222 }
1223 cutIf2:
1224 cutIf1:
1225 { }
1226 }
1227 }
1228 }
1229
1230 public static IEnumerable<bool> samePredicateRuleList(object arg1, object arg2, object arg3)
1231 {
1232 {
1233 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
1234 {
1235 foreach (bool l3 in YP.unify(arg2, Atom.NIL))
1236 {
1237 foreach (bool l4 in YP.unify(arg3, Atom.NIL))
1238 {
1239 yield return true;
1240 yield break;
1241 }
1242 }
1243 }
1244 }
1245 {
1246 Variable First = new Variable();
1247 foreach (bool l2 in YP.unify(arg1, new ListPair(First, Atom.NIL)))
1248 {
1249 foreach (bool l3 in YP.unify(arg2, new ListPair(First, Atom.NIL)))
1250 {
1251 foreach (bool l4 in YP.unify(arg3, Atom.NIL))
1252 {
1253 yield return true;
1254 yield break;
1255 }
1256 }
1257 }
1258 }
1259 {
1260 object SamePredicateRuleList = arg2;
1261 object RestRules = arg3;
1262 Variable First = new Variable();
1263 Variable Rest = new Variable();
1264 Variable FirstRule = new Variable();
1265 Variable x6 = new Variable();
1266 Variable SecondRule = new Variable();
1267 Variable x8 = new Variable();
1268 Variable x9 = new Variable();
1269 Variable FirstHead = new Variable();
1270 Variable x11 = new Variable();
1271 Variable SecondHead = new Variable();
1272 Variable x13 = new Variable();
1273 Variable Name = new Variable();
1274 Variable Arity = new Variable();
1275 Variable RestSamePredicates = new Variable();
1276 foreach (bool l2 in YP.unify(arg1, new ListPair(First, Rest)))
1277 {
1278 foreach (bool l3 in YP.unify(new Functor2("f", FirstRule, x6), First))
1279 {
1280 foreach (bool l4 in YP.unify(new ListPair(new Functor2("f", SecondRule, x8), x9), Rest))
1281 {
1282 foreach (bool l5 in YP.unify(new Functor2(":-", FirstHead, x11), FirstRule))
1283 {
1284 foreach (bool l6 in YP.unify(new Functor2(":-", SecondHead, x13), SecondRule))
1285 {
1286 foreach (bool l7 in YP.functor(FirstHead, Name, Arity))
1287 {
1288 foreach (bool l8 in YP.functor(SecondHead, Name, Arity))
1289 {
1290 foreach (bool l9 in samePredicateRuleList(Rest, RestSamePredicates, RestRules))
1291 {
1292 foreach (bool l10 in YP.unify(SamePredicateRuleList, new ListPair(First, RestSamePredicates)))
1293 {
1294 yield return true;
1295 yield break;
1296 }
1297 }
1298 goto cutIf3;
1299 }
1300 foreach (bool l8 in YP.unify(SamePredicateRuleList, new ListPair(First, Atom.NIL)))
1301 {
1302 foreach (bool l9 in YP.unify(RestRules, Rest))
1303 {
1304 yield return true;
1305 yield break;
1306 }
1307 }
1308 cutIf3:
1309 { }
1310 }
1311 goto cutIf2;
1312 }
1313 foreach (bool l6 in YP.unify(SecondHead, SecondRule))
1314 {
1315 foreach (bool l7 in YP.functor(FirstHead, Name, Arity))
1316 {
1317 foreach (bool l8 in YP.functor(SecondHead, Name, Arity))
1318 {
1319 foreach (bool l9 in samePredicateRuleList(Rest, RestSamePredicates, RestRules))
1320 {
1321 foreach (bool l10 in YP.unify(SamePredicateRuleList, new ListPair(First, RestSamePredicates)))
1322 {
1323 yield return true;
1324 yield break;
1325 }
1326 }
1327 goto cutIf4;
1328 }
1329 foreach (bool l8 in YP.unify(SamePredicateRuleList, new ListPair(First, Atom.NIL)))
1330 {
1331 foreach (bool l9 in YP.unify(RestRules, Rest))
1332 {
1333 yield return true;
1334 yield break;
1335 }
1336 }
1337 cutIf4:
1338 { }
1339 }
1340 }
1341 cutIf2:
1342 goto cutIf1;
1343 }
1344 foreach (bool l5 in YP.unify(FirstHead, FirstRule))
1345 {
1346 foreach (bool l6 in YP.unify(new Functor2(":-", SecondHead, x13), SecondRule))
1347 {
1348 foreach (bool l7 in YP.functor(FirstHead, Name, Arity))
1349 {
1350 foreach (bool l8 in YP.functor(SecondHead, Name, Arity))
1351 {
1352 foreach (bool l9 in samePredicateRuleList(Rest, RestSamePredicates, RestRules))
1353 {
1354 foreach (bool l10 in YP.unify(SamePredicateRuleList, new ListPair(First, RestSamePredicates)))
1355 {
1356 yield return true;
1357 yield break;
1358 }
1359 }
1360 goto cutIf6;
1361 }
1362 foreach (bool l8 in YP.unify(SamePredicateRuleList, new ListPair(First, Atom.NIL)))
1363 {
1364 foreach (bool l9 in YP.unify(RestRules, Rest))
1365 {
1366 yield return true;
1367 yield break;
1368 }
1369 }
1370 cutIf6:
1371 { }
1372 }
1373 goto cutIf5;
1374 }
1375 foreach (bool l6 in YP.unify(SecondHead, SecondRule))
1376 {
1377 foreach (bool l7 in YP.functor(FirstHead, Name, Arity))
1378 {
1379 foreach (bool l8 in YP.functor(SecondHead, Name, Arity))
1380 {
1381 foreach (bool l9 in samePredicateRuleList(Rest, RestSamePredicates, RestRules))
1382 {
1383 foreach (bool l10 in YP.unify(SamePredicateRuleList, new ListPair(First, RestSamePredicates)))
1384 {
1385 yield return true;
1386 yield break;
1387 }
1388 }
1389 goto cutIf7;
1390 }
1391 foreach (bool l8 in YP.unify(SamePredicateRuleList, new ListPair(First, Atom.NIL)))
1392 {
1393 foreach (bool l9 in YP.unify(RestRules, Rest))
1394 {
1395 yield return true;
1396 yield break;
1397 }
1398 }
1399 cutIf7:
1400 { }
1401 }
1402 }
1403 cutIf5:
1404 { }
1405 }
1406 cutIf1:
1407 { }
1408 }
1409 }
1410 }
1411 }
1412 }
1413
1414 public static IEnumerable<bool> maplist_compileClause(object arg1, object arg2, object arg3)
1415 {
1416 {
1417 object _MergedArgNames = arg2;
1418 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
1419 {
1420 foreach (bool l3 in YP.unify(arg3, Atom.NIL))
1421 {
1422 yield return true;
1423 yield break;
1424 }
1425 }
1426 }
1427 {
1428 object MergedArgNames = arg2;
1429 Variable ArgAssignments = new Variable();
1430 Variable Calls = new Variable();
1431 Variable Rest = new Variable();
1432 Variable ClauseCode = new Variable();
1433 Variable RestResults = new Variable();
1434 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("f", ArgAssignments, Calls), Rest)))
1435 {
1436 foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor1("blockScope", ClauseCode), RestResults)))
1437 {
1438 foreach (bool l4 in prependArgAssignments(ArgAssignments, Calls, MergedArgNames, ClauseCode))
1439 {
1440 foreach (bool l5 in maplist_compileClause(Rest, MergedArgNames, RestResults))
1441 {
1442 yield return true;
1443 yield break;
1444 }
1445 }
1446 }
1447 }
1448 }
1449 }
1450
1451 public static IEnumerable<bool> prependArgAssignments(object arg1, object arg2, object arg3, object arg4)
1452 {
1453 {
1454 object _MergedArgNames = arg3;
1455 Variable In = new Variable();
1456 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
1457 {
1458 foreach (bool l3 in YP.unify(arg2, In))
1459 {
1460 foreach (bool l4 in YP.unify(arg4, In))
1461 {
1462 yield return true;
1463 yield break;
1464 }
1465 }
1466 }
1467 }
1468 {
1469 object In = arg2;
1470 object MergedArgNames = arg3;
1471 object ClauseCode = arg4;
1472 Variable VariableName = new Variable();
1473 Variable ArgName = new Variable();
1474 Variable RestArgAssignments = new Variable();
1475 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("f", VariableName, ArgName), RestArgAssignments)))
1476 {
1477 foreach (bool l3 in member(VariableName, MergedArgNames))
1478 {
1479 foreach (bool l4 in prependArgAssignments(RestArgAssignments, In, MergedArgNames, ClauseCode))
1480 {
1481 yield return true;
1482 yield break;
1483 }
1484 goto cutIf1;
1485 }
1486 foreach (bool l3 in prependArgAssignments(RestArgAssignments, new ListPair(new Functor3("declare", Atom.a("object"), VariableName, new Functor1("var", ArgName)), In), MergedArgNames, ClauseCode))
1487 {
1488 yield return true;
1489 yield break;
1490 }
1491 cutIf1:
1492 { }
1493 }
1494 }
1495 }
1496
1497 public static IEnumerable<bool> argAssignedAll(object arg1, object arg2, object VariableName)
1498 {
1499 {
1500 object _ArgName = arg1;
1501 foreach (bool l2 in YP.unify(arg2, Atom.NIL))
1502 {
1503 if (YP.nonvar(VariableName))
1504 {
1505 yield return true;
1506 yield break;
1507 }
1508 }
1509 }
1510 {
1511 object ArgName = arg1;
1512 Variable ArgAssignments = new Variable();
1513 Variable _Calls = new Variable();
1514 Variable RestClauseBag = new Variable();
1515 foreach (bool l2 in YP.unify(arg2, new ListPair(new Functor2("f", ArgAssignments, _Calls), RestClauseBag)))
1516 {
1517 foreach (bool l3 in member(new Functor2("f", VariableName, ArgName), ArgAssignments))
1518 {
1519 foreach (bool l4 in argAssignedAll(ArgName, RestClauseBag, VariableName))
1520 {
1521 yield return false;
1522 }
1523 }
1524 }
1525 }
1526 }
1527
1528 public static IEnumerable<bool> maplist_arg(object arg1, object arg2)
1529 {
1530 {
1531 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
1532 {
1533 foreach (bool l3 in YP.unify(arg2, Atom.NIL))
1534 {
1535 yield return true;
1536 yield break;
1537 }
1538 }
1539 }
1540 {
1541 Variable First = new Variable();
1542 Variable Rest = new Variable();
1543 Variable RestResults = new Variable();
1544 foreach (bool l2 in YP.unify(arg1, new ListPair(First, Rest)))
1545 {
1546 foreach (bool l3 in YP.unify(arg2, new ListPair(new Functor1("arg", First), RestResults)))
1547 {
1548 foreach (bool l4 in maplist_arg(Rest, RestResults))
1549 {
1550 yield return true;
1551 yield break;
1552 }
1553 }
1554 }
1555 }
1556 }
1557
1558 public static IEnumerable<bool> getFunctionArgNames(object arg1, object arg2, object arg3)
1559 {
1560 {
1561 object _StartArgNumber = arg2;
1562 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
1563 {
1564 foreach (bool l3 in YP.unify(arg3, Atom.NIL))
1565 {
1566 yield return true;
1567 yield break;
1568 }
1569 }
1570 }
1571 {
1572 object StartArgNumber = arg2;
1573 Variable x1 = new Variable();
1574 Variable Rest = new Variable();
1575 Variable ArgName = new Variable();
1576 Variable RestFunctionArgs = new Variable();
1577 Variable NumberCodes = new Variable();
1578 Variable NumberAtom = new Variable();
1579 Variable NextArgNumber = new Variable();
1580 foreach (bool l2 in YP.unify(arg1, new ListPair(x1, Rest)))
1581 {
1582 foreach (bool l3 in YP.unify(arg3, new ListPair(ArgName, RestFunctionArgs)))
1583 {
1584 foreach (bool l4 in YP.number_codes(StartArgNumber, NumberCodes))
1585 {
1586 foreach (bool l5 in YP.atom_codes(NumberAtom, NumberCodes))
1587 {
1588 foreach (bool l6 in YP.atom_concat(Atom.a("arg"), NumberAtom, ArgName))
1589 {
1590 foreach (bool l7 in YP.unify(NextArgNumber, YP.add(StartArgNumber, 1)))
1591 {
1592 foreach (bool l8 in getFunctionArgNames(Rest, NextArgNumber, RestFunctionArgs))
1593 {
1594 yield return true;
1595 yield break;
1596 }
1597 }
1598 }
1599 }
1600 }
1601 }
1602 }
1603 }
1604 }
1605
1606 public static IEnumerable<bool> compileBodyWithHeadBindings(object Rule, object VariableNameSuggestions, object State, object ArgAssignments, object Calls)
1607 {
1608 {
1609 Variable Head = new Variable();
1610 Variable Body = new Variable();
1611 Variable x8 = new Variable();
1612 Variable HeadArgs = new Variable();
1613 Variable CompiledHeadArgs = new Variable();
1614 Variable BodyCode = new Variable();
1615 Variable VariableNamesList = new Variable();
1616 Variable ArgUnifications = new Variable();
1617 foreach (bool l2 in YP.unify(new Functor2(":-", Head, Body), Rule))
1618 {
1619 CompilerState.newVariableNames(State, Rule, VariableNameSuggestions);
1620 foreach (bool l3 in YP.univ(Head, new ListPair(x8, HeadArgs)))
1621 {
1622 foreach (bool l4 in maplist_compileTerm(HeadArgs, State, CompiledHeadArgs))
1623 {
1624 foreach (bool l5 in compileRuleBody(Body, State, BodyCode))
1625 {
1626 foreach (bool l6 in CompilerState.variableNamesList(State, VariableNamesList))
1627 {
1628 foreach (bool l7 in compileArgUnifications(HeadArgs, CompiledHeadArgs, 1, HeadArgs, BodyCode, ArgUnifications))
1629 {
1630 foreach (bool l8 in compileDeclarations(VariableNamesList, HeadArgs, Atom.NIL, ArgAssignments, ArgUnifications, Calls))
1631 {
1632 yield return true;
1633 yield break;
1634 }
1635 }
1636 }
1637 }
1638 }
1639 }
1640 }
1641 }
1642 {
1643 foreach (bool l2 in compileBodyWithHeadBindings(new Functor2(":-", Rule, Atom.a("true")), VariableNameSuggestions, State, ArgAssignments, Calls))
1644 {
1645 yield return true;
1646 yield break;
1647 }
1648 }
1649 }
1650
1651 public static IEnumerable<bool> compileArgUnifications(object arg1, object arg2, object arg3, object arg4, object arg5, object arg6)
1652 {
1653 {
1654 object x1 = arg2;
1655 object x2 = arg3;
1656 object x3 = arg4;
1657 Variable BodyCode = new Variable();
1658 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
1659 {
1660 foreach (bool l3 in YP.unify(arg5, BodyCode))
1661 {
1662 foreach (bool l4 in YP.unify(arg6, BodyCode))
1663 {
1664 yield return true;
1665 yield break;
1666 }
1667 }
1668 }
1669 }
1670 {
1671 object Index = arg3;
1672 object AllHeadArgs = arg4;
1673 object BodyCode = arg5;
1674 object ArgUnifications = arg6;
1675 Variable HeadArg = new Variable();
1676 Variable RestHeadArgs = new Variable();
1677 Variable x3 = new Variable();
1678 Variable RestCompiledHeadArgs = new Variable();
1679 Variable _ArgIndex1 = new Variable();
1680 Variable NextIndex = new Variable();
1681 foreach (bool l2 in YP.unify(arg1, new ListPair(HeadArg, RestHeadArgs)))
1682 {
1683 foreach (bool l3 in YP.unify(arg2, new ListPair(x3, RestCompiledHeadArgs)))
1684 {
1685 foreach (bool l4 in getVariableArgIndex1(HeadArg, AllHeadArgs, _ArgIndex1))
1686 {
1687 foreach (bool l5 in YP.unify(NextIndex, YP.add(Index, 1)))
1688 {
1689 foreach (bool l6 in compileArgUnifications(RestHeadArgs, RestCompiledHeadArgs, NextIndex, AllHeadArgs, BodyCode, ArgUnifications))
1690 {
1691 yield return true;
1692 yield break;
1693 }
1694 }
1695 }
1696 }
1697 }
1698 }
1699 {
1700 object Index = arg3;
1701 object AllHeadArgs = arg4;
1702 object BodyCode = arg5;
1703 Variable _HeadArg = new Variable();
1704 Variable RestHeadArgs = new Variable();
1705 Variable CompiledHeadArg = new Variable();
1706 Variable RestCompiledHeadArgs = new Variable();
1707 Variable ArgName = new Variable();
1708 Variable RestArgUnifications = new Variable();
1709 Variable NumberCodes = new Variable();
1710 Variable NumberAtom = new Variable();
1711 Variable NextIndex = new Variable();
1712 foreach (bool l2 in YP.unify(arg1, new ListPair(_HeadArg, RestHeadArgs)))
1713 {
1714 foreach (bool l3 in YP.unify(arg2, new ListPair(CompiledHeadArg, RestCompiledHeadArgs)))
1715 {
1716 foreach (bool l4 in YP.unify(arg6, new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.unify"), new ListPair(new Functor1("var", ArgName), new ListPair(CompiledHeadArg, Atom.NIL))), RestArgUnifications), Atom.NIL)))
1717 {
1718 foreach (bool l5 in YP.number_codes(Index, NumberCodes))
1719 {
1720 foreach (bool l6 in YP.atom_codes(NumberAtom, NumberCodes))
1721 {
1722 foreach (bool l7 in YP.atom_concat(Atom.a("arg"), NumberAtom, ArgName))
1723 {
1724 foreach (bool l8 in YP.unify(NextIndex, YP.add(Index, 1)))
1725 {
1726 foreach (bool l9 in compileArgUnifications(RestHeadArgs, RestCompiledHeadArgs, NextIndex, AllHeadArgs, BodyCode, RestArgUnifications))
1727 {
1728 yield return true;
1729 yield break;
1730 }
1731 }
1732 }
1733 }
1734 }
1735 }
1736 }
1737 }
1738 }
1739 }
1740
1741 public static IEnumerable<bool> compileDeclarations(object arg1, object arg2, object arg3, object arg4, object arg5, object arg6)
1742 {
1743 {
1744 object _HeadArgs = arg2;
1745 Variable ArgAssignmentsIn = new Variable();
1746 Variable DeclarationsIn = new Variable();
1747 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
1748 {
1749 foreach (bool l3 in YP.unify(arg3, ArgAssignmentsIn))
1750 {
1751 foreach (bool l4 in YP.unify(arg4, ArgAssignmentsIn))
1752 {
1753 foreach (bool l5 in YP.unify(arg5, DeclarationsIn))
1754 {
1755 foreach (bool l6 in YP.unify(arg6, DeclarationsIn))
1756 {
1757 yield return true;
1758 yield break;
1759 }
1760 }
1761 }
1762 }
1763 }
1764 }
1765 {
1766 object HeadArgs = arg2;
1767 object ArgAssignmentsIn = arg3;
1768 object ArgAssignmentsOut = arg4;
1769 object DeclarationsIn = arg5;
1770 object DeclarationsOut = arg6;
1771 Variable VariableName = new Variable();
1772 Variable Var = new Variable();
1773 Variable RestVariableNames = new Variable();
1774 Variable ArgIndex1 = new Variable();
1775 Variable NumberCodes = new Variable();
1776 Variable NumberAtom = new Variable();
1777 Variable ArgName = new Variable();
1778 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("=", VariableName, Var), RestVariableNames)))
1779 {
1780 foreach (bool l3 in getVariableArgIndex1(Var, HeadArgs, ArgIndex1))
1781 {
1782 foreach (bool l4 in YP.number_codes(ArgIndex1, NumberCodes))
1783 {
1784 foreach (bool l5 in YP.atom_codes(NumberAtom, NumberCodes))
1785 {
1786 foreach (bool l6 in YP.atom_concat(Atom.a("arg"), NumberAtom, ArgName))
1787 {
1788 foreach (bool l7 in compileDeclarations(RestVariableNames, HeadArgs, new ListPair(new Functor2("f", VariableName, ArgName), ArgAssignmentsIn), ArgAssignmentsOut, DeclarationsIn, DeclarationsOut))
1789 {
1790 yield return true;
1791 yield break;
1792 }
1793 }
1794 }
1795 }
1796 }
1797 }
1798 }
1799 {
1800 object HeadArgs = arg2;
1801 object ArgAssignmentsIn = arg3;
1802 object ArgAssignmentsOut = arg4;
1803 object DeclarationsIn = arg5;
1804 Variable VariableName = new Variable();
1805 Variable _Var = new Variable();
1806 Variable RestVariableNames = new Variable();
1807 Variable DeclarationsOut = new Variable();
1808 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("=", VariableName, _Var), RestVariableNames)))
1809 {
1810 foreach (bool l3 in YP.unify(arg6, new ListPair(new Functor3("declare", Atom.a("Variable"), VariableName, new Functor2("new", Atom.a("Variable"), Atom.NIL)), DeclarationsOut)))
1811 {
1812 foreach (bool l4 in compileDeclarations(RestVariableNames, HeadArgs, ArgAssignmentsIn, ArgAssignmentsOut, DeclarationsIn, DeclarationsOut))
1813 {
1814 yield return true;
1815 yield break;
1816 }
1817 }
1818 }
1819 }
1820 }
1821
1822 public static IEnumerable<bool> getVariableArgIndex1(object Var, object arg2, object arg3)
1823 {
1824 {
1825 Variable FirstHeadArgs = new Variable();
1826 Variable RestHeadArgs = new Variable();
1827 Variable x4 = new Variable();
1828 foreach (bool l2 in YP.unify(arg2, new ListPair(FirstHeadArgs, RestHeadArgs)))
1829 {
1830 foreach (bool l3 in YP.unify(arg3, 1))
1831 {
1832 if (sameVariable(Var, FirstHeadArgs))
1833 {
1834 foreach (bool l5 in getVariableArgIndex1(Var, RestHeadArgs, x4))
1835 {
1836 goto cutIf1;
1837 }
1838 yield return false;
1839 cutIf1:
1840 yield break;
1841 }
1842 }
1843 }
1844 }
1845 {
1846 object Index = arg3;
1847 Variable x2 = new Variable();
1848 Variable RestHeadArgs = new Variable();
1849 Variable RestIndex = new Variable();
1850 foreach (bool l2 in YP.unify(arg2, new ListPair(x2, RestHeadArgs)))
1851 {
1852 foreach (bool l3 in getVariableArgIndex1(Var, RestHeadArgs, RestIndex))
1853 {
1854 foreach (bool l4 in YP.unify(Index, YP.add(1, RestIndex)))
1855 {
1856 yield return true;
1857 yield break;
1858 }
1859 }
1860 }
1861 }
1862 }
1863
1864 public static IEnumerable<bool> compileRuleBody(object arg1, object arg2, object arg3)
1865 {
1866 {
1867 object A = arg1;
1868 object State = arg2;
1869 object PseudoCode = arg3;
1870 if (YP.var(A))
1871 {
1872 foreach (bool l3 in compileRuleBody(new Functor2(",", new Functor1("call", A), Atom.a("true")), State, PseudoCode))
1873 {
1874 yield return true;
1875 yield break;
1876 }
1877 }
1878 }
1879 {
1880 object State = arg2;
1881 object PseudoCode = arg3;
1882 Variable A = new Variable();
1883 Variable B = new Variable();
1884 foreach (bool l2 in YP.unify(arg1, new Functor2(",", A, B)))
1885 {
1886 if (YP.var(A))
1887 {
1888 foreach (bool l4 in compileRuleBody(new Functor2(",", new Functor1("call", A), B), State, PseudoCode))
1889 {
1890 yield return true;
1891 yield break;
1892 }
1893 }
1894 }
1895 }
1896 {
1897 object State = arg2;
1898 object PseudoCode = arg3;
1899 Variable A = new Variable();
1900 Variable B = new Variable();
1901 Variable ACode = new Variable();
1902 Variable BCode = new Variable();
1903 foreach (bool l2 in YP.unify(arg1, new Functor2(",", A, B)))
1904 {
1905 foreach (bool l3 in compileFunctorCall(A, State, ACode))
1906 {
1907 if (CompilerState.isDetNoneOut(State, A))
1908 {
1909 foreach (bool l5 in compileRuleBody(B, State, BCode))
1910 {
1911 foreach (bool l6 in YP.unify(PseudoCode, new ListPair(ACode, BCode)))
1912 {
1913 yield return true;
1914 yield break;
1915 }
1916 }
1917 }
1918 if (CompilerState.isSemidetNoneOut(State, A))
1919 {
1920 foreach (bool l5 in compileRuleBody(B, State, BCode))
1921 {
1922 foreach (bool l6 in YP.unify(PseudoCode, new ListPair(new Functor2("if", ACode, BCode), Atom.NIL)))
1923 {
1924 yield return true;
1925 yield break;
1926 }
1927 }
1928 }
1929 foreach (bool l4 in compileRuleBody(B, State, BCode))
1930 {
1931 foreach (bool l5 in YP.unify(PseudoCode, new ListPair(new Functor2("foreach", ACode, BCode), Atom.NIL)))
1932 {
1933 yield return true;
1934 yield break;
1935 }
1936 }
1937 }
1938 }
1939 }
1940 {
1941 object State = arg2;
1942 object PseudoCode = arg3;
1943 Variable A = new Variable();
1944 Variable T = new Variable();
1945 Variable B = new Variable();
1946 Variable C = new Variable();
1947 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor2(";", new Functor2("->", A, T), B), C)))
1948 {
1949 foreach (bool l3 in compileRuleBody(new Functor2(";", new Functor2("->", A, new Functor2(",", T, C)), new Functor2(",", B, C)), State, PseudoCode))
1950 {
1951 yield return true;
1952 yield break;
1953 }
1954 }
1955 }
1956 {
1957 object State = arg2;
1958 object PseudoCode = arg3;
1959 Variable A = new Variable();
1960 Variable B = new Variable();
1961 Variable C = new Variable();
1962 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor2(";", A, B), C)))
1963 {
1964 foreach (bool l3 in compileRuleBody(new Functor2(";", new Functor2(",", A, C), new Functor2(",", B, C)), State, PseudoCode))
1965 {
1966 yield return true;
1967 yield break;
1968 }
1969 }
1970 }
1971 {
1972 object State = arg2;
1973 Variable A = new Variable();
1974 Variable B = new Variable();
1975 Variable ACode = new Variable();
1976 Variable BCode = new Variable();
1977 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor1("\\+", A), B)))
1978 {
1979 foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("if", new Functor1("not", ACode), BCode), Atom.NIL)))
1980 {
1981 if (CompilerState.isSemidetNoneOut(State, A))
1982 {
1983 foreach (bool l5 in compileFunctorCall(A, State, ACode))
1984 {
1985 foreach (bool l6 in compileRuleBody(B, State, BCode))
1986 {
1987 yield return true;
1988 yield break;
1989 }
1990 }
1991 }
1992 }
1993 }
1994 }
1995 {
1996 object State = arg2;
1997 object PseudoCode = arg3;
1998 Variable A = new Variable();
1999 Variable B = new Variable();
2000 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor1("\\+", A), B)))
2001 {
2002 foreach (bool l3 in compileRuleBody(new Functor2(",", new Functor2(";", new Functor2("->", A, Atom.a("fail")), Atom.a("true")), B), State, PseudoCode))
2003 {
2004 yield return true;
2005 yield break;
2006 }
2007 }
2008 }
2009 {
2010 object State = arg2;
2011 object PseudoCode = arg3;
2012 Variable A = new Variable();
2013 Variable B = new Variable();
2014 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor1("once", A), B)))
2015 {
2016 foreach (bool l3 in compileRuleBody(new Functor2(",", new Functor2(";", new Functor2("->", A, Atom.a("true")), Atom.a("fail")), B), State, PseudoCode))
2017 {
2018 yield return true;
2019 yield break;
2020 }
2021 }
2022 }
2023 {
2024 object State = arg2;
2025 object PseudoCode = arg3;
2026 Variable A = new Variable();
2027 Variable T = new Variable();
2028 Variable B = new Variable();
2029 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor2("->", A, T), B)))
2030 {
2031 foreach (bool l3 in compileRuleBody(new Functor2(",", new Functor2(";", new Functor2("->", A, T), Atom.a("fail")), B), State, PseudoCode))
2032 {
2033 yield return true;
2034 yield break;
2035 }
2036 }
2037 }
2038 {
2039 object State = arg2;
2040 object PseudoCode = arg3;
2041 Variable A = new Variable();
2042 Variable B = new Variable();
2043 Variable C = new Variable();
2044 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor2("\\=", A, B), C)))
2045 {
2046 foreach (bool l3 in compileRuleBody(new Functor2(",", new Functor1("\\+", new Functor2("=", A, B)), C), State, PseudoCode))
2047 {
2048 yield return true;
2049 yield break;
2050 }
2051 }
2052 }
2053 {
2054 object State = arg2;
2055 object PseudoCode = arg3;
2056 Variable A = new Variable();
2057 Variable ACode = new Variable();
2058 foreach (bool l2 in YP.unify(arg1, new Functor2(",", Atom.a("!"), A)))
2059 {
2060 foreach (bool l3 in compileRuleBody(A, State, ACode))
2061 {
2062 foreach (bool l4 in append(ACode, new ListPair(Atom.a("yieldbreak"), Atom.NIL), PseudoCode))
2063 {
2064 yield return true;
2065 yield break;
2066 }
2067 }
2068 }
2069 }
2070 {
2071 object State = arg2;
2072 object PseudoCode = arg3;
2073 Variable Name = new Variable();
2074 Variable A = new Variable();
2075 Variable ACode = new Variable();
2076 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor1("$CUTIF", Name), A)))
2077 {
2078 foreach (bool l3 in compileRuleBody(A, State, ACode))
2079 {
2080 foreach (bool l4 in append(ACode, new ListPair(new Functor1("breakBlock", Name), Atom.NIL), PseudoCode))
2081 {
2082 yield return true;
2083 yield break;
2084 }
2085 }
2086 }
2087 }
2088 {
2089 object _State = arg2;
2090 Variable x1 = new Variable();
2091 foreach (bool l2 in YP.unify(arg1, new Functor2(",", Atom.a("fail"), x1)))
2092 {
2093 foreach (bool l3 in YP.unify(arg3, Atom.NIL))
2094 {
2095 yield return true;
2096 yield break;
2097 }
2098 }
2099 }
2100 {
2101 object State = arg2;
2102 object PseudoCode = arg3;
2103 Variable A = new Variable();
2104 foreach (bool l2 in YP.unify(arg1, new Functor2(",", Atom.a("true"), A)))
2105 {
2106 foreach (bool l3 in compileRuleBody(A, State, PseudoCode))
2107 {
2108 yield return true;
2109 yield break;
2110 }
2111 }
2112 }
2113 {
2114 object State = arg2;
2115 Variable A = new Variable();
2116 Variable Term = new Variable();
2117 Variable B = new Variable();
2118 Variable ACode = new Variable();
2119 Variable TermCode = new Variable();
2120 Variable BCode = new Variable();
2121 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor2("is", A, Term), B)))
2122 {
2123 foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.unify"), new ListPair(ACode, new ListPair(TermCode, Atom.NIL))), BCode), Atom.NIL)))
2124 {
2125 foreach (bool l4 in compileTerm(A, State, ACode))
2126 {
2127 foreach (bool l5 in compileExpression(Term, State, TermCode))
2128 {
2129 foreach (bool l6 in compileRuleBody(B, State, BCode))
2130 {
2131 yield return true;
2132 yield break;
2133 }
2134 }
2135 }
2136 }
2137 }
2138 }
2139 {
2140 object State = arg2;
2141 Variable ACode = new Variable();
2142 Variable B = new Variable();
2143 Variable BCode = new Variable();
2144 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor1("$DET_NONE_OUT", ACode), B)))
2145 {
2146 foreach (bool l3 in YP.unify(arg3, new ListPair(ACode, BCode)))
2147 {
2148 foreach (bool l4 in compileRuleBody(B, State, BCode))
2149 {
2150 yield return true;
2151 yield break;
2152 }
2153 }
2154 }
2155 }
2156 {
2157 object State = arg2;
2158 Variable A = new Variable();
2159 Variable B = new Variable();
2160 Variable FunctionName = new Variable();
2161 Variable X1Code = new Variable();
2162 Variable X2Code = new Variable();
2163 Variable BCode = new Variable();
2164 Variable Name = new Variable();
2165 Variable X1 = new Variable();
2166 Variable X2 = new Variable();
2167 foreach (bool l2 in YP.unify(arg1, new Functor2(",", A, B)))
2168 {
2169 foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("if", new Functor2("call", FunctionName, new ListPair(X1Code, new ListPair(X2Code, Atom.NIL))), BCode), Atom.NIL)))
2170 {
2171 foreach (bool l4 in YP.univ(A, ListPair.make(new object[] { Name, X1, X2 })))
2172 {
2173 foreach (bool l5 in binaryExpressionConditional(Name, FunctionName))
2174 {
2175 foreach (bool l6 in compileExpression(X1, State, X1Code))
2176 {
2177 foreach (bool l7 in compileExpression(X2, State, X2Code))
2178 {
2179 foreach (bool l8 in compileRuleBody(B, State, BCode))
2180 {
2181 yield return true;
2182 yield break;
2183 }
2184 }
2185 }
2186 }
2187 }
2188 }
2189 }
2190 }
2191 {
2192 object State = arg2;
2193 object PseudoCode = arg3;
2194 Variable Template = new Variable();
2195 Variable Goal = new Variable();
2196 Variable Bag = new Variable();
2197 Variable B = new Variable();
2198 Variable TemplateCode = new Variable();
2199 Variable FindallAnswers = new Variable();
2200 Variable GoalAndAddCode = new Variable();
2201 Variable BagCode = new Variable();
2202 Variable BCode = new Variable();
2203 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor3("findall", Template, Goal, Bag), B)))
2204 {
2205 foreach (bool l3 in compileTerm(Template, State, TemplateCode))
2206 {
2207 foreach (bool l4 in CompilerState.gensym(State, Atom.a("findallAnswers"), FindallAnswers))
2208 {
2209 foreach (bool l5 in compileRuleBody(new Functor2(",", Goal, new Functor2(",", new Functor1("$DET_NONE_OUT", new Functor3("callMember", new Functor1("var", FindallAnswers), Atom.a("add"), Atom.NIL)), Atom.a("fail"))), State, GoalAndAddCode))
2210 {
2211 foreach (bool l6 in compileTerm(Bag, State, BagCode))
2212 {
2213 foreach (bool l7 in compileRuleBody(B, State, BCode))
2214 {
2215 foreach (bool l8 in append(new ListPair(new Functor3("declare", Atom.a("FindallAnswers"), FindallAnswers, new Functor2("new", Atom.a("FindallAnswers"), new ListPair(TemplateCode, Atom.NIL))), GoalAndAddCode), new ListPair(new Functor2("foreach", new Functor3("callMember", new Functor1("var", FindallAnswers), Atom.a("result"), new ListPair(BagCode, Atom.NIL)), BCode), Atom.NIL), PseudoCode))
2216 {
2217 yield return true;
2218 yield break;
2219 }
2220 }
2221 }
2222 }
2223 }
2224 }
2225 }
2226 }
2227 {
2228 object State = arg2;
2229 object PseudoCode = arg3;
2230 Variable Template = new Variable();
2231 Variable Goal = new Variable();
2232 Variable Bag = new Variable();
2233 Variable B = new Variable();
2234 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor3("bagof", Template, Goal, Bag), B)))
2235 {
2236 foreach (bool l3 in compileBagof(Atom.a("result"), Template, Goal, Bag, B, State, PseudoCode))
2237 {
2238 yield return true;
2239 yield break;
2240 }
2241 }
2242 }
2243 {
2244 object State = arg2;
2245 object PseudoCode = arg3;
2246 Variable Template = new Variable();
2247 Variable Goal = new Variable();
2248 Variable Bag = new Variable();
2249 Variable B = new Variable();
2250 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor3("setof", Template, Goal, Bag), B)))
2251 {
2252 foreach (bool l3 in compileBagof(Atom.a("resultSet"), Template, Goal, Bag, B, State, PseudoCode))
2253 {
2254 yield return true;
2255 yield break;
2256 }
2257 }
2258 }
2259 {
2260 object State = arg2;
2261 Variable A = new Variable();
2262 Variable B = new Variable();
2263 Variable ATermCode = new Variable();
2264 Variable BCode = new Variable();
2265 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor1("call", A), B)))
2266 {
2267 foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.getIterator"), new ListPair(ATermCode, new ListPair(new Functor2("call", Atom.a("getDeclaringClass"), Atom.NIL), Atom.NIL))), BCode), Atom.NIL)))
2268 {
2269 foreach (bool l4 in compileTerm(A, State, ATermCode))
2270 {
2271 foreach (bool l5 in compileRuleBody(B, State, BCode))
2272 {
2273 yield return true;
2274 yield break;
2275 }
2276 }
2277 }
2278 }
2279 }
2280 {
2281 object State = arg2;
2282 Variable A = new Variable();
2283 Variable B = new Variable();
2284 Variable ATermCode = new Variable();
2285 Variable BCode = new Variable();
2286 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor1("current_predicate", A), B)))
2287 {
2288 foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.current_predicate"), new ListPair(ATermCode, new ListPair(new Functor2("call", Atom.a("getDeclaringClass"), Atom.NIL), Atom.NIL))), BCode), Atom.NIL)))
2289 {
2290 foreach (bool l4 in compileTerm(A, State, ATermCode))
2291 {
2292 foreach (bool l5 in compileRuleBody(B, State, BCode))
2293 {
2294 yield return true;
2295 yield break;
2296 }
2297 }
2298 }
2299 }
2300 }
2301 {
2302 object State = arg2;
2303 Variable A = new Variable();
2304 Variable B = new Variable();
2305 Variable ATermCode = new Variable();
2306 Variable BCode = new Variable();
2307 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor1("asserta", A), B)))
2308 {
2309 foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("call", Atom.a("YP.asserta"), new ListPair(ATermCode, new ListPair(new Functor2("call", Atom.a("getDeclaringClass"), Atom.NIL), Atom.NIL))), BCode)))
2310 {
2311 foreach (bool l4 in compileTerm(A, State, ATermCode))
2312 {
2313 foreach (bool l5 in compileRuleBody(B, State, BCode))
2314 {
2315 yield return true;
2316 yield break;
2317 }
2318 }
2319 }
2320 }
2321 }
2322 {
2323 object State = arg2;
2324 Variable A = new Variable();
2325 Variable B = new Variable();
2326 Variable ATermCode = new Variable();
2327 Variable BCode = new Variable();
2328 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor1("assertz", A), B)))
2329 {
2330 foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("call", Atom.a("YP.assertz"), new ListPair(ATermCode, new ListPair(new Functor2("call", Atom.a("getDeclaringClass"), Atom.NIL), Atom.NIL))), BCode)))
2331 {
2332 foreach (bool l4 in compileTerm(A, State, ATermCode))
2333 {
2334 foreach (bool l5 in compileRuleBody(B, State, BCode))
2335 {
2336 yield return true;
2337 yield break;
2338 }
2339 }
2340 }
2341 }
2342 }
2343 {
2344 object State = arg2;
2345 object PseudoCode = arg3;
2346 Variable A = new Variable();
2347 Variable B = new Variable();
2348 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor1("assert", A), B)))
2349 {
2350 foreach (bool l3 in compileRuleBody(new Functor2(",", new Functor1("assertz", A), B), State, PseudoCode))
2351 {
2352 yield return true;
2353 yield break;
2354 }
2355 }
2356 }
2357 {
2358 object State = arg2;
2359 Variable Goal = new Variable();
2360 Variable Catcher = new Variable();
2361 Variable Handler = new Variable();
2362 Variable B = new Variable();
2363 Variable CatchGoal = new Variable();
2364 Variable GoalTermCode = new Variable();
2365 Variable BCode = new Variable();
2366 Variable CatcherTermCode = new Variable();
2367 Variable HandlerAndBCode = new Variable();
2368 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor3("catch", Goal, Catcher, Handler), B)))
2369 {
2370 foreach (bool l3 in YP.unify(arg3, ListPair.make(new object[] { new Functor3("declare", Atom.a("YP.Catch"), CatchGoal, new Functor2("new", Atom.a("YP.Catch"), new ListPair(GoalTermCode, new ListPair(new Functor2("call", Atom.a("getDeclaringClass"), Atom.NIL), Atom.NIL)))), new Functor2("foreach", new Functor1("var", CatchGoal), BCode), new Functor2("foreach", new Functor3("callMember", new Functor1("var", CatchGoal), Atom.a("unifyExceptionOrThrow"), new ListPair(CatcherTermCode, Atom.NIL)), HandlerAndBCode) })))
2371 {
2372 foreach (bool l4 in CompilerState.gensym(State, Atom.a("catchGoal"), CatchGoal))
2373 {
2374 foreach (bool l5 in compileTerm(Goal, State, GoalTermCode))
2375 {
2376 foreach (bool l6 in compileTerm(Catcher, State, CatcherTermCode))
2377 {
2378 foreach (bool l7 in compileRuleBody(B, State, BCode))
2379 {
2380 foreach (bool l8 in compileRuleBody(new Functor2(",", Handler, B), State, HandlerAndBCode))
2381 {
2382 yield return true;
2383 yield break;
2384 }
2385 }
2386 }
2387 }
2388 }
2389 }
2390 }
2391 }
2392 {
2393 object State = arg2;
2394 object PseudoCode = arg3;
2395 Variable A = new Variable();
2396 Variable B = new Variable();
2397 Variable C = new Variable();
2398 foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor2(",", A, B), C)))
2399 {
2400 foreach (bool l3 in compileRuleBody(new Functor2(",", A, new Functor2(",", B, C)), State, PseudoCode))
2401 {
2402 yield return true;
2403 yield break;
2404 }
2405 }
2406 }
2407 {
2408 object State = arg2;
2409 object PseudoCode = arg3;
2410 Variable A = new Variable();
2411 Variable B = new Variable();
2412 foreach (bool l2 in YP.unify(arg1, new Functor2(";", A, B)))
2413 {
2414 if (YP.var(A))
2415 {
2416 foreach (bool l4 in compileRuleBody(new Functor2(";", new Functor1("call", A), B), State, PseudoCode))
2417 {
2418 yield return true;
2419 yield break;
2420 }
2421 }
2422 }
2423 }
2424 {
2425 object State = arg2;
2426 Variable A = new Variable();
2427 Variable T = new Variable();
2428 Variable B = new Variable();
2429 Variable CutIfLabel = new Variable();
2430 Variable Code = new Variable();
2431 foreach (bool l2 in YP.unify(arg1, new Functor2(";", new Functor2("->", A, T), B)))
2432 {
2433 foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("breakableBlock", CutIfLabel, Code), Atom.NIL)))
2434 {
2435 foreach (bool l4 in CompilerState.gensym(State, Atom.a("cutIf"), CutIfLabel))
2436 {
2437 foreach (bool l5 in compileRuleBody(new Functor2(";", new Functor2(",", A, new Functor2(",", new Functor1("$CUTIF", CutIfLabel), T)), B), State, Code))
2438 {
2439 yield return true;
2440 yield break;
2441 }
2442 }
2443 }
2444 }
2445 }
2446 {
2447 object State = arg2;
2448 object PseudoCode = arg3;
2449 Variable _B = new Variable();
2450 foreach (bool l2 in YP.unify(arg1, new Functor2(";", Atom.a("!"), _B)))
2451 {
2452 foreach (bool l3 in compileRuleBody(Atom.a("!"), State, PseudoCode))
2453 {
2454 yield return true;
2455 yield break;
2456 }
2457 }
2458 }
2459 {
2460 object State = arg2;
2461 object PseudoCode = arg3;
2462 Variable A = new Variable();
2463 Variable B = new Variable();
2464 Variable ACode = new Variable();
2465 Variable BCode = new Variable();
2466 foreach (bool l2 in YP.unify(arg1, new Functor2(";", A, B)))
2467 {
2468 foreach (bool l3 in compileRuleBody(A, State, ACode))
2469 {
2470 foreach (bool l4 in compileRuleBody(B, State, BCode))
2471 {
2472 foreach (bool l5 in append(ACode, BCode, PseudoCode))
2473 {
2474 yield return true;
2475 yield break;
2476 }
2477 }
2478 }
2479 }
2480 }
2481 {
2482 object State = arg2;
2483 foreach (bool l2 in YP.unify(arg1, Atom.a("!")))
2484 {
2485 foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a("return"), Atom.NIL)))
2486 {
2487 if (CompilerState.determinismEquals(State, Atom.a("detNoneOut")))
2488 {
2489 yield return true;
2490 yield break;
2491 }
2492 }
2493 }
2494 }
2495 {
2496 object State = arg2;
2497 foreach (bool l2 in YP.unify(arg1, Atom.a("!")))
2498 {
2499 foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a("returntrue"), Atom.NIL)))
2500 {
2501 if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut")))
2502 {
2503 yield return true;
2504 yield break;
2505 }
2506 }
2507 }
2508 }
2509 {
2510 object State = arg2;
2511 foreach (bool l2 in YP.unify(arg1, Atom.a("!")))
2512 {
2513 foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a("yieldtrue"), new ListPair(Atom.a("yieldbreak"), Atom.NIL))))
2514 {
2515 CompilerState.setCodeUsesYield(State);
2516 yield return true;
2517 yield break;
2518 }
2519 }
2520 }
2521 {
2522 object _State = arg2;
2523 Variable Name = new Variable();
2524 foreach (bool l2 in YP.unify(arg1, new Functor1("$CUTIF", Name)))
2525 {
2526 foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor1("breakBlock", Name), Atom.NIL)))
2527 {
2528 yield return true;
2529 yield break;
2530 }
2531 }
2532 }
2533 {
2534 object State = arg2;
2535 foreach (bool l2 in YP.unify(arg1, Atom.a("true")))
2536 {
2537 foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a("return"), Atom.NIL)))
2538 {
2539 if (CompilerState.determinismEquals(State, Atom.a("detNoneOut")))
2540 {
2541 yield return true;
2542 yield break;
2543 }
2544 }
2545 }
2546 }
2547 {
2548 object State = arg2;
2549 foreach (bool l2 in YP.unify(arg1, Atom.a("true")))
2550 {
2551 foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a("returntrue"), Atom.NIL)))
2552 {
2553 if (CompilerState.determinismEquals(State, Atom.a("semidetNoneOut")))
2554 {
2555 yield return true;
2556 yield break;
2557 }
2558 }
2559 }
2560 }
2561 {
2562 object State = arg2;
2563 foreach (bool l2 in YP.unify(arg1, Atom.a("true")))
2564 {
2565 foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a("yieldfalse"), Atom.NIL)))
2566 {
2567 CompilerState.setCodeUsesYield(State);
2568 yield return true;
2569 yield break;
2570 }
2571 }
2572 }
2573 {
2574 object A = arg1;
2575 object State = arg2;
2576 object PseudoCode = arg3;
2577 foreach (bool l2 in compileRuleBody(new Functor2(",", A, Atom.a("true")), State, PseudoCode))
2578 {
2579 yield return true;
2580 yield break;
2581 }
2582 }
2583 }
2584
2585 public static IEnumerable<bool> compileBagof(object ResultMethod, object Template, object Goal, object Bag, object B, object State, object PseudoCode)
2586 {
2587 {
2588 Variable TemplateCode = new Variable();
2589 Variable GoalTermCode = new Variable();
2590 Variable UnqualifiedGoal = new Variable();
2591 Variable BagofAnswers = new Variable();
2592 Variable GoalAndAddCode = new Variable();
2593 Variable BagCode = new Variable();
2594 Variable BCode = new Variable();
2595 foreach (bool l2 in compileTerm(Template, State, TemplateCode))
2596 {
2597 foreach (bool l3 in compileTerm(Goal, State, GoalTermCode))
2598 {
2599 foreach (bool l4 in unqualifiedGoal(Goal, UnqualifiedGoal))
2600 {
2601 foreach (bool l5 in CompilerState.gensym(State, Atom.a("bagofAnswers"), BagofAnswers))
2602 {
2603 foreach (bool l6 in compileRuleBody(new Functor2(",", UnqualifiedGoal, new Functor2(",", new Functor1("$DET_NONE_OUT", new Functor3("callMember", new Functor1("var", BagofAnswers), Atom.a("add"), Atom.NIL)), Atom.a("fail"))), State, GoalAndAddCode))
2604 {
2605 foreach (bool l7 in compileTerm(Bag, State, BagCode))
2606 {
2607 foreach (bool l8 in compileRuleBody(B, State, BCode))
2608 {
2609 foreach (bool l9 in append(new ListPair(new Functor3("declare", Atom.a("BagofAnswers"), BagofAnswers, new Functor2("new", Atom.a("BagofAnswers"), new ListPair(TemplateCode, new ListPair(GoalTermCode, Atom.NIL)))), GoalAndAddCode), new ListPair(new Functor2("foreach", new Functor3("callMember", new Functor1("var", BagofAnswers), ResultMethod, new ListPair(BagCode, Atom.NIL)), BCode), Atom.NIL), PseudoCode))
2610 {
2611 yield return true;
2612 yield break;
2613 }
2614 }
2615 }
2616 }
2617 }
2618 }
2619 }
2620 }
2621 }
2622 }
2623
2624 public static IEnumerable<bool> unqualifiedGoal(object arg1, object arg2)
2625 {
2626 {
2627 object Goal = arg1;
2628 foreach (bool l2 in YP.unify(arg2, new Functor1("call", Goal)))
2629 {
2630 if (YP.var(Goal))
2631 {
2632 yield return true;
2633 yield break;
2634 }
2635 }
2636 }
2637 {
2638 object UnqualifiedGoal = arg2;
2639 Variable x1 = new Variable();
2640 Variable Goal = new Variable();
2641 foreach (bool l2 in YP.unify(arg1, new Functor2("^", x1, Goal)))
2642 {
2643 foreach (bool l3 in unqualifiedGoal(Goal, UnqualifiedGoal))
2644 {
2645 yield return true;
2646 yield break;
2647 }
2648 }
2649 }
2650 {
2651 Variable UnqualifiedGoal = new Variable();
2652 foreach (bool l2 in YP.unify(arg1, UnqualifiedGoal))
2653 {
2654 foreach (bool l3 in YP.unify(arg2, UnqualifiedGoal))
2655 {
2656 yield return true;
2657 yield break;
2658 }
2659 }
2660 }
2661 }
2662
2663 public static IEnumerable<bool> binaryExpressionConditional(object arg1, object arg2)
2664 {
2665 {
2666 foreach (bool l2 in YP.unify(arg1, Atom.a("=:=")))
2667 {
2668 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.equal")))
2669 {
2670 yield return true;
2671 yield break;
2672 }
2673 }
2674 }
2675 {
2676 foreach (bool l2 in YP.unify(arg1, Atom.a("=\\=")))
2677 {
2678 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.notEqual")))
2679 {
2680 yield return true;
2681 yield break;
2682 }
2683 }
2684 }
2685 {
2686 foreach (bool l2 in YP.unify(arg1, Atom.a(">")))
2687 {
2688 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.greaterThan")))
2689 {
2690 yield return true;
2691 yield break;
2692 }
2693 }
2694 }
2695 {
2696 foreach (bool l2 in YP.unify(arg1, Atom.a("<")))
2697 {
2698 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.lessThan")))
2699 {
2700 yield return true;
2701 yield break;
2702 }
2703 }
2704 }
2705 {
2706 foreach (bool l2 in YP.unify(arg1, Atom.a(">=")))
2707 {
2708 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.greaterThanOrEqual")))
2709 {
2710 yield return true;
2711 yield break;
2712 }
2713 }
2714 }
2715 {
2716 foreach (bool l2 in YP.unify(arg1, Atom.a("=<")))
2717 {
2718 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.lessThanOrEqual")))
2719 {
2720 yield return true;
2721 yield break;
2722 }
2723 }
2724 }
2725 }
2726
2727 public static IEnumerable<bool> compileFunctorCall(object Functor_1, object State, object PseudoCode)
2728 {
2729 {
2730 Variable FunctorName = new Variable();
2731 Variable FunctorArgs = new Variable();
2732 Variable x6 = new Variable();
2733 Variable Arity = new Variable();
2734 Variable FunctionName = new Variable();
2735 Variable CompiledArgs = new Variable();
2736 foreach (bool l2 in YP.univ(Functor_1, new ListPair(FunctorName, FunctorArgs)))
2737 {
2738 foreach (bool l3 in YP.functor(Functor_1, x6, Arity))
2739 {
2740 foreach (bool l4 in functorCallFunctionName(State, FunctorName, Arity, FunctionName))
2741 {
2742 foreach (bool l5 in maplist_compileTerm(FunctorArgs, State, CompiledArgs))
2743 {
2744 if (YP.termEqual(FunctionName, Atom.NIL))
2745 {
2746 foreach (bool l7 in YP.unify(PseudoCode, new Functor2("call", Atom.a("YP.matchDynamic"), new ListPair(new Functor2("call", Atom.a("Atom.a"), new ListPair(new Functor1("object", FunctorName), Atom.NIL)), new ListPair(new Functor1("objectArray", CompiledArgs), Atom.NIL)))))
2747 {
2748 yield return true;
2749 yield break;
2750 }
2751 goto cutIf1;
2752 }
2753 foreach (bool l6 in YP.unify(PseudoCode, new Functor3("functorCall", FunctionName, FunctorArgs, CompiledArgs)))
2754 {
2755 yield return true;
2756 yield break;
2757 }
2758 cutIf1:
2759 { }
2760 }
2761 }
2762 }
2763 }
2764 }
2765 }
2766
2767 public static IEnumerable<bool> functorCallFunctionName(object arg1, object arg2, object arg3, object arg4)
2768 {
2769 {
2770 object _State = arg1;
2771 object Name = arg2;
2772 object Arity = arg3;
2773 object x4 = arg4;
2774 if (functorCallIsSpecialForm(Name, Arity))
2775 {
2776 yield break;
2777 }
2778 }
2779 {
2780 object x1 = arg1;
2781 object Name = arg2;
2782 object Arity = arg3;
2783 object FunctionName = arg4;
2784 foreach (bool l2 in functorCallYPFunctionName(Name, Arity, FunctionName))
2785 {
2786 yield return true;
2787 yield break;
2788 }
2789 }
2790 {
2791 object State = arg1;
2792 object Arity = arg3;
2793 Variable Name = new Variable();
2794 foreach (bool l2 in YP.unify(arg2, Name))
2795 {
2796 foreach (bool l3 in YP.unify(arg4, Name))
2797 {
2798 if (CompilerState.nameArityHasModule(State, Name, Arity, Atom.a("")))
2799 {
2800 yield return true;
2801 yield break;
2802 }
2803 }
2804 }
2805 }
2806 {
2807 object _State = arg1;
2808 object _Arity = arg3;
2809 Variable Name = new Variable();
2810 foreach (bool l2 in YP.unify(arg2, Name))
2811 {
2812 foreach (bool l3 in YP.unify(arg4, Name))
2813 {
2814 foreach (bool l4 in Atom.module(Name, Atom.a("")))
2815 {
2816 yield return true;
2817 yield break;
2818 }
2819 }
2820 }
2821 }
2822 {
2823 object _State = arg1;
2824 object Name = arg2;
2825 object _Arity = arg3;
2826 foreach (bool l2 in YP.unify(arg4, Atom.NIL))
2827 {
2828 foreach (bool l3 in Atom.module(Name, Atom.NIL))
2829 {
2830 yield return true;
2831 yield break;
2832 }
2833 }
2834 }
2835 {
2836 object _State = arg1;
2837 object Name = arg2;
2838 object Arity = arg3;
2839 object x4 = arg4;
2840 Variable Module = new Variable();
2841 Variable Message = new Variable();
2842 foreach (bool l2 in Atom.module(Name, Module))
2843 {
2844 foreach (bool l3 in YP.atom_concat(Atom.a("Not supporting calls to external module: "), Module, Message))
2845 {
2846 YP.throwException(new Functor2("error", new Functor2("type_error", Atom.a("callable"), new Functor2("/", Name, Arity)), Message));
2847 yield return true;
2848 yield break;
2849 }
2850 }
2851 }
2852 {
2853 object _State = arg1;
2854 object Name = arg2;
2855 object _Arity = arg3;
2856 object x4 = arg4;
2857 YP.throwException(new Functor2("error", new Functor2("type_error", Atom.a("callable"), Name), Atom.a("Term is not callable")));
2858 yield return true;
2859 yield break;
2860 }
2861 }
2862
2863 public static bool functorCallIsSpecialForm(object Name, object Arity)
2864 {
2865 {
2866 Variable x3 = new Variable();
2867 if (YP.termEqual(Arity, 0))
2868 {
2869 if (YP.termEqual(Name, Atom.a("!")))
2870 {
2871 return true;
2872 }
2873 if (YP.termEqual(Name, Atom.a("fail")))
2874 {
2875 return true;
2876 }
2877 if (YP.termEqual(Name, Atom.a("true")))
2878 {
2879 return true;
2880 }
2881 }
2882 if (YP.termEqual(Arity, 1))
2883 {
2884 if (YP.termEqual(Name, Atom.a("\\+")))
2885 {
2886 return true;
2887 }
2888 if (YP.termEqual(Name, Atom.a("once")))
2889 {
2890 return true;
2891 }
2892 if (YP.termEqual(Name, Atom.a("$CUTIF")))
2893 {
2894 return true;
2895 }
2896 if (YP.termEqual(Name, Atom.a("$DET_NONE_OUT")))
2897 {
2898 return true;
2899 }
2900 if (YP.termEqual(Name, Atom.a("call")))
2901 {
2902 return true;
2903 }
2904 if (YP.termEqual(Name, Atom.a("current_predicate")))
2905 {
2906 return true;
2907 }
2908 if (YP.termEqual(Name, Atom.a("asserta")))
2909 {
2910 return true;
2911 }
2912 if (YP.termEqual(Name, Atom.a("assertz")))
2913 {
2914 return true;
2915 }
2916 if (YP.termEqual(Name, Atom.a("assert")))
2917 {
2918 return true;
2919 }
2920 }
2921 if (YP.termEqual(Arity, 2))
2922 {
2923 if (YP.termEqual(Name, Atom.a(";")))
2924 {
2925 return true;
2926 }
2927 if (YP.termEqual(Name, Atom.a(",")))
2928 {
2929 return true;
2930 }
2931 if (YP.termEqual(Name, Atom.a("->")))
2932 {
2933 return true;
2934 }
2935 if (YP.termEqual(Name, Atom.a("\\=")))
2936 {
2937 return true;
2938 }
2939 if (YP.termEqual(Name, Atom.a("is")))
2940 {
2941 return true;
2942 }
2943 foreach (bool l3 in binaryExpressionConditional(Name, x3))
2944 {
2945 return true;
2946 }
2947 }
2948 if (YP.termEqual(Arity, 3))
2949 {
2950 if (YP.termEqual(Name, Atom.a("findall")))
2951 {
2952 return true;
2953 }
2954 if (YP.termEqual(Name, Atom.a("bagof")))
2955 {
2956 return true;
2957 }
2958 if (YP.termEqual(Name, Atom.a("setof")))
2959 {
2960 return true;
2961 }
2962 if (YP.termEqual(Name, Atom.a("catch")))
2963 {
2964 return true;
2965 }
2966 }
2967 }
2968 return false;
2969 }
2970
2971 public static IEnumerable<bool> functorCallYPFunctionName(object arg1, object arg2, object arg3)
2972 {
2973 {
2974 foreach (bool l2 in YP.unify(arg1, Atom.a("=")))
2975 {
2976 foreach (bool l3 in YP.unify(arg2, 2))
2977 {
2978 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.unify")))
2979 {
2980 yield return true;
2981 yield break;
2982 }
2983 }
2984 }
2985 }
2986 {
2987 foreach (bool l2 in YP.unify(arg1, Atom.a("=..")))
2988 {
2989 foreach (bool l3 in YP.unify(arg2, 2))
2990 {
2991 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.univ")))
2992 {
2993 yield return true;
2994 yield break;
2995 }
2996 }
2997 }
2998 }
2999 {
3000 foreach (bool l2 in YP.unify(arg1, Atom.a("var")))
3001 {
3002 foreach (bool l3 in YP.unify(arg2, 1))
3003 {
3004 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.var")))
3005 {
3006 yield return true;
3007 yield break;
3008 }
3009 }
3010 }
3011 }
3012 {
3013 foreach (bool l2 in YP.unify(arg1, Atom.a("nonvar")))
3014 {
3015 foreach (bool l3 in YP.unify(arg2, 1))
3016 {
3017 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.nonvar")))
3018 {
3019 yield return true;
3020 yield break;
3021 }
3022 }
3023 }
3024 }
3025 {
3026 foreach (bool l2 in YP.unify(arg1, Atom.a("arg")))
3027 {
3028 foreach (bool l3 in YP.unify(arg2, 3))
3029 {
3030 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.arg")))
3031 {
3032 yield return true;
3033 yield break;
3034 }
3035 }
3036 }
3037 }
3038 {
3039 foreach (bool l2 in YP.unify(arg1, Atom.a("functor")))
3040 {
3041 foreach (bool l3 in YP.unify(arg2, 3))
3042 {
3043 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.functor")))
3044 {
3045 yield return true;
3046 yield break;
3047 }
3048 }
3049 }
3050 }
3051 {
3052 foreach (bool l2 in YP.unify(arg1, Atom.a("repeat")))
3053 {
3054 foreach (bool l3 in YP.unify(arg2, 0))
3055 {
3056 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.repeat")))
3057 {
3058 yield return true;
3059 yield break;
3060 }
3061 }
3062 }
3063 }
3064 {
3065 foreach (bool l2 in YP.unify(arg1, Atom.a("get_code")))
3066 {
3067 foreach (bool l3 in YP.unify(arg2, 1))
3068 {
3069 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.get_code")))
3070 {
3071 yield return true;
3072 yield break;
3073 }
3074 }
3075 }
3076 }
3077 {
3078 foreach (bool l2 in YP.unify(arg1, Atom.a("current_op")))
3079 {
3080 foreach (bool l3 in YP.unify(arg2, 3))
3081 {
3082 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.current_op")))
3083 {
3084 yield return true;
3085 yield break;
3086 }
3087 }
3088 }
3089 }
3090 {
3091 foreach (bool l2 in YP.unify(arg1, Atom.a("atom_length")))
3092 {
3093 foreach (bool l3 in YP.unify(arg2, 2))
3094 {
3095 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.atom_length")))
3096 {
3097 yield return true;
3098 yield break;
3099 }
3100 }
3101 }
3102 }
3103 {
3104 foreach (bool l2 in YP.unify(arg1, Atom.a("atom_concat")))
3105 {
3106 foreach (bool l3 in YP.unify(arg2, 3))
3107 {
3108 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.atom_concat")))
3109 {
3110 yield return true;
3111 yield break;
3112 }
3113 }
3114 }
3115 }
3116 {
3117 foreach (bool l2 in YP.unify(arg1, Atom.a("sub_atom")))
3118 {
3119 foreach (bool l3 in YP.unify(arg2, 5))
3120 {
3121 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.sub_atom")))
3122 {
3123 yield return true;
3124 yield break;
3125 }
3126 }
3127 }
3128 }
3129 {
3130 foreach (bool l2 in YP.unify(arg1, Atom.a("atom_chars")))
3131 {
3132 foreach (bool l3 in YP.unify(arg2, 2))
3133 {
3134 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.atom_chars")))
3135 {
3136 yield return true;
3137 yield break;
3138 }
3139 }
3140 }
3141 }
3142 {
3143 foreach (bool l2 in YP.unify(arg1, Atom.a("atom_codes")))
3144 {
3145 foreach (bool l3 in YP.unify(arg2, 2))
3146 {
3147 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.atom_codes")))
3148 {
3149 yield return true;
3150 yield break;
3151 }
3152 }
3153 }
3154 }
3155 {
3156 foreach (bool l2 in YP.unify(arg1, Atom.a("char_code")))
3157 {
3158 foreach (bool l3 in YP.unify(arg2, 2))
3159 {
3160 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.char_code")))
3161 {
3162 yield return true;
3163 yield break;
3164 }
3165 }
3166 }
3167 }
3168 {
3169 foreach (bool l2 in YP.unify(arg1, Atom.a("number_chars")))
3170 {
3171 foreach (bool l3 in YP.unify(arg2, 2))
3172 {
3173 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.number_chars")))
3174 {
3175 yield return true;
3176 yield break;
3177 }
3178 }
3179 }
3180 }
3181 {
3182 foreach (bool l2 in YP.unify(arg1, Atom.a("number_codes")))
3183 {
3184 foreach (bool l3 in YP.unify(arg2, 2))
3185 {
3186 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.number_codes")))
3187 {
3188 yield return true;
3189 yield break;
3190 }
3191 }
3192 }
3193 }
3194 {
3195 foreach (bool l2 in YP.unify(arg1, Atom.a("copy_term")))
3196 {
3197 foreach (bool l3 in YP.unify(arg2, 2))
3198 {
3199 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.copy_term")))
3200 {
3201 yield return true;
3202 yield break;
3203 }
3204 }
3205 }
3206 }
3207 {
3208 foreach (bool l2 in YP.unify(arg1, Atom.a("sort")))
3209 {
3210 foreach (bool l3 in YP.unify(arg2, 2))
3211 {
3212 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.sort")))
3213 {
3214 yield return true;
3215 yield break;
3216 }
3217 }
3218 }
3219 }
3220 {
3221 // Manually included : script_event for callback to LSL/C#
3222
3223 //object x1 = arg1;
3224 foreach (bool l2 in YP.unify(arg1, Atom.a(@"script_event")))
3225 {
3226 foreach (bool l3 in YP.unify(arg2, 2))
3227 {
3228 foreach (bool l4 in YP.unify(arg3, Atom.a(@"YP.script_event")))
3229 {
3230 yield return true;
3231 yield break;
3232 }
3233 }
3234 }
3235 }
3236 {
3237 foreach (bool l2 in YP.unify(arg1, Atom.a("nl")))
3238 {
3239 foreach (bool l3 in YP.unify(arg2, 0))
3240 {
3241 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.nl")))
3242 {
3243 yield return true;
3244 yield break;
3245 }
3246 }
3247 }
3248 }
3249 {
3250 foreach (bool l2 in YP.unify(arg1, Atom.a("write")))
3251 {
3252 foreach (bool l3 in YP.unify(arg2, 1))
3253 {
3254 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.write")))
3255 {
3256 yield return true;
3257 yield break;
3258 }
3259 }
3260 }
3261 }
3262 {
3263 foreach (bool l2 in YP.unify(arg1, Atom.a("put_code")))
3264 {
3265 foreach (bool l3 in YP.unify(arg2, 1))
3266 {
3267 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.put_code")))
3268 {
3269 yield return true;
3270 yield break;
3271 }
3272 }
3273 }
3274 }
3275 {
3276 foreach (bool l2 in YP.unify(arg1, Atom.a("see")))
3277 {
3278 foreach (bool l3 in YP.unify(arg2, 1))
3279 {
3280 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.see")))
3281 {
3282 yield return true;
3283 yield break;
3284 }
3285 }
3286 }
3287 }
3288 {
3289 foreach (bool l2 in YP.unify(arg1, Atom.a("seen")))
3290 {
3291 foreach (bool l3 in YP.unify(arg2, 0))
3292 {
3293 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.seen")))
3294 {
3295 yield return true;
3296 yield break;
3297 }
3298 }
3299 }
3300 }
3301 {
3302 foreach (bool l2 in YP.unify(arg1, Atom.a("tell")))
3303 {
3304 foreach (bool l3 in YP.unify(arg2, 1))
3305 {
3306 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.tell")))
3307 {
3308 yield return true;
3309 yield break;
3310 }
3311 }
3312 }
3313 }
3314 {
3315 foreach (bool l2 in YP.unify(arg1, Atom.a("told")))
3316 {
3317 foreach (bool l3 in YP.unify(arg2, 0))
3318 {
3319 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.told")))
3320 {
3321 yield return true;
3322 yield break;
3323 }
3324 }
3325 }
3326 }
3327 {
3328 foreach (bool l2 in YP.unify(arg1, Atom.a("clause")))
3329 {
3330 foreach (bool l3 in YP.unify(arg2, 2))
3331 {
3332 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.clause")))
3333 {
3334 yield return true;
3335 yield break;
3336 }
3337 }
3338 }
3339 }
3340 {
3341 foreach (bool l2 in YP.unify(arg1, Atom.a("retract")))
3342 {
3343 foreach (bool l3 in YP.unify(arg2, 1))
3344 {
3345 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.retract")))
3346 {
3347 yield return true;
3348 yield break;
3349 }
3350 }
3351 }
3352 }
3353 {
3354 foreach (bool l2 in YP.unify(arg1, Atom.a("abolish")))
3355 {
3356 foreach (bool l3 in YP.unify(arg2, 1))
3357 {
3358 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.abolish")))
3359 {
3360 yield return true;
3361 yield break;
3362 }
3363 }
3364 }
3365 }
3366 {
3367 foreach (bool l2 in YP.unify(arg1, Atom.a("retractall")))
3368 {
3369 foreach (bool l3 in YP.unify(arg2, 1))
3370 {
3371 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.retractall")))
3372 {
3373 yield return true;
3374 yield break;
3375 }
3376 }
3377 }
3378 }
3379 {
3380 foreach (bool l2 in YP.unify(arg1, Atom.a("atom")))
3381 {
3382 foreach (bool l3 in YP.unify(arg2, 1))
3383 {
3384 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.atom")))
3385 {
3386 yield return true;
3387 yield break;
3388 }
3389 }
3390 }
3391 }
3392 {
3393 foreach (bool l2 in YP.unify(arg1, Atom.a("integer")))
3394 {
3395 foreach (bool l3 in YP.unify(arg2, 1))
3396 {
3397 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.integer")))
3398 {
3399 yield return true;
3400 yield break;
3401 }
3402 }
3403 }
3404 }
3405 {
3406 foreach (bool l2 in YP.unify(arg1, Atom.a("float")))
3407 {
3408 foreach (bool l3 in YP.unify(arg2, 1))
3409 {
3410 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.isFloat")))
3411 {
3412 yield return true;
3413 yield break;
3414 }
3415 }
3416 }
3417 }
3418 {
3419 foreach (bool l2 in YP.unify(arg1, Atom.a("number")))
3420 {
3421 foreach (bool l3 in YP.unify(arg2, 1))
3422 {
3423 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.number")))
3424 {
3425 yield return true;
3426 yield break;
3427 }
3428 }
3429 }
3430 }
3431 {
3432 foreach (bool l2 in YP.unify(arg1, Atom.a("atomic")))
3433 {
3434 foreach (bool l3 in YP.unify(arg2, 1))
3435 {
3436 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.atomic")))
3437 {
3438 yield return true;
3439 yield break;
3440 }
3441 }
3442 }
3443 }
3444 {
3445 foreach (bool l2 in YP.unify(arg1, Atom.a("compound")))
3446 {
3447 foreach (bool l3 in YP.unify(arg2, 1))
3448 {
3449 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.compound")))
3450 {
3451 yield return true;
3452 yield break;
3453 }
3454 }
3455 }
3456 }
3457 {
3458 foreach (bool l2 in YP.unify(arg1, Atom.a("==")))
3459 {
3460 foreach (bool l3 in YP.unify(arg2, 2))
3461 {
3462 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.termEqual")))
3463 {
3464 yield return true;
3465 yield break;
3466 }
3467 }
3468 }
3469 }
3470 {
3471 foreach (bool l2 in YP.unify(arg1, Atom.a("\\==")))
3472 {
3473 foreach (bool l3 in YP.unify(arg2, 2))
3474 {
3475 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.termNotEqual")))
3476 {
3477 yield return true;
3478 yield break;
3479 }
3480 }
3481 }
3482 }
3483 {
3484 foreach (bool l2 in YP.unify(arg1, Atom.a("@<")))
3485 {
3486 foreach (bool l3 in YP.unify(arg2, 2))
3487 {
3488 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.termLessThan")))
3489 {
3490 yield return true;
3491 yield break;
3492 }
3493 }
3494 }
3495 }
3496 {
3497 foreach (bool l2 in YP.unify(arg1, Atom.a("@=<")))
3498 {
3499 foreach (bool l3 in YP.unify(arg2, 2))
3500 {
3501 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.termLessThanOrEqual")))
3502 {
3503 yield return true;
3504 yield break;
3505 }
3506 }
3507 }
3508 }
3509 {
3510 foreach (bool l2 in YP.unify(arg1, Atom.a("@>")))
3511 {
3512 foreach (bool l3 in YP.unify(arg2, 2))
3513 {
3514 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.termGreaterThan")))
3515 {
3516 yield return true;
3517 yield break;
3518 }
3519 }
3520 }
3521 }
3522 {
3523 foreach (bool l2 in YP.unify(arg1, Atom.a("@>=")))
3524 {
3525 foreach (bool l3 in YP.unify(arg2, 2))
3526 {
3527 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.termGreaterThanOrEqual")))
3528 {
3529 yield return true;
3530 yield break;
3531 }
3532 }
3533 }
3534 }
3535 {
3536 foreach (bool l2 in YP.unify(arg1, Atom.a("throw")))
3537 {
3538 foreach (bool l3 in YP.unify(arg2, 1))
3539 {
3540 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.throwException")))
3541 {
3542 yield return true;
3543 yield break;
3544 }
3545 }
3546 }
3547 }
3548 {
3549 foreach (bool l2 in YP.unify(arg1, Atom.a("current_prolog_flag")))
3550 {
3551 foreach (bool l3 in YP.unify(arg2, 2))
3552 {
3553 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.current_prolog_flag")))
3554 {
3555 yield return true;
3556 yield break;
3557 }
3558 }
3559 }
3560 }
3561 {
3562 foreach (bool l2 in YP.unify(arg1, Atom.a("set_prolog_flag")))
3563 {
3564 foreach (bool l3 in YP.unify(arg2, 2))
3565 {
3566 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.set_prolog_flag")))
3567 {
3568 yield return true;
3569 yield break;
3570 }
3571 }
3572 }
3573 }
3574 {
3575 foreach (bool l2 in YP.unify(arg1, Atom.a("current_input")))
3576 {
3577 foreach (bool l3 in YP.unify(arg2, 1))
3578 {
3579 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.current_input")))
3580 {
3581 yield return true;
3582 yield break;
3583 }
3584 }
3585 }
3586 }
3587 {
3588 foreach (bool l2 in YP.unify(arg1, Atom.a("current_output")))
3589 {
3590 foreach (bool l3 in YP.unify(arg2, 1))
3591 {
3592 foreach (bool l4 in YP.unify(arg3, Atom.a("YP.current_output")))
3593 {
3594 yield return true;
3595 yield break;
3596 }
3597 }
3598 }
3599 }
3600 {
3601 foreach (bool l2 in YP.unify(arg1, Atom.a("read_term")))
3602 {
3603 foreach (bool l3 in YP.unify(arg2, 2))
3604 {
3605 foreach (bool l4 in YP.unify(arg3, Atom.a("Parser.read_term2")))
3606 {
3607 yield return true;
3608 yield break;
3609 }
3610 }
3611 }
3612 }
3613 {
3614 foreach (bool l2 in YP.unify(arg1, Atom.a("read_term")))
3615 {
3616 foreach (bool l3 in YP.unify(arg2, 3))
3617 {
3618 foreach (bool l4 in YP.unify(arg3, Atom.a("Parser.read_term3")))
3619 {
3620 yield return true;
3621 yield break;
3622 }
3623 }
3624 }
3625 }
3626 {
3627 foreach (bool l2 in YP.unify(arg1, Atom.a("read")))
3628 {
3629 foreach (bool l3 in YP.unify(arg2, 1))
3630 {
3631 foreach (bool l4 in YP.unify(arg3, Atom.a("Parser.read1")))
3632 {
3633 yield return true;
3634 yield break;
3635 }
3636 }
3637 }
3638 }
3639 {
3640 foreach (bool l2 in YP.unify(arg1, Atom.a("read")))
3641 {
3642 foreach (bool l3 in YP.unify(arg2, 2))
3643 {
3644 foreach (bool l4 in YP.unify(arg3, Atom.a("Parser.read2")))
3645 {
3646 yield return true;
3647 yield break;
3648 }
3649 }
3650 }
3651 }
3652 }
3653
3654 public static IEnumerable<bool> compileTerm(object arg1, object arg2, object arg3)
3655 {
3656 {
3657 object Term = arg1;
3658 object State = arg2;
3659 Variable VariableName = new Variable();
3660 foreach (bool l2 in YP.unify(arg3, new Functor1("var", VariableName)))
3661 {
3662 if (YP.var(Term))
3663 {
3664 foreach (bool l4 in CompilerState.getVariableName(State, Term, VariableName))
3665 {
3666 yield return true;
3667 yield break;
3668 }
3669 }
3670 }
3671 }
3672 {
3673 object _State = arg2;
3674 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
3675 {
3676 foreach (bool l3 in YP.unify(arg3, new Functor1("var", Atom.a("Atom.NIL"))))
3677 {
3678 yield return true;
3679 yield break;
3680 }
3681 }
3682 }
3683 {
3684 object Term = arg1;
3685 object State = arg2;
3686 object Code = arg3;
3687 Variable ModuleCode = new Variable();
3688 if (YP.atom(Term))
3689 {
3690 foreach (bool l3 in compileAtomModule(Term, 0, State, ModuleCode))
3691 {
3692 foreach (bool l4 in YP.unify(Code, new Functor2("call", Atom.a("Atom.a"), new ListPair(new Functor1("object", Term), new ListPair(ModuleCode, Atom.NIL)))))
3693 {
3694 yield return true;
3695 yield break;
3696 }
3697 goto cutIf1;
3698 }
3699 foreach (bool l3 in YP.unify(Code, new Functor2("call", Atom.a("Atom.a"), new ListPair(new Functor1("object", Term), Atom.NIL))))
3700 {
3701 yield return true;
3702 yield break;
3703 }
3704 cutIf1:
3705 { }
3706 }
3707 }
3708 {
3709 object State = arg2;
3710 Variable First = new Variable();
3711 Variable Rest = new Variable();
3712 Variable CompiledList = new Variable();
3713 Variable x5 = new Variable();
3714 Variable Rest2 = new Variable();
3715 foreach (bool l2 in YP.unify(arg1, new ListPair(First, Rest)))
3716 {
3717 foreach (bool l3 in YP.unify(arg3, new Functor2("call", Atom.a("ListPair.make"), new ListPair(new Functor1("objectArray", CompiledList), Atom.NIL))))
3718 {
3719 if (YP.nonvar(Rest))
3720 {
3721 foreach (bool l5 in YP.unify(Rest, new ListPair(x5, Rest2)))
3722 {
3723 if (YP.termNotEqual(Rest2, Atom.NIL))
3724 {
3725 foreach (bool l7 in maplist_compileTerm(new ListPair(First, Rest), State, CompiledList))
3726 {
3727 yield return true;
3728 yield break;
3729 }
3730 }
3731 }
3732 }
3733 }
3734 }
3735 }
3736 {
3737 object State = arg2;
3738 Variable First = new Variable();
3739 Variable Rest = new Variable();
3740 Variable Arg1 = new Variable();
3741 Variable Arg2 = new Variable();
3742 foreach (bool l2 in YP.unify(arg1, new ListPair(First, Rest)))
3743 {
3744 foreach (bool l3 in YP.unify(arg3, new Functor2("new", Atom.a("ListPair"), new ListPair(Arg1, new ListPair(Arg2, Atom.NIL)))))
3745 {
3746 foreach (bool l4 in compileTerm(First, State, Arg1))
3747 {
3748 foreach (bool l5 in compileTerm(Rest, State, Arg2))
3749 {
3750 yield return true;
3751 yield break;
3752 }
3753 }
3754 }
3755 }
3756 }
3757 {
3758 object Term = arg1;
3759 object State = arg2;
3760 object Result = arg3;
3761 Variable Name = new Variable();
3762 Variable TermArgs = new Variable();
3763 Variable x6 = new Variable();
3764 Variable Arity = new Variable();
3765 Variable ModuleCode = new Variable();
3766 Variable NameCode = new Variable();
3767 Variable X1 = new Variable();
3768 Variable Arg1 = new Variable();
3769 Variable X2 = new Variable();
3770 Variable Arg2 = new Variable();
3771 Variable X3 = new Variable();
3772 Variable Arg3 = new Variable();
3773 Variable Args = new Variable();
3774 foreach (bool l2 in YP.univ(Term, new ListPair(Name, TermArgs)))
3775 {
3776 if (YP.termEqual(TermArgs, Atom.NIL))
3777 {
3778 foreach (bool l4 in YP.unify(Result, new Functor1("object", Name)))
3779 {
3780 yield return true;
3781 yield break;
3782 }
3783 goto cutIf2;
3784 }
3785 foreach (bool l3 in YP.functor(Term, x6, Arity))
3786 {
3787 foreach (bool l4 in compileAtomModule(Name, Arity, State, ModuleCode))
3788 {
3789 foreach (bool l5 in YP.unify(NameCode, new Functor2("call", Atom.a("Atom.a"), new ListPair(new Functor1("object", Name), new ListPair(ModuleCode, Atom.NIL)))))
3790 {
3791 foreach (bool l6 in YP.unify(TermArgs, new ListPair(X1, Atom.NIL)))
3792 {
3793 foreach (bool l7 in compileTerm(X1, State, Arg1))
3794 {
3795 foreach (bool l8 in YP.unify(Result, new Functor2("new", Atom.a("Functor1"), new ListPair(NameCode, new ListPair(Arg1, Atom.NIL)))))
3796 {
3797 yield return true;
3798 yield break;
3799 }
3800 }
3801 goto cutIf4;
3802 }
3803 foreach (bool l6 in YP.unify(TermArgs, new ListPair(X1, new ListPair(X2, Atom.NIL))))
3804 {
3805 foreach (bool l7 in compileTerm(X1, State, Arg1))
3806 {
3807 foreach (bool l8 in compileTerm(X2, State, Arg2))
3808 {
3809 foreach (bool l9 in YP.unify(Result, new Functor2("new", Atom.a("Functor2"), ListPair.make(new object[] { NameCode, Arg1, Arg2 }))))
3810 {
3811 yield return true;
3812 yield break;
3813 }
3814 }
3815 }
3816 goto cutIf5;
3817 }
3818 foreach (bool l6 in YP.unify(TermArgs, ListPair.make(new object[] { X1, X2, X3 })))
3819 {
3820 foreach (bool l7 in compileTerm(X1, State, Arg1))
3821 {
3822 foreach (bool l8 in compileTerm(X2, State, Arg2))
3823 {
3824 foreach (bool l9 in compileTerm(X3, State, Arg3))
3825 {
3826 foreach (bool l10 in YP.unify(Result, new Functor2("new", Atom.a("Functor3"), ListPair.make(new object[] { NameCode, Arg1, Arg2, Arg3 }))))
3827 {
3828 yield return true;
3829 yield break;
3830 }
3831 }
3832 }
3833 }
3834 }
3835 foreach (bool l6 in maplist_compileTerm(TermArgs, State, Args))
3836 {
3837 foreach (bool l7 in YP.unify(Result, new Functor2("new", Atom.a("Functor"), new ListPair(NameCode, new ListPair(new Functor1("objectArray", Args), Atom.NIL)))))
3838 {
3839 yield return true;
3840 yield break;
3841 }
3842 }
3843 cutIf5:
3844 cutIf4:
3845 { }
3846 }
3847 goto cutIf3;
3848 }
3849 foreach (bool l4 in YP.unify(NameCode, new Functor1("object", Name)))
3850 {
3851 foreach (bool l5 in YP.unify(TermArgs, new ListPair(X1, Atom.NIL)))
3852 {
3853 foreach (bool l6 in compileTerm(X1, State, Arg1))
3854 {
3855 foreach (bool l7 in YP.unify(Result, new Functor2("new", Atom.a("Functor1"), new ListPair(NameCode, new ListPair(Arg1, Atom.NIL)))))
3856 {
3857 yield return true;
3858 yield break;
3859 }
3860 }
3861 goto cutIf6;
3862 }
3863 foreach (bool l5 in YP.unify(TermArgs, new ListPair(X1, new ListPair(X2, Atom.NIL))))
3864 {
3865 foreach (bool l6 in compileTerm(X1, State, Arg1))
3866 {
3867 foreach (bool l7 in compileTerm(X2, State, Arg2))
3868 {
3869 foreach (bool l8 in YP.unify(Result, new Functor2("new", Atom.a("Functor2"), ListPair.make(new object[] { NameCode, Arg1, Arg2 }))))
3870 {
3871 yield return true;
3872 yield break;
3873 }
3874 }
3875 }
3876 goto cutIf7;
3877 }
3878 foreach (bool l5 in YP.unify(TermArgs, ListPair.make(new object[] { X1, X2, X3 })))
3879 {
3880 foreach (bool l6 in compileTerm(X1, State, Arg1))
3881 {
3882 foreach (bool l7 in compileTerm(X2, State, Arg2))
3883 {
3884 foreach (bool l8 in compileTerm(X3, State, Arg3))
3885 {
3886 foreach (bool l9 in YP.unify(Result, new Functor2("new", Atom.a("Functor3"), ListPair.make(new object[] { NameCode, Arg1, Arg2, Arg3 }))))
3887 {
3888 yield return true;
3889 yield break;
3890 }
3891 }
3892 }
3893 }
3894 }
3895 foreach (bool l5 in maplist_compileTerm(TermArgs, State, Args))
3896 {
3897 foreach (bool l6 in YP.unify(Result, new Functor2("new", Atom.a("Functor"), new ListPair(NameCode, new ListPair(new Functor1("objectArray", Args), Atom.NIL)))))
3898 {
3899 yield return true;
3900 yield break;
3901 }
3902 }
3903 cutIf7:
3904 cutIf6:
3905 { }
3906 }
3907 cutIf3:
3908 { }
3909 }
3910 cutIf2:
3911 { }
3912 }
3913 }
3914 }
3915
3916 public static IEnumerable<bool> compileAtomModule(object Name, object arg2, object arg3, object ModuleCode)
3917 {
3918 {
3919 object Arity = arg2;
3920 object State = arg3;
3921 if (CompilerState.nameArityHasModule(State, Name, Arity, Atom.a("")))
3922 {
3923 foreach (bool l3 in YP.unify(ModuleCode, new Functor2("call", Atom.a("Atom.a"), new ListPair(new Functor1("object", Atom.a("")), Atom.NIL))))
3924 {
3925 yield return true;
3926 yield break;
3927 }
3928 }
3929 }
3930 {
3931 object _Arity = arg2;
3932 object _State = arg3;
3933 Variable Module = new Variable();
3934 foreach (bool l2 in Atom.module(Name, Module))
3935 {
3936 if (YP.termNotEqual(Module, Atom.NIL))
3937 {
3938 foreach (bool l4 in YP.unify(ModuleCode, new Functor2("call", Atom.a("Atom.a"), new ListPair(new Functor1("object", Module), Atom.NIL))))
3939 {
3940 yield return true;
3941 yield break;
3942 }
3943 }
3944 }
3945 }
3946 }
3947
3948 public static IEnumerable<bool> maplist_compileTerm(object arg1, object arg2, object arg3)
3949 {
3950 {
3951 object _State = arg2;
3952 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
3953 {
3954 foreach (bool l3 in YP.unify(arg3, Atom.NIL))
3955 {
3956 yield return true;
3957 yield break;
3958 }
3959 }
3960 }
3961 {
3962 object State = arg2;
3963 Variable First = new Variable();
3964 Variable Rest = new Variable();
3965 Variable FirstResult = new Variable();
3966 Variable RestResults = new Variable();
3967 foreach (bool l2 in YP.unify(arg1, new ListPair(First, Rest)))
3968 {
3969 foreach (bool l3 in YP.unify(arg3, new ListPair(FirstResult, RestResults)))
3970 {
3971 if (YP.nonvar(Rest))
3972 {
3973 foreach (bool l5 in compileTerm(First, State, FirstResult))
3974 {
3975 foreach (bool l6 in maplist_compileTerm(Rest, State, RestResults))
3976 {
3977 yield return true;
3978 yield break;
3979 }
3980 }
3981 }
3982 }
3983 }
3984 }
3985 }
3986
3987 public static IEnumerable<bool> compileExpression(object Term, object State, object Result)
3988 {
3989 {
3990 Variable Name = new Variable();
3991 Variable TermArgs = new Variable();
3992 Variable X1 = new Variable();
3993 Variable FunctionName = new Variable();
3994 Variable Arg1 = new Variable();
3995 Variable x9 = new Variable();
3996 Variable X2 = new Variable();
3997 Variable Arg2 = new Variable();
3998 Variable x12 = new Variable();
3999 Variable Arity = new Variable();
4000 if (YP.nonvar(Term))
4001 {
4002 foreach (bool l3 in YP.univ(Term, new ListPair(Name, TermArgs)))
4003 {
4004 if (YP.atom(Name))
4005 {
4006 foreach (bool l5 in YP.unify(TermArgs, new ListPair(X1, Atom.NIL)))
4007 {
4008 foreach (bool l6 in unaryFunction(Name, FunctionName))
4009 {
4010 foreach (bool l7 in compileExpression(X1, State, Arg1))
4011 {
4012 foreach (bool l8 in YP.unify(Result, new Functor2("call", FunctionName, new ListPair(Arg1, Atom.NIL))))
4013 {
4014 yield return true;
4015 yield break;
4016 }
4017 }
4018 goto cutIf1;
4019 }
4020 }
4021 foreach (bool l5 in YP.unify(Term, new ListPair(x9, Atom.NIL)))
4022 {
4023 foreach (bool l6 in compileTerm(Term, State, Result))
4024 {
4025 yield return true;
4026 yield break;
4027 }
4028 goto cutIf2;
4029 }
4030 foreach (bool l5 in YP.unify(TermArgs, new ListPair(X1, new ListPair(X2, Atom.NIL))))
4031 {
4032 foreach (bool l6 in binaryFunction(Name, FunctionName))
4033 {
4034 foreach (bool l7 in compileExpression(X1, State, Arg1))
4035 {
4036 foreach (bool l8 in compileExpression(X2, State, Arg2))
4037 {
4038 foreach (bool l9 in YP.unify(Result, new Functor2("call", FunctionName, new ListPair(Arg1, new ListPair(Arg2, Atom.NIL)))))
4039 {
4040 yield return true;
4041 yield break;
4042 }
4043 }
4044 }
4045 goto cutIf3;
4046 }
4047 }
4048 foreach (bool l5 in YP.functor(Term, x12, Arity))
4049 {
4050 YP.throwException(new Functor2("error", new Functor2("type_error", Atom.a("evaluable"), new Functor2("/", Name, Arity)), Atom.a("Not an expression function")));
4051 yield return false;
4052 }
4053 cutIf3:
4054 cutIf2:
4055 cutIf1:
4056 { }
4057 }
4058 }
4059 }
4060 }
4061 {
4062 foreach (bool l2 in compileTerm(Term, State, Result))
4063 {
4064 yield return true;
4065 yield break;
4066 }
4067 }
4068 }
4069
4070 public static IEnumerable<bool> unaryFunction(object arg1, object arg2)
4071 {
4072 {
4073 foreach (bool l2 in YP.unify(arg1, Atom.a("-")))
4074 {
4075 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.negate")))
4076 {
4077 yield return true;
4078 yield break;
4079 }
4080 }
4081 }
4082 {
4083 foreach (bool l2 in YP.unify(arg1, Atom.a("abs")))
4084 {
4085 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.abs")))
4086 {
4087 yield return true;
4088 yield break;
4089 }
4090 }
4091 }
4092 {
4093 foreach (bool l2 in YP.unify(arg1, Atom.a("sign")))
4094 {
4095 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.sign")))
4096 {
4097 yield return true;
4098 yield break;
4099 }
4100 }
4101 }
4102 {
4103 foreach (bool l2 in YP.unify(arg1, Atom.a("float")))
4104 {
4105 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.toFloat")))
4106 {
4107 yield return true;
4108 yield break;
4109 }
4110 }
4111 }
4112 {
4113 foreach (bool l2 in YP.unify(arg1, Atom.a("floor")))
4114 {
4115 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.floor")))
4116 {
4117 yield return true;
4118 yield break;
4119 }
4120 }
4121 }
4122 {
4123 foreach (bool l2 in YP.unify(arg1, Atom.a("truncate")))
4124 {
4125 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.truncate")))
4126 {
4127 yield return true;
4128 yield break;
4129 }
4130 }
4131 }
4132 {
4133 foreach (bool l2 in YP.unify(arg1, Atom.a("round")))
4134 {
4135 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.round")))
4136 {
4137 yield return true;
4138 yield break;
4139 }
4140 }
4141 }
4142 {
4143 foreach (bool l2 in YP.unify(arg1, Atom.a("ceiling")))
4144 {
4145 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.ceiling")))
4146 {
4147 yield return true;
4148 yield break;
4149 }
4150 }
4151 }
4152 {
4153 foreach (bool l2 in YP.unify(arg1, Atom.a("sin")))
4154 {
4155 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.sin")))
4156 {
4157 yield return true;
4158 yield break;
4159 }
4160 }
4161 }
4162 {
4163 foreach (bool l2 in YP.unify(arg1, Atom.a("cos")))
4164 {
4165 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.cos")))
4166 {
4167 yield return true;
4168 yield break;
4169 }
4170 }
4171 }
4172 {
4173 foreach (bool l2 in YP.unify(arg1, Atom.a("atan")))
4174 {
4175 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.atan")))
4176 {
4177 yield return true;
4178 yield break;
4179 }
4180 }
4181 }
4182 {
4183 foreach (bool l2 in YP.unify(arg1, Atom.a("exp")))
4184 {
4185 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.exp")))
4186 {
4187 yield return true;
4188 yield break;
4189 }
4190 }
4191 }
4192 {
4193 foreach (bool l2 in YP.unify(arg1, Atom.a("log")))
4194 {
4195 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.log")))
4196 {
4197 yield return true;
4198 yield break;
4199 }
4200 }
4201 }
4202 {
4203 foreach (bool l2 in YP.unify(arg1, Atom.a("sqrt")))
4204 {
4205 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.sqrt")))
4206 {
4207 yield return true;
4208 yield break;
4209 }
4210 }
4211 }
4212 {
4213 foreach (bool l2 in YP.unify(arg1, Atom.a("\\")))
4214 {
4215 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.bitwiseComplement")))
4216 {
4217 yield return true;
4218 yield break;
4219 }
4220 }
4221 }
4222 }
4223
4224 public static IEnumerable<bool> binaryFunction(object arg1, object arg2)
4225 {
4226 {
4227 foreach (bool l2 in YP.unify(arg1, Atom.a("+")))
4228 {
4229 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.add")))
4230 {
4231 yield return true;
4232 yield break;
4233 }
4234 }
4235 }
4236 {
4237 foreach (bool l2 in YP.unify(arg1, Atom.a("-")))
4238 {
4239 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.subtract")))
4240 {
4241 yield return true;
4242 yield break;
4243 }
4244 }
4245 }
4246 {
4247 foreach (bool l2 in YP.unify(arg1, Atom.a("*")))
4248 {
4249 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.multiply")))
4250 {
4251 yield return true;
4252 yield break;
4253 }
4254 }
4255 }
4256 {
4257 foreach (bool l2 in YP.unify(arg1, Atom.a("/")))
4258 {
4259 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.divide")))
4260 {
4261 yield return true;
4262 yield break;
4263 }
4264 }
4265 }
4266 {
4267 foreach (bool l2 in YP.unify(arg1, Atom.a("//")))
4268 {
4269 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.intDivide")))
4270 {
4271 yield return true;
4272 yield break;
4273 }
4274 }
4275 }
4276 {
4277 foreach (bool l2 in YP.unify(arg1, Atom.a("mod")))
4278 {
4279 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.mod")))
4280 {
4281 yield return true;
4282 yield break;
4283 }
4284 }
4285 }
4286 {
4287 foreach (bool l2 in YP.unify(arg1, Atom.a("**")))
4288 {
4289 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.pow")))
4290 {
4291 yield return true;
4292 yield break;
4293 }
4294 }
4295 }
4296 {
4297 foreach (bool l2 in YP.unify(arg1, Atom.a(">>")))
4298 {
4299 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.bitwiseShiftRight")))
4300 {
4301 yield return true;
4302 yield break;
4303 }
4304 }
4305 }
4306 {
4307 foreach (bool l2 in YP.unify(arg1, Atom.a("<<")))
4308 {
4309 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.bitwiseShiftLeft")))
4310 {
4311 yield return true;
4312 yield break;
4313 }
4314 }
4315 }
4316 {
4317 foreach (bool l2 in YP.unify(arg1, Atom.a("/\\")))
4318 {
4319 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.bitwiseAnd")))
4320 {
4321 yield return true;
4322 yield break;
4323 }
4324 }
4325 }
4326 {
4327 foreach (bool l2 in YP.unify(arg1, Atom.a("\\/")))
4328 {
4329 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.bitwiseOr")))
4330 {
4331 yield return true;
4332 yield break;
4333 }
4334 }
4335 }
4336 {
4337 foreach (bool l2 in YP.unify(arg1, Atom.a("min")))
4338 {
4339 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.min")))
4340 {
4341 yield return true;
4342 yield break;
4343 }
4344 }
4345 }
4346 {
4347 foreach (bool l2 in YP.unify(arg1, Atom.a("max")))
4348 {
4349 foreach (bool l3 in YP.unify(arg2, Atom.a("YP.max")))
4350 {
4351 yield return true;
4352 yield break;
4353 }
4354 }
4355 }
4356 }
4357
4358 public static void convertFunctionCSharp(object arg1)
4359 {
4360 {
4361 foreach (bool l2 in YP.unify(arg1, Atom.a("getDeclaringClass")))
4362 {
4363 YP.write(Atom.a("public class YPInnerClass {}"));
4364 YP.nl();
4365 YP.write(Atom.a("public static System.Type getDeclaringClass() { return typeof(YPInnerClass).DeclaringType; }"));
4366 YP.nl();
4367 YP.nl();
4368 return;
4369 }
4370 }
4371 {
4372 Variable ReturnType = new Variable();
4373 Variable Name = new Variable();
4374 Variable ArgList = new Variable();
4375 Variable Body = new Variable();
4376 Variable Level = new Variable();
4377 foreach (bool l2 in YP.unify(arg1, new Functor("function", new object[] { ReturnType, Name, ArgList, Body })))
4378 {
4379 YP.write(Atom.a("public static "));
4380 YP.write(ReturnType);
4381 YP.write(Atom.a(" "));
4382 YP.write(Name);
4383 YP.write(Atom.a("("));
4384 convertArgListCSharp(ArgList);
4385 YP.write(Atom.a(") {"));
4386 YP.nl();
4387 foreach (bool l3 in YP.unify(Level, 1))
4388 {
4389 convertStatementListCSharp(Body, Level);
4390 YP.write(Atom.a("}"));
4391 YP.nl();
4392 YP.nl();
4393 return;
4394 }
4395 }
4396 }
4397 }
4398
4399 public static IEnumerable<bool> convertStatementListCSharp(object arg1, object x1, object x2)
4400 {
4401 {
4402 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
4403 {
4404 yield return true;
4405 yield break;
4406 }
4407 }
4408 }
4409
4410 public static void convertStatementListCSharp(object arg1, object Level)
4411 {
4412 {
4413 Variable Name = new Variable();
4414 Variable Body = new Variable();
4415 Variable RestStatements = new Variable();
4416 Variable NewStatements = new Variable();
4417 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("breakableBlock", Name, Body), RestStatements)))
4418 {
4419 foreach (bool l3 in append(Body, new ListPair(new Functor1("label", Name), RestStatements), NewStatements))
4420 {
4421 convertStatementListCSharp(NewStatements, Level);
4422 return;
4423 }
4424 }
4425 }
4426 {
4427 Variable Type = new Variable();
4428 Variable Name = new Variable();
4429 Variable Expression = new Variable();
4430 Variable RestStatements = new Variable();
4431 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3("declare", Type, Name, Expression), RestStatements)))
4432 {
4433 convertIndentationCSharp(Level);
4434 YP.write(Type);
4435 YP.write(Atom.a(" "));
4436 YP.write(Name);
4437 YP.write(Atom.a(" = "));
4438 convertExpressionCSharp(Expression);
4439 YP.write(Atom.a(";"));
4440 YP.nl();
4441 convertStatementListCSharp(RestStatements, Level);
4442 return;
4443 }
4444 }
4445 {
4446 Variable Name = new Variable();
4447 Variable Expression = new Variable();
4448 Variable RestStatements = new Variable();
4449 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("assign", Name, Expression), RestStatements)))
4450 {
4451 convertIndentationCSharp(Level);
4452 YP.write(Name);
4453 YP.write(Atom.a(" = "));
4454 convertExpressionCSharp(Expression);
4455 YP.write(Atom.a(";"));
4456 YP.nl();
4457 convertStatementListCSharp(RestStatements, Level);
4458 return;
4459 }
4460 }
4461 {
4462 Variable RestStatements = new Variable();
4463 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("yieldtrue"), RestStatements)))
4464 {
4465 convertIndentationCSharp(Level);
4466 YP.write(Atom.a("yield return true;"));
4467 YP.nl();
4468 convertStatementListCSharp(RestStatements, Level);
4469 return;
4470 }
4471 }
4472 {
4473 Variable RestStatements = new Variable();
4474 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("yieldfalse"), RestStatements)))
4475 {
4476 convertIndentationCSharp(Level);
4477 YP.write(Atom.a("yield return false;"));
4478 YP.nl();
4479 convertStatementListCSharp(RestStatements, Level);
4480 return;
4481 }
4482 }
4483 {
4484 Variable RestStatements = new Variable();
4485 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("yieldbreak"), RestStatements)))
4486 {
4487 convertIndentationCSharp(Level);
4488 YP.write(Atom.a("yield break;"));
4489 YP.nl();
4490 convertStatementListCSharp(RestStatements, Level);
4491 return;
4492 }
4493 }
4494 {
4495 Variable RestStatements = new Variable();
4496 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("return"), RestStatements)))
4497 {
4498 convertIndentationCSharp(Level);
4499 YP.write(Atom.a("return;"));
4500 YP.nl();
4501 convertStatementListCSharp(RestStatements, Level);
4502 return;
4503 }
4504 }
4505 {
4506 Variable RestStatements = new Variable();
4507 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("returntrue"), RestStatements)))
4508 {
4509 convertIndentationCSharp(Level);
4510 YP.write(Atom.a("return true;"));
4511 YP.nl();
4512 convertStatementListCSharp(RestStatements, Level);
4513 return;
4514 }
4515 }
4516 {
4517 Variable RestStatements = new Variable();
4518 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("returnfalse"), RestStatements)))
4519 {
4520 convertIndentationCSharp(Level);
4521 YP.write(Atom.a("return false;"));
4522 YP.nl();
4523 convertStatementListCSharp(RestStatements, Level);
4524 return;
4525 }
4526 }
4527 {
4528 Variable Name = new Variable();
4529 Variable RestStatements = new Variable();
4530 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("label", Name), RestStatements)))
4531 {
4532 convertIndentationCSharp(Level);
4533 YP.write(Name);
4534 YP.write(Atom.a(":"));
4535 YP.nl();
4536 if (YP.termEqual(RestStatements, Atom.NIL))
4537 {
4538 convertIndentationCSharp(Level);
4539 YP.write(Atom.a("{}"));
4540 YP.nl();
4541 convertStatementListCSharp(RestStatements, Level);
4542 return;
4543 goto cutIf1;
4544 }
4545 convertStatementListCSharp(RestStatements, Level);
4546 return;
4547 cutIf1:
4548 { }
4549 }
4550 }
4551 {
4552 Variable Name = new Variable();
4553 Variable RestStatements = new Variable();
4554 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("breakBlock", Name), RestStatements)))
4555 {
4556 convertIndentationCSharp(Level);
4557 YP.write(Atom.a("goto "));
4558 YP.write(Name);
4559 YP.write(Atom.a(";"));
4560 YP.nl();
4561 convertStatementListCSharp(RestStatements, Level);
4562 return;
4563 }
4564 }
4565 {
4566 Variable Name = new Variable();
4567 Variable ArgList = new Variable();
4568 Variable RestStatements = new Variable();
4569 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("call", Name, ArgList), RestStatements)))
4570 {
4571 convertIndentationCSharp(Level);
4572 YP.write(Name);
4573 YP.write(Atom.a("("));
4574 convertArgListCSharp(ArgList);
4575 YP.write(Atom.a(");"));
4576 YP.nl();
4577 convertStatementListCSharp(RestStatements, Level);
4578 return;
4579 }
4580 }
4581 {
4582 Variable Name = new Variable();
4583 Variable _FunctorArgs = new Variable();
4584 Variable ArgList = new Variable();
4585 Variable RestStatements = new Variable();
4586 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3("functorCall", Name, _FunctorArgs, ArgList), RestStatements)))
4587 {
4588 convertStatementListCSharp(new ListPair(new Functor2("call", Name, ArgList), RestStatements), Level);
4589 return;
4590 }
4591 }
4592 {
4593 Variable Obj = new Variable();
4594 Variable Name = new Variable();
4595 Variable ArgList = new Variable();
4596 Variable RestStatements = new Variable();
4597 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3("callMember", new Functor1("var", Obj), Name, ArgList), RestStatements)))
4598 {
4599 convertIndentationCSharp(Level);
4600 YP.write(Obj);
4601 YP.write(Atom.a("."));
4602 YP.write(Name);
4603 YP.write(Atom.a("("));
4604 convertArgListCSharp(ArgList);
4605 YP.write(Atom.a(");"));
4606 YP.nl();
4607 convertStatementListCSharp(RestStatements, Level);
4608 return;
4609 }
4610 }
4611 {
4612 Variable Body = new Variable();
4613 Variable RestStatements = new Variable();
4614 Variable NextLevel = new Variable();
4615 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("blockScope", Body), RestStatements)))
4616 {
4617 convertIndentationCSharp(Level);
4618 YP.write(Atom.a("{"));
4619 YP.nl();
4620 foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1)))
4621 {
4622 convertStatementListCSharp(Body, NextLevel);
4623 convertIndentationCSharp(Level);
4624 YP.write(Atom.a("}"));
4625 YP.nl();
4626 convertStatementListCSharp(RestStatements, Level);
4627 return;
4628 }
4629 }
4630 }
4631 {
4632 Variable Expression = new Variable();
4633 Variable Body = new Variable();
4634 Variable RestStatements = new Variable();
4635 Variable NextLevel = new Variable();
4636 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("if", Expression, Body), RestStatements)))
4637 {
4638 convertIndentationCSharp(Level);
4639 YP.write(Atom.a("if ("));
4640 convertExpressionCSharp(Expression);
4641 YP.write(Atom.a(") {"));
4642 YP.nl();
4643 foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1)))
4644 {
4645 convertStatementListCSharp(Body, NextLevel);
4646 convertIndentationCSharp(Level);
4647 YP.write(Atom.a("}"));
4648 YP.nl();
4649 convertStatementListCSharp(RestStatements, Level);
4650 return;
4651 }
4652 }
4653 }
4654 {
4655 Variable Expression = new Variable();
4656 Variable Body = new Variable();
4657 Variable RestStatements = new Variable();
4658 Variable NextLevel = new Variable();
4659 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("foreach", Expression, Body), RestStatements)))
4660 {
4661 convertIndentationCSharp(Level);
4662 YP.write(Atom.a("foreach (bool l"));
4663 YP.write(Level);
4664 YP.write(Atom.a(" in "));
4665 convertExpressionCSharp(Expression);
4666 YP.write(Atom.a(") {"));
4667 YP.nl();
4668 foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1)))
4669 {
4670 convertStatementListCSharp(Body, NextLevel);
4671 convertIndentationCSharp(Level);
4672 YP.write(Atom.a("}"));
4673 YP.nl();
4674 convertStatementListCSharp(RestStatements, Level);
4675 return;
4676 }
4677 }
4678 }
4679 {
4680 Variable Expression = new Variable();
4681 Variable RestStatements = new Variable();
4682 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("throw", Expression), RestStatements)))
4683 {
4684 convertIndentationCSharp(Level);
4685 YP.write(Atom.a("throw "));
4686 convertExpressionCSharp(Expression);
4687 YP.write(Atom.a(";"));
4688 YP.nl();
4689 convertStatementListCSharp(RestStatements, Level);
4690 return;
4691 }
4692 }
4693 }
4694
4695 public static void convertIndentationCSharp(object Level)
4696 {
4697 {
4698 Variable N = new Variable();
4699 foreach (bool l2 in YP.unify(N, YP.multiply(Level, 2)))
4700 {
4701 repeatWrite(Atom.a(" "), N);
4702 return;
4703 }
4704 }
4705 }
4706
4707 public static void convertArgListCSharp(object arg1)
4708 {
4709 {
4710 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
4711 {
4712 return;
4713 }
4714 }
4715 {
4716 Variable Head = new Variable();
4717 Variable Tail = new Variable();
4718 foreach (bool l2 in YP.unify(arg1, new ListPair(Head, Tail)))
4719 {
4720 convertExpressionCSharp(Head);
4721 if (YP.termNotEqual(Tail, Atom.NIL))
4722 {
4723 YP.write(Atom.a(", "));
4724 convertArgListCSharp(Tail);
4725 return;
4726 goto cutIf1;
4727 }
4728 convertArgListCSharp(Tail);
4729 return;
4730 cutIf1:
4731 { }
4732 }
4733 }
4734 }
4735
4736 public static void convertExpressionCSharp(object arg1)
4737 {
4738 {
4739 Variable X = new Variable();
4740 foreach (bool l2 in YP.unify(arg1, new Functor1("arg", X)))
4741 {
4742 YP.write(Atom.a("object "));
4743 YP.write(X);
4744 return;
4745 }
4746 }
4747 {
4748 Variable Name = new Variable();
4749 Variable ArgList = new Variable();
4750 foreach (bool l2 in YP.unify(arg1, new Functor2("call", Name, ArgList)))
4751 {
4752 YP.write(Name);
4753 YP.write(Atom.a("("));
4754 convertArgListCSharp(ArgList);
4755 YP.write(Atom.a(")"));
4756 return;
4757 }
4758 }
4759 {
4760 Variable Name = new Variable();
4761 Variable _FunctorArgs = new Variable();
4762 Variable ArgList = new Variable();
4763 foreach (bool l2 in YP.unify(arg1, new Functor3("functorCall", Name, _FunctorArgs, ArgList)))
4764 {
4765 convertExpressionCSharp(new Functor2("call", Name, ArgList));
4766 return;
4767 }
4768 }
4769 {
4770 Variable Obj = new Variable();
4771 Variable Name = new Variable();
4772 Variable ArgList = new Variable();
4773 foreach (bool l2 in YP.unify(arg1, new Functor3("callMember", new Functor1("var", Obj), Name, ArgList)))
4774 {
4775 YP.write(Obj);
4776 YP.write(Atom.a("."));
4777 YP.write(Name);
4778 YP.write(Atom.a("("));
4779 convertArgListCSharp(ArgList);
4780 YP.write(Atom.a(")"));
4781 return;
4782 }
4783 }
4784 {
4785 Variable Name = new Variable();
4786 Variable ArgList = new Variable();
4787 foreach (bool l2 in YP.unify(arg1, new Functor2("new", Name, ArgList)))
4788 {
4789 YP.write(Atom.a("new "));
4790 YP.write(Name);
4791 YP.write(Atom.a("("));
4792 convertArgListCSharp(ArgList);
4793 YP.write(Atom.a(")"));
4794 return;
4795 }
4796 }
4797 {
4798 Variable Name = new Variable();
4799 foreach (bool l2 in YP.unify(arg1, new Functor1("var", Name)))
4800 {
4801 YP.write(Name);
4802 return;
4803 }
4804 }
4805 {
4806 foreach (bool l2 in YP.unify(arg1, Atom.a("null")))
4807 {
4808 YP.write(Atom.a("null"));
4809 return;
4810 }
4811 }
4812 {
4813 Variable X = new Variable();
4814 foreach (bool l2 in YP.unify(arg1, new Functor1("not", X)))
4815 {
4816 YP.write(Atom.a("!("));
4817 convertExpressionCSharp(X);
4818 YP.write(Atom.a(")"));
4819 return;
4820 }
4821 }
4822 {
4823 Variable X = new Variable();
4824 Variable Y = new Variable();
4825 foreach (bool l2 in YP.unify(arg1, new Functor2("and", X, Y)))
4826 {
4827 YP.write(Atom.a("("));
4828 convertExpressionCSharp(X);
4829 YP.write(Atom.a(") && ("));
4830 convertExpressionCSharp(Y);
4831 YP.write(Atom.a(")"));
4832 return;
4833 }
4834 }
4835 {
4836 Variable ArgList = new Variable();
4837 foreach (bool l2 in YP.unify(arg1, new Functor1("objectArray", ArgList)))
4838 {
4839 YP.write(Atom.a("new object[] {"));
4840 convertArgListCSharp(ArgList);
4841 YP.write(Atom.a("}"));
4842 return;
4843 }
4844 }
4845 {
4846 Variable X = new Variable();
4847 Variable Codes = new Variable();
4848 foreach (bool l2 in YP.unify(arg1, new Functor1("object", X)))
4849 {
4850 if (YP.atom(X))
4851 {
4852 YP.write(Atom.a("\""));
4853 foreach (bool l4 in YP.atom_codes(X, Codes))
4854 {
4855 convertStringCodesCSharp(Codes);
4856 YP.write(Atom.a("\""));
4857 return;
4858 }
4859 }
4860 }
4861 }
4862 {
4863 Variable X = new Variable();
4864 foreach (bool l2 in YP.unify(arg1, new Functor1("object", X)))
4865 {
4866 YP.write(X);
4867 return;
4868 }
4869 }
4870 }
4871
4872 public static void convertStringCodesCSharp(object arg1)
4873 {
4874 {
4875 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
4876 {
4877 return;
4878 }
4879 }
4880 {
4881 Variable Code = new Variable();
4882 Variable RestCodes = new Variable();
4883 foreach (bool l2 in YP.unify(arg1, new ListPair(Code, RestCodes)))
4884 {
4885 foreach (bool l3 in putCStringCode(Code))
4886 {
4887 convertStringCodesCSharp(RestCodes);
4888 return;
4889 }
4890 }
4891 }
4892 }
4893
4894 public static void convertFunctionJavascript(object arg1)
4895 {
4896 {
4897 foreach (bool l2 in YP.unify(arg1, Atom.a("getDeclaringClass")))
4898 {
4899 YP.write(Atom.a("function getDeclaringClass() { return null; }"));
4900 YP.nl();
4901 YP.nl();
4902 return;
4903 }
4904 }
4905 {
4906 Variable x1 = new Variable();
4907 Variable Name = new Variable();
4908 Variable ArgList = new Variable();
4909 Variable Body = new Variable();
4910 foreach (bool l2 in YP.unify(arg1, new Functor("function", new object[] { x1, Name, ArgList, Body })))
4911 {
4912 YP.write(Atom.a("function "));
4913 YP.write(Name);
4914 YP.write(Atom.a("("));
4915 convertArgListJavascript(ArgList);
4916 YP.write(Atom.a(") {"));
4917 YP.nl();
4918 convertStatementListJavascript(Body, 1);
4919 YP.write(Atom.a("}"));
4920 YP.nl();
4921 YP.nl();
4922 return;
4923 }
4924 }
4925 }
4926
4927 public static void convertStatementListJavascript(object arg1, object arg2)
4928 {
4929 {
4930 object x1 = arg2;
4931 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
4932 {
4933 return;
4934 }
4935 }
4936 {
4937 object Level = arg2;
4938 Variable Name = new Variable();
4939 Variable Body = new Variable();
4940 Variable RestStatements = new Variable();
4941 Variable NextLevel = new Variable();
4942 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("breakableBlock", Name, Body), RestStatements)))
4943 {
4944 convertIndentationJavascript(Level);
4945 YP.write(Name);
4946 YP.write(Atom.a(":"));
4947 YP.nl();
4948 convertIndentationJavascript(Level);
4949 YP.write(Atom.a("{"));
4950 YP.nl();
4951 foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1)))
4952 {
4953 convertStatementListJavascript(Body, NextLevel);
4954 convertIndentationJavascript(Level);
4955 YP.write(Atom.a("}"));
4956 YP.nl();
4957 convertStatementListJavascript(RestStatements, Level);
4958 return;
4959 }
4960 }
4961 }
4962 {
4963 object Level = arg2;
4964 Variable _Type = new Variable();
4965 Variable Name = new Variable();
4966 Variable Expression = new Variable();
4967 Variable RestStatements = new Variable();
4968 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3("declare", _Type, Name, Expression), RestStatements)))
4969 {
4970 convertIndentationJavascript(Level);
4971 YP.write(Atom.a("var "));
4972 YP.write(Name);
4973 YP.write(Atom.a(" = "));
4974 convertExpressionJavascript(Expression);
4975 YP.write(Atom.a(";"));
4976 YP.nl();
4977 convertStatementListJavascript(RestStatements, Level);
4978 return;
4979 }
4980 }
4981 {
4982 object Level = arg2;
4983 Variable Name = new Variable();
4984 Variable Expression = new Variable();
4985 Variable RestStatements = new Variable();
4986 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("assign", Name, Expression), RestStatements)))
4987 {
4988 convertIndentationJavascript(Level);
4989 YP.write(Name);
4990 YP.write(Atom.a(" = "));
4991 convertExpressionJavascript(Expression);
4992 YP.write(Atom.a(";"));
4993 YP.nl();
4994 convertStatementListJavascript(RestStatements, Level);
4995 return;
4996 }
4997 }
4998 {
4999 object Level = arg2;
5000 Variable RestStatements = new Variable();
5001 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("yieldtrue"), RestStatements)))
5002 {
5003 convertIndentationJavascript(Level);
5004 YP.write(Atom.a("yield true;"));
5005 YP.nl();
5006 convertStatementListJavascript(RestStatements, Level);
5007 return;
5008 }
5009 }
5010 {
5011 object Level = arg2;
5012 Variable RestStatements = new Variable();
5013 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("yieldfalse"), RestStatements)))
5014 {
5015 convertIndentationJavascript(Level);
5016 YP.write(Atom.a("yield false;"));
5017 YP.nl();
5018 convertStatementListJavascript(RestStatements, Level);
5019 return;
5020 }
5021 }
5022 {
5023 object Level = arg2;
5024 Variable RestStatements = new Variable();
5025 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("yieldbreak"), RestStatements)))
5026 {
5027 convertIndentationJavascript(Level);
5028 YP.write(Atom.a("return;"));
5029 YP.nl();
5030 convertStatementListJavascript(RestStatements, Level);
5031 return;
5032 }
5033 }
5034 {
5035 object Level = arg2;
5036 Variable RestStatements = new Variable();
5037 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("return"), RestStatements)))
5038 {
5039 convertIndentationJavascript(Level);
5040 YP.write(Atom.a("return;"));
5041 YP.nl();
5042 convertStatementListJavascript(RestStatements, Level);
5043 return;
5044 }
5045 }
5046 {
5047 object Level = arg2;
5048 Variable RestStatements = new Variable();
5049 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("returntrue"), RestStatements)))
5050 {
5051 convertIndentationJavascript(Level);
5052 YP.write(Atom.a("return true;"));
5053 YP.nl();
5054 convertStatementListJavascript(RestStatements, Level);
5055 return;
5056 }
5057 }
5058 {
5059 object Level = arg2;
5060 Variable RestStatements = new Variable();
5061 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("returnfalse"), RestStatements)))
5062 {
5063 convertIndentationJavascript(Level);
5064 YP.write(Atom.a("return false;"));
5065 YP.nl();
5066 convertStatementListJavascript(RestStatements, Level);
5067 return;
5068 }
5069 }
5070 {
5071 object Level = arg2;
5072 Variable Name = new Variable();
5073 Variable RestStatements = new Variable();
5074 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("breakBlock", Name), RestStatements)))
5075 {
5076 convertIndentationJavascript(Level);
5077 YP.write(Atom.a("break "));
5078 YP.write(Name);
5079 YP.write(Atom.a(";"));
5080 YP.nl();
5081 convertStatementListJavascript(RestStatements, Level);
5082 return;
5083 }
5084 }
5085 {
5086 object Level = arg2;
5087 Variable Name = new Variable();
5088 Variable ArgList = new Variable();
5089 Variable RestStatements = new Variable();
5090 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("call", Name, ArgList), RestStatements)))
5091 {
5092 convertIndentationJavascript(Level);
5093 YP.write(Name);
5094 YP.write(Atom.a("("));
5095 convertArgListJavascript(ArgList);
5096 YP.write(Atom.a(");"));
5097 YP.nl();
5098 convertStatementListJavascript(RestStatements, Level);
5099 return;
5100 }
5101 }
5102 {
5103 object Level = arg2;
5104 Variable Name = new Variable();
5105 Variable _FunctorArgs = new Variable();
5106 Variable ArgList = new Variable();
5107 Variable RestStatements = new Variable();
5108 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3("functorCall", Name, _FunctorArgs, ArgList), RestStatements)))
5109 {
5110 convertStatementListJavascript(new ListPair(new Functor2("call", Name, ArgList), RestStatements), Level);
5111 return;
5112 }
5113 }
5114 {
5115 object Level = arg2;
5116 Variable Obj = new Variable();
5117 Variable Name = new Variable();
5118 Variable ArgList = new Variable();
5119 Variable RestStatements = new Variable();
5120 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3("callMember", new Functor1("var", Obj), Name, ArgList), RestStatements)))
5121 {
5122 convertIndentationJavascript(Level);
5123 YP.write(Obj);
5124 YP.write(Atom.a("."));
5125 YP.write(Name);
5126 YP.write(Atom.a("("));
5127 convertArgListJavascript(ArgList);
5128 YP.write(Atom.a(");"));
5129 YP.nl();
5130 convertStatementListJavascript(RestStatements, Level);
5131 return;
5132 }
5133 }
5134 {
5135 object Level = arg2;
5136 Variable Body = new Variable();
5137 Variable RestStatements = new Variable();
5138 Variable NextLevel = new Variable();
5139 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("blockScope", Body), RestStatements)))
5140 {
5141 convertIndentationJavascript(Level);
5142 YP.write(Atom.a("{"));
5143 YP.nl();
5144 foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1)))
5145 {
5146 convertStatementListJavascript(Body, NextLevel);
5147 convertIndentationJavascript(Level);
5148 YP.write(Atom.a("}"));
5149 YP.nl();
5150 convertStatementListJavascript(RestStatements, Level);
5151 return;
5152 }
5153 }
5154 }
5155 {
5156 object Level = arg2;
5157 Variable Expression = new Variable();
5158 Variable Body = new Variable();
5159 Variable RestStatements = new Variable();
5160 Variable NextLevel = new Variable();
5161 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("if", Expression, Body), RestStatements)))
5162 {
5163 convertIndentationJavascript(Level);
5164 YP.write(Atom.a("if ("));
5165 convertExpressionJavascript(Expression);
5166 YP.write(Atom.a(") {"));
5167 YP.nl();
5168 foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1)))
5169 {
5170 convertStatementListJavascript(Body, NextLevel);
5171 convertIndentationJavascript(Level);
5172 YP.write(Atom.a("}"));
5173 YP.nl();
5174 convertStatementListJavascript(RestStatements, Level);
5175 return;
5176 }
5177 }
5178 }
5179 {
5180 object Level = arg2;
5181 Variable Expression = new Variable();
5182 Variable Body = new Variable();
5183 Variable RestStatements = new Variable();
5184 Variable NextLevel = new Variable();
5185 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("foreach", Expression, Body), RestStatements)))
5186 {
5187 convertIndentationJavascript(Level);
5188 YP.write(Atom.a("for each (var l"));
5189 YP.write(Level);
5190 YP.write(Atom.a(" in "));
5191 convertExpressionJavascript(Expression);
5192 YP.write(Atom.a(") {"));
5193 YP.nl();
5194 foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1)))
5195 {
5196 convertStatementListJavascript(Body, NextLevel);
5197 convertIndentationJavascript(Level);
5198 YP.write(Atom.a("}"));
5199 YP.nl();
5200 convertStatementListJavascript(RestStatements, Level);
5201 return;
5202 }
5203 }
5204 }
5205 {
5206 object Level = arg2;
5207 Variable Expression = new Variable();
5208 Variable RestStatements = new Variable();
5209 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("throw", Expression), RestStatements)))
5210 {
5211 convertIndentationJavascript(Level);
5212 YP.write(Atom.a("throw "));
5213 convertExpressionJavascript(Expression);
5214 YP.write(Atom.a(";"));
5215 YP.nl();
5216 convertStatementListJavascript(RestStatements, Level);
5217 return;
5218 }
5219 }
5220 }
5221
5222 public static void convertIndentationJavascript(object Level)
5223 {
5224 {
5225 Variable N = new Variable();
5226 foreach (bool l2 in YP.unify(N, YP.multiply(Level, 2)))
5227 {
5228 repeatWrite(Atom.a(" "), N);
5229 return;
5230 }
5231 }
5232 }
5233
5234 public static void convertArgListJavascript(object arg1)
5235 {
5236 {
5237 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
5238 {
5239 return;
5240 }
5241 }
5242 {
5243 Variable Head = new Variable();
5244 Variable Tail = new Variable();
5245 foreach (bool l2 in YP.unify(arg1, new ListPair(Head, Tail)))
5246 {
5247 convertExpressionJavascript(Head);
5248 if (YP.termNotEqual(Tail, Atom.NIL))
5249 {
5250 YP.write(Atom.a(", "));
5251 convertArgListJavascript(Tail);
5252 return;
5253 goto cutIf1;
5254 }
5255 convertArgListJavascript(Tail);
5256 return;
5257 cutIf1:
5258 { }
5259 }
5260 }
5261 }
5262
5263 public static void convertExpressionJavascript(object arg1)
5264 {
5265 {
5266 Variable X = new Variable();
5267 foreach (bool l2 in YP.unify(arg1, new Functor1("arg", X)))
5268 {
5269 YP.write(X);
5270 return;
5271 }
5272 }
5273 {
5274 Variable Name = new Variable();
5275 Variable ArgList = new Variable();
5276 foreach (bool l2 in YP.unify(arg1, new Functor2("call", Name, ArgList)))
5277 {
5278 YP.write(Name);
5279 YP.write(Atom.a("("));
5280 convertArgListJavascript(ArgList);
5281 YP.write(Atom.a(")"));
5282 return;
5283 }
5284 }
5285 {
5286 Variable Name = new Variable();
5287 Variable _FunctorArgs = new Variable();
5288 Variable ArgList = new Variable();
5289 foreach (bool l2 in YP.unify(arg1, new Functor3("functorCall", Name, _FunctorArgs, ArgList)))
5290 {
5291 convertExpressionJavascript(new Functor2("call", Name, ArgList));
5292 return;
5293 }
5294 }
5295 {
5296 Variable Obj = new Variable();
5297 Variable Name = new Variable();
5298 Variable ArgList = new Variable();
5299 foreach (bool l2 in YP.unify(arg1, new Functor3("callMember", new Functor1("var", Obj), Name, ArgList)))
5300 {
5301 YP.write(Obj);
5302 YP.write(Atom.a("."));
5303 YP.write(Name);
5304 YP.write(Atom.a("("));
5305 convertArgListJavascript(ArgList);
5306 YP.write(Atom.a(")"));
5307 return;
5308 }
5309 }
5310 {
5311 Variable Name = new Variable();
5312 Variable ArgList = new Variable();
5313 foreach (bool l2 in YP.unify(arg1, new Functor2("new", Name, ArgList)))
5314 {
5315 YP.write(Atom.a("new "));
5316 YP.write(Name);
5317 YP.write(Atom.a("("));
5318 convertArgListJavascript(ArgList);
5319 YP.write(Atom.a(")"));
5320 return;
5321 }
5322 }
5323 {
5324 Variable Name = new Variable();
5325 foreach (bool l2 in YP.unify(arg1, new Functor1("var", Name)))
5326 {
5327 YP.write(Name);
5328 return;
5329 }
5330 }
5331 {
5332 foreach (bool l2 in YP.unify(arg1, Atom.a("null")))
5333 {
5334 YP.write(Atom.a("null"));
5335 return;
5336 }
5337 }
5338 {
5339 Variable X = new Variable();
5340 foreach (bool l2 in YP.unify(arg1, new Functor1("not", X)))
5341 {
5342 YP.write(Atom.a("!("));
5343 convertExpressionJavascript(X);
5344 YP.write(Atom.a(")"));
5345 return;
5346 }
5347 }
5348 {
5349 Variable X = new Variable();
5350 Variable Y = new Variable();
5351 foreach (bool l2 in YP.unify(arg1, new Functor2("and", X, Y)))
5352 {
5353 YP.write(Atom.a("("));
5354 convertExpressionJavascript(X);
5355 YP.write(Atom.a(") && ("));
5356 convertExpressionJavascript(Y);
5357 YP.write(Atom.a(")"));
5358 return;
5359 }
5360 }
5361 {
5362 Variable ArgList = new Variable();
5363 foreach (bool l2 in YP.unify(arg1, new Functor1("objectArray", ArgList)))
5364 {
5365 YP.write(Atom.a("["));
5366 convertArgListJavascript(ArgList);
5367 YP.write(Atom.a("]"));
5368 return;
5369 }
5370 }
5371 {
5372 Variable X = new Variable();
5373 Variable Codes = new Variable();
5374 foreach (bool l2 in YP.unify(arg1, new Functor1("object", X)))
5375 {
5376 if (YP.atom(X))
5377 {
5378 YP.write(Atom.a("\""));
5379 foreach (bool l4 in YP.atom_codes(X, Codes))
5380 {
5381 convertStringCodesJavascript(Codes);
5382 YP.write(Atom.a("\""));
5383 return;
5384 }
5385 }
5386 }
5387 }
5388 {
5389 Variable X = new Variable();
5390 foreach (bool l2 in YP.unify(arg1, new Functor1("object", X)))
5391 {
5392 YP.write(X);
5393 return;
5394 }
5395 }
5396 }
5397
5398 public static void convertStringCodesJavascript(object arg1)
5399 {
5400 {
5401 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
5402 {
5403 return;
5404 }
5405 }
5406 {
5407 Variable Code = new Variable();
5408 Variable RestCodes = new Variable();
5409 foreach (bool l2 in YP.unify(arg1, new ListPair(Code, RestCodes)))
5410 {
5411 foreach (bool l3 in putCStringCode(Code))
5412 {
5413 convertStringCodesJavascript(RestCodes);
5414 return;
5415 }
5416 }
5417 }
5418 }
5419
5420 public static void convertFunctionPython(object arg1)
5421 {
5422 {
5423 foreach (bool l2 in YP.unify(arg1, Atom.a("getDeclaringClass")))
5424 {
5425 YP.write(Atom.a("def getDeclaringClass():"));
5426 YP.nl();
5427 YP.write(Atom.a(" return None"));
5428 YP.nl();
5429 YP.nl();
5430 return;
5431 }
5432 }
5433 {
5434 Variable x1 = new Variable();
5435 Variable Name = new Variable();
5436 Variable ArgList = new Variable();
5437 Variable Body = new Variable();
5438 Variable Level = new Variable();
5439 Variable HasBreakableBlock = new Variable();
5440 foreach (bool l2 in YP.unify(arg1, new Functor("function", new object[] { x1, Name, ArgList, Body })))
5441 {
5442 YP.write(Atom.a("def "));
5443 YP.write(Name);
5444 YP.write(Atom.a("("));
5445 convertArgListPython(ArgList);
5446 YP.write(Atom.a("):"));
5447 YP.nl();
5448 foreach (bool l3 in YP.unify(Level, 1))
5449 {
5450 if (hasBreakableBlockPython(Body))
5451 {
5452 foreach (bool l5 in YP.unify(HasBreakableBlock, 1))
5453 {
5454 if (YP.termEqual(HasBreakableBlock, 1))
5455 {
5456 convertIndentationPython(Level);
5457 YP.write(Atom.a("doBreak = False"));
5458 YP.nl();
5459 foreach (bool l7 in convertStatementListPython(Body, Level, HasBreakableBlock))
5460 {
5461 YP.nl();
5462 return;
5463 }
5464 goto cutIf2;
5465 }
5466 foreach (bool l6 in convertStatementListPython(Body, Level, HasBreakableBlock))
5467 {
5468 YP.nl();
5469 return;
5470 }
5471 cutIf2:
5472 { }
5473 }
5474 goto cutIf1;
5475 }
5476 foreach (bool l4 in YP.unify(HasBreakableBlock, 0))
5477 {
5478 if (YP.termEqual(HasBreakableBlock, 1))
5479 {
5480 convertIndentationPython(Level);
5481 YP.write(Atom.a("doBreak = False"));
5482 YP.nl();
5483 foreach (bool l6 in convertStatementListPython(Body, Level, HasBreakableBlock))
5484 {
5485 YP.nl();
5486 return;
5487 }
5488 goto cutIf3;
5489 }
5490 foreach (bool l5 in convertStatementListPython(Body, Level, HasBreakableBlock))
5491 {
5492 YP.nl();
5493 return;
5494 }
5495 cutIf3:
5496 { }
5497 }
5498 cutIf1:
5499 { }
5500 }
5501 }
5502 }
5503 }
5504
5505 public static bool hasBreakableBlockPython(object arg1)
5506 {
5507 {
5508 Variable _Name = new Variable();
5509 Variable _Body = new Variable();
5510 Variable _RestStatements = new Variable();
5511 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("breakableBlock", _Name, _Body), _RestStatements)))
5512 {
5513 return true;
5514 }
5515 }
5516 {
5517 Variable Body = new Variable();
5518 Variable _RestStatements = new Variable();
5519 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("blockScope", Body), _RestStatements)))
5520 {
5521 if (hasBreakableBlockPython(Body))
5522 {
5523 return true;
5524 }
5525 }
5526 }
5527 {
5528 Variable _Expression = new Variable();
5529 Variable Body = new Variable();
5530 Variable _RestStatements = new Variable();
5531 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("if", _Expression, Body), _RestStatements)))
5532 {
5533 if (hasBreakableBlockPython(Body))
5534 {
5535 return true;
5536 }
5537 }
5538 }
5539 {
5540 Variable _Expression = new Variable();
5541 Variable Body = new Variable();
5542 Variable _RestStatements = new Variable();
5543 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("foreach", _Expression, Body), _RestStatements)))
5544 {
5545 if (hasBreakableBlockPython(Body))
5546 {
5547 return true;
5548 }
5549 }
5550 }
5551 {
5552 Variable x1 = new Variable();
5553 Variable RestStatements = new Variable();
5554 foreach (bool l2 in YP.unify(arg1, new ListPair(x1, RestStatements)))
5555 {
5556 if (hasBreakableBlockPython(RestStatements))
5557 {
5558 return true;
5559 }
5560 }
5561 }
5562 return false;
5563 }
5564
5565 public static IEnumerable<bool> convertStatementListPython(object arg1, object arg2, object arg3)
5566 {
5567 {
5568 object x1 = arg2;
5569 object x2 = arg3;
5570 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
5571 {
5572 yield return true;
5573 yield break;
5574 }
5575 }
5576 {
5577 object Level = arg2;
5578 object HasBreakableBlock = arg3;
5579 Variable Name = new Variable();
5580 Variable Body = new Variable();
5581 Variable RestStatements = new Variable();
5582 Variable NextLevel = new Variable();
5583 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("breakableBlock", Name, Body), RestStatements)))
5584 {
5585 convertIndentationPython(Level);
5586 YP.write(Name);
5587 YP.write(Atom.a(" = False"));
5588 YP.nl();
5589 convertIndentationPython(Level);
5590 YP.write(Atom.a("for _ in [1]:"));
5591 YP.nl();
5592 foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1)))
5593 {
5594 foreach (bool l4 in convertStatementListPython(Body, NextLevel, HasBreakableBlock))
5595 {
5596 convertIndentationPython(Level);
5597 YP.write(Atom.a("if "));
5598 YP.write(Name);
5599 YP.write(Atom.a(":"));
5600 YP.nl();
5601 convertIndentationPython(NextLevel);
5602 YP.write(Atom.a("doBreak = False"));
5603 YP.nl();
5604 convertIndentationPython(Level);
5605 YP.write(Atom.a("if doBreak:"));
5606 YP.nl();
5607 convertIndentationPython(NextLevel);
5608 YP.write(Atom.a("break"));
5609 YP.nl();
5610 foreach (bool l5 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5611 {
5612 yield return true;
5613 yield break;
5614 }
5615 }
5616 }
5617 }
5618 }
5619 {
5620 object Level = arg2;
5621 object HasBreakableBlock = arg3;
5622 Variable _Type = new Variable();
5623 Variable Name = new Variable();
5624 Variable Expression = new Variable();
5625 Variable RestStatements = new Variable();
5626 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3("declare", _Type, Name, Expression), RestStatements)))
5627 {
5628 convertIndentationPython(Level);
5629 YP.write(Name);
5630 YP.write(Atom.a(" = "));
5631 convertExpressionPython(Expression);
5632 YP.nl();
5633 foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5634 {
5635 yield return true;
5636 yield break;
5637 }
5638 }
5639 }
5640 {
5641 object Level = arg2;
5642 object HasBreakableBlock = arg3;
5643 Variable Name = new Variable();
5644 Variable Expression = new Variable();
5645 Variable RestStatements = new Variable();
5646 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("assign", Name, Expression), RestStatements)))
5647 {
5648 convertIndentationPython(Level);
5649 YP.write(Name);
5650 YP.write(Atom.a(" = "));
5651 convertExpressionPython(Expression);
5652 YP.nl();
5653 foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5654 {
5655 yield return true;
5656 yield break;
5657 }
5658 }
5659 }
5660 {
5661 object Level = arg2;
5662 object HasBreakableBlock = arg3;
5663 Variable RestStatements = new Variable();
5664 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("yieldtrue"), RestStatements)))
5665 {
5666 convertIndentationPython(Level);
5667 YP.write(Atom.a("yield True"));
5668 YP.nl();
5669 foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5670 {
5671 yield return true;
5672 yield break;
5673 }
5674 }
5675 }
5676 {
5677 object Level = arg2;
5678 object HasBreakableBlock = arg3;
5679 Variable RestStatements = new Variable();
5680 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("yieldfalse"), RestStatements)))
5681 {
5682 convertIndentationPython(Level);
5683 YP.write(Atom.a("yield False"));
5684 YP.nl();
5685 foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5686 {
5687 yield return true;
5688 yield break;
5689 }
5690 }
5691 }
5692 {
5693 object Level = arg2;
5694 object HasBreakableBlock = arg3;
5695 Variable RestStatements = new Variable();
5696 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("yieldbreak"), RestStatements)))
5697 {
5698 convertIndentationPython(Level);
5699 YP.write(Atom.a("return"));
5700 YP.nl();
5701 foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5702 {
5703 yield return true;
5704 yield break;
5705 }
5706 }
5707 }
5708 {
5709 object Level = arg2;
5710 object HasBreakableBlock = arg3;
5711 Variable RestStatements = new Variable();
5712 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("return"), RestStatements)))
5713 {
5714 convertIndentationPython(Level);
5715 YP.write(Atom.a("return"));
5716 YP.nl();
5717 foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5718 {
5719 yield return true;
5720 yield break;
5721 }
5722 }
5723 }
5724 {
5725 object Level = arg2;
5726 object HasBreakableBlock = arg3;
5727 Variable RestStatements = new Variable();
5728 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("returntrue"), RestStatements)))
5729 {
5730 convertIndentationPython(Level);
5731 YP.write(Atom.a("return True"));
5732 YP.nl();
5733 foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5734 {
5735 yield return true;
5736 yield break;
5737 }
5738 }
5739 }
5740 {
5741 object Level = arg2;
5742 object HasBreakableBlock = arg3;
5743 Variable RestStatements = new Variable();
5744 foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a("returnfalse"), RestStatements)))
5745 {
5746 convertIndentationPython(Level);
5747 YP.write(Atom.a("return False"));
5748 YP.nl();
5749 foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5750 {
5751 yield return true;
5752 yield break;
5753 }
5754 }
5755 }
5756 {
5757 object Level = arg2;
5758 object HasBreakableBlock = arg3;
5759 Variable Name = new Variable();
5760 Variable RestStatements = new Variable();
5761 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("breakBlock", Name), RestStatements)))
5762 {
5763 convertIndentationPython(Level);
5764 YP.write(Name);
5765 YP.write(Atom.a(" = True"));
5766 YP.nl();
5767 convertIndentationPython(Level);
5768 YP.write(Atom.a("doBreak = True"));
5769 YP.nl();
5770 convertIndentationPython(Level);
5771 YP.write(Atom.a("break"));
5772 YP.nl();
5773 foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5774 {
5775 yield return true;
5776 yield break;
5777 }
5778 }
5779 }
5780 {
5781 object Level = arg2;
5782 object HasBreakableBlock = arg3;
5783 Variable Name = new Variable();
5784 Variable ArgList = new Variable();
5785 Variable RestStatements = new Variable();
5786 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("call", Name, ArgList), RestStatements)))
5787 {
5788 convertIndentationPython(Level);
5789 YP.write(Name);
5790 YP.write(Atom.a("("));
5791 convertArgListPython(ArgList);
5792 YP.write(Atom.a(")"));
5793 YP.nl();
5794 foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5795 {
5796 yield return true;
5797 yield break;
5798 }
5799 }
5800 }
5801 {
5802 object Level = arg2;
5803 object HasBreakableBlock = arg3;
5804 Variable Name = new Variable();
5805 Variable _FunctorArgs = new Variable();
5806 Variable ArgList = new Variable();
5807 Variable RestStatements = new Variable();
5808 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3("functorCall", Name, _FunctorArgs, ArgList), RestStatements)))
5809 {
5810 foreach (bool l3 in convertStatementListPython(new ListPair(new Functor2("call", Name, ArgList), RestStatements), Level, HasBreakableBlock))
5811 {
5812 yield return true;
5813 yield break;
5814 }
5815 }
5816 }
5817 {
5818 object Level = arg2;
5819 object HasBreakableBlock = arg3;
5820 Variable Obj = new Variable();
5821 Variable Name = new Variable();
5822 Variable ArgList = new Variable();
5823 Variable RestStatements = new Variable();
5824 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor3("callMember", new Functor1("var", Obj), Name, ArgList), RestStatements)))
5825 {
5826 convertIndentationPython(Level);
5827 YP.write(Obj);
5828 YP.write(Atom.a("."));
5829 YP.write(Name);
5830 YP.write(Atom.a("("));
5831 convertArgListPython(ArgList);
5832 YP.write(Atom.a(")"));
5833 YP.nl();
5834 foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5835 {
5836 yield return true;
5837 yield break;
5838 }
5839 }
5840 }
5841 {
5842 object Level = arg2;
5843 object HasBreakableBlock = arg3;
5844 Variable Body = new Variable();
5845 Variable RestStatements = new Variable();
5846 Variable NextLevel = new Variable();
5847 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("blockScope", Body), RestStatements)))
5848 {
5849 if (YP.termEqual(HasBreakableBlock, 1))
5850 {
5851 convertIndentationPython(Level);
5852 YP.write(Atom.a("for _ in [1]:"));
5853 YP.nl();
5854 foreach (bool l4 in YP.unify(NextLevel, YP.add(Level, 1)))
5855 {
5856 foreach (bool l5 in convertStatementListPython(Body, NextLevel, HasBreakableBlock))
5857 {
5858 if (YP.termEqual(HasBreakableBlock, 1))
5859 {
5860 if (YP.greaterThan(Level, 1))
5861 {
5862 convertIndentationPython(Level);
5863 YP.write(Atom.a("if doBreak:"));
5864 YP.nl();
5865 convertIndentationPython(NextLevel);
5866 YP.write(Atom.a("break"));
5867 YP.nl();
5868 foreach (bool l8 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5869 {
5870 yield return true;
5871 yield break;
5872 }
5873 goto cutIf3;
5874 }
5875 foreach (bool l7 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5876 {
5877 yield return true;
5878 yield break;
5879 }
5880 cutIf3:
5881 goto cutIf2;
5882 }
5883 foreach (bool l6 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5884 {
5885 yield return true;
5886 yield break;
5887 }
5888 cutIf2:
5889 { }
5890 }
5891 }
5892 goto cutIf1;
5893 }
5894 foreach (bool l3 in YP.unify(NextLevel, Level))
5895 {
5896 foreach (bool l4 in convertStatementListPython(Body, NextLevel, HasBreakableBlock))
5897 {
5898 if (YP.termEqual(HasBreakableBlock, 1))
5899 {
5900 if (YP.greaterThan(Level, 1))
5901 {
5902 convertIndentationPython(Level);
5903 YP.write(Atom.a("if doBreak:"));
5904 YP.nl();
5905 convertIndentationPython(NextLevel);
5906 YP.write(Atom.a("break"));
5907 YP.nl();
5908 foreach (bool l7 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5909 {
5910 yield return true;
5911 yield break;
5912 }
5913 goto cutIf5;
5914 }
5915 foreach (bool l6 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5916 {
5917 yield return true;
5918 yield break;
5919 }
5920 cutIf5:
5921 goto cutIf4;
5922 }
5923 foreach (bool l5 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5924 {
5925 yield return true;
5926 yield break;
5927 }
5928 cutIf4:
5929 { }
5930 }
5931 }
5932 cutIf1:
5933 { }
5934 }
5935 }
5936 {
5937 object Level = arg2;
5938 object HasBreakableBlock = arg3;
5939 Variable Expression = new Variable();
5940 Variable Body = new Variable();
5941 Variable RestStatements = new Variable();
5942 Variable NextLevel = new Variable();
5943 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("if", Expression, Body), RestStatements)))
5944 {
5945 convertIndentationPython(Level);
5946 YP.write(Atom.a("if "));
5947 convertExpressionPython(Expression);
5948 YP.write(Atom.a(":"));
5949 YP.nl();
5950 foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1)))
5951 {
5952 foreach (bool l4 in convertStatementListPython(Body, NextLevel, HasBreakableBlock))
5953 {
5954 foreach (bool l5 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5955 {
5956 yield return true;
5957 yield break;
5958 }
5959 }
5960 }
5961 }
5962 }
5963 {
5964 object Level = arg2;
5965 object HasBreakableBlock = arg3;
5966 Variable Expression = new Variable();
5967 Variable Body = new Variable();
5968 Variable RestStatements = new Variable();
5969 Variable NextLevel = new Variable();
5970 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("foreach", Expression, Body), RestStatements)))
5971 {
5972 convertIndentationPython(Level);
5973 YP.write(Atom.a("for l"));
5974 YP.write(Level);
5975 YP.write(Atom.a(" in "));
5976 convertExpressionPython(Expression);
5977 YP.write(Atom.a(":"));
5978 YP.nl();
5979 foreach (bool l3 in YP.unify(NextLevel, YP.add(Level, 1)))
5980 {
5981 foreach (bool l4 in convertStatementListPython(Body, NextLevel, HasBreakableBlock))
5982 {
5983 if (YP.termEqual(HasBreakableBlock, 1))
5984 {
5985 convertIndentationPython(Level);
5986 YP.write(Atom.a("if doBreak:"));
5987 YP.nl();
5988 convertIndentationPython(NextLevel);
5989 YP.write(Atom.a("break"));
5990 YP.nl();
5991 foreach (bool l6 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5992 {
5993 yield return true;
5994 yield break;
5995 }
5996 goto cutIf6;
5997 }
5998 foreach (bool l5 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
5999 {
6000 yield return true;
6001 yield break;
6002 }
6003 cutIf6:
6004 { }
6005 }
6006 }
6007 }
6008 }
6009 {
6010 object Level = arg2;
6011 object HasBreakableBlock = arg3;
6012 Variable Expression = new Variable();
6013 Variable RestStatements = new Variable();
6014 foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor1("throw", Expression), RestStatements)))
6015 {
6016 convertIndentationPython(Level);
6017 YP.write(Atom.a("raise "));
6018 convertExpressionPython(Expression);
6019 YP.nl();
6020 foreach (bool l3 in convertStatementListPython(RestStatements, Level, HasBreakableBlock))
6021 {
6022 yield return true;
6023 yield break;
6024 }
6025 }
6026 }
6027 }
6028
6029 public static void convertIndentationPython(object Level)
6030 {
6031 {
6032 Variable N = new Variable();
6033 foreach (bool l2 in YP.unify(N, YP.multiply(Level, 2)))
6034 {
6035 repeatWrite(Atom.a(" "), N);
6036 return;
6037 }
6038 }
6039 }
6040
6041 public static void convertArgListPython(object arg1)
6042 {
6043 {
6044 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
6045 {
6046 return;
6047 }
6048 }
6049 {
6050 Variable Head = new Variable();
6051 Variable Tail = new Variable();
6052 foreach (bool l2 in YP.unify(arg1, new ListPair(Head, Tail)))
6053 {
6054 convertExpressionPython(Head);
6055 if (YP.termNotEqual(Tail, Atom.NIL))
6056 {
6057 YP.write(Atom.a(", "));
6058 convertArgListPython(Tail);
6059 return;
6060 goto cutIf1;
6061 }
6062 convertArgListPython(Tail);
6063 return;
6064 cutIf1:
6065 { }
6066 }
6067 }
6068 }
6069
6070 public static void convertExpressionPython(object arg1)
6071 {
6072 {
6073 Variable X = new Variable();
6074 foreach (bool l2 in YP.unify(arg1, new Functor1("arg", X)))
6075 {
6076 YP.write(X);
6077 return;
6078 }
6079 }
6080 {
6081 Variable Name = new Variable();
6082 Variable ArgList = new Variable();
6083 foreach (bool l2 in YP.unify(arg1, new Functor2("call", Name, ArgList)))
6084 {
6085 YP.write(Name);
6086 YP.write(Atom.a("("));
6087 convertArgListPython(ArgList);
6088 YP.write(Atom.a(")"));
6089 return;
6090 }
6091 }
6092 {
6093 Variable Name = new Variable();
6094 Variable _FunctorArgs = new Variable();
6095 Variable ArgList = new Variable();
6096 foreach (bool l2 in YP.unify(arg1, new Functor3("functorCall", Name, _FunctorArgs, ArgList)))
6097 {
6098 convertExpressionPython(new Functor2("call", Name, ArgList));
6099 return;
6100 }
6101 }
6102 {
6103 Variable Obj = new Variable();
6104 Variable Name = new Variable();
6105 Variable ArgList = new Variable();
6106 foreach (bool l2 in YP.unify(arg1, new Functor3("callMember", new Functor1("var", Obj), Name, ArgList)))
6107 {
6108 YP.write(Obj);
6109 YP.write(Atom.a("."));
6110 YP.write(Name);
6111 YP.write(Atom.a("("));
6112 convertArgListPython(ArgList);
6113 YP.write(Atom.a(")"));
6114 return;
6115 }
6116 }
6117 {
6118 Variable Name = new Variable();
6119 Variable ArgList = new Variable();
6120 foreach (bool l2 in YP.unify(arg1, new Functor2("new", Name, ArgList)))
6121 {
6122 YP.write(Name);
6123 YP.write(Atom.a("("));
6124 convertArgListPython(ArgList);
6125 YP.write(Atom.a(")"));
6126 return;
6127 }
6128 }
6129 {
6130 Variable Name = new Variable();
6131 foreach (bool l2 in YP.unify(arg1, new Functor1("var", Name)))
6132 {
6133 YP.write(Name);
6134 return;
6135 }
6136 }
6137 {
6138 foreach (bool l2 in YP.unify(arg1, Atom.a("null")))
6139 {
6140 YP.write(Atom.a("None"));
6141 return;
6142 }
6143 }
6144 {
6145 Variable X = new Variable();
6146 foreach (bool l2 in YP.unify(arg1, new Functor1("not", X)))
6147 {
6148 YP.write(Atom.a("not ("));
6149 convertExpressionPython(X);
6150 YP.write(Atom.a(")"));
6151 return;
6152 }
6153 }
6154 {
6155 Variable X = new Variable();
6156 Variable Y = new Variable();
6157 foreach (bool l2 in YP.unify(arg1, new Functor2("and", X, Y)))
6158 {
6159 YP.write(Atom.a("("));
6160 convertExpressionPython(X);
6161 YP.write(Atom.a(") and ("));
6162 convertExpressionPython(Y);
6163 YP.write(Atom.a(")"));
6164 return;
6165 }
6166 }
6167 {
6168 Variable ArgList = new Variable();
6169 foreach (bool l2 in YP.unify(arg1, new Functor1("objectArray", ArgList)))
6170 {
6171 YP.write(Atom.a("["));
6172 convertArgListPython(ArgList);
6173 YP.write(Atom.a("]"));
6174 return;
6175 }
6176 }
6177 {
6178 Variable X = new Variable();
6179 Variable Codes = new Variable();
6180 foreach (bool l2 in YP.unify(arg1, new Functor1("object", X)))
6181 {
6182 if (YP.atom(X))
6183 {
6184 YP.write(Atom.a("\""));
6185 foreach (bool l4 in YP.atom_codes(X, Codes))
6186 {
6187 convertStringCodesPython(Codes);
6188 YP.write(Atom.a("\""));
6189 return;
6190 }
6191 }
6192 }
6193 }
6194 {
6195 Variable X = new Variable();
6196 foreach (bool l2 in YP.unify(arg1, new Functor1("object", X)))
6197 {
6198 YP.write(X);
6199 return;
6200 }
6201 }
6202 }
6203
6204 public static void convertStringCodesPython(object arg1)
6205 {
6206 {
6207 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
6208 {
6209 return;
6210 }
6211 }
6212 {
6213 Variable Code = new Variable();
6214 Variable RestCodes = new Variable();
6215 foreach (bool l2 in YP.unify(arg1, new ListPair(Code, RestCodes)))
6216 {
6217 if (YP.termEqual(Code, 34))
6218 {
6219 YP.put_code(92);
6220 YP.put_code(Code);
6221 convertStringCodesPython(RestCodes);
6222 return;
6223 goto cutIf1;
6224 }
6225 if (YP.termEqual(Code, 92))
6226 {
6227 YP.put_code(92);
6228 YP.put_code(Code);
6229 convertStringCodesPython(RestCodes);
6230 return;
6231 goto cutIf1;
6232 }
6233 YP.put_code(Code);
6234 convertStringCodesPython(RestCodes);
6235 return;
6236 cutIf1:
6237 { }
6238 }
6239 }
6240 }
6241
6242 public static IEnumerable<bool> putCStringCode(object Code)
6243 {
6244 {
6245 Variable HexDigit = new Variable();
6246 Variable HexChar = new Variable();
6247 if (YP.lessThanOrEqual(Code, 31))
6248 {
6249 if (YP.lessThanOrEqual(Code, 15))
6250 {
6251 YP.write(Atom.a("\\u000"));
6252 foreach (bool l4 in YP.unify(HexDigit, Code))
6253 {
6254 if (YP.lessThanOrEqual(HexDigit, 9))
6255 {
6256 foreach (bool l6 in YP.unify(HexChar, YP.add(HexDigit, 48)))
6257 {
6258 YP.put_code(HexChar);
6259 yield return true;
6260 yield break;
6261 }
6262 goto cutIf2;
6263 }
6264 foreach (bool l5 in YP.unify(HexChar, YP.add(HexDigit, 55)))
6265 {
6266 YP.put_code(HexChar);
6267 yield return true;
6268 yield break;
6269 }
6270 cutIf2:
6271 { }
6272 }
6273 goto cutIf1;
6274 }
6275 YP.write(Atom.a("\\u001"));
6276 foreach (bool l3 in YP.unify(HexDigit, YP.subtract(Code, 16)))
6277 {
6278 if (YP.lessThanOrEqual(HexDigit, 9))
6279 {
6280 foreach (bool l5 in YP.unify(HexChar, YP.add(HexDigit, 48)))
6281 {
6282 YP.put_code(HexChar);
6283 yield return true;
6284 yield break;
6285 }
6286 goto cutIf3;
6287 }
6288 foreach (bool l4 in YP.unify(HexChar, YP.add(HexDigit, 55)))
6289 {
6290 YP.put_code(HexChar);
6291 yield return true;
6292 yield break;
6293 }
6294 cutIf3:
6295 { }
6296 }
6297 cutIf1:
6298 { }
6299 }
6300 }
6301 {
6302 if (YP.termEqual(Code, 34))
6303 {
6304 YP.put_code(92);
6305 YP.put_code(34);
6306 yield return true;
6307 yield break;
6308 }
6309 }
6310 {
6311 if (YP.termEqual(Code, 92))
6312 {
6313 YP.put_code(92);
6314 YP.put_code(92);
6315 yield return true;
6316 yield break;
6317 }
6318 }
6319 {
6320 YP.put_code(Code);
6321 yield return true;
6322 yield break;
6323 }
6324 }
6325
6326 public static IEnumerable<bool> member(object X, object arg2)
6327 {
6328 {
6329 Variable x2 = new Variable();
6330 foreach (bool l2 in YP.unify(arg2, new ListPair(X, x2)))
6331 {
6332 yield return false;
6333 }
6334 }
6335 {
6336 Variable x2 = new Variable();
6337 Variable Rest = new Variable();
6338 foreach (bool l2 in YP.unify(arg2, new ListPair(x2, Rest)))
6339 {
6340 foreach (bool l3 in member(X, Rest))
6341 {
6342 yield return false;
6343 }
6344 }
6345 }
6346 }
6347
6348 public static IEnumerable<bool> append(object arg1, object arg2, object arg3)
6349 {
6350 {
6351 Variable List = new Variable();
6352 foreach (bool l2 in YP.unify(arg1, Atom.NIL))
6353 {
6354 foreach (bool l3 in YP.unify(arg2, List))
6355 {
6356 foreach (bool l4 in YP.unify(arg3, List))
6357 {
6358 yield return false;
6359 }
6360 }
6361 }
6362 }
6363 {
6364 object List2 = arg2;
6365 Variable X = new Variable();
6366 Variable List1 = new Variable();
6367 Variable List12 = new Variable();
6368 foreach (bool l2 in YP.unify(arg1, new ListPair(X, List1)))
6369 {
6370 foreach (bool l3 in YP.unify(arg3, new ListPair(X, List12)))
6371 {
6372 foreach (bool l4 in append(List1, List2, List12))
6373 {
6374 yield return false;
6375 }
6376 }
6377 }
6378 }
6379 }
6380 #pragma warning restore 0168, 0219, 0164,0162
6381 }
6382}
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
index 6aa717d..4e0c273 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
@@ -162,7 +162,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
162 m_braceCount++; 162 m_braceCount++;
163 163
164 // line number 164 // line number
165 m_CSharpLine += 3; 165 m_CSharpLine += 9;
166 166
167 // here's the payload 167 // here's the payload
168 retstr += GenerateLine(); 168 retstr += GenerateLine();
@@ -626,11 +626,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
626 string labelStatement; 626 string labelStatement;
627 627
628 if (m_insertCoopTerminationChecks) 628 if (m_insertCoopTerminationChecks)
629 labelStatement = m_coopTerminationCheck + "\n"; 629 labelStatement = m_coopTerminationCheck;
630 else 630 else
631 labelStatement = "NoOp();\n"; 631 labelStatement = "NoOp();";
632 632
633 return Generate(String.Format("{0}: ", CheckName(jl.LabelName)), jl) + labelStatement; 633 return GenerateLine(String.Format("{0}: {1}", CheckName(jl.LabelName), labelStatement), jl);
634 } 634 }
635 635
636 /// <summary> 636 /// <summary>
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
index a1b8d85..af324bf 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
@@ -58,9 +58,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
58 { 58 {
59 lsl = 0, 59 lsl = 0,
60 cs = 1, 60 cs = 1,
61 vb = 2, 61 vb = 2
62 js = 3,
63 yp = 4
64 } 62 }
65 63
66 /// <summary> 64 /// <summary>
@@ -85,9 +83,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
85 83
86 private static CSharpCodeProvider CScodeProvider = new CSharpCodeProvider(); 84 private static CSharpCodeProvider CScodeProvider = new CSharpCodeProvider();
87 private static VBCodeProvider VBcodeProvider = new VBCodeProvider(); 85 private static VBCodeProvider VBcodeProvider = new VBCodeProvider();
88// private static JScriptCodeProvider JScodeProvider = new JScriptCodeProvider();
89 private static CSharpCodeProvider YPcodeProvider = new CSharpCodeProvider(); // YP is translated into CSharp
90 private static YP2CSConverter YP_Converter = new YP2CSConverter();
91 86
92 // private static int instanceID = new Random().Next(0, int.MaxValue); // Unique number to use on our compiled files 87 // private static int instanceID = new Random().Next(0, int.MaxValue); // Unique number to use on our compiled files
93 private static UInt64 scriptCompileCounter = 0; // And a counter 88 private static UInt64 scriptCompileCounter = 0; // And a counter
@@ -123,7 +118,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
123 if (in_startup) 118 if (in_startup)
124 { 119 {
125 in_startup = false; 120 in_startup = false;
126 CreateScriptsDirectory(); 121 CheckOrCreateScriptsDirectory();
127 122
128 // First time we start? Delete old files 123 // First time we start? Delete old files
129 if (DeleteScriptsOnStartup) 124 if (DeleteScriptsOnStartup)
@@ -134,8 +129,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
134 LanguageMapping.Add(enumCompileType.cs.ToString(), enumCompileType.cs); 129 LanguageMapping.Add(enumCompileType.cs.ToString(), enumCompileType.cs);
135 LanguageMapping.Add(enumCompileType.vb.ToString(), enumCompileType.vb); 130 LanguageMapping.Add(enumCompileType.vb.ToString(), enumCompileType.vb);
136 LanguageMapping.Add(enumCompileType.lsl.ToString(), enumCompileType.lsl); 131 LanguageMapping.Add(enumCompileType.lsl.ToString(), enumCompileType.lsl);
137 LanguageMapping.Add(enumCompileType.js.ToString(), enumCompileType.js);
138 LanguageMapping.Add(enumCompileType.yp.ToString(), enumCompileType.yp);
139 132
140 // Allowed compilers 133 // Allowed compilers
141 string allowComp = m_scriptEngine.Config.GetString("AllowedCompilers", "lsl"); 134 string allowComp = m_scriptEngine.Config.GetString("AllowedCompilers", "lsl");
@@ -192,13 +185,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
192 } 185 }
193 186
194 // We now have an allow-list, a mapping list, and a default language 187 // We now have an allow-list, a mapping list, and a default language
195
196 } 188 }
197 189
198 /// <summary> 190 /// <summary>
199 /// Create the directory where compiled scripts are stored. 191 /// Create the directory where compiled scripts are stored if it does not already exist.
200 /// </summary> 192 /// </summary>
201 private void CreateScriptsDirectory() 193 private void CheckOrCreateScriptsDirectory()
202 { 194 {
203 if (!Directory.Exists(ScriptEnginesPath)) 195 if (!Directory.Exists(ScriptEnginesPath))
204 { 196 {
@@ -288,15 +280,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
288 return GetCompilerOutput(assetID.ToString()); 280 return GetCompilerOutput(assetID.ToString());
289 } 281 }
290 282
291 /// <summary> 283 public void PerformScriptCompile(
292 /// Converts script from LSL to CS and calls CompileFromCSText 284 string source, string asset, UUID ownerUUID,
293 /// </summary> 285 out string assembly, out Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap)
294 /// <param name="Script">LSL script</param> 286 {
295 /// <returns>Filename to .dll assembly</returns> 287 PerformScriptCompile(source, asset, ownerUUID, false, out assembly, out linemap);
296 public void PerformScriptCompile(string Script, string asset, UUID ownerUUID, 288 }
289
290 public void PerformScriptCompile(
291 string source, string asset, UUID ownerUUID, bool alwaysRecompile,
297 out string assembly, out Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap) 292 out string assembly, out Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap)
298 { 293 {
299// m_log.DebugFormat("[Compiler]: Compiling script\n{0}", Script); 294// m_log.DebugFormat("[Compiler]: Checking script for asset {0} in {1}\n{2}", asset, m_scriptEngine.World.Name, source);
300 295
301 IScriptModuleComms comms = m_scriptEngine.World.RequestModuleInterface<IScriptModuleComms>(); 296 IScriptModuleComms comms = m_scriptEngine.World.RequestModuleInterface<IScriptModuleComms>();
302 297
@@ -305,33 +300,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
305 300
306 assembly = GetCompilerOutput(asset); 301 assembly = GetCompilerOutput(asset);
307 302
308 if (!Directory.Exists(ScriptEnginesPath)) 303// m_log.DebugFormat("[Compiler]: Retrieved assembly {0} for asset {1} in {2}", assembly, asset, m_scriptEngine.World.Name);
309 {
310 try
311 {
312 Directory.CreateDirectory(ScriptEnginesPath);
313 }
314 catch (Exception)
315 {
316 }
317 }
318 304
319 if (!Directory.Exists(Path.Combine(ScriptEnginesPath, 305 CheckOrCreateScriptsDirectory();
320 m_scriptEngine.World.RegionInfo.RegionID.ToString())))
321 {
322 try
323 {
324 Directory.CreateDirectory(ScriptEnginesPath);
325 }
326 catch (Exception)
327 {
328 }
329 }
330 306
331 // Don't recompile if we already have it 307 // Don't recompile if we're not forced to and we already have it
332 // Performing 3 file exists tests for every script can still be slow 308 // Performing 3 file exists tests for every script can still be slow
333 if (File.Exists(assembly) && File.Exists(assembly + ".text") && File.Exists(assembly + ".map")) 309 if (!alwaysRecompile && File.Exists(assembly) && File.Exists(assembly + ".text") && File.Exists(assembly + ".map"))
334 { 310 {
311// m_log.DebugFormat("[Compiler]: Found existing assembly {0} for asset {1} in {2}", assembly, asset, m_scriptEngine.World.Name);
312
335 // If we have already read this linemap file, then it will be in our dictionary. 313 // If we have already read this linemap file, then it will be in our dictionary.
336 // Don't build another copy of the dictionary (saves memory) and certainly 314 // Don't build another copy of the dictionary (saves memory) and certainly
337 // don't keep reading the same file from disk multiple times. 315 // don't keep reading the same file from disk multiple times.
@@ -341,31 +319,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
341 return; 319 return;
342 } 320 }
343 321
344 if (Script == String.Empty) 322// m_log.DebugFormat("[Compiler]: Compiling assembly {0} for asset {1} in {2}", assembly, asset, m_scriptEngine.World.Name);
345 { 323
324 if (source == String.Empty)
346 throw new Exception("Cannot find script assembly and no script text present"); 325 throw new Exception("Cannot find script assembly and no script text present");
347 }
348 326
349 enumCompileType language = DefaultCompileLanguage; 327 enumCompileType language = DefaultCompileLanguage;
350 328
351 if (Script.StartsWith("//c#", true, CultureInfo.InvariantCulture)) 329 if (source.StartsWith("//c#", true, CultureInfo.InvariantCulture))
352 language = enumCompileType.cs; 330 language = enumCompileType.cs;
353 if (Script.StartsWith("//vb", true, CultureInfo.InvariantCulture)) 331 if (source.StartsWith("//vb", true, CultureInfo.InvariantCulture))
354 { 332 {
355 language = enumCompileType.vb; 333 language = enumCompileType.vb;
356 // We need to remove //vb, it won't compile with that 334 // We need to remove //vb, it won't compile with that
357 335
358 Script = Script.Substring(4, Script.Length - 4); 336 source = source.Substring(4, source.Length - 4);
359 } 337 }
360 if (Script.StartsWith("//lsl", true, CultureInfo.InvariantCulture)) 338 if (source.StartsWith("//lsl", true, CultureInfo.InvariantCulture))
361 language = enumCompileType.lsl; 339 language = enumCompileType.lsl;
362 340
363 if (Script.StartsWith("//js", true, CultureInfo.InvariantCulture))
364 language = enumCompileType.js;
365
366 if (Script.StartsWith("//yp", true, CultureInfo.InvariantCulture))
367 language = enumCompileType.yp;
368
369// m_log.DebugFormat("[Compiler]: Compile language is {0}", language); 341// m_log.DebugFormat("[Compiler]: Compile language is {0}", language);
370 342
371 if (!AllowedCompilers.ContainsKey(language.ToString())) 343 if (!AllowedCompilers.ContainsKey(language.ToString()))
@@ -384,13 +356,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
384 throw new Exception(errtext); 356 throw new Exception(errtext);
385 } 357 }
386 358
387 string compileScript = Script; 359 string compileScript = source;
388 360
389 if (language == enumCompileType.lsl) 361 if (language == enumCompileType.lsl)
390 { 362 {
391 // Its LSL, convert it to C# 363 // Its LSL, convert it to C#
392 LSL_Converter = (ICodeConverter)new CSCodeGenerator(comms, m_insertCoopTerminationCalls); 364 LSL_Converter = (ICodeConverter)new CSCodeGenerator(comms, m_insertCoopTerminationCalls);
393 compileScript = LSL_Converter.Convert(Script); 365 compileScript = LSL_Converter.Convert(source);
394 366
395 // copy converter warnings into our warnings. 367 // copy converter warnings into our warnings.
396 foreach (string warning in LSL_Converter.GetWarnings()) 368 foreach (string warning in LSL_Converter.GetWarnings())
@@ -404,12 +376,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
404 WriteMapFile(assembly + ".map", linemap); 376 WriteMapFile(assembly + ".map", linemap);
405 } 377 }
406 378
407 if (language == enumCompileType.yp)
408 {
409 // Its YP, convert it to C#
410 compileScript = YP_Converter.Convert(Script);
411 }
412
413 switch (language) 379 switch (language)
414 { 380 {
415 case enumCompileType.cs: 381 case enumCompileType.cs:
@@ -424,13 +390,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
424 compileScript = CreateVBCompilerScript( 390 compileScript = CreateVBCompilerScript(
425 compileScript, m_scriptEngine.ScriptClassName, m_scriptEngine.ScriptBaseClassName); 391 compileScript, m_scriptEngine.ScriptClassName, m_scriptEngine.ScriptBaseClassName);
426 break; 392 break;
427// case enumCompileType.js:
428// compileScript = CreateJSCompilerScript(compileScript, m_scriptEngine.ScriptBaseClassName);
429// break;
430 case enumCompileType.yp:
431 compileScript = CreateYPCompilerScript(
432 compileScript, m_scriptEngine.ScriptClassName,m_scriptEngine.ScriptBaseClassName);
433 break;
434 } 393 }
435 394
436 assembly = CompileFromDotNetText(compileScript, language, asset, assembly); 395 assembly = CompileFromDotNetText(compileScript, language, asset, assembly);
@@ -460,7 +419,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
460// return compileScript; 419// return compileScript;
461// } 420// }
462 421
463 private static string CreateCSCompilerScript( 422 public static string CreateCSCompilerScript(
464 string compileScript, string className, string baseClassName, ParameterInfo[] constructorParameters) 423 string compileScript, string className, string baseClassName, ParameterInfo[] constructorParameters)
465 { 424 {
466 compileScript = string.Format( 425 compileScript = string.Format(
@@ -488,23 +447,7 @@ namespace SecondLife
488 return compileScript; 447 return compileScript;
489 } 448 }
490 449
491 private static string CreateYPCompilerScript(string compileScript, string className, string baseClassName) 450 public static string CreateVBCompilerScript(string compileScript, string className, string baseClassName)
492 {
493 compileScript = String.Empty +
494 "using OpenSim.Region.ScriptEngine.Shared.YieldProlog; " +
495 "using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\r\n" +
496 String.Empty + "namespace SecondLife { " +
497 String.Empty + "public class " + className + " : " + baseClassName + " { \r\n" +
498 //@"public Script() { } " +
499 @"static OpenSim.Region.ScriptEngine.Shared.YieldProlog.YP YP=null; " +
500 @"public " + className + "() { YP= new OpenSim.Region.ScriptEngine.Shared.YieldProlog.YP(); } " +
501 compileScript +
502 "} }\r\n";
503
504 return compileScript;
505 }
506
507 private static string CreateVBCompilerScript(string compileScript, string className, string baseClassName)
508 { 451 {
509 compileScript = String.Empty + 452 compileScript = String.Empty +
510 "Imports OpenSim.Region.ScriptEngine.Shared: Imports System.Collections.Generic: " + 453 "Imports OpenSim.Region.ScriptEngine.Shared: Imports System.Collections.Generic: " +
@@ -532,7 +475,11 @@ namespace SecondLife
532 scriptCompileCounter++; 475 scriptCompileCounter++;
533 try 476 try
534 { 477 {
535 File.Delete(assembly); 478 if (File.Exists(assembly))
479 {
480 File.SetAttributes(assembly, FileAttributes.Normal);
481 File.Delete(assembly);
482 }
536 } 483 }
537 catch (Exception e) // NOTLEGIT - Should be just FileIOException 484 catch (Exception e) // NOTLEGIT - Should be just FileIOException
538 { 485 {
@@ -580,12 +527,6 @@ namespace SecondLife
580 m_scriptEngine.ScriptReferencedAssemblies, 527 m_scriptEngine.ScriptReferencedAssemblies,
581 a => parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, a))); 528 a => parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, a)));
582 529
583 if (lang == enumCompileType.yp)
584 {
585 parameters.ReferencedAssemblies.Add(Path.Combine(rootPath,
586 "OpenSim.Region.ScriptEngine.Shared.YieldProlog.dll"));
587 }
588
589 parameters.GenerateExecutable = false; 530 parameters.GenerateExecutable = false;
590 parameters.OutputAssembly = assembly; 531 parameters.OutputAssembly = assembly;
591 parameters.IncludeDebugInformation = CompileWithDebugInformation; 532 parameters.IncludeDebugInformation = CompileWithDebugInformation;
@@ -635,14 +576,6 @@ namespace SecondLife
635 } 576 }
636 } while (!complete); 577 } while (!complete);
637 break; 578 break;
638// case enumCompileType.js:
639// results = JScodeProvider.CompileAssemblyFromSource(
640// parameters, Script);
641// break;
642 case enumCompileType.yp:
643 results = YPcodeProvider.CompileAssemblyFromSource(
644 parameters, Script);
645 break;
646 default: 579 default:
647 throw new Exception("Compiler is not able to recongnize " + 580 throw new Exception("Compiler is not able to recongnize " +
648 "language type \"" + lang.ToString() + "\""); 581 "language type \"" + lang.ToString() + "\"");
@@ -740,9 +673,8 @@ namespace SecondLife
740 673
741 try 674 try
742 { 675 {
743 FileStream fs = File.Open(assembly, FileMode.Open, FileAccess.Read); 676 using (FileStream fs = File.Open(assembly, FileMode.Open, FileAccess.Read))
744 fs.Read(data, 0, data.Length); 677 fs.Read(data, 0, data.Length);
745 fs.Close();
746 } 678 }
747 catch (Exception) 679 catch (Exception)
748 { 680 {
@@ -757,19 +689,19 @@ namespace SecondLife
757 689
758 Byte[] buf = Encoding.ASCII.GetBytes(filetext); 690 Byte[] buf = Encoding.ASCII.GetBytes(filetext);
759 691
760 FileStream sfs = File.Create(assembly + ".text"); 692 using (FileStream sfs = File.Create(assembly + ".text"))
761 sfs.Write(buf, 0, buf.Length); 693 sfs.Write(buf, 0, buf.Length);
762 sfs.Close();
763 694
764 return assembly; 695 return assembly;
765 } 696 }
766 697
767 private class kvpSorter : IComparer<KeyValuePair<int, int>> 698 private class kvpSorter : IComparer<KeyValuePair<KeyValuePair<int, int>, KeyValuePair<int, int>>>
768 { 699 {
769 public int Compare(KeyValuePair<int, int> a, 700 public int Compare(KeyValuePair<KeyValuePair<int, int>, KeyValuePair<int, int>> a,
770 KeyValuePair<int, int> b) 701 KeyValuePair<KeyValuePair<int, int>, KeyValuePair<int, int>> b)
771 { 702 {
772 return a.Key.CompareTo(b.Key); 703 int kc = a.Key.Key.CompareTo(b.Key.Key);
704 return (kc != 0) ? kc : a.Key.Value.CompareTo(b.Key.Value);
773 } 705 }
774 } 706 }
775 707
@@ -786,30 +718,46 @@ namespace SecondLife
786 out ret)) 718 out ret))
787 return ret; 719 return ret;
788 720
789 List<KeyValuePair<int, int>> sorted = 721 var sorted = new List<KeyValuePair<KeyValuePair<int, int>, KeyValuePair<int, int>>>(positionMap);
790 new List<KeyValuePair<int, int>>(positionMap.Keys);
791 722
792 sorted.Sort(new kvpSorter()); 723 sorted.Sort(new kvpSorter());
793 724
794 int l = 1; 725 int l = 1;
795 int c = 1; 726 int c = 1;
727 int pl = 1;
796 728
797 foreach (KeyValuePair<int, int> cspos in sorted) 729 foreach (KeyValuePair<KeyValuePair<int, int>, KeyValuePair<int, int>> posmap in sorted)
798 { 730 {
799 if (cspos.Key >= line) 731 //m_log.DebugFormat("[Compiler]: Scanning line map {0},{1} --> {2},{3}", posmap.Key.Key, posmap.Key.Value, posmap.Value.Key, posmap.Value.Value);
732 int nl = posmap.Value.Key + line - posmap.Key.Key; // New, translated LSL line and column.
733 int nc = posmap.Value.Value + col - posmap.Key.Value;
734 // Keep going until we find the first point passed line,col.
735 if (posmap.Key.Key > line)
800 { 736 {
801 if (cspos.Key > line) 737 //m_log.DebugFormat("[Compiler]: Line is larger than requested {0},{1}, returning {2},{3}", line, col, l, c);
802 return new KeyValuePair<int, int>(l, c); 738 if (pl < line)
803 if (cspos.Value > col) 739 {
804 return new KeyValuePair<int, int>(l, c); 740 //m_log.DebugFormat("[Compiler]: Previous line ({0}) is less than requested line ({1}), setting column to 1.", pl, line);
805 c = cspos.Value; 741 c = 1;
806 if (c == 0) 742 }
807 c++; 743 break;
808 } 744 }
809 else 745 if (posmap.Key.Key == line && posmap.Key.Value > col)
810 { 746 {
811 l = cspos.Key; 747 // Never move l,c backwards.
748 if (nl > l || (nl == l && nc > c))
749 {
750 //m_log.DebugFormat("[Compiler]: Using offset relative to this: {0} + {1} - {2}, {3} + {4} - {5} = {6}, {7}",
751 // posmap.Value.Key, line, posmap.Key.Key, posmap.Value.Value, col, posmap.Key.Value, nl, nc);
752 l = nl;
753 c = nc;
754 }
755 //m_log.DebugFormat("[Compiler]: Column is larger than requested {0},{1}, returning {2},{3}", line, col, l, c);
756 break;
812 } 757 }
758 pl = posmap.Key.Key;
759 l = posmap.Value.Key;
760 c = posmap.Value.Value;
813 } 761 }
814 return new KeyValuePair<int, int>(l, c); 762 return new KeyValuePair<int, int>(l, c);
815 } 763 }
@@ -835,7 +783,6 @@ namespace SecondLife
835 return message; 783 return message;
836 } 784 }
837 785
838
839 private static void WriteMapFile(string filename, Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap) 786 private static void WriteMapFile(string filename, Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap)
840 { 787 {
841 string mapstring = String.Empty; 788 string mapstring = String.Empty;
@@ -847,40 +794,42 @@ namespace SecondLife
847 } 794 }
848 795
849 Byte[] mapbytes = Encoding.ASCII.GetBytes(mapstring); 796 Byte[] mapbytes = Encoding.ASCII.GetBytes(mapstring);
850 FileStream mfs = File.Create(filename);
851 mfs.Write(mapbytes, 0, mapbytes.Length);
852 mfs.Close();
853 }
854 797
798 using (FileStream mfs = File.Create(filename))
799 mfs.Write(mapbytes, 0, mapbytes.Length);
800 }
855 801
856 private static Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> ReadMapFile(string filename) 802 private static Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> ReadMapFile(string filename)
857 { 803 {
858 Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap; 804 Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap;
859 try 805 try
860 { 806 {
861 StreamReader r = File.OpenText(filename); 807 using (StreamReader r = File.OpenText(filename))
862 linemap = new Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>>();
863
864 string line;
865 while ((line = r.ReadLine()) != null)
866 { 808 {
867 String[] parts = line.Split(new Char[] { ',' }); 809 linemap = new Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>>();
868 int kk = System.Convert.ToInt32(parts[0]);
869 int kv = System.Convert.ToInt32(parts[1]);
870 int vk = System.Convert.ToInt32(parts[2]);
871 int vv = System.Convert.ToInt32(parts[3]);
872 810
873 KeyValuePair<int, int> k = new KeyValuePair<int, int>(kk, kv); 811 string line;
874 KeyValuePair<int, int> v = new KeyValuePair<int, int>(vk, vv); 812 while ((line = r.ReadLine()) != null)
813 {
814 String[] parts = line.Split(new Char[] { ',' });
815 int kk = System.Convert.ToInt32(parts[0]);
816 int kv = System.Convert.ToInt32(parts[1]);
817 int vk = System.Convert.ToInt32(parts[2]);
818 int vv = System.Convert.ToInt32(parts[3]);
875 819
876 linemap[k] = v; 820 KeyValuePair<int, int> k = new KeyValuePair<int, int>(kk, kv);
821 KeyValuePair<int, int> v = new KeyValuePair<int, int>(vk, vv);
822
823 linemap[k] = v;
824 }
877 } 825 }
878 } 826 }
879 catch 827 catch
880 { 828 {
881 linemap = new Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>>(); 829 linemap = new Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>>();
882 } 830 }
831
883 return linemap; 832 return linemap;
884 } 833 }
885 } 834 }
886} 835} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Properties/AssemblyInfo.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Properties/AssemblyInfo.cs
index d163438..4df09ef 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.8.0.*")] 32[assembly: AssemblyVersion("0.8.2.*")]
33 33
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs
index 05a8756..b476e32 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CompilerTest.cs
@@ -25,12 +25,14 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
28using System.IO; 29using System.IO;
29using System.CodeDom.Compiler; 30using System.CodeDom.Compiler;
30using System.Collections.Generic; 31using System.Collections.Generic;
31using Microsoft.CSharp; 32using Microsoft.CSharp;
32using NUnit.Framework; 33using NUnit.Framework;
33using OpenSim.Region.ScriptEngine.Shared.CodeTools; 34using OpenSim.Region.ScriptEngine.Shared.CodeTools;
35using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
34using OpenSim.Tests.Common; 36using OpenSim.Tests.Common;
35 37
36namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests 38namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
@@ -46,7 +48,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
46 private string m_testDir; 48 private string m_testDir;
47 private CSharpCodeProvider m_CSCodeProvider; 49 private CSharpCodeProvider m_CSCodeProvider;
48 private CompilerParameters m_compilerParameters; 50 private CompilerParameters m_compilerParameters;
49 private CompilerResults m_compilerResults; 51 // private CompilerResults m_compilerResults;
52 private ResolveEventHandler m_resolveEventHandler;
50 53
51 /// <summary> 54 /// <summary>
52 /// Creates a temporary directory where build artifacts are stored. 55 /// Creates a temporary directory where build artifacts are stored.
@@ -61,14 +64,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
61 // Create the temporary directory for housing build artifacts. 64 // Create the temporary directory for housing build artifacts.
62 Directory.CreateDirectory(m_testDir); 65 Directory.CreateDirectory(m_testDir);
63 } 66 }
67 }
68
69 [SetUp]
70 public override void SetUp()
71 {
72 base.SetUp();
64 73
65 // Create a CSCodeProvider and CompilerParameters. 74 // Create a CSCodeProvider and CompilerParameters.
66 m_CSCodeProvider = new CSharpCodeProvider(); 75 m_CSCodeProvider = new CSharpCodeProvider();
67 m_compilerParameters = new CompilerParameters(); 76 m_compilerParameters = new CompilerParameters();
68 77
69 string rootPath = Path.Combine(Path.GetDirectoryName(System.AppDomain.CurrentDomain.BaseDirectory), "bin"); 78 string rootPath = System.AppDomain.CurrentDomain.BaseDirectory;
79
80 m_resolveEventHandler = new ResolveEventHandler(AssemblyResolver.OnAssemblyResolve);
81
82 System.AppDomain.CurrentDomain.AssemblyResolve += m_resolveEventHandler;
83
70 m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.dll")); 84 m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.dll"));
71 m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.Api.Runtime.dll")); 85 m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.Api.Runtime.dll"));
86 m_compilerParameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenMetaverseTypes.dll"));
72 m_compilerParameters.GenerateExecutable = false; 87 m_compilerParameters.GenerateExecutable = false;
73 } 88 }
74 89
@@ -76,9 +91,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
76 /// Removes the temporary build directory and any build artifacts 91 /// Removes the temporary build directory and any build artifacts
77 /// inside it. 92 /// inside it.
78 /// </summary> 93 /// </summary>
79 [TestFixtureTearDown] 94 [TearDown]
80 public void CleanUp() 95 public void CleanUp()
81 { 96 {
97 System.AppDomain.CurrentDomain.AssemblyResolve -= m_resolveEventHandler;
98
82 if (Directory.Exists(m_testDir)) 99 if (Directory.Exists(m_testDir))
83 { 100 {
84 // Blow away the temporary directory with artifacts. 101 // Blow away the temporary directory with artifacts.
@@ -86,52 +103,100 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
86 } 103 }
87 } 104 }
88 105
106 private CompilerResults CompileScript(
107 string input, out Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> positionMap)
108 {
109 m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll");
110
111 CSCodeGenerator cg = new CSCodeGenerator();
112 string output = cg.Convert(input);
113
114 output = Compiler.CreateCSCompilerScript(output, "script1", typeof(ScriptBaseClass).FullName, null);
115 // System.Console.WriteLine(output);
116
117 positionMap = cg.PositionMap;
118
119 CompilerResults compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output);
120
121 // foreach (KeyValuePair<int, int> key in positionMap.Keys)
122 // {
123 // KeyValuePair<int, int> val = positionMap[key];
124 //
125 // System.Console.WriteLine("{0},{1} => {2},{3}", key.Key, key.Value, val.Key, val.Value);
126 // }
127 //
128 // foreach (CompilerError compErr in m_compilerResults.Errors)
129 // {
130 // System.Console.WriteLine("Error: {0},{1} => {2}", compErr.Line, compErr.Column, compErr);
131 // }
132
133 return compilerResults;
134 }
135
136 /// <summary>
137 /// Test that line number errors are resolved as expected when preceding code contains a jump.
138 /// </summary>
139 [Test]
140 public void TestJumpAndSyntaxError()
141 {
142 TestHelpers.InMethod();
143
144 Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> positionMap;
145
146 CompilerResults compilerResults = CompileScript(
147@"default
148{
149 state_entry()
150 {
151 jump l;
152 @l;
153 i = 1;
154 }
155}", out positionMap);
156
157 Assert.AreEqual(
158 new KeyValuePair<int, int>(7, 9),
159 positionMap[new KeyValuePair<int, int>(compilerResults.Errors[0].Line, compilerResults.Errors[0].Column)]);
160 }
161
89 /// <summary> 162 /// <summary>
90 /// Test the C# compiler error message can be mapped to the correct 163 /// Test the C# compiler error message can be mapped to the correct
91 /// line/column in the LSL source when an undeclared variable is used. 164 /// line/column in the LSL source when an undeclared variable is used.
92 /// </summary> 165 /// </summary>
93 //[Test] 166 [Test]
94 public void TestUseUndeclaredVariable() 167 public void TestUseUndeclaredVariable()
95 { 168 {
96 TestHelpers.InMethod(); 169 TestHelpers.InMethod();
97 170
98 m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll"); 171 Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> positionMap;
99 172
100 string input = @"default 173 CompilerResults compilerResults = CompileScript(
174@"default
101{ 175{
102 state_entry() 176 state_entry()
103 { 177 {
104 integer y = x + 3; 178 integer y = x + 3;
105 } 179 }
106}"; 180}", out positionMap);
107 181
108 CSCodeGenerator cg = new CSCodeGenerator(); 182 Assert.AreEqual(
109 string output = "using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\n" + 183 new KeyValuePair<int, int>(5, 21),
110 "namespace SecondLife { " + 184 positionMap[new KeyValuePair<int, int>(compilerResults.Errors[0].Line, compilerResults.Errors[0].Column)]);
111 "public class Script : OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass {\n" +
112 "public Script() { } " +
113 cg.Convert(input) +
114 "} }\n";
115 Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> positionMap = cg.PositionMap;
116
117 m_compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output);
118
119 Assert.AreEqual(new KeyValuePair<int, int>(5, 21),
120 positionMap[new KeyValuePair<int, int>(m_compilerResults.Errors[0].Line, m_compilerResults.Errors[0].Column)]);
121 } 185 }
122 186
123 /// <summary> 187 /// <summary>
124 /// Test that a string can be cast to string and another string 188 /// Test that a string can be cast to string and another string
125 /// concatenated. 189 /// concatenated.
126 /// </summary> 190 /// </summary>
127 //[Test] 191 [Test]
128 public void TestCastAndConcatString() 192 public void TestCastAndConcatString()
129 { 193 {
130 TestHelpers.InMethod(); 194 TestHelpers.InMethod();
131 195
132 m_compilerParameters.OutputAssembly = Path.Combine(m_testDir, Path.GetRandomFileName() + ".dll"); 196 Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> positionMap;
133 197
134 string input = @"string s = "" a string""; 198 CompilerResults compilerResults = CompileScript(
199@"string s = "" a string"";
135 200
136default 201default
137{ 202{
@@ -141,18 +206,9 @@ default
141 string tmp = (string) gAvatarKey + s; 206 string tmp = (string) gAvatarKey + s;
142 llSay(0, tmp); 207 llSay(0, tmp);
143 } 208 }
144}"; 209}", out positionMap);
145 210
146 CSCodeGenerator cg = new CSCodeGenerator(); 211 Assert.AreEqual(0, compilerResults.Errors.Count);
147 string output = "using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\n" +
148 "namespace SecondLife { " +
149 "public class Script : OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass {\n" +
150 "public Script() { } " +
151 cg.Convert(input) +
152 "} }\n";
153 m_compilerResults = m_CSCodeProvider.CompileAssemblyFromSource(m_compilerParameters, output);
154
155 Assert.AreEqual(0, m_compilerResults.Errors.Count);
156 } 212 }
157 } 213 }
158} \ No newline at end of file 214} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/YP2CSConverter.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/YP2CSConverter.cs
deleted file mode 100644
index 7ea3cfc..0000000
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/YP2CSConverter.cs
+++ /dev/null
@@ -1,117 +0,0 @@
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*/
28
29using System;
30using System.IO;
31using System.Collections.Generic;
32using System.Text;
33using System.Text.RegularExpressions;
34using OpenSim.Region.ScriptEngine.Shared.YieldProlog;
35
36namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
37{
38 public class YP2CSConverter
39 {
40 public YP2CSConverter()
41 {
42 }
43
44 public string Convert(string Script)
45 {
46 string CS_code = GenCode(Script);
47 return CS_code;
48 }
49
50 static string GenCode(string myCode)
51 {
52 Variable TermList = new Variable();
53 Variable FunctionCode = new Variable();
54
55 string CS_code = "";
56
57 int cs_pointer = myCode.IndexOf("\n//cs");
58 if (cs_pointer > 0)
59 {
60 CS_code = myCode.Substring(cs_pointer); // CS code comes after
61 myCode = myCode.Substring(0, cs_pointer);
62 }
63 myCode.Replace("//yp", "%YPCode");
64
65 StringWriter myCS_SW = new StringWriter();
66 StringReader myCode_SR = new StringReader(" yp_nop_header_nop. \n "+myCode + "\n");
67
68 YP.see(myCode_SR);
69 YP.tell(myCS_SW);
70
71 //m_log.Debug("Mycode\n ===================================\n" + myCode+"\n");
72
73// disable warning: don't see how we can code this differently short
74// of rewriting the whole thing
75#pragma warning disable 0168, 0219
76 foreach (bool l1 in Parser.parseInput(TermList))
77 {
78 foreach (bool l2 in YPCompiler.makeFunctionPseudoCode(TermList, FunctionCode))
79 {
80 // ListPair VFC = new ListPair(FunctionCode, new Variable());
81 //m_log.Debug("-------------------------")
82 //m_log.Debug(FunctionCode.ToString())
83 //m_log.Debug("-------------------------")
84 YPCompiler.convertFunctionCSharp(FunctionCode);
85 //YPCompiler.convertStringCodesCSharp(VFC);
86 }
87 }
88#pragma warning restore 0168, 0219
89 YP.seen();
90 myCS_SW.Close();
91 YP.told();
92 StringBuilder bu = myCS_SW.GetStringBuilder();
93 string finalcode = "//YPEncoded\n" + bu.ToString();
94 // FIX script events (we're in the same script)
95 // 'YP.script_event(Atom.a(@"sayit"),' ==> 'sayit('
96 finalcode = Regex.Replace(finalcode,
97 @"YP.script_event\(Atom.a\(\@\""(.*?)""\)\,",
98 @"this.$1(",
99 RegexOptions.Compiled | RegexOptions.Singleline);
100 finalcode = Regex.Replace(finalcode,
101 @"YP.script_event\(Atom.a\(\""(.*?)""\)\,",
102 @"this.$1(",
103 RegexOptions.Compiled | RegexOptions.Singleline);
104 finalcode = Regex.Replace(finalcode,
105 @" static ",
106 @" ",
107 RegexOptions.Compiled | RegexOptions.Singleline);
108
109 finalcode = CS_code+"\n\r"+ finalcode;
110 finalcode = Regex.Replace(finalcode,
111 @"PrologCallback",
112 @"public IEnumerable<bool> ",
113 RegexOptions.Compiled | RegexOptions.Singleline);
114 return finalcode;
115 }
116 }
117}
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/lsl.lexer.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/lsl.lexer.cs
index cad27b7..f87f446 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/lsl.lexer.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/lsl.lexer.cs
@@ -357,21 +357,25 @@ public override int yynum { get { return 90; }}
357public class HTTP_REQUEST_EVENT : TOKEN{ public override string yyname { get { return "HTTP_REQUEST_EVENT";}} 357public class HTTP_REQUEST_EVENT : TOKEN{ public override string yyname { get { return "HTTP_REQUEST_EVENT";}}
358public override int yynum { get { return 91; }} 358public override int yynum { get { return 91; }}
359 public HTTP_REQUEST_EVENT(Lexer yyl):base(yyl) {}} 359 public HTTP_REQUEST_EVENT(Lexer yyl):base(yyl) {}}
360//%IDENT+92 360//%TRANSACTION_RESULT_EVENT+92
361public class IDENT : TOKEN{ public override string yyname { get { return "IDENT";}} 361public class TRANSACTION_RESULT_EVENT : TOKEN{ public override string yyname { get { return "TRANSACTION_RESULT_EVENT";}}
362public override int yynum { get { return 92; }} 362public override int yynum { get { return 92; }}
363 public TRANSACTION_RESULT_EVENT(Lexer yyl):base(yyl) {}}
364//%IDENT+93
365public class IDENT : TOKEN{ public override string yyname { get { return "IDENT";}}
366public override int yynum { get { return 93; }}
363 public IDENT(Lexer yyl):base(yyl) {}} 367 public IDENT(Lexer yyl):base(yyl) {}}
364//%INTEGER_CONSTANT+93 368//%INTEGER_CONSTANT+94
365public class INTEGER_CONSTANT : TOKEN{ public override string yyname { get { return "INTEGER_CONSTANT";}} 369public class INTEGER_CONSTANT : TOKEN{ public override string yyname { get { return "INTEGER_CONSTANT";}}
366public override int yynum { get { return 93; }} 370public override int yynum { get { return 94; }}
367 public INTEGER_CONSTANT(Lexer yyl):base(yyl) {}} 371 public INTEGER_CONSTANT(Lexer yyl):base(yyl) {}}
368//%HEX_INTEGER_CONSTANT+94 372//%HEX_INTEGER_CONSTANT+95
369public class HEX_INTEGER_CONSTANT : TOKEN{ public override string yyname { get { return "HEX_INTEGER_CONSTANT";}} 373public class HEX_INTEGER_CONSTANT : TOKEN{ public override string yyname { get { return "HEX_INTEGER_CONSTANT";}}
370public override int yynum { get { return 94; }} 374public override int yynum { get { return 95; }}
371 public HEX_INTEGER_CONSTANT(Lexer yyl):base(yyl) {}} 375 public HEX_INTEGER_CONSTANT(Lexer yyl):base(yyl) {}}
372//%FLOAT_CONSTANT+95 376//%FLOAT_CONSTANT+96
373public class FLOAT_CONSTANT : TOKEN{ public override string yyname { get { return "FLOAT_CONSTANT";}} 377public class FLOAT_CONSTANT : TOKEN{ public override string yyname { get { return "FLOAT_CONSTANT";}}
374public override int yynum { get { return 95; }} 378public override int yynum { get { return 96; }}
375 public FLOAT_CONSTANT(Lexer yyl):base(yyl) {}} 379 public FLOAT_CONSTANT(Lexer yyl):base(yyl) {}}
376//%|LSLTokens 380//%|LSLTokens
377public class yyLSLTokens : YyLexer { 381public class yyLSLTokens : YyLexer {
@@ -476,9 +480,9 @@ public class yyLSLTokens : YyLexer {
4762,1,3,56,0, 4802,1,3,56,0,
4772,1,3,57,0, 4812,1,3,57,0,
4782,1,7,9,122, 4822,1,7,9,122,
4799,1,9,3,96, 4839,1,9,3,238,
48033,123,5,1,3, 48422,123,5,1,3,
48196,33,2,1,7, 485238,22,2,1,7,
48210,124,9,1,10, 48610,124,9,1,10,
4833,178,0,125,5, 4873,178,0,125,5,
4841,3,178,0,2, 4881,3,178,0,2,
@@ -502,8 +506,8 @@ public class yyLSLTokens : YyLexer {
5029,0,2,1,3, 5069,0,2,1,3,
50310,0,2,1,7, 50710,0,2,1,7,
50415,134,9,1,15, 50815,134,9,1,15,
5053,15,7,135,5, 5093,0,6,135,5,
5061,3,15,7,2, 5101,3,0,6,2,
5071,7,17,136,9, 5111,7,17,136,9,
5081,17,3,0,224, 5121,17,3,0,224,
509137,5,1,3,0, 513137,5,1,3,0,
@@ -573,18 +577,18 @@ public class yyLSLTokens : YyLexer {
57379,0,77,0,77, 57779,0,77,0,77,
5740,69,0,78,0, 5780,69,0,78,0,
57584,0,160,12,1, 57984,0,160,12,1,
5761073,161,5,119,3, 5801095,161,5,119,3,
5771,0,162,12,1, 5811,0,162,12,1,
5781074,163,5,0,164, 5821096,163,5,0,164,
57911,1,1041,0,165, 58311,1,1063,0,165,
5804,0,1,-1,3, 5844,0,1,-1,3,
5819,0,162,3,10, 5859,0,162,3,10,
5820,166,12,1,1275, 5860,166,12,1,1297,
583167,5,0,168,11, 587167,5,0,168,11,
5841,1045,0,165,1, 5881,1067,0,165,1,
585-1,3,13,0,162, 589-1,3,13,0,162,
5863,0,3,162,3, 5903,0,3,162,3,
58796,33,162,3,32, 5910,6,162,3,32,
5880,162,3,33,0, 5920,162,3,33,0,
589162,3,34,0,162, 593162,3,34,0,162,
5903,35,0,162,3, 5943,35,0,162,3,
@@ -593,12 +597,12 @@ public class yyLSLTokens : YyLexer {
593162,3,40,0,162, 597162,3,40,0,162,
5943,41,0,162,3, 5983,41,0,162,3,
59542,0,169,12,1, 59942,0,169,12,1,
5961414,170,5,1,3, 6001436,170,5,1,3,
59747,0,171,12,1, 60147,0,171,12,1,
5981518,172,5,0,173, 6021540,172,5,0,173,
59911,1,1027,0,165, 60311,1,1049,0,165,
6001,-1,174,11,1, 6041,-1,174,11,1,
6011041,0,165,1,-1, 6051063,0,165,1,-1,
6023,43,0,162,3, 6063,43,0,162,3,
60344,0,162,3,45, 60744,0,162,3,45,
6040,162,3,46,0, 6080,162,3,46,0,
@@ -641,15 +645,15 @@ public class yyLSLTokens : YyLexer {
641162,3,93,0,162, 645162,3,93,0,162,
6423,94,0,162,3, 6463,94,0,162,3,
64395,0,162,3,96, 64795,0,162,3,96,
6440,162,3,97,0, 6480,162,3,238,22,
645162,3,98,0,162, 649162,3,98,0,162,
6463,99,0,162,3, 6503,99,0,162,3,
647100,0,162,3,101, 651100,0,162,3,101,
6480,162,3,102,0, 6520,162,3,97,0,
649162,3,103,0,162, 653162,3,103,0,162,
6503,104,0,162,3, 6543,104,0,162,3,
651105,0,162,3,106, 655105,0,162,3,106,
6520,162,3,107,0, 6560,162,3,102,0,
653162,3,108,0,162, 657162,3,108,0,162,
6543,109,0,162,3, 6583,109,0,162,3,
655110,0,162,3,111, 659110,0,162,3,111,
@@ -665,11 +669,11 @@ public class yyLSLTokens : YyLexer {
665162,3,123,0,162, 669162,3,123,0,162,
6663,124,0,162,3, 6703,124,0,162,3,
667125,0,162,3,96, 671125,0,162,3,96,
6686,162,3,126,0, 6726,162,3,107,0,
669162,3,58,15,162, 673162,3,126,0,162,
6703,59,15,162,3, 6743,58,15,162,3,
671136,4,162,3,160, 67559,15,162,3,136,
6720,162,3,15,7, 6764,162,3,160,0,
673162,3,170,0,162, 677162,3,170,0,162,
6743,171,0,162,3, 6783,171,0,162,3,
675172,0,162,3,173, 679172,0,162,3,173,
@@ -687,17 +691,17 @@ public class yyLSLTokens : YyLexer {
68778,0,73,0,84, 69178,0,73,0,84,
6880,73,0,65,0, 6920,73,0,65,0,
68976,0,176,12,1, 69376,0,176,12,1,
6901674,177,5,91,3, 6941696,177,5,91,3,
6919,0,178,12,1, 6959,0,178,12,1,
69240509,179,5,0,180, 69642571,179,5,0,180,
69311,1,1050,0,165, 69711,1,1072,0,165,
6941,-1,3,10,0, 6981,-1,3,10,0,
695178,3,13,0,178, 699178,3,13,0,178,
6963,32,0,178,3, 7003,32,0,178,3,
69733,0,181,12,1, 70133,0,181,12,1,
69843542,182,5,1,3, 70245604,182,5,1,3,
69961,0,183,12,1, 70361,0,183,12,1,
70043657,184,5,0,185, 70445719,184,5,0,185,
70111,1,142,0,186, 70511,1,142,0,186,
7024,36,69,0,88, 7064,36,69,0,88,
7030,67,0,76,0, 7070,67,0,76,0,
@@ -714,13 +718,13 @@ public class yyLSLTokens : YyLexer {
71465,0,84,0,73, 71865,0,84,0,73,
7150,79,0,78,0, 7190,79,0,78,0,
7161,-1,3,34,0, 7201,-1,3,34,0,
717189,12,1,43783,190, 721189,12,1,45845,190,
7185,0,191,11,1, 7225,0,191,11,1,
719941,0,165,1,-1, 723963,0,165,1,-1,
7203,37,0,192,12, 7243,37,0,192,12,
7211,41733,193,5,1, 7251,43795,193,5,1,
7223,61,0,194,12, 7263,61,0,194,12,
7231,41848,195,5,0, 7271,43910,195,5,0,
724196,11,1,40,0, 728196,11,1,40,0,
725197,4,28,80,0, 729197,4,28,80,0,
72669,0,82,0,67, 73069,0,82,0,67,
@@ -734,9 +738,9 @@ public class yyLSLTokens : YyLexer {
73482,0,67,0,69, 73882,0,67,0,69,
7350,78,0,84,0, 7390,78,0,84,0,
7361,-1,3,38,0, 7401,-1,3,38,0,
737200,12,1,41974,201, 741200,12,1,44036,201,
7385,1,3,38,0, 7425,1,3,38,0,
739202,12,1,42074,203, 743202,12,1,44136,203,
7405,0,204,11,1, 7445,0,204,11,1,
741185,0,205,4,14, 745185,0,205,4,14,
74265,0,77,0,80, 74665,0,77,0,80,
@@ -746,7 +750,7 @@ public class yyLSLTokens : YyLexer {
7460,207,4,6,65, 7500,207,4,6,65,
7470,77,0,80,0, 7510,77,0,80,0,
7481,-1,3,40,0, 7521,-1,3,40,0,
749208,12,1,41246,209, 753208,12,1,43308,209,
7505,0,210,11,1, 7545,0,210,11,1,
75171,0,211,4,20, 75571,0,211,4,20,
75276,0,69,0,70, 75676,0,69,0,70,
@@ -754,7 +758,7 @@ public class yyLSLTokens : YyLexer {
75480,0,65,0,82, 75880,0,65,0,82,
7550,69,0,78,0, 7590,69,0,78,0,
7561,-1,3,41,0, 7601,-1,3,41,0,
757212,12,1,41610,213, 761212,12,1,43672,213,
7585,0,214,11,1, 7625,0,214,11,1,
75976,0,215,4,22, 76376,0,215,4,22,
76082,0,73,0,71, 76482,0,73,0,71,
@@ -763,9 +767,9 @@ public class yyLSLTokens : YyLexer {
7630,82,0,69,0, 7670,82,0,69,0,
76478,0,1,-1,3, 76878,0,1,-1,3,
76542,0,216,12,1, 76942,0,216,12,1,
76642215,217,5,1,3, 77044277,217,5,1,3,
76761,0,218,12,1, 77161,0,218,12,1,
76842330,219,5,0,220, 77244392,219,5,0,220,
76911,1,28,0,221, 77311,1,28,0,221,
7704,22,83,0,84, 7744,22,83,0,84,
7710,65,0,82,0, 7750,65,0,82,0,
@@ -777,9 +781,9 @@ public class yyLSLTokens : YyLexer {
7770,84,0,65,0, 7810,84,0,65,0,
77882,0,1,-1,3, 78282,0,1,-1,3,
77943,0,224,12,1, 78343,0,224,12,1,
78045231,225,5,2,3, 78447293,225,5,2,3,
78161,0,226,12,1, 78561,0,226,12,1,
78245346,227,5,0,228, 78647408,227,5,0,228,
78311,1,16,0,229, 78711,1,16,0,229,
7844,22,80,0,76, 7884,22,80,0,76,
7850,85,0,83,0, 7890,85,0,83,0,
@@ -787,7 +791,7 @@ public class yyLSLTokens : YyLexer {
7870,85,0,65,0, 7910,85,0,65,0,
78876,0,83,0,1, 79276,0,83,0,1,
789-1,3,43,0,230, 793-1,3,43,0,230,
79012,1,45468,231,5, 79412,1,47530,231,5,
7910,232,11,1,2, 7950,232,11,1,2,
7920,233,4,18,73, 7960,233,4,18,73,
7930,78,0,67,0, 7970,78,0,67,0,
@@ -798,15 +802,15 @@ public class yyLSLTokens : YyLexer {
7984,8,80,0,76, 8024,8,80,0,76,
7990,85,0,83,0, 8030,85,0,83,0,
8001,-1,3,44,0, 8041,-1,3,44,0,
801236,12,1,42456,237, 805236,12,1,44518,237,
8025,0,238,11,1, 8065,0,238,11,1,
80361,0,239,4,10, 80761,0,239,4,10,
80467,0,79,0,77, 80867,0,79,0,77,
8050,77,0,65,0, 8090,77,0,65,0,
8061,-1,3,45,0, 8101,-1,3,45,0,
807240,12,1,40641,241, 811240,12,1,42703,241,
8085,2,3,45,0, 8125,2,3,45,0,
809242,12,1,40728,243, 813242,12,1,42790,243,
8105,0,244,11,1, 8145,0,244,11,1,
81110,0,245,4,18, 81510,0,245,4,18,
81268,0,69,0,67, 81668,0,69,0,67,
@@ -814,7 +818,7 @@ public class yyLSLTokens : YyLexer {
81477,0,69,0,78, 81877,0,69,0,78,
8150,84,0,1,-1, 8190,84,0,1,-1,
8163,61,0,246,12, 8203,61,0,246,12,
8171,40876,247,5,0, 8211,42938,247,5,0,
818248,11,1,22,0, 822248,11,1,22,0,
819249,4,24,77,0, 823249,4,24,77,0,
82073,0,78,0,85, 82473,0,78,0,85,
@@ -827,9 +831,9 @@ public class yyLSLTokens : YyLexer {
8270,78,0,85,0, 8310,78,0,85,0,
82883,0,1,-1,3, 83283,0,1,-1,3,
82946,0,252,12,1, 83346,0,252,12,1,
83042577,253,5,14,3, 83444639,253,5,14,3,
83148,0,254,12,1, 83548,0,254,12,1,
83240243,255,5,14,3, 83642305,255,5,14,3,
83348,0,254,3,49, 83748,0,254,3,49,
8340,254,3,50,0, 8380,254,3,50,0,
835254,3,51,0,254, 839254,3,51,0,254,
@@ -839,11 +843,11 @@ public class yyLSLTokens : YyLexer {
839254,3,56,0,254, 843254,3,56,0,254,
8403,57,0,254,3, 8443,57,0,254,3,
841101,0,256,12,1, 845101,0,256,12,1,
84239706,257,5,12,3, 84641768,257,5,12,3,
84343,0,258,12,1, 84743,0,258,12,1,
84440033,259,5,10,3, 84842095,259,5,10,3,
84548,0,260,12,1, 84948,0,260,12,1,
84639768,261,5,12,3, 85041830,261,5,12,3,
84748,0,260,3,49, 85148,0,260,3,49,
8480,260,3,50,0, 8520,260,3,50,0,
849260,3,51,0,260, 853260,3,51,0,260,
@@ -853,8 +857,8 @@ public class yyLSLTokens : YyLexer {
853260,3,56,0,260, 857260,3,56,0,260,
8543,57,0,260,3, 8583,57,0,260,3,
855102,0,262,12,1, 859102,0,262,12,1,
85639774,263,5,0,264, 86041836,263,5,0,264,
85711,1,882,0,265, 86111,1,904,0,265,
8584,28,70,0,76, 8624,28,70,0,76,
8590,79,0,65,0, 8630,79,0,65,0,
86084,0,95,0,67, 86484,0,95,0,67,
@@ -862,7 +866,7 @@ public class yyLSLTokens : YyLexer {
86283,0,84,0,65, 86683,0,84,0,65,
8630,78,0,84,0, 8670,78,0,84,0,
8641,-1,3,70,0, 8681,-1,3,70,0,
865262,266,11,1,882, 869262,266,11,1,904,
8660,265,1,-1,3, 8700,265,1,-1,3,
86749,0,260,3,50, 87149,0,260,3,50,
8680,260,3,51,0, 8720,260,3,51,0,
@@ -884,7 +888,7 @@ public class yyLSLTokens : YyLexer {
8841,-1,3,102,0, 8881,-1,3,102,0,
885262,3,69,0,256, 889262,3,69,0,256,
8863,70,0,262,267, 8903,70,0,262,267,
88711,1,882,0,265, 89111,1,904,0,265,
8881,-1,3,49,0, 8921,-1,3,49,0,
889254,3,50,0,254, 893254,3,50,0,254,
8903,51,0,254,3, 8943,51,0,254,3,
@@ -901,15 +905,15 @@ public class yyLSLTokens : YyLexer {
9010,82,0,73,0, 9050,82,0,73,0,
90279,0,68,0,1, 90679,0,68,0,1,
903-1,3,47,0,270, 907-1,3,47,0,270,
90412,1,42698,271,5, 90812,1,44760,271,5,
9053,3,47,0,272, 9093,3,47,0,272,
90612,1,42922,273,5, 91012,1,44984,273,5,
907118,3,1,0,274, 911118,3,1,0,274,
90812,1,42923,275,5, 91212,1,44985,275,5,
909118,3,1,0,274, 913118,3,1,0,274,
9103,9,0,274,3, 9143,9,0,274,3,
91196,33,274,3,13, 91513,0,274,3,0,
9120,274,3,0,3, 9163,274,3,0,6,
913274,3,32,0,274, 917274,3,32,0,274,
9143,33,0,274,3, 9183,33,0,274,3,
91534,0,274,3,35, 91934,0,274,3,35,
@@ -960,16 +964,16 @@ public class yyLSLTokens : YyLexer {
9600,274,3,93,0, 9640,274,3,93,0,
961274,3,94,0,274, 965274,3,94,0,274,
9623,95,0,274,3, 9663,95,0,274,3,
96396,0,274,3,97, 96796,0,274,3,238,
9640,274,3,98,0, 96822,274,3,98,0,
965274,3,99,0,274, 969274,3,99,0,274,
9663,100,0,274,3, 9703,100,0,274,3,
967101,0,274,3,102, 971101,0,274,3,97,
9680,274,3,103,0, 9720,274,3,103,0,
969274,3,104,0,274, 973274,3,104,0,274,
9703,105,0,274,3, 9743,105,0,274,3,
971106,0,274,3,107, 975106,0,274,3,102,
9720,274,3,15,7, 9760,274,3,108,0,
973274,3,109,0,274, 977274,3,109,0,274,
9743,110,0,274,3, 9783,110,0,274,3,
975111,0,274,3,112, 979111,0,274,3,112,
@@ -981,10 +985,10 @@ public class yyLSLTokens : YyLexer {
981274,3,119,0,274, 985274,3,119,0,274,
9823,120,0,274,3, 9863,120,0,274,3,
983121,0,274,3,122, 987121,0,274,3,122,
9840,274,3,108,0, 9880,274,3,123,0,
985274,3,124,0,274, 989274,3,124,0,274,
9863,125,0,274,3, 9903,125,0,274,3,
98796,6,274,3,123, 99196,6,274,3,107,
9880,274,3,126,0, 9920,274,3,126,0,
989274,3,58,15,274, 993274,3,58,15,274,
9903,59,15,274,3, 9943,59,15,274,3,
@@ -1001,11 +1005,11 @@ public class yyLSLTokens : YyLexer {
1001274,3,0,224,274, 1005274,3,0,224,274,
10023,40,32,274,3, 10063,40,32,274,3,
100363,32,274,276,11, 100763,32,274,276,11,
10041,1054,0,165,1, 10081,1076,0,165,1,
1005-1,3,9,0,274, 1009-1,3,9,0,274,
10063,96,33,274,3, 10103,13,0,274,3,
100713,0,274,3,0, 10110,3,274,3,0,
10083,274,3,32,0, 10126,274,3,32,0,
1009274,3,33,0,274, 1013274,3,33,0,274,
10103,34,0,274,3, 10143,34,0,274,3,
101135,0,274,3,36, 101535,0,274,3,36,
@@ -1056,16 +1060,16 @@ public class yyLSLTokens : YyLexer {
10560,274,3,94,0, 10600,274,3,94,0,
1057274,3,95,0,274, 1061274,3,95,0,274,
10583,96,0,274,3, 10623,96,0,274,3,
105997,0,274,3,98, 1063238,22,274,3,98,
10600,274,3,99,0, 10640,274,3,99,0,
1061274,3,100,0,274, 1065274,3,100,0,274,
10623,101,0,274,3, 10663,101,0,274,3,
1063102,0,274,3,103, 106797,0,274,3,103,
10640,274,3,104,0, 10680,274,3,104,0,
1065274,3,105,0,274, 1069274,3,105,0,274,
10663,106,0,274,3, 10703,106,0,274,3,
1067107,0,274,3,15, 1071102,0,274,3,108,
10687,274,3,109,0, 10720,274,3,109,0,
1069274,3,110,0,274, 1073274,3,110,0,274,
10703,111,0,274,3, 10743,111,0,274,3,
1071112,0,274,3,113, 1075112,0,274,3,113,
@@ -1076,11 +1080,11 @@ public class yyLSLTokens : YyLexer {
10760,274,3,119,0, 10800,274,3,119,0,
1077274,3,120,0,274, 1081274,3,120,0,274,
10783,121,0,274,3, 10823,121,0,274,3,
1079122,0,274,3,108, 1083122,0,274,3,123,
10800,274,3,124,0, 10840,274,3,124,0,
1081274,3,125,0,274, 1085274,3,125,0,274,
10823,96,6,274,3, 10863,96,6,274,3,
1083123,0,274,3,126, 1087107,0,274,3,126,
10840,274,3,58,15, 10880,274,3,58,15,
1085274,3,59,15,274, 1089274,3,59,15,274,
10863,136,4,274,3, 10903,136,4,274,3,
@@ -1096,9 +1100,9 @@ public class yyLSLTokens : YyLexer {
10961,274,3,0,224, 11001,274,3,0,224,
1097274,3,40,32,274, 1101274,3,40,32,274,
10983,63,32,274,277, 11023,63,32,274,277,
109911,1,1054,0,165, 110311,1,1076,0,165,
11001,-1,3,61,0, 11041,-1,3,61,0,
1101278,12,1,43173,279, 1105278,12,1,45235,279,
11025,0,280,11,1, 11065,0,280,11,1,
110334,0,281,4,24, 110734,0,281,4,24,
110483,0,76,0,65, 110883,0,76,0,65,
@@ -1107,19 +1111,19 @@ public class yyLSLTokens : YyLexer {
11070,85,0,65,0, 11110,85,0,65,0,
110876,0,83,0,1, 111276,0,83,0,1,
1109-1,3,42,0,282, 1113-1,3,42,0,282,
111012,1,42799,283,5, 111412,1,44861,283,5,
11110,284,11,1,1015, 11150,284,11,1,1037,
11120,165,1,-1,285, 11160,165,1,-1,285,
111311,1,96,0,286, 111711,1,96,0,286,
11144,10,83,0,76, 11184,10,83,0,76,
11150,65,0,83,0, 11190,65,0,83,0,
111672,0,1,-1,3, 112072,0,1,-1,3,
111748,0,287,12,1, 112148,0,287,12,1,
111839296,288,5,13,3, 112241358,288,5,13,3,
1119120,0,289,12,1, 1123120,0,289,12,1,
112039320,290,5,22,3, 112441382,290,5,22,3,
1121102,0,291,12,1, 1125102,0,291,12,1,
112239321,292,5,22,3, 112641383,292,5,22,3,
1123102,0,291,3,48, 1127102,0,291,3,48,
11240,291,3,49,0, 11280,291,3,49,0,
1125291,3,50,0,291, 1129291,3,50,0,291,
@@ -1138,7 +1142,7 @@ public class yyLSLTokens : YyLexer {
11383,68,0,291,3, 11423,68,0,291,3,
113969,0,291,3,70, 114369,0,291,3,70,
11400,291,293,11,1, 11440,291,293,11,1,
1141863,0,294,4,40, 1145885,0,294,4,40,
114272,0,69,0,88, 114672,0,69,0,88,
11430,95,0,73,0, 11470,95,0,73,0,
114478,0,84,0,69, 114878,0,84,0,69,
@@ -1166,9 +1170,9 @@ public class yyLSLTokens : YyLexer {
11660,291,3,70,0, 11700,291,3,70,0,
1167291,0,165,1,-1, 1171291,0,165,1,-1,
11683,48,0,295,12, 11723,48,0,295,12,
11691,39598,296,5,11, 11731,41660,296,5,11,
11703,46,0,297,12, 11743,46,0,297,12,
11711,39701,298,5,14, 11751,41763,298,5,14,
11723,48,0,254,3, 11763,48,0,254,3,
117349,0,254,3,50, 117749,0,254,3,50,
11740,254,3,51,0, 11780,254,3,51,0,
@@ -1180,7 +1184,7 @@ public class yyLSLTokens : YyLexer {
11803,101,0,256,3, 11843,101,0,256,3,
1181102,0,262,3,69, 1185102,0,262,3,69,
11820,256,3,70,0, 11860,256,3,70,0,
1183262,299,11,1,882, 1187262,299,11,1,904,
11840,265,1,-1,3, 11880,265,1,-1,3,
118548,0,295,3,49, 118948,0,295,3,49,
11860,295,3,50,0, 11900,295,3,50,0,
@@ -1190,7 +1194,7 @@ public class yyLSLTokens : YyLexer {
11900,295,3,55,0, 11940,295,3,55,0,
1191295,3,56,0,295, 1195295,3,56,0,295,
11923,57,0,295,300, 11963,57,0,295,300,
119311,1,857,0,301, 119711,1,879,0,301,
11944,32,73,0,78, 11984,32,73,0,78,
11950,84,0,69,0, 11990,84,0,69,0,
119671,0,69,0,82, 120071,0,69,0,82,
@@ -1207,7 +1211,7 @@ public class yyLSLTokens : YyLexer {
120756,0,295,3,54, 121156,0,295,3,54,
12080,295,3,46,0, 12120,295,3,46,0,
1209297,3,57,0,295, 1213297,3,57,0,295,
1210302,11,1,857,0, 1214302,11,1,879,0,
1211301,1,-1,3,49, 1215301,1,-1,3,49,
12120,295,3,50,0, 12160,295,3,50,0,
1213295,3,51,0,295, 1217295,3,51,0,295,
@@ -1217,16 +1221,16 @@ public class yyLSLTokens : YyLexer {
1217295,3,56,0,295, 1221295,3,56,0,295,
12183,57,0,295,3, 12223,57,0,295,3,
121959,0,303,12,1, 122359,0,303,12,1,
122043300,304,5,0,305, 122445362,304,5,0,305,
122111,1,46,0,306, 122511,1,46,0,306,
12224,18,83,0,69, 12264,18,83,0,69,
12230,77,0,73,0, 12270,77,0,73,0,
122467,0,79,0,76, 122867,0,79,0,76,
12250,79,0,78,0, 12290,79,0,78,0,
12261,-1,3,60,0, 12301,-1,3,60,0,
1227307,12,1,44268,308, 1231307,12,1,46330,308,
12285,2,3,60,0, 12325,2,3,60,0,
1229309,12,1,44382,310, 1233309,12,1,46444,310,
12305,0,311,11,1, 12345,0,311,11,1,
1231197,0,312,4,20, 1235197,0,312,4,20,
123276,0,69,0,70, 123676,0,69,0,70,
@@ -1234,7 +1238,7 @@ public class yyLSLTokens : YyLexer {
123483,0,72,0,73, 123883,0,72,0,73,
12350,70,0,84,0, 12390,70,0,84,0,
12361,-1,3,61,0, 12401,-1,3,61,0,
1237313,12,1,44503,314, 1241313,12,1,46565,314,
12385,0,315,11,1, 12425,0,315,11,1,
1239148,0,316,4,22, 1243148,0,316,4,22,
124076,0,69,0,83, 124476,0,69,0,83,
@@ -1249,9 +1253,9 @@ public class yyLSLTokens : YyLexer {
12490,71,0,76,0, 12530,71,0,76,0,
125069,0,1,-1,3, 125469,0,1,-1,3,
125161,0,319,12,1, 125561,0,319,12,1,
125244629,320,5,1,3, 125646691,320,5,1,3,
125361,0,321,12,1, 125761,0,321,12,1,
125444744,322,5,0,323, 125846806,322,5,0,323,
125511,1,136,0,324, 125911,1,136,0,324,
12564,26,69,0,81, 12604,26,69,0,81,
12570,85,0,65,0, 12610,85,0,65,0,
@@ -1264,9 +1268,9 @@ public class yyLSLTokens : YyLexer {
126481,0,85,0,65, 126881,0,85,0,65,
12650,76,0,83,0, 12690,76,0,83,0,
12661,-1,3,62,0, 12701,-1,3,62,0,
1267327,12,1,44870,328, 1271327,12,1,46932,328,
12685,2,3,61,0, 12725,2,3,61,0,
1269329,12,1,44985,330, 1273329,12,1,47047,330,
12705,0,331,11,1, 12745,0,331,11,1,
1271154,0,332,4,28, 1275154,0,332,4,28,
127271,0,82,0,69, 127671,0,82,0,69,
@@ -1276,7 +1280,7 @@ public class yyLSLTokens : YyLexer {
127685,0,65,0,76, 128085,0,65,0,76,
12770,83,0,1,-1, 12810,83,0,1,-1,
12783,62,0,333,12, 12823,62,0,333,12,
12791,45106,334,5,0, 12831,47168,334,5,0,
1280335,11,1,203,0, 1284335,11,1,203,0,
1281336,4,22,82,0, 1285336,4,22,82,0,
128273,0,71,0,72, 128673,0,71,0,72,
@@ -1291,13 +1295,13 @@ public class yyLSLTokens : YyLexer {
12910,71,0,76,0, 12950,71,0,76,0,
129269,0,1,-1,3, 129669,0,1,-1,3,
129364,0,339,12,1, 129764,0,339,12,1,
129443421,340,5,0,341, 129845483,340,5,0,341,
129511,1,106,0,342, 129911,1,106,0,342,
12964,4,65,0,84, 13004,4,65,0,84,
12970,1,-1,3,65, 13010,1,-1,3,65,
12980,343,12,1,1675, 13020,343,12,1,1697,
1299344,5,63,3,109, 1303344,5,63,3,109,
13000,345,12,1,1676, 13040,345,12,1,1698,
1301346,5,63,3,109, 1305346,5,63,3,109,
13020,345,3,110,0, 13060,345,3,110,0,
1303345,3,111,0,345, 1307345,3,111,0,345,
@@ -1349,7 +1353,7 @@ public class yyLSLTokens : YyLexer {
1349105,0,345,3,106, 1353105,0,345,3,106,
13500,345,3,107,0, 13540,345,3,107,0,
1351345,3,108,0,345, 1355345,3,108,0,345,
1352347,11,1,845,0, 1356347,11,1,867,0,
1353348,4,10,73,0, 1357348,4,10,73,0,
135468,0,69,0,78, 135868,0,69,0,78,
13550,84,0,1,-1, 13590,84,0,1,-1,
@@ -1403,7 +1407,7 @@ public class yyLSLTokens : YyLexer {
1403345,3,106,0,345, 1407345,3,106,0,345,
14043,107,0,345,3, 14083,107,0,345,3,
1405108,0,345,349,11, 1409108,0,345,349,11,
14061,845,0,348,1, 14101,867,0,348,1,
1407-1,3,66,0,343, 1411-1,3,66,0,343,
14083,67,0,343,3, 14123,67,0,343,3,
140968,0,343,3,69, 141368,0,343,3,69,
@@ -1425,7 +1429,7 @@ public class yyLSLTokens : YyLexer {
142588,0,343,3,89, 142988,0,343,3,89,
14260,343,3,90,0, 14300,343,3,90,0,
1427343,3,91,0,350, 1431343,3,91,0,350,
142812,1,41124,351,5, 143212,1,43186,351,5,
14290,352,11,1,126, 14330,352,11,1,126,
14300,353,4,24,76, 14340,353,4,24,76,
14310,69,0,70,0, 14350,69,0,70,0,
@@ -1434,7 +1438,7 @@ public class yyLSLTokens : YyLexer {
143467,0,75,0,69, 143867,0,75,0,69,
14350,84,0,1,-1, 14390,84,0,1,-1,
14363,93,0,354,12, 14403,93,0,354,12,
14371,41489,355,5,0, 14411,43551,355,5,0,
1438356,11,1,131,0, 1442356,11,1,131,0,
1439357,4,26,82,0, 1443357,4,26,82,0,
144073,0,71,0,72, 144473,0,71,0,72,
@@ -1443,21 +1447,21 @@ public class yyLSLTokens : YyLexer {
14430,67,0,75,0, 14470,67,0,75,0,
144469,0,84,0,1, 144869,0,84,0,1,
1445-1,3,94,0,358, 1449-1,3,94,0,358,
144612,1,45593,359,5, 145012,1,47655,359,5,
14470,360,11,1,170, 14510,360,11,1,170,
14480,361,4,10,67, 14520,361,4,10,67,
14490,65,0,82,0, 14530,65,0,82,0,
145069,0,84,0,1, 145469,0,84,0,1,
1451-1,3,95,0,343, 1455-1,3,95,0,343,
14523,97,0,362,12, 14563,97,0,362,12,
14531,20677,363,5,63, 14571,22739,363,5,63,
14543,109,0,345,3, 14583,109,0,345,3,
1455110,0,345,3,111, 1459110,0,345,3,111,
14560,345,3,112,0, 14600,345,3,112,0,
1457345,3,113,0,345, 1461345,3,113,0,345,
14583,114,0,345,3, 14623,114,0,345,3,
1459115,0,345,3,116, 1463115,0,345,3,116,
14600,364,12,1,20712, 14640,364,12,1,22774,
1461365,5,63,3,109, 1465365,5,63,3,109,
14620,345,3,110,0, 14660,345,3,110,0,
1463345,3,111,0,345, 1467345,3,111,0,345,
@@ -1465,7 +1469,7 @@ public class yyLSLTokens : YyLexer {
1465113,0,345,3,114, 1469113,0,345,3,114,
14660,345,3,115,0, 14700,345,3,115,0,
1467345,3,116,0,366, 1471345,3,116,0,366,
146812,1,20747,367,5, 147212,1,22809,367,5,
146963,3,109,0,345, 147363,3,109,0,345,
14703,110,0,345,3, 14743,110,0,345,3,
1471111,0,345,3,112, 1475111,0,345,3,112,
@@ -1508,7 +1512,7 @@ public class yyLSLTokens : YyLexer {
15080,345,3,90,0, 15120,345,3,90,0,
1509345,3,95,0,345, 1513345,3,95,0,345,
15103,97,0,368,12, 15143,97,0,368,12,
15111,20790,369,5,63, 15151,22852,369,5,63,
15123,109,0,345,3, 15163,109,0,345,3,
1513110,0,345,3,111, 1517110,0,345,3,111,
15140,345,3,112,0, 15180,345,3,112,0,
@@ -1552,7 +1556,7 @@ public class yyLSLTokens : YyLexer {
15523,95,0,345,3, 15563,95,0,345,3,
155397,0,345,3,98, 155797,0,345,3,98,
15540,345,3,99,0, 15580,345,3,99,0,
1555370,12,1,20835,371, 1559370,12,1,22897,371,
15565,63,3,109,0, 15605,63,3,109,0,
1557345,3,110,0,345, 1561345,3,110,0,345,
15583,111,0,345,3, 15623,111,0,345,3,
@@ -1601,7 +1605,7 @@ public class yyLSLTokens : YyLexer {
1601345,3,102,0,345, 1605345,3,102,0,345,
16023,103,0,345,3, 16063,103,0,345,3,
1603104,0,372,12,1, 1607104,0,372,12,1,
160420885,373,5,63,3, 160822947,373,5,63,3,
1605109,0,345,3,110, 1609109,0,345,3,110,
16060,345,3,111,0, 16100,345,3,111,0,
1607345,3,112,0,345, 1611345,3,112,0,345,
@@ -1662,7 +1666,7 @@ public class yyLSLTokens : YyLexer {
16623,105,0,345,3, 16663,105,0,345,3,
1663106,0,345,3,107, 1667106,0,345,3,107,
16640,345,3,108,0, 16680,345,3,108,0,
1665345,376,11,1,845, 1669345,376,11,1,867,
16660,348,1,-1,3, 16700,348,1,-1,3,
1667100,0,345,3,101, 1671100,0,345,3,101,
16680,345,3,102,0, 16720,345,3,102,0,
@@ -1671,7 +1675,7 @@ public class yyLSLTokens : YyLexer {
1671105,0,345,3,106, 1675105,0,345,3,106,
16720,345,3,107,0, 16760,345,3,107,0,
1673345,3,108,0,345, 1677345,3,108,0,345,
1674377,11,1,845,0, 1678377,11,1,867,0,
1675348,1,-1,3,98, 1679348,1,-1,3,98,
16760,345,3,99,0, 16800,345,3,99,0,
1677345,3,100,0,345, 1681345,3,100,0,345,
@@ -1682,7 +1686,7 @@ public class yyLSLTokens : YyLexer {
16823,106,0,345,3, 16863,106,0,345,3,
1683107,0,345,3,108, 1687107,0,345,3,108,
16840,345,378,11,1, 16880,345,378,11,1,
1685845,0,348,1,-1, 1689867,0,348,1,-1,
16863,117,0,345,3, 16903,117,0,345,3,
1687118,0,345,3,119, 1691118,0,345,3,119,
16880,345,3,120,0, 16920,345,3,120,0,
@@ -1717,17 +1721,17 @@ public class yyLSLTokens : YyLexer {
1717345,3,88,0,345, 1721345,3,88,0,345,
17183,89,0,345,3, 17223,89,0,345,3,
171990,0,345,3,95, 172390,0,345,3,95,
17200,379,12,1,21278, 17240,379,12,1,23340,
1721380,5,63,3,109, 1725380,5,63,3,109,
17220,345,3,110,0, 17260,345,3,110,0,
1723345,3,111,0,345, 1727345,3,111,0,345,
17243,112,0,345,3, 17283,112,0,345,3,
1725113,0,345,3,114, 1729113,0,345,3,114,
17260,381,12,1,21311, 17300,381,12,1,23373,
1727382,5,63,3,109, 1731382,5,63,3,109,
17280,345,3,110,0, 17320,345,3,110,0,
1729345,3,111,0,383, 1733345,3,111,0,383,
173012,1,21341,384,5, 173412,1,23403,384,5,
173163,3,109,0,345, 173563,3,109,0,345,
17323,110,0,345,3, 17363,110,0,345,3,
1733111,0,345,3,112, 1737111,0,345,3,112,
@@ -1735,7 +1739,7 @@ public class yyLSLTokens : YyLexer {
1735345,3,114,0,345, 1739345,3,114,0,345,
17363,115,0,345,3, 17403,115,0,345,3,
1737116,0,385,12,1, 1741116,0,385,12,1,
173821376,386,5,63,3, 174223438,386,5,63,3,
1739109,0,345,3,110, 1743109,0,345,3,110,
17400,345,3,111,0, 17440,345,3,111,0,
1741345,3,112,0,345, 1745345,3,112,0,345,
@@ -1777,14 +1781,14 @@ public class yyLSLTokens : YyLexer {
1777345,3,89,0,345, 1781345,3,89,0,345,
17783,90,0,345,3, 17823,90,0,345,3,
177995,0,387,12,1, 178395,0,387,12,1,
178021462,388,5,63,3, 178423524,388,5,63,3,
1781109,0,345,3,110, 1785109,0,345,3,110,
17820,345,3,111,0, 17860,345,3,111,0,
1783345,3,112,0,345, 1787345,3,112,0,345,
17843,113,0,345,3, 17883,113,0,345,3,
1785114,0,345,3,115, 1789114,0,345,3,115,
17860,345,3,116,0, 17900,345,3,116,0,
1787389,12,1,21497,390, 1791389,12,1,23559,390,
17885,63,3,109,0, 17925,63,3,109,0,
1789345,3,110,0,345, 1793345,3,110,0,345,
17903,111,0,345,3, 17943,111,0,345,3,
@@ -1827,13 +1831,13 @@ public class yyLSLTokens : YyLexer {
182789,0,345,3,90, 183189,0,345,3,90,
18280,345,3,95,0, 18320,345,3,95,0,
1829345,3,97,0,391, 1833345,3,97,0,391,
183012,1,21540,392,5, 183412,1,23602,392,5,
183163,3,109,0,345, 183563,3,109,0,345,
18323,110,0,345,3, 18363,110,0,345,3,
1833111,0,345,3,112, 1837111,0,345,3,112,
18340,345,3,113,0, 18380,345,3,113,0,
1835345,3,114,0,393, 1839345,3,114,0,393,
183612,1,21573,394,5, 184012,1,23635,394,5,
183763,3,109,0,345, 184163,3,109,0,345,
18383,110,0,345,3, 18423,110,0,345,3,
1839111,0,345,3,112, 1843111,0,345,3,112,
@@ -1881,7 +1885,7 @@ public class yyLSLTokens : YyLexer {
1881345,3,101,0,345, 1885345,3,101,0,345,
18823,102,0,345,3, 18863,102,0,345,3,
1883103,0,395,12,1, 1887103,0,395,12,1,
188421622,396,5,63,3, 188823684,396,5,63,3,
1885109,0,345,3,110, 1889109,0,345,3,110,
18860,345,3,111,0, 18900,345,3,111,0,
1887345,3,112,0,345, 1891345,3,112,0,345,
@@ -1927,14 +1931,14 @@ public class yyLSLTokens : YyLexer {
1927345,3,99,0,345, 1931345,3,99,0,345,
19283,100,0,345,3, 19323,100,0,345,3,
1929101,0,397,12,1, 1933101,0,397,12,1,
193021669,398,5,63,3, 193423731,398,5,63,3,
1931109,0,345,3,110, 1935109,0,345,3,110,
19320,345,3,111,0, 19360,345,3,111,0,
1933345,3,112,0,345, 1937345,3,112,0,345,
19343,113,0,345,3, 19383,113,0,345,3,
1935114,0,345,3,115, 1939114,0,345,3,115,
19360,345,3,116,0, 19400,345,3,116,0,
1937399,12,1,21704,400, 1941399,12,1,23766,400,
19385,63,3,109,0, 19425,63,3,109,0,
1939345,3,110,0,345, 1943345,3,110,0,345,
19403,111,0,345,3, 19443,111,0,345,3,
@@ -2040,19 +2044,19 @@ public class yyLSLTokens : YyLexer {
20403,106,0,345,3, 20443,106,0,345,3,
2041107,0,345,3,108, 2045107,0,345,3,108,
20420,345,403,11,1, 20460,345,403,11,1,
2043845,0,348,1,-1, 2047867,0,348,1,-1,
20443,102,0,345,3, 20483,102,0,345,3,
2045103,0,345,3,104, 2049103,0,345,3,104,
20460,345,3,105,0, 20500,345,3,105,0,
2047345,3,106,0,345, 2051345,3,106,0,345,
20483,107,0,345,3, 20523,107,0,345,3,
2049108,0,345,404,11, 2053108,0,345,404,11,
20501,845,0,348,1, 20541,867,0,348,1,
2051-1,3,104,0,345, 2055-1,3,104,0,345,
20523,105,0,345,3, 20563,105,0,345,3,
2053106,0,345,3,107, 2057106,0,345,3,107,
20540,345,3,108,0, 20580,345,3,108,0,
2055345,405,11,1,845, 2059345,405,11,1,867,
20560,348,1,-1,3, 20600,348,1,-1,3,
2057115,0,345,3,116, 2061115,0,345,3,116,
20580,345,3,117,0, 20620,345,3,117,0,
@@ -2100,7 +2104,7 @@ public class yyLSLTokens : YyLexer {
21003,106,0,345,3, 21043,106,0,345,3,
2101107,0,345,3,108, 2105107,0,345,3,108,
21020,345,406,11,1, 21060,345,406,11,1,
2103845,0,348,1,-1, 2107867,0,348,1,-1,
21043,98,0,345,3, 21083,98,0,345,3,
210599,0,345,3,100, 210999,0,345,3,100,
21060,345,3,101,0, 21100,345,3,101,0,
@@ -2110,7 +2114,7 @@ public class yyLSLTokens : YyLexer {
21100,345,3,106,0, 21140,345,3,106,0,
2111345,3,107,0,345, 2115345,3,107,0,345,
21123,108,0,345,407, 21163,108,0,345,407,
211311,1,845,0,348, 211711,1,867,0,348,
21141,-1,3,117,0, 21181,-1,3,117,0,
2115345,3,118,0,345, 2119345,3,118,0,345,
21163,119,0,345,3, 21203,119,0,345,3,
@@ -2156,7 +2160,7 @@ public class yyLSLTokens : YyLexer {
21563,106,0,345,3, 21603,106,0,345,3,
2157107,0,345,3,108, 2161107,0,345,3,108,
21580,345,408,11,1, 21620,345,408,11,1,
2159845,0,348,1,-1, 2163867,0,348,1,-1,
21603,97,0,345,3, 21643,97,0,345,3,
216198,0,345,3,99, 216598,0,345,3,99,
21620,345,3,100,0, 21660,345,3,100,0,
@@ -2167,7 +2171,7 @@ public class yyLSLTokens : YyLexer {
2167345,3,106,0,345, 2171345,3,106,0,345,
21683,107,0,345,3, 21723,107,0,345,3,
2169108,0,345,409,11, 2173108,0,345,409,11,
21701,845,0,348,1, 21741,867,0,348,1,
2171-1,3,117,0,345, 2175-1,3,117,0,345,
21723,118,0,345,3, 21763,118,0,345,3,
2173119,0,345,3,120, 2177119,0,345,3,120,
@@ -2212,7 +2216,7 @@ public class yyLSLTokens : YyLexer {
22123,105,0,345,3, 22163,105,0,345,3,
2213106,0,345,3,107, 2217106,0,345,3,107,
22140,345,3,108,0, 22180,345,3,108,0,
2215345,410,11,1,845, 2219345,410,11,1,867,
22160,348,1,-1,3, 22200,348,1,-1,3,
2217112,0,345,3,113, 2221112,0,345,3,113,
22180,345,3,114,0, 22220,345,3,114,0,
@@ -2262,10 +2266,10 @@ public class yyLSLTokens : YyLexer {
22620,345,3,106,0, 22660,345,3,106,0,
2263345,3,107,0,345, 2267345,3,107,0,345,
22643,108,0,345,411, 22683,108,0,345,411,
226511,1,845,0,348, 226911,1,867,0,348,
22661,-1,3,115,0, 22701,-1,3,115,0,
2267345,3,116,0,412, 2271345,3,116,0,412,
226812,1,22513,413,5, 227212,1,24575,413,5,
226963,3,109,0,345, 227363,3,109,0,345,
22703,110,0,345,3, 22743,110,0,345,3,
2271111,0,345,3,112, 2275111,0,345,3,112,
@@ -2308,13 +2312,13 @@ public class yyLSLTokens : YyLexer {
23080,345,3,90,0, 23120,345,3,90,0,
2309345,3,95,0,345, 2313345,3,95,0,345,
23103,97,0,414,12, 23143,97,0,414,12,
23111,22556,415,5,63, 23151,24618,415,5,63,
23123,109,0,345,3, 23163,109,0,345,3,
2313110,0,345,3,111, 2317110,0,345,3,111,
23140,345,3,112,0, 23180,345,3,112,0,
2315345,3,113,0,345, 2319345,3,113,0,345,
23163,114,0,416,12, 23203,114,0,416,12,
23171,22589,417,5,63, 23211,24651,417,5,63,
23183,109,0,345,3, 23223,109,0,345,3,
2319110,0,345,3,111, 2323110,0,345,3,111,
23200,345,3,112,0, 23240,345,3,112,0,
@@ -2361,7 +2365,7 @@ public class yyLSLTokens : YyLexer {
2361345,3,100,0,345, 2365345,3,100,0,345,
23623,101,0,345,3, 23663,101,0,345,3,
2363102,0,345,3,103, 2367102,0,345,3,103,
23640,418,12,1,22638, 23680,418,12,1,24700,
2365419,5,63,3,109, 2369419,5,63,3,109,
23660,345,3,110,0, 23700,345,3,110,0,
2367345,3,111,0,345, 2371345,3,111,0,345,
@@ -2407,7 +2411,7 @@ public class yyLSLTokens : YyLexer {
2407345,3,98,0,345, 2411345,3,98,0,345,
24083,99,0,345,3, 24123,99,0,345,3,
2409100,0,345,3,101, 2413100,0,345,3,101,
24100,420,12,1,22685, 24140,420,12,1,24747,
2411421,5,63,3,109, 2415421,5,63,3,109,
24120,345,3,110,0, 24160,345,3,110,0,
2413345,3,111,0,345, 2417345,3,111,0,345,
@@ -2415,7 +2419,7 @@ public class yyLSLTokens : YyLexer {
2415113,0,345,3,114, 2419113,0,345,3,114,
24160,345,3,115,0, 24200,345,3,115,0,
2417345,3,116,0,422, 2421345,3,116,0,422,
241812,1,22720,423,5, 242212,1,24782,423,5,
241963,3,109,0,345, 242363,3,109,0,345,
24203,110,0,345,3, 24243,110,0,345,3,
2421111,0,345,3,112, 2425111,0,345,3,112,
@@ -2519,20 +2523,20 @@ public class yyLSLTokens : YyLexer {
2519345,3,106,0,345, 2523345,3,106,0,345,
25203,107,0,345,3, 25243,107,0,345,3,
2521108,0,345,426,11, 2525108,0,345,426,11,
25221,845,0,348,1, 25261,867,0,348,1,
2523-1,3,102,0,345, 2527-1,3,102,0,345,
25243,103,0,345,3, 25283,103,0,345,3,
2525104,0,345,3,105, 2529104,0,345,3,105,
25260,345,3,106,0, 25300,345,3,106,0,
2527345,3,107,0,345, 2531345,3,107,0,345,
25283,108,0,345,427, 25323,108,0,345,427,
252911,1,845,0,348, 253311,1,867,0,348,
25301,-1,3,104,0, 25341,-1,3,104,0,
2531345,3,105,0,345, 2535345,3,105,0,345,
25323,106,0,345,3, 25363,106,0,345,3,
2533107,0,345,3,108, 2537107,0,345,3,108,
25340,345,428,11,1, 25380,345,428,11,1,
2535845,0,348,1,-1, 2539867,0,348,1,-1,
25363,115,0,345,3, 25403,115,0,345,3,
2537116,0,345,3,117, 2541116,0,345,3,117,
25380,345,3,118,0, 25420,345,3,118,0,
@@ -2579,7 +2583,7 @@ public class yyLSLTokens : YyLexer {
2579345,3,106,0,345, 2583345,3,106,0,345,
25803,107,0,345,3, 25843,107,0,345,3,
2581108,0,345,429,11, 2585108,0,345,429,11,
25821,845,0,348,1, 25861,867,0,348,1,
2583-1,3,98,0,345, 2587-1,3,98,0,345,
25843,99,0,345,3, 25883,99,0,345,3,
2585100,0,345,3,101, 2589100,0,345,3,101,
@@ -2589,7 +2593,7 @@ public class yyLSLTokens : YyLexer {
2589105,0,345,3,106, 2593105,0,345,3,106,
25900,345,3,107,0, 25940,345,3,107,0,
2591345,3,108,0,345, 2595345,3,108,0,345,
2592430,11,1,845,0, 2596430,11,1,867,0,
2593348,1,-1,3,117, 2597348,1,-1,3,117,
25940,345,3,118,0, 25980,345,3,118,0,
2595345,3,119,0,345, 2599345,3,119,0,345,
@@ -2635,7 +2639,7 @@ public class yyLSLTokens : YyLexer {
2635345,3,106,0,345, 2639345,3,106,0,345,
26363,107,0,345,3, 26403,107,0,345,3,
2637108,0,345,431,11, 2641108,0,345,431,11,
26381,845,0,348,1, 26421,867,0,348,1,
2639-1,3,97,0,345, 2643-1,3,97,0,345,
26403,98,0,345,3, 26443,98,0,345,3,
264199,0,345,3,100, 264599,0,345,3,100,
@@ -2646,7 +2650,7 @@ public class yyLSLTokens : YyLexer {
26460,345,3,106,0, 26500,345,3,106,0,
2647345,3,107,0,345, 2651345,3,107,0,345,
26483,108,0,345,432, 26523,108,0,345,432,
264911,1,845,0,348, 265311,1,867,0,348,
26501,-1,3,117,0, 26541,-1,3,117,0,
2651345,3,118,0,345, 2655345,3,118,0,345,
26523,119,0,345,3, 26563,119,0,345,3,
@@ -2692,16 +2696,16 @@ public class yyLSLTokens : YyLexer {
26923,106,0,345,3, 26963,106,0,345,3,
2693107,0,345,3,108, 2697107,0,345,3,108,
26940,345,433,11,1, 26980,345,433,11,1,
2695845,0,348,1,-1, 2699867,0,348,1,-1,
26963,98,0,343,3, 27003,98,0,343,3,
269799,0,434,12,1, 270199,0,434,12,1,
269823439,435,5,63,3, 270225501,435,5,63,3,
2699109,0,345,3,110, 2703109,0,345,3,110,
27000,345,3,111,0, 27040,345,3,111,0,
2701436,12,1,23469,437, 2705436,12,1,25531,437,
27025,63,3,109,0, 27065,63,3,109,0,
2703345,3,110,0,438, 2707345,3,110,0,438,
270412,1,23498,439,5, 270812,1,25560,439,5,
270563,3,109,0,345, 270963,3,109,0,345,
27063,110,0,345,3, 27103,110,0,345,3,
2707111,0,345,3,112, 2711111,0,345,3,112,
@@ -2709,16 +2713,16 @@ public class yyLSLTokens : YyLexer {
2709345,3,114,0,345, 2713345,3,114,0,345,
27103,115,0,345,3, 27143,115,0,345,3,
2711116,0,440,12,1, 2715116,0,440,12,1,
271223533,441,5,63,3, 271625595,441,5,63,3,
2713109,0,345,3,110, 2717109,0,345,3,110,
27140,345,3,111,0, 27180,345,3,111,0,
2715345,3,112,0,345, 2719345,3,112,0,345,
27163,113,0,345,3, 27203,113,0,345,3,
2717114,0,442,12,1, 2721114,0,442,12,1,
271823566,443,5,63,3, 272225628,443,5,63,3,
2719109,0,345,3,110, 2723109,0,345,3,110,
27200,345,3,111,0, 27240,345,3,111,0,
2721444,12,1,23596,445, 2725444,12,1,25658,445,
27225,63,3,109,0, 27265,63,3,109,0,
2723345,3,110,0,345, 2727345,3,110,0,345,
27243,111,0,345,3, 27283,111,0,345,3,
@@ -2770,7 +2774,7 @@ public class yyLSLTokens : YyLexer {
27700,345,3,106,0, 27740,345,3,106,0,
2771345,3,107,0,345, 2775345,3,107,0,345,
27723,108,0,446,12, 27763,108,0,446,12,
27731,23650,447,5,63, 27771,25712,447,5,63,
27743,109,0,345,3, 27783,109,0,345,3,
2775110,0,345,3,111, 2779110,0,345,3,111,
27760,345,3,112,0, 27800,345,3,112,0,
@@ -2829,7 +2833,7 @@ public class yyLSLTokens : YyLexer {
28290,69,0,86,0, 28330,69,0,86,0,
283069,0,78,0,84, 283469,0,78,0,84,
28310,1,-1,450,11, 28350,1,-1,450,11,
28321,845,0,348,1, 28361,867,0,348,1,
2833-1,3,112,0,345, 2837-1,3,112,0,345,
28343,113,0,345,3, 28383,113,0,345,3,
2835114,0,345,3,115, 2839114,0,345,3,115,
@@ -2878,7 +2882,7 @@ public class yyLSLTokens : YyLexer {
28783,105,0,345,3, 28823,105,0,345,3,
2879106,0,345,3,107, 2883106,0,345,3,107,
28800,345,3,108,0, 28840,345,3,108,0,
2881345,451,11,1,845, 2885345,451,11,1,867,
28820,348,1,-1,3, 28860,348,1,-1,3,
2883115,0,345,3,116, 2887115,0,345,3,116,
28840,345,3,117,0, 28880,345,3,117,0,
@@ -2926,7 +2930,7 @@ public class yyLSLTokens : YyLexer {
29263,106,0,345,3, 29303,106,0,345,3,
2927107,0,345,3,108, 2931107,0,345,3,108,
29280,345,452,11,1, 29320,345,452,11,1,
2929845,0,348,1,-1, 2933867,0,348,1,-1,
29303,117,0,345,3, 29343,117,0,345,3,
2931118,0,345,3,119, 2935118,0,345,3,119,
29320,345,3,120,0, 29360,345,3,120,0,
@@ -2971,7 +2975,7 @@ public class yyLSLTokens : YyLexer {
2971105,0,345,3,106, 2975105,0,345,3,106,
29720,345,3,107,0, 29760,345,3,107,0,
2973345,3,108,0,345, 2977345,3,108,0,345,
2974453,11,1,845,0, 2978453,11,1,867,0,
2975348,1,-1,3,111, 2979348,1,-1,3,111,
29760,345,3,112,0, 29800,345,3,112,0,
2977345,3,113,0,345, 2981345,3,113,0,345,
@@ -3021,7 +3025,7 @@ public class yyLSLTokens : YyLexer {
3021345,3,105,0,345, 3025345,3,105,0,345,
30223,106,0,345,3, 30263,106,0,345,3,
3023107,0,345,3,108, 3027107,0,345,3,108,
30240,454,12,1,24123, 30280,454,12,1,26185,
3025455,5,63,3,109, 3029455,5,63,3,109,
30260,345,3,110,0, 30300,345,3,110,0,
3027345,3,111,0,345, 3031345,3,111,0,345,
@@ -3073,7 +3077,7 @@ public class yyLSLTokens : YyLexer {
3073105,0,345,3,106, 3077105,0,345,3,106,
30740,345,3,107,0, 30780,345,3,107,0,
3075345,3,108,0,456, 3079345,3,108,0,456,
307612,1,24177,457,5, 308012,1,26239,457,5,
307763,3,109,0,345, 308163,3,109,0,345,
30783,110,0,345,3, 30823,110,0,345,3,
3079111,0,345,3,112, 3083111,0,345,3,112,
@@ -3122,14 +3126,14 @@ public class yyLSLTokens : YyLexer {
31223,102,0,345,3, 31263,102,0,345,3,
3123103,0,345,3,104, 3127103,0,345,3,104,
31240,345,3,105,0, 31280,345,3,105,0,
3125458,12,1,24228,459, 3129458,12,1,26290,459,
31265,63,3,109,0, 31305,63,3,109,0,
3127345,3,110,0,345, 3131345,3,110,0,345,
31283,111,0,345,3, 31323,111,0,345,3,
3129112,0,345,3,113, 3133112,0,345,3,113,
31300,345,3,114,0, 31340,345,3,114,0,
3131345,3,115,0,460, 3135345,3,115,0,460,
313212,1,24262,461,5, 313612,1,26324,461,5,
313363,3,109,0,345, 313763,3,109,0,345,
31343,110,0,345,3, 31383,110,0,345,3,
3135111,0,345,3,112, 3139111,0,345,3,112,
@@ -3178,14 +3182,14 @@ public class yyLSLTokens : YyLexer {
31783,102,0,345,3, 31823,102,0,345,3,
3179103,0,345,3,104, 3183103,0,345,3,104,
31800,345,3,105,0, 31840,345,3,105,0,
3181462,12,1,24313,463, 3185462,12,1,26375,463,
31825,63,3,109,0, 31865,63,3,109,0,
3183345,3,110,0,345, 3187345,3,110,0,345,
31843,111,0,464,12, 31883,111,0,464,12,
31851,24343,465,5,63, 31891,26405,465,5,63,
31863,109,0,345,3, 31903,109,0,345,3,
3187110,0,466,12,1, 3191110,0,466,12,1,
318824372,467,5,63,3, 319226434,467,5,63,3,
3189109,0,345,3,110, 3193109,0,345,3,110,
31900,345,3,111,0, 31940,345,3,111,0,
3191345,3,112,0,345, 3195345,3,112,0,345,
@@ -3227,13 +3231,13 @@ public class yyLSLTokens : YyLexer {
3227345,3,89,0,345, 3231345,3,89,0,345,
32283,90,0,345,3, 32323,90,0,345,3,
322995,0,468,12,1, 323395,0,468,12,1,
323024458,469,5,63,3, 323426520,469,5,63,3,
3231109,0,345,3,110, 3235109,0,345,3,110,
32320,345,3,111,0, 32360,345,3,111,0,
3233345,3,112,0,345, 3237345,3,112,0,345,
32343,113,0,345,3, 32383,113,0,345,3,
3235114,0,345,3,115, 3239114,0,345,3,115,
32360,470,12,1,24492, 32400,470,12,1,26554,
3237471,5,63,3,109, 3241471,5,63,3,109,
32380,345,3,110,0, 32420,345,3,110,0,
3239345,3,111,0,345, 3243345,3,111,0,345,
@@ -3241,7 +3245,7 @@ public class yyLSLTokens : YyLexer {
3241113,0,345,3,114, 3245113,0,345,3,114,
32420,345,3,115,0, 32460,345,3,115,0,
3243345,3,116,0,472, 3247345,3,116,0,472,
324412,1,24527,473,5, 324812,1,26589,473,5,
324563,3,109,0,345, 324963,3,109,0,345,
32463,110,0,345,3, 32503,110,0,345,3,
3247111,0,345,3,112, 3251111,0,345,3,112,
@@ -3284,20 +3288,20 @@ public class yyLSLTokens : YyLexer {
32840,345,3,90,0, 32880,345,3,90,0,
3285345,3,95,0,345, 3289345,3,95,0,345,
32863,97,0,474,12, 32903,97,0,474,12,
32871,24570,475,5,63, 32911,26632,475,5,63,
32883,109,0,345,3, 32923,109,0,345,3,
3289110,0,345,3,111, 3293110,0,345,3,111,
32900,345,3,112,0, 32940,345,3,112,0,
3291345,3,113,0,345, 3295345,3,113,0,345,
32923,114,0,476,12, 32963,114,0,476,12,
32931,24603,477,5,63, 32971,26665,477,5,63,
32943,109,0,345,3, 32983,109,0,345,3,
3295110,0,345,3,111, 3299110,0,345,3,111,
32960,345,3,112,0, 33000,345,3,112,0,
3297345,3,113,0,345, 3301345,3,113,0,345,
32983,114,0,345,3, 33023,114,0,345,3,
3299115,0,345,3,116, 3303115,0,345,3,116,
33000,478,12,1,24638, 33040,478,12,1,26700,
3301479,5,63,3,109, 3305479,5,63,3,109,
33020,345,3,110,0, 33060,345,3,110,0,
3303345,3,111,0,345, 3307345,3,111,0,345,
@@ -3404,7 +3408,7 @@ public class yyLSLTokens : YyLexer {
34043,106,0,345,3, 34083,106,0,345,3,
3405107,0,345,3,108, 3409107,0,345,3,108,
34060,345,482,11,1, 34100,345,482,11,1,
3407845,0,348,1,-1, 3411867,0,348,1,-1,
34083,115,0,345,3, 34123,115,0,345,3,
3409116,0,345,3,117, 3413116,0,345,3,117,
34100,345,3,118,0, 34140,345,3,118,0,
@@ -3451,7 +3455,7 @@ public class yyLSLTokens : YyLexer {
3451345,3,106,0,345, 3455345,3,106,0,345,
34523,107,0,345,3, 34563,107,0,345,3,
3453108,0,345,483,11, 3457108,0,345,483,11,
34541,845,0,348,1, 34581,867,0,348,1,
3455-1,3,98,0,345, 3459-1,3,98,0,345,
34563,99,0,345,3, 34603,99,0,345,3,
3457100,0,345,3,101, 3461100,0,345,3,101,
@@ -3461,7 +3465,7 @@ public class yyLSLTokens : YyLexer {
3461105,0,345,3,106, 3465105,0,345,3,106,
34620,345,3,107,0, 34660,345,3,107,0,
3463345,3,108,0,345, 3467345,3,108,0,345,
3464484,11,1,845,0, 3468484,11,1,867,0,
3465348,1,-1,3,117, 3469348,1,-1,3,117,
34660,345,3,118,0, 34700,345,3,118,0,
3467345,3,119,0,345, 3471345,3,119,0,345,
@@ -3507,7 +3511,7 @@ public class yyLSLTokens : YyLexer {
3507345,3,106,0,345, 3511345,3,106,0,345,
35083,107,0,345,3, 35123,107,0,345,3,
3509108,0,345,485,11, 3513108,0,345,485,11,
35101,845,0,348,1, 35141,867,0,348,1,
3511-1,3,116,0,345, 3515-1,3,116,0,345,
35123,117,0,345,3, 35163,117,0,345,3,
3513118,0,345,3,119, 3517118,0,345,3,119,
@@ -3547,10 +3551,10 @@ public class yyLSLTokens : YyLexer {
3547345,3,98,0,345, 3551345,3,98,0,345,
35483,99,0,345,3, 35523,99,0,345,3,
3549100,0,345,3,101, 3553100,0,345,3,101,
35500,486,12,1,25105, 35540,486,12,1,27167,
3551487,5,63,3,109, 3555487,5,63,3,109,
35520,345,3,110,0, 35560,345,3,110,0,
3553488,12,1,25134,489, 3557488,12,1,27196,489,
35545,63,3,109,0, 35585,63,3,109,0,
3555345,3,110,0,345, 3559345,3,110,0,345,
35563,111,0,345,3, 35603,111,0,345,3,
@@ -3595,7 +3599,7 @@ public class yyLSLTokens : YyLexer {
3595345,3,97,0,345, 3599345,3,97,0,345,
35963,98,0,345,3, 36003,98,0,345,3,
359799,0,345,3,100, 360199,0,345,3,100,
35980,490,12,1,25180, 36020,490,12,1,27242,
3599491,5,63,3,109, 3603491,5,63,3,109,
36000,345,3,110,0, 36040,345,3,110,0,
3601345,3,111,0,345, 3605345,3,111,0,345,
@@ -3663,7 +3667,7 @@ public class yyLSLTokens : YyLexer {
3663105,0,345,3,106, 3667105,0,345,3,106,
36640,345,3,107,0, 36680,345,3,107,0,
3665345,3,108,0,345, 3669345,3,108,0,345,
3666494,11,1,845,0, 3670494,11,1,867,0,
3667348,1,-1,3,111, 3671348,1,-1,3,111,
36680,345,3,112,0, 36720,345,3,112,0,
3669345,3,113,0,345, 3673345,3,113,0,345,
@@ -3714,14 +3718,14 @@ public class yyLSLTokens : YyLexer {
37143,106,0,345,3, 37183,106,0,345,3,
3715107,0,345,3,108, 3719107,0,345,3,108,
37160,345,495,11,1, 37200,345,495,11,1,
3717845,0,348,1,-1, 3721867,0,348,1,-1,
37183,102,0,345,3, 37223,102,0,345,3,
3719103,0,345,3,104, 3723103,0,345,3,104,
37200,345,3,105,0, 37240,345,3,105,0,
3721345,3,106,0,345, 3725345,3,106,0,345,
37223,107,0,345,3, 37263,107,0,345,3,
3723108,0,345,496,11, 3727108,0,345,496,11,
37241,845,0,348,1, 37281,867,0,348,1,
3725-1,3,97,0,345, 3729-1,3,97,0,345,
37263,98,0,345,3, 37303,98,0,345,3,
372799,0,345,3,100, 373199,0,345,3,100,
@@ -3789,7 +3793,7 @@ public class yyLSLTokens : YyLexer {
3789345,3,106,0,345, 3793345,3,106,0,345,
37903,107,0,345,3, 37943,107,0,345,3,
3791108,0,345,499,11, 3795108,0,345,499,11,
37921,845,0,348,1, 37961,867,0,348,1,
3793-1,3,112,0,345, 3797-1,3,112,0,345,
37943,113,0,345,3, 37983,113,0,345,3,
3795114,0,345,3,115, 3799114,0,345,3,115,
@@ -3838,11 +3842,11 @@ public class yyLSLTokens : YyLexer {
38383,105,0,345,3, 38423,105,0,345,3,
3839106,0,345,3,107, 3843106,0,345,3,107,
38400,345,3,108,0, 38440,345,3,108,0,
3841345,500,11,1,845, 3845345,500,11,1,867,
38420,348,1,-1,3, 38460,348,1,-1,3,
3843106,0,345,3,107, 3847106,0,345,3,107,
38440,345,3,108,0, 38480,345,3,108,0,
3845345,501,11,1,845, 3849345,501,11,1,867,
38460,348,1,-1,3, 38500,348,1,-1,3,
3847116,0,345,3,117, 3851116,0,345,3,117,
38480,345,3,118,0, 38520,345,3,118,0,
@@ -3889,14 +3893,14 @@ public class yyLSLTokens : YyLexer {
3889345,3,106,0,345, 3893345,3,106,0,345,
38903,107,0,345,3, 38943,107,0,345,3,
3891108,0,345,502,11, 3895108,0,345,502,11,
38921,845,0,348,1, 38961,867,0,348,1,
3893-1,3,106,0,345, 3897-1,3,106,0,345,
38943,107,0,345,3, 38983,107,0,345,3,
3895108,0,345,503,11, 3899108,0,345,503,11,
38961,845,0,348,1, 39001,867,0,348,1,
3897-1,504,11,1,845, 3901-1,504,11,1,867,
38980,348,1,-1,505, 39020,348,1,-1,505,
389911,1,845,0,348, 390311,1,867,0,348,
39001,-1,3,112,0, 39041,-1,3,112,0,
3901345,3,113,0,345, 3905345,3,113,0,345,
39023,114,0,345,3, 39063,114,0,345,3,
@@ -3942,7 +3946,7 @@ public class yyLSLTokens : YyLexer {
39423,101,0,345,3, 39463,101,0,345,3,
3943102,0,345,3,103, 3947102,0,345,3,103,
39440,345,3,104,0, 39480,345,3,104,0,
3945506,12,1,26129,507, 3949506,12,1,28191,507,
39465,63,3,109,0, 39505,63,3,109,0,
3947345,3,110,0,345, 3951345,3,110,0,345,
39483,111,0,345,3, 39523,111,0,345,3,
@@ -3985,10 +3989,10 @@ public class yyLSLTokens : YyLexer {
398589,0,345,3,90, 398989,0,345,3,90,
39860,345,3,95,0, 39900,345,3,95,0,
3987345,3,97,0,508, 3991345,3,97,0,508,
398812,1,26172,509,5, 399212,1,28234,509,5,
398963,3,109,0,345, 399363,3,109,0,345,
39903,110,0,510,12, 39943,110,0,510,12,
39911,26201,511,5,63, 39951,28263,511,5,63,
39923,109,0,345,3, 39963,109,0,345,3,
3993110,0,345,3,111, 3997110,0,345,3,111,
39940,345,3,112,0, 39980,345,3,112,0,
@@ -4035,7 +4039,7 @@ public class yyLSLTokens : YyLexer {
4035345,3,100,0,345, 4039345,3,100,0,345,
40363,101,0,345,3, 40403,101,0,345,3,
4037102,0,345,3,103, 4041102,0,345,3,103,
40380,512,12,1,26250, 40420,512,12,1,28312,
4039513,5,63,3,109, 4043513,5,63,3,109,
40400,345,3,110,0, 40440,345,3,110,0,
4041345,3,111,0,345, 4045345,3,111,0,345,
@@ -4081,7 +4085,7 @@ public class yyLSLTokens : YyLexer {
4081345,3,98,0,345, 4085345,3,98,0,345,
40823,99,0,345,3, 40863,99,0,345,3,
4083100,0,345,3,101, 4087100,0,345,3,101,
40840,514,12,1,26297, 40880,514,12,1,28359,
4085515,5,63,3,109, 4089515,5,63,3,109,
40860,345,3,110,0, 40900,345,3,110,0,
4087345,3,111,0,345, 4091345,3,111,0,345,
@@ -4127,7 +4131,7 @@ public class yyLSLTokens : YyLexer {
4127345,3,98,0,345, 4131345,3,98,0,345,
41283,99,0,345,3, 41323,99,0,345,3,
4129100,0,516,12,1, 4133100,0,516,12,1,
413026343,517,5,63,3, 413428405,517,5,63,3,
4131109,0,345,3,110, 4135109,0,345,3,110,
41320,345,3,111,0, 41360,345,3,111,0,
4133345,3,112,0,345, 4137345,3,112,0,345,
@@ -4192,20 +4196,20 @@ public class yyLSLTokens : YyLexer {
41920,345,3,106,0, 41960,345,3,106,0,
4193345,3,107,0,345, 4197345,3,107,0,345,
41943,108,0,345,520, 41983,108,0,345,520,
419511,1,845,0,348, 419911,1,867,0,348,
41961,-1,3,102,0, 42001,-1,3,102,0,
4197345,3,103,0,345, 4201345,3,103,0,345,
41983,104,0,345,3, 42023,104,0,345,3,
4199105,0,345,3,106, 4203105,0,345,3,106,
42000,345,3,107,0, 42040,345,3,107,0,
4201345,3,108,0,345, 4205345,3,108,0,345,
4202521,11,1,845,0, 4206521,11,1,867,0,
4203348,1,-1,3,104, 4207348,1,-1,3,104,
42040,345,3,105,0, 42080,345,3,105,0,
4205345,3,106,0,345, 4209345,3,106,0,345,
42063,107,0,345,3, 42103,107,0,345,3,
4207108,0,345,522,11, 4211108,0,345,522,11,
42081,845,0,348,1, 42121,867,0,348,1,
4209-1,3,111,0,345, 4213-1,3,111,0,345,
42103,112,0,345,3, 42143,112,0,345,3,
4211113,0,345,3,114, 4215113,0,345,3,114,
@@ -4255,7 +4259,7 @@ public class yyLSLTokens : YyLexer {
4255105,0,345,3,106, 4259105,0,345,3,106,
42560,345,3,107,0, 42600,345,3,107,0,
4257345,3,108,0,345, 4261345,3,108,0,345,
4258523,11,1,845,0, 4262523,11,1,867,0,
4259348,1,-1,3,98, 4263348,1,-1,3,98,
42600,345,3,99,0, 42640,345,3,99,0,
4261345,3,100,0,345, 4265345,3,100,0,345,
@@ -4266,17 +4270,17 @@ public class yyLSLTokens : YyLexer {
42663,106,0,345,3, 42703,106,0,345,3,
4267107,0,345,3,108, 4271107,0,345,3,108,
42680,345,524,11,1, 42720,345,524,11,1,
4269845,0,348,1,-1, 4273867,0,348,1,-1,
42703,105,0,345,3, 42743,105,0,345,3,
4271106,0,345,3,107, 4275106,0,345,3,107,
42720,345,3,108,0, 42760,345,3,108,0,
4273345,525,11,1,845, 4277345,525,11,1,867,
42740,348,1,-1,3, 42780,348,1,-1,3,
4275100,0,526,12,1, 4279100,0,526,12,1,
427626920,527,5,63,3, 428028982,527,5,63,3,
4277109,0,345,3,110, 4281109,0,345,3,110,
42780,345,3,111,0, 42820,345,3,111,0,
4279528,12,1,26950,529, 4283528,12,1,29012,529,
42805,63,3,109,0, 42845,63,3,109,0,
4281345,3,110,0,345, 4285345,3,110,0,345,
42823,111,0,345,3, 42863,111,0,345,3,
@@ -4370,14 +4374,14 @@ public class yyLSLTokens : YyLexer {
43700,345,3,90,0, 43740,345,3,90,0,
4371345,3,95,0,345, 4375345,3,95,0,345,
43723,97,0,532,12, 43763,97,0,532,12,
43731,27083,533,5,63, 43771,29145,533,5,63,
43743,109,0,345,3, 43783,109,0,345,3,
4375110,0,345,3,111, 4379110,0,345,3,111,
43760,345,3,112,0, 43800,345,3,112,0,
4377345,3,113,0,345, 4381345,3,113,0,345,
43783,114,0,345,3, 43823,114,0,345,3,
4379115,0,345,3,116, 4383115,0,345,3,116,
43800,534,12,1,27118, 43840,534,12,1,29180,
4381535,5,63,3,109, 4385535,5,63,3,109,
43820,345,3,110,0, 43860,345,3,110,0,
4383345,3,111,0,345, 4387345,3,111,0,345,
@@ -4420,14 +4424,14 @@ public class yyLSLTokens : YyLexer {
44203,89,0,345,3, 44243,89,0,345,3,
442190,0,345,3,95, 442590,0,345,3,95,
44220,345,3,97,0, 44260,345,3,97,0,
4423536,12,1,27161,537, 4427536,12,1,29223,537,
44245,63,3,109,0, 44285,63,3,109,0,
4425345,3,110,0,345, 4429345,3,110,0,345,
44263,111,0,345,3, 44303,111,0,345,3,
4427112,0,345,3,113, 4431112,0,345,3,113,
44280,345,3,114,0, 44320,345,3,114,0,
4429345,3,115,0,538, 4433345,3,115,0,538,
443012,1,27195,539,5, 443412,1,29257,539,5,
443163,3,109,0,345, 443563,3,109,0,345,
44323,110,0,345,3, 44363,110,0,345,3,
4433111,0,345,3,112, 4437111,0,345,3,112,
@@ -4473,13 +4477,13 @@ public class yyLSLTokens : YyLexer {
447398,0,345,3,99, 447798,0,345,3,99,
44740,345,3,100,0, 44780,345,3,100,0,
4475345,3,101,0,540, 4479345,3,101,0,540,
447612,1,27242,541,5, 448012,1,29304,541,5,
447763,3,109,0,345, 448163,3,109,0,345,
44783,110,0,345,3, 44823,110,0,345,3,
4479111,0,345,3,112, 4483111,0,345,3,112,
44800,345,3,113,0, 44840,345,3,113,0,
4481345,3,114,0,542, 4485345,3,114,0,542,
448212,1,27275,543,5, 448612,1,29337,543,5,
448363,3,109,0,345, 448763,3,109,0,345,
44843,110,0,345,3, 44883,110,0,345,3,
4485111,0,345,3,112, 4489111,0,345,3,112,
@@ -4488,7 +4492,7 @@ public class yyLSLTokens : YyLexer {
44883,115,0,345,3, 44923,115,0,345,3,
4489116,0,345,3,117, 4493116,0,345,3,117,
44900,345,3,118,0, 44940,345,3,118,0,
4491544,12,1,27312,545, 4495544,12,1,29374,545,
44925,63,3,109,0, 44965,63,3,109,0,
4493345,3,110,0,345, 4497345,3,110,0,345,
44943,111,0,345,3, 44983,111,0,345,3,
@@ -4534,13 +4538,13 @@ public class yyLSLTokens : YyLexer {
45343,98,0,345,3, 45383,98,0,345,3,
453599,0,345,3,100, 453999,0,345,3,100,
45360,345,3,101,0, 45400,345,3,101,0,
4537546,12,1,27359,547, 4541546,12,1,29421,547,
45385,63,3,109,0, 45425,63,3,109,0,
4539345,3,110,0,345, 4543345,3,110,0,345,
45403,111,0,345,3, 45443,111,0,345,3,
4541112,0,345,3,113, 4545112,0,345,3,113,
45420,345,3,114,0, 45460,345,3,114,0,
4543548,12,1,27392,549, 4547548,12,1,29454,549,
45445,63,3,109,0, 45485,63,3,109,0,
4545345,3,110,0,345, 4549345,3,110,0,345,
45463,111,0,345,3, 45503,111,0,345,3,
@@ -4646,14 +4650,14 @@ public class yyLSLTokens : YyLexer {
46460,345,3,106,0, 46500,345,3,106,0,
4647345,3,107,0,345, 4651345,3,107,0,345,
46483,108,0,345,552, 46523,108,0,345,552,
464911,1,845,0,348, 465311,1,867,0,348,
46501,-1,3,102,0, 46541,-1,3,102,0,
4651345,3,103,0,345, 4655345,3,103,0,345,
46523,104,0,345,3, 46563,104,0,345,3,
4653105,0,345,3,106, 4657105,0,345,3,106,
46540,345,3,107,0, 46580,345,3,107,0,
4655345,3,108,0,345, 4659345,3,108,0,345,
4656553,11,1,845,0, 4660553,11,1,867,0,
4657348,1,-1,3,119, 4661348,1,-1,3,119,
46580,345,3,120,0, 46620,345,3,120,0,
4659345,3,121,0,345, 4663345,3,121,0,345,
@@ -4697,7 +4701,7 @@ public class yyLSLTokens : YyLexer {
4697105,0,345,3,106, 4701105,0,345,3,106,
46980,345,3,107,0, 47020,345,3,107,0,
4699345,3,108,0,345, 4703345,3,108,0,345,
4700554,11,1,845,0, 4704554,11,1,867,0,
4701348,1,-1,3,115, 4705348,1,-1,3,115,
47020,345,3,116,0, 47060,345,3,116,0,
4703345,3,117,0,345, 4707345,3,117,0,345,
@@ -4744,7 +4748,7 @@ public class yyLSLTokens : YyLexer {
47443,105,0,345,3, 47483,105,0,345,3,
4745106,0,345,3,107, 4749106,0,345,3,107,
47460,345,3,108,0, 47500,345,3,108,0,
4747345,555,11,1,845, 4751345,555,11,1,867,
47480,348,1,-1,3, 47520,348,1,-1,3,
4749102,0,345,3,103, 4753102,0,345,3,103,
47500,345,3,104,0, 47540,345,3,104,0,
@@ -4752,7 +4756,7 @@ public class yyLSLTokens : YyLexer {
47523,106,0,345,3, 47563,106,0,345,3,
4753107,0,345,3,108, 4757107,0,345,3,108,
47540,345,556,11,1, 47580,345,556,11,1,
4755845,0,348,1,-1, 4759867,0,348,1,-1,
47563,116,0,345,3, 47603,116,0,345,3,
4757117,0,345,3,118, 4761117,0,345,3,118,
47580,345,3,119,0, 47620,345,3,119,0,
@@ -4798,7 +4802,7 @@ public class yyLSLTokens : YyLexer {
47980,345,3,106,0, 48020,345,3,106,0,
4799345,3,107,0,345, 4803345,3,107,0,345,
48003,108,0,345,557, 48043,108,0,345,557,
480111,1,845,0,348, 480511,1,867,0,348,
48021,-1,3,98,0, 48061,-1,3,98,0,
4803345,3,99,0,345, 4807345,3,99,0,345,
48043,100,0,345,3, 48083,100,0,345,3,
@@ -4808,7 +4812,7 @@ public class yyLSLTokens : YyLexer {
48083,105,0,345,3, 48123,105,0,345,3,
4809106,0,345,3,107, 4813106,0,345,3,107,
48100,345,3,108,0, 48140,345,3,108,0,
4811345,558,11,1,845, 4815345,558,11,1,867,
48120,348,1,-1,3, 48160,348,1,-1,3,
4813117,0,345,3,118, 4817117,0,345,3,118,
48140,345,3,119,0, 48180,345,3,119,0,
@@ -4854,12 +4858,12 @@ public class yyLSLTokens : YyLexer {
48540,345,3,106,0, 48580,345,3,106,0,
4855345,3,107,0,345, 4859345,3,107,0,345,
48563,108,0,345,559, 48603,108,0,345,559,
485711,1,845,0,348, 486111,1,867,0,348,
48581,-1,3,98,0, 48621,-1,3,98,0,
4859345,3,99,0,345, 4863345,3,99,0,345,
48603,100,0,345,3, 48643,100,0,345,3,
4861101,0,560,12,1, 4865101,0,560,12,1,
486228167,561,5,63,3, 486630229,561,5,63,3,
4863109,0,345,3,110, 4867109,0,345,3,110,
48640,345,3,111,0, 48680,345,3,111,0,
4865345,3,112,0,345, 4869345,3,112,0,345,
@@ -4905,7 +4909,7 @@ public class yyLSLTokens : YyLexer {
4905345,3,99,0,345, 4909345,3,99,0,345,
49063,100,0,345,3, 49103,100,0,345,3,
4907101,0,345,3,102, 4911101,0,345,3,102,
49080,562,12,1,28215, 49120,562,12,1,30277,
4909563,5,63,3,109, 4913563,5,63,3,109,
49100,345,3,110,0, 49140,345,3,110,0,
4911345,3,111,0,345, 4915345,3,111,0,345,
@@ -4948,7 +4952,7 @@ public class yyLSLTokens : YyLexer {
49483,89,0,345,3, 49523,89,0,345,3,
494990,0,345,3,95, 495390,0,345,3,95,
49500,345,3,97,0, 49540,345,3,97,0,
4951564,12,1,28258,565, 4955564,12,1,30320,565,
49525,63,3,109,0, 49565,63,3,109,0,
4953345,3,110,0,345, 4957345,3,110,0,345,
49543,111,0,345,3, 49583,111,0,345,3,
@@ -4957,7 +4961,7 @@ public class yyLSLTokens : YyLexer {
4957345,3,115,0,345, 4961345,3,115,0,345,
49583,116,0,345,3, 49623,116,0,345,3,
4959117,0,566,12,1, 4963117,0,566,12,1,
496028294,567,5,63,3, 496430356,567,5,63,3,
4961109,0,345,3,110, 4965109,0,345,3,110,
49620,345,3,111,0, 49660,345,3,111,0,
4963345,3,112,0,345, 4967345,3,112,0,345,
@@ -5008,7 +5012,7 @@ public class yyLSLTokens : YyLexer {
50083,105,0,345,3, 50123,105,0,345,3,
5009106,0,345,3,107, 5013106,0,345,3,107,
50100,345,3,108,0, 50140,345,3,108,0,
5011568,12,1,28348,569, 5015568,12,1,30410,569,
50125,63,3,109,0, 50165,63,3,109,0,
5013345,3,110,0,345, 5017345,3,110,0,345,
50143,111,0,345,3, 50183,111,0,345,3,
@@ -5016,7 +5020,7 @@ public class yyLSLTokens : YyLexer {
50160,345,3,114,0, 50200,345,3,114,0,
5017345,3,115,0,345, 5021345,3,115,0,345,
50183,116,0,570,12, 50223,116,0,570,12,
50191,28383,571,5,63, 50231,30445,571,5,63,
50203,109,0,345,3, 50243,109,0,345,3,
5021110,0,345,3,111, 5025110,0,345,3,111,
50220,345,3,112,0, 50260,345,3,112,0,
@@ -5119,8 +5123,8 @@ public class yyLSLTokens : YyLexer {
5119345,3,106,0,345, 5123345,3,106,0,345,
51203,107,0,345,3, 51243,107,0,345,3,
5121108,0,345,574,11, 5125108,0,345,574,11,
51221,845,0,348,1, 51261,867,0,348,1,
5123-1,575,11,1,845, 5127-1,575,11,1,867,
51240,348,1,-1,3, 51280,348,1,-1,3,
5125118,0,345,3,119, 5129118,0,345,3,119,
51260,345,3,120,0, 51300,345,3,120,0,
@@ -5165,7 +5169,7 @@ public class yyLSLTokens : YyLexer {
5165105,0,345,3,106, 5169105,0,345,3,106,
51660,345,3,107,0, 51700,345,3,107,0,
5167345,3,108,0,345, 5171345,3,108,0,345,
5168576,11,1,845,0, 5172576,11,1,867,0,
5169348,1,-1,3,98, 5173348,1,-1,3,98,
51700,345,3,99,0, 51740,345,3,99,0,
5171345,3,100,0,345, 5175345,3,100,0,345,
@@ -5176,24 +5180,24 @@ public class yyLSLTokens : YyLexer {
51763,106,0,345,3, 51803,106,0,345,3,
5177107,0,345,3,108, 5181107,0,345,3,108,
51780,345,577,11,1, 51820,345,577,11,1,
5179845,0,348,1,-1, 5183867,0,348,1,-1,
51803,103,0,345,3, 51843,103,0,345,3,
5181104,0,345,3,105, 5185104,0,345,3,105,
51820,345,3,106,0, 51860,345,3,106,0,
5183345,3,107,0,345, 5187345,3,107,0,345,
51843,108,0,345,578, 51883,108,0,345,578,
518511,1,845,0,348, 518911,1,867,0,348,
51861,-1,3,102,0, 51901,-1,3,102,0,
5187345,3,103,0,345, 5191345,3,103,0,345,
51883,104,0,345,3, 51923,104,0,345,3,
5189105,0,345,3,106, 5193105,0,345,3,106,
51900,345,3,107,0, 51940,345,3,107,0,
5191345,3,108,0,345, 5195345,3,108,0,345,
5192579,11,1,845,0, 5196579,11,1,867,0,
5193348,1,-1,3,101, 5197348,1,-1,3,101,
51940,580,12,1,28961, 51980,580,12,1,31023,
5195581,5,63,3,109, 5199581,5,63,3,109,
51960,582,12,1,28989, 52000,582,12,1,31051,
5197583,5,63,3,109, 5201583,5,63,3,109,
51980,345,3,110,0, 52020,345,3,110,0,
5199345,3,111,0,345, 5203345,3,111,0,345,
@@ -5236,7 +5240,7 @@ public class yyLSLTokens : YyLexer {
52363,89,0,345,3, 52403,89,0,345,3,
523790,0,345,3,95, 524190,0,345,3,95,
52380,345,3,97,0, 52420,345,3,97,0,
5239584,12,1,29032,585, 5243584,12,1,31094,585,
52405,63,3,109,0, 52445,63,3,109,0,
5241345,3,110,0,345, 5245345,3,110,0,345,
52423,111,0,345,3, 52463,111,0,345,3,
@@ -5285,7 +5289,7 @@ public class yyLSLTokens : YyLexer {
5285345,3,102,0,345, 5289345,3,102,0,345,
52863,103,0,345,3, 52903,103,0,345,3,
5287104,0,345,3,105, 5291104,0,345,3,105,
52880,586,12,1,29083, 52920,586,12,1,31145,
5289587,5,63,3,109, 5293587,5,63,3,109,
52900,345,3,110,0, 52940,345,3,110,0,
5291345,3,111,0,345, 5295345,3,111,0,345,
@@ -5337,7 +5341,7 @@ public class yyLSLTokens : YyLexer {
5337105,0,345,3,106, 5341105,0,345,3,106,
53380,345,3,107,0, 53420,345,3,107,0,
5339345,3,108,0,588, 5343345,3,108,0,588,
534012,1,29137,589,5, 534412,1,31199,589,5,
534163,3,109,0,345, 534563,3,109,0,345,
53423,110,0,345,3, 53463,110,0,345,3,
5343111,0,345,3,112, 5347111,0,345,3,112,
@@ -5395,11 +5399,11 @@ public class yyLSLTokens : YyLexer {
53950,95,0,69,0, 53990,95,0,69,0,
539686,0,69,0,78, 540086,0,69,0,78,
53970,84,0,1,-1, 54010,84,0,1,-1,
5398592,11,1,845,0, 5402592,11,1,867,0,
5399348,1,-1,3,106, 5403348,1,-1,3,106,
54000,345,3,107,0, 54040,345,3,107,0,
5401345,3,108,0,345, 5405345,3,108,0,345,
5402593,11,1,845,0, 5406593,11,1,867,0,
5403348,1,-1,3,98, 5407348,1,-1,3,98,
54040,345,3,99,0, 54080,345,3,99,0,
5405345,3,100,0,345, 5409345,3,100,0,345,
@@ -5410,7 +5414,7 @@ public class yyLSLTokens : YyLexer {
54103,106,0,345,3, 54143,106,0,345,3,
5411107,0,345,3,108, 5415107,0,345,3,108,
54120,345,594,11,1, 54160,345,594,11,1,
5413845,0,348,1,-1, 5417867,0,348,1,-1,
54143,110,0,345,3, 54183,110,0,345,3,
5415111,0,345,3,112, 5419111,0,345,3,112,
54160,345,3,113,0, 54200,345,3,113,0,
@@ -5461,13 +5465,13 @@ public class yyLSLTokens : YyLexer {
5461345,3,106,0,345, 5465345,3,106,0,345,
54623,107,0,345,3, 54663,107,0,345,3,
5463108,0,595,12,1, 5467108,0,595,12,1,
546429495,596,5,63,3, 546831557,596,5,63,3,
5465109,0,345,3,110, 5469109,0,345,3,110,
54660,345,3,111,0, 54700,345,3,111,0,
5467345,3,112,0,345, 5471345,3,112,0,345,
54683,113,0,345,3, 54723,113,0,345,3,
5469114,0,345,3,115, 5473114,0,345,3,115,
54700,597,12,1,29529, 54740,597,12,1,31591,
5471598,5,63,3,109, 5475598,5,63,3,109,
54720,345,3,110,0, 54760,345,3,110,0,
5473345,3,111,0,345, 5477345,3,111,0,345,
@@ -5513,7 +5517,7 @@ public class yyLSLTokens : YyLexer {
5513345,3,98,0,345, 5517345,3,98,0,345,
55143,99,0,345,3, 55183,99,0,345,3,
5515100,0,345,3,101, 5519100,0,345,3,101,
55160,599,12,1,29576, 55200,599,12,1,31638,
5517600,5,63,3,109, 5521600,5,63,3,109,
55180,345,3,110,0, 55220,345,3,110,0,
5519345,3,111,0,345, 5523345,3,111,0,345,
@@ -5574,7 +5578,7 @@ public class yyLSLTokens : YyLexer {
55743,105,0,345,3, 55783,105,0,345,3,
5575106,0,345,3,107, 5579106,0,345,3,107,
55760,345,3,108,0, 55800,345,3,108,0,
5577345,603,11,1,845, 5581345,603,11,1,867,
55780,348,1,-1,3, 55820,348,1,-1,3,
5579116,0,345,3,117, 5583116,0,345,3,117,
55800,345,3,118,0, 55840,345,3,118,0,
@@ -5621,20 +5625,20 @@ public class yyLSLTokens : YyLexer {
5621345,3,106,0,345, 5625345,3,106,0,345,
56223,107,0,345,3, 56263,107,0,345,3,
5623108,0,345,604,11, 5627108,0,345,604,11,
56241,845,0,348,1, 56281,867,0,348,1,
5625-1,605,11,1,845, 5629-1,605,11,1,867,
56260,348,1,-1,3, 56300,348,1,-1,3,
5627102,0,606,12,1, 5631102,0,606,12,1,
562829922,607,5,63,3, 563231984,607,5,63,3,
5629109,0,345,3,110, 5633109,0,345,3,110,
56300,345,3,111,0, 56340,345,3,111,0,
5631608,12,1,29952,609, 5635608,12,1,32014,609,
56325,63,3,109,0, 56365,63,3,109,0,
5633345,3,110,0,345, 5637345,3,110,0,345,
56343,111,0,345,3, 56383,111,0,345,3,
5635112,0,345,3,113, 5639112,0,345,3,113,
56360,345,3,114,0, 56400,345,3,114,0,
5637610,12,1,29985,611, 5641610,12,1,32047,611,
56385,63,3,109,0, 56425,63,3,109,0,
5639345,3,110,0,345, 5643345,3,110,0,345,
56403,111,0,345,3, 56443,111,0,345,3,
@@ -5735,7 +5739,7 @@ public class yyLSLTokens : YyLexer {
5735345,3,106,0,345, 5739345,3,106,0,345,
57363,107,0,345,3, 57403,107,0,345,3,
5737108,0,345,614,11, 5741108,0,345,614,11,
57381,845,0,348,1, 57421,867,0,348,1,
5739-1,3,112,0,345, 5743-1,3,112,0,345,
57403,113,0,345,3, 57443,113,0,345,3,
5741114,0,345,3,115, 5745114,0,345,3,115,
@@ -5784,11 +5788,11 @@ public class yyLSLTokens : YyLexer {
57843,105,0,345,3, 57883,105,0,345,3,
5785106,0,345,3,107, 5789106,0,345,3,107,
57860,345,3,108,0, 57900,345,3,108,0,
5787615,12,1,30216,616, 5791615,12,1,32278,616,
57885,63,3,109,0, 57925,63,3,109,0,
5789345,3,110,0,345, 5793345,3,110,0,345,
57903,111,0,617,12, 57943,111,0,617,12,
57911,30246,618,5,63, 57951,32308,618,5,63,
57923,109,0,345,3, 57963,109,0,345,3,
5793110,0,345,3,111, 5797110,0,345,3,111,
57940,345,3,112,0, 57980,345,3,112,0,
@@ -5831,14 +5835,14 @@ public class yyLSLTokens : YyLexer {
5831345,3,90,0,345, 5835345,3,90,0,345,
58323,95,0,345,3, 58363,95,0,345,3,
583397,0,619,12,1, 583797,0,619,12,1,
583430289,620,5,63,3, 583832351,620,5,63,3,
5835109,0,345,3,110, 5839109,0,345,3,110,
58360,345,3,111,0, 58400,345,3,111,0,
5837345,3,112,0,345, 5841345,3,112,0,345,
58383,113,0,345,3, 58423,113,0,345,3,
5839114,0,345,3,115, 5843114,0,345,3,115,
58400,345,3,116,0, 58440,345,3,116,0,
5841621,12,1,30324,622, 5845621,12,1,32386,622,
58425,63,3,109,0, 58465,63,3,109,0,
5843345,3,110,0,345, 5847345,3,110,0,345,
58443,111,0,345,3, 58483,111,0,345,3,
@@ -5940,7 +5944,7 @@ public class yyLSLTokens : YyLexer {
59400,345,3,106,0, 59440,345,3,106,0,
5941345,3,107,0,345, 5945345,3,107,0,345,
59423,108,0,345,625, 59463,108,0,345,625,
594311,1,845,0,348, 594711,1,867,0,348,
59441,-1,3,98,0, 59481,-1,3,98,0,
5945345,3,99,0,345, 5949345,3,99,0,345,
59463,100,0,345,3, 59503,100,0,345,3,
@@ -5950,7 +5954,7 @@ public class yyLSLTokens : YyLexer {
59503,105,0,345,3, 59543,105,0,345,3,
5951106,0,345,3,107, 5955106,0,345,3,107,
59520,345,3,108,0, 59560,345,3,108,0,
5953345,626,11,1,845, 5957345,626,11,1,867,
59540,348,1,-1,3, 59580,348,1,-1,3,
5955112,0,345,3,113, 5959112,0,345,3,113,
59560,345,3,114,0, 59600,345,3,114,0,
@@ -6000,19 +6004,19 @@ public class yyLSLTokens : YyLexer {
60000,345,3,106,0, 60040,345,3,106,0,
6001345,3,107,0,345, 6005345,3,107,0,345,
60023,108,0,345,627, 60063,108,0,345,627,
600311,1,845,0,348, 600711,1,867,0,348,
60041,-1,628,11,1, 60081,-1,628,11,1,
6005845,0,348,1,-1, 6009867,0,348,1,-1,
60063,103,0,343,3, 60103,103,0,343,3,
6007104,0,629,12,1, 6011104,0,629,12,1,
600830764,630,5,63,3, 601232826,630,5,63,3,
6009109,0,345,3,110, 6013109,0,345,3,110,
60100,345,3,111,0, 60140,345,3,111,0,
6011345,3,112,0,345, 6015345,3,112,0,345,
60123,113,0,345,3, 60163,113,0,345,3,
6013114,0,345,3,115, 6017114,0,345,3,115,
60140,345,3,116,0, 60180,345,3,116,0,
6015631,12,1,30799,632, 6019631,12,1,32861,632,
60165,63,3,109,0, 60205,63,3,109,0,
6017345,3,110,0,345, 6021345,3,110,0,345,
60183,111,0,345,3, 60223,111,0,345,3,
@@ -6020,11 +6024,11 @@ public class yyLSLTokens : YyLexer {
60200,345,3,114,0, 60240,345,3,114,0,
6021345,3,115,0,345, 6025345,3,115,0,345,
60223,116,0,633,12, 60263,116,0,633,12,
60231,30834,634,5,63, 60271,32896,634,5,63,
60243,109,0,345,3, 60283,109,0,345,3,
6025110,0,345,3,111, 6029110,0,345,3,111,
60260,345,3,112,0, 60300,345,3,112,0,
6027635,12,1,30865,636, 6031635,12,1,32927,636,
60285,63,3,109,0, 60325,63,3,109,0,
6029345,3,110,0,345, 6033345,3,110,0,345,
60303,111,0,345,3, 60343,111,0,345,3,
@@ -6066,13 +6070,13 @@ public class yyLSLTokens : YyLexer {
60663,88,0,345,3, 60703,88,0,345,3,
606789,0,345,3,90, 607189,0,345,3,90,
60680,345,3,95,0, 60720,345,3,95,0,
6069637,12,1,30951,638, 6073637,12,1,33013,638,
60705,63,3,109,0, 60745,63,3,109,0,
6071345,3,110,0,345, 6075345,3,110,0,345,
60723,111,0,345,3, 60763,111,0,345,3,
6073112,0,345,3,113, 6077112,0,345,3,113,
60740,345,3,114,0, 60780,345,3,114,0,
6075639,12,1,30984,640, 6079639,12,1,33046,640,
60765,63,3,109,0, 60805,63,3,109,0,
6077345,3,110,0,345, 6081345,3,110,0,345,
60783,111,0,345,3, 60823,111,0,345,3,
@@ -6118,12 +6122,12 @@ public class yyLSLTokens : YyLexer {
61183,98,0,345,3, 61223,98,0,345,3,
611999,0,345,3,100, 612399,0,345,3,100,
61200,345,3,101,0, 61240,345,3,101,0,
6121641,12,1,31031,642, 6125641,12,1,33093,642,
61225,63,3,109,0, 61265,63,3,109,0,
6123345,3,110,0,345, 6127345,3,110,0,345,
61243,111,0,345,3, 61283,111,0,345,3,
6125112,0,345,3,113, 6129112,0,345,3,113,
61260,643,12,1,31063, 61300,643,12,1,33125,
6127644,5,63,3,109, 6131644,5,63,3,109,
61280,345,3,110,0, 61320,345,3,110,0,
6129345,3,111,0,345, 6133345,3,111,0,345,
@@ -6132,7 +6136,7 @@ public class yyLSLTokens : YyLexer {
61320,345,3,115,0, 61360,345,3,115,0,
6133345,3,116,0,345, 6137345,3,116,0,345,
61343,117,0,645,12, 61383,117,0,645,12,
61351,31099,646,5,63, 61391,33161,646,5,63,
61363,109,0,345,3, 61403,109,0,345,3,
6137110,0,345,3,111, 6141110,0,345,3,111,
61380,345,3,112,0, 61420,345,3,112,0,
@@ -6178,21 +6182,21 @@ public class yyLSLTokens : YyLexer {
61780,345,3,99,0, 61820,345,3,99,0,
6179345,3,100,0,345, 6183345,3,100,0,345,
61803,101,0,647,12, 61843,101,0,647,12,
61811,31146,648,5,63, 61851,33208,648,5,63,
61823,109,0,345,3, 61863,109,0,345,3,
6183110,0,345,3,111, 6187110,0,345,3,111,
61840,345,3,112,0, 61880,345,3,112,0,
6185345,3,113,0,345, 6189345,3,113,0,345,
61863,114,0,345,3, 61903,114,0,345,3,
6187115,0,649,12,1, 6191115,0,649,12,1,
618831180,650,5,63,3, 619233242,650,5,63,3,
6189109,0,345,3,110, 6193109,0,345,3,110,
61900,345,3,111,0, 61940,345,3,111,0,
6191345,3,112,0,345, 6195345,3,112,0,345,
61923,113,0,345,3, 61963,113,0,345,3,
6193114,0,345,3,115, 6197114,0,345,3,115,
61940,345,3,116,0, 61980,345,3,116,0,
6195651,12,1,31215,652, 6199651,12,1,33277,652,
61965,63,3,109,0, 62005,63,3,109,0,
6197345,3,110,0,345, 6201345,3,110,0,345,
61983,111,0,345,3, 62023,111,0,345,3,
@@ -6297,7 +6301,7 @@ public class yyLSLTokens : YyLexer {
6297105,0,345,3,106, 6301105,0,345,3,106,
62980,345,3,107,0, 63020,345,3,107,0,
6299345,3,108,0,345, 6303345,3,108,0,345,
6300655,11,1,845,0, 6304655,11,1,867,0,
6301348,1,-1,3,116, 6305348,1,-1,3,116,
63020,345,3,117,0, 63060,345,3,117,0,
6303345,3,118,0,345, 6307345,3,118,0,345,
@@ -6344,14 +6348,14 @@ public class yyLSLTokens : YyLexer {
63443,106,0,345,3, 63483,106,0,345,3,
6345107,0,345,3,108, 6349107,0,345,3,108,
63460,345,656,11,1, 63500,345,656,11,1,
6347845,0,348,1,-1, 6351867,0,348,1,-1,
63483,102,0,345,3, 63523,102,0,345,3,
6349103,0,345,3,104, 6353103,0,345,3,104,
63500,345,3,105,0, 63540,345,3,105,0,
6351345,3,106,0,345, 6355345,3,106,0,345,
63523,107,0,345,3, 63563,107,0,345,3,
6353108,0,345,657,11, 6357108,0,345,657,11,
63541,845,0,348,1, 63581,867,0,348,1,
6355-1,3,118,0,345, 6359-1,3,118,0,345,
63563,119,0,345,3, 63603,119,0,345,3,
6357120,0,345,3,121, 6361120,0,345,3,121,
@@ -6396,27 +6400,27 @@ public class yyLSLTokens : YyLexer {
63963,106,0,345,3, 64003,106,0,345,3,
6397107,0,345,3,108, 6401107,0,345,3,108,
63980,345,658,11,1, 64020,345,658,11,1,
6399845,0,348,1,-1, 6403867,0,348,1,-1,
64003,114,0,345,3, 64043,114,0,345,3,
6401115,0,659,12,1, 6405115,0,659,12,1,
640231665,660,5,63,3, 640633727,660,5,63,3,
6403109,0,345,3,110, 6407109,0,345,3,110,
64040,345,3,111,0, 64080,345,3,111,0,
6405345,3,112,0,661, 6409345,3,112,0,661,
640612,1,31696,662,5, 641012,1,33758,662,5,
640763,3,109,0,345, 641163,3,109,0,345,
64083,110,0,345,3, 64123,110,0,345,3,
6409111,0,663,12,1, 6413111,0,663,12,1,
641031726,664,5,63,3, 641433788,664,5,63,3,
6411109,0,345,3,110, 6415109,0,345,3,110,
64120,665,12,1,31755, 64160,665,12,1,33817,
6413666,5,63,3,109, 6417666,5,63,3,109,
64140,345,3,110,0, 64180,345,3,110,0,
6415345,3,111,0,345, 6419345,3,111,0,345,
64163,112,0,345,3, 64203,112,0,345,3,
6417113,0,345,3,114, 6421113,0,345,3,114,
64180,345,3,115,0, 64220,345,3,115,0,
6419667,12,1,31789,668, 6423667,12,1,33851,668,
64205,63,3,109,0, 64245,63,3,109,0,
6421345,3,110,0,345, 6425345,3,110,0,345,
64223,111,0,345,3, 64263,111,0,345,3,
@@ -6462,7 +6466,7 @@ public class yyLSLTokens : YyLexer {
64623,98,0,345,3, 64663,98,0,345,3,
646399,0,345,3,100, 646799,0,345,3,100,
64640,345,3,101,0, 64680,345,3,101,0,
6465669,12,1,31836,670, 6469669,12,1,33898,670,
64665,63,3,109,0, 64705,63,3,109,0,
6467345,3,110,0,345, 6471345,3,110,0,345,
64683,111,0,345,3, 64723,111,0,345,3,
@@ -6529,7 +6533,7 @@ public class yyLSLTokens : YyLexer {
6529105,0,345,3,106, 6533105,0,345,3,106,
65300,345,3,107,0, 65340,345,3,107,0,
6531345,3,108,0,345, 6535345,3,108,0,345,
6532673,11,1,845,0, 6536673,11,1,867,0,
6533348,1,-1,3,116, 6537348,1,-1,3,116,
65340,345,3,117,0, 65380,345,3,117,0,
6535345,3,118,0,345, 6539345,3,118,0,345,
@@ -6576,7 +6580,7 @@ public class yyLSLTokens : YyLexer {
65763,106,0,345,3, 65803,106,0,345,3,
6577107,0,345,3,108, 6581107,0,345,3,108,
65780,345,674,11,1, 65820,345,674,11,1,
6579845,0,348,1,-1, 6583867,0,348,1,-1,
65803,111,0,345,3, 65843,111,0,345,3,
6581112,0,345,3,113, 6585112,0,345,3,113,
65820,345,3,114,0, 65860,345,3,114,0,
@@ -6626,7 +6630,7 @@ public class yyLSLTokens : YyLexer {
66260,345,3,106,0, 66300,345,3,106,0,
6627345,3,107,0,345, 6631345,3,107,0,345,
66283,108,0,345,675, 66323,108,0,345,675,
662911,1,845,0,348, 663311,1,867,0,348,
66301,-1,3,112,0, 66341,-1,3,112,0,
6631345,3,113,0,345, 6635345,3,113,0,345,
66323,114,0,345,3, 66363,114,0,345,3,
@@ -6676,7 +6680,7 @@ public class yyLSLTokens : YyLexer {
66763,106,0,345,3, 66803,106,0,345,3,
6677107,0,345,3,108, 6681107,0,345,3,108,
66780,345,676,11,1, 66820,345,676,11,1,
6679845,0,348,1,-1, 6683867,0,348,1,-1,
66803,113,0,345,3, 66843,113,0,345,3,
6681114,0,345,3,115, 6685114,0,345,3,115,
66820,345,3,116,0, 66860,345,3,116,0,
@@ -6724,7 +6728,7 @@ public class yyLSLTokens : YyLexer {
67243,105,0,345,3, 67283,105,0,345,3,
6725106,0,345,3,107, 6729106,0,345,3,107,
67260,345,3,108,0, 67300,345,3,108,0,
6727345,677,11,1,845, 6731345,677,11,1,867,
67280,348,1,-1,3, 67320,348,1,-1,3,
6729116,0,345,3,117, 6733116,0,345,3,117,
67300,345,3,118,0, 67340,345,3,118,0,
@@ -6771,14 +6775,14 @@ public class yyLSLTokens : YyLexer {
6771345,3,106,0,345, 6775345,3,106,0,345,
67723,107,0,345,3, 67763,107,0,345,3,
6773108,0,345,678,11, 6777108,0,345,678,11,
67741,845,0,348,1, 67781,867,0,348,1,
6775-1,3,102,0,345, 6779-1,3,102,0,345,
67763,103,0,345,3, 67803,103,0,345,3,
6777104,0,345,3,105, 6781104,0,345,3,105,
67780,345,3,106,0, 67820,345,3,106,0,
6779345,3,107,0,345, 6783345,3,107,0,345,
67803,108,0,345,679, 67843,108,0,345,679,
678111,1,845,0,348, 678511,1,867,0,348,
67821,-1,3,115,0, 67861,-1,3,115,0,
6783345,3,116,0,345, 6787345,3,116,0,345,
67843,117,0,345,3, 67883,117,0,345,3,
@@ -6825,7 +6829,7 @@ public class yyLSLTokens : YyLexer {
6825105,0,345,3,106, 6829105,0,345,3,106,
68260,345,3,107,0, 68300,345,3,107,0,
6827345,3,108,0,345, 6831345,3,108,0,345,
6828680,11,1,845,0, 6832680,11,1,867,0,
6829348,1,-1,3,97, 6833348,1,-1,3,97,
68300,345,3,98,0, 68340,345,3,98,0,
6831345,3,99,0,345, 6835345,3,99,0,345,
@@ -6836,7 +6840,7 @@ public class yyLSLTokens : YyLexer {
68363,105,0,345,3, 68403,105,0,345,3,
6837106,0,345,3,107, 6841106,0,345,3,107,
68380,345,3,108,0, 68420,345,3,108,0,
6839345,681,11,1,845, 6843345,681,11,1,867,
68400,348,1,-1,3, 68440,348,1,-1,3,
6841113,0,345,3,114, 6845113,0,345,3,114,
68420,345,3,115,0, 68460,345,3,115,0,
@@ -6885,7 +6889,7 @@ public class yyLSLTokens : YyLexer {
6885105,0,345,3,106, 6889105,0,345,3,106,
68860,345,3,107,0, 68900,345,3,107,0,
6887345,3,108,0,345, 6891345,3,108,0,345,
6888682,11,1,845,0, 6892682,11,1,867,0,
6889348,1,-1,3,117, 6893348,1,-1,3,117,
68900,345,3,118,0, 68940,345,3,118,0,
6891345,3,119,0,345, 6895345,3,119,0,345,
@@ -6931,7 +6935,7 @@ public class yyLSLTokens : YyLexer {
6931345,3,106,0,345, 6935345,3,106,0,345,
69323,107,0,345,3, 69363,107,0,345,3,
6933108,0,345,683,11, 6937108,0,345,683,11,
69341,845,0,348,1, 69381,867,0,348,1,
6935-1,3,117,0,345, 6939-1,3,117,0,345,
69363,118,0,345,3, 69403,118,0,345,3,
6937119,0,345,3,120, 6941119,0,345,3,120,
@@ -6976,12 +6980,12 @@ public class yyLSLTokens : YyLexer {
69763,105,0,345,3, 69803,105,0,345,3,
6977106,0,345,3,107, 6981106,0,345,3,107,
69780,345,3,108,0, 69820,345,3,108,0,
6979345,684,11,1,845, 6983345,684,11,1,867,
69800,348,1,-1,3, 69840,348,1,-1,3,
6981105,0,685,12,1, 6985105,0,685,12,1,
698232925,686,5,63,3, 698634987,686,5,63,3,
6983109,0,345,3,110, 6987109,0,345,3,110,
69840,687,12,1,32954, 69880,687,12,1,35016,
6985688,5,63,3,109, 6989688,5,63,3,109,
69860,345,3,110,0, 69900,345,3,110,0,
6987345,3,111,0,345, 6991345,3,111,0,345,
@@ -6989,7 +6993,7 @@ public class yyLSLTokens : YyLexer {
6989113,0,345,3,114, 6993113,0,345,3,114,
69900,345,3,115,0, 69940,345,3,115,0,
6991345,3,116,0,689, 6995345,3,116,0,689,
699212,1,32989,690,5, 699612,1,35051,690,5,
699363,3,109,0,345, 699763,3,109,0,345,
69943,110,0,345,3, 69983,110,0,345,3,
6995111,0,345,3,112, 6999111,0,345,3,112,
@@ -7035,7 +7039,7 @@ public class yyLSLTokens : YyLexer {
703598,0,345,3,99, 703998,0,345,3,99,
70360,345,3,100,0, 70400,345,3,100,0,
7037345,3,101,0,691, 7041345,3,101,0,691,
703812,1,33036,692,5, 704212,1,35098,692,5,
703963,3,109,0,345, 704363,3,109,0,345,
70403,110,0,345,3, 70443,110,0,345,3,
7041111,0,345,3,112, 7045111,0,345,3,112,
@@ -7083,7 +7087,7 @@ public class yyLSLTokens : YyLexer {
7083345,3,101,0,345, 7087345,3,101,0,345,
70843,102,0,345,3, 70883,102,0,345,3,
7085103,0,693,12,1, 7089103,0,693,12,1,
708633085,694,5,63,3, 709035147,694,5,63,3,
7087109,0,345,3,110, 7091109,0,345,3,110,
70880,345,3,111,0, 70920,345,3,111,0,
7089345,3,112,0,345, 7093345,3,112,0,345,
@@ -7129,13 +7133,13 @@ public class yyLSLTokens : YyLexer {
7129345,3,99,0,345, 7133345,3,99,0,345,
71303,100,0,345,3, 71343,100,0,345,3,
7131101,0,695,12,1, 7135101,0,695,12,1,
713233132,696,5,63,3, 713635194,696,5,63,3,
7133109,0,345,3,110, 7137109,0,345,3,110,
71340,345,3,111,0, 71380,345,3,111,0,
7135345,3,112,0,345, 7139345,3,112,0,345,
71363,113,0,345,3, 71403,113,0,345,3,
7137114,0,697,12,1, 7141114,0,697,12,1,
713833165,698,5,63,3, 714235227,698,5,63,3,
7139109,0,345,3,110, 7143109,0,345,3,110,
71400,345,3,111,0, 71440,345,3,111,0,
7141345,3,112,0,345, 7145345,3,112,0,345,
@@ -7239,27 +7243,27 @@ public class yyLSLTokens : YyLexer {
7239345,3,106,0,345, 7243345,3,106,0,345,
72403,107,0,345,3, 72443,107,0,345,3,
7241108,0,345,701,11, 7245108,0,345,701,11,
72421,845,0,348,1, 72461,867,0,348,1,
7243-1,3,102,0,345, 7247-1,3,102,0,345,
72443,103,0,345,3, 72483,103,0,345,3,
7245104,0,345,3,105, 7249104,0,345,3,105,
72460,345,3,106,0, 72500,345,3,106,0,
7247345,3,107,0,345, 7251345,3,107,0,345,
72483,108,0,345,702, 72523,108,0,345,702,
724911,1,845,0,348, 725311,1,867,0,348,
72501,-1,3,104,0, 72541,-1,3,104,0,
7251345,3,105,0,345, 7255345,3,105,0,345,
72523,106,0,345,3, 72563,106,0,345,3,
7253107,0,345,3,108, 7257107,0,345,3,108,
72540,345,703,11,1, 72580,345,703,11,1,
7255845,0,348,1,-1, 7259867,0,348,1,-1,
72563,102,0,345,3, 72603,102,0,345,3,
7257103,0,345,3,104, 7261103,0,345,3,104,
72580,345,3,105,0, 72620,345,3,105,0,
7259345,3,106,0,345, 7263345,3,106,0,345,
72603,107,0,345,3, 72643,107,0,345,3,
7261108,0,345,704,11, 7265108,0,345,704,11,
72621,845,0,348,1, 72661,867,0,348,1,
7263-1,3,117,0,345, 7267-1,3,117,0,345,
72643,118,0,345,3, 72683,118,0,345,3,
7265119,0,345,3,120, 7269119,0,345,3,120,
@@ -7304,7 +7308,7 @@ public class yyLSLTokens : YyLexer {
73043,105,0,345,3, 73083,105,0,345,3,
7305106,0,345,3,107, 7309106,0,345,3,107,
73060,345,3,108,0, 73100,345,3,108,0,
7307345,705,11,1,845, 7311345,705,11,1,867,
73080,348,1,-1,3, 73120,348,1,-1,3,
7309111,0,345,3,112, 7313111,0,345,3,112,
73100,345,3,113,0, 73140,345,3,113,0,
@@ -7350,7 +7354,7 @@ public class yyLSLTokens : YyLexer {
73500,345,3,100,0, 73540,345,3,100,0,
7351345,3,101,0,345, 7355345,3,101,0,345,
73523,102,0,706,12, 73563,102,0,706,12,
73531,33693,707,5,63, 73571,35755,707,5,63,
73543,109,0,345,3, 73583,109,0,345,3,
7355110,0,345,3,111, 7359110,0,345,3,111,
73560,345,3,112,0, 73600,345,3,112,0,
@@ -7409,9 +7413,9 @@ public class yyLSLTokens : YyLexer {
7409105,0,345,3,106, 7413105,0,345,3,106,
74100,345,3,107,0, 74140,345,3,107,0,
7411345,3,108,0,345, 7415345,3,108,0,345,
7412710,11,1,845,0, 7416710,11,1,867,0,
7413348,1,-1,3,106, 7417348,1,-1,3,106,
74140,711,12,1,33886, 74180,711,12,1,35948,
7415712,5,63,3,109, 7419712,5,63,3,109,
74160,345,3,110,0, 74200,345,3,110,0,
7417345,3,111,0,345, 7421345,3,111,0,345,
@@ -7420,13 +7424,13 @@ public class yyLSLTokens : YyLexer {
74200,345,3,115,0, 74240,345,3,115,0,
7421345,3,116,0,345, 7425345,3,116,0,345,
74223,117,0,713,12, 74263,117,0,713,12,
74231,33922,714,5,63, 74271,35984,714,5,63,
74243,109,0,715,12, 74283,109,0,715,12,
74251,33950,716,5,63, 74291,36012,716,5,63,
74263,109,0,345,3, 74303,109,0,345,3,
7427110,0,345,3,111, 7431110,0,345,3,111,
74280,345,3,112,0, 74320,345,3,112,0,
7429717,12,1,33981,718, 7433717,12,1,36043,718,
74305,63,3,109,0, 74345,63,3,109,0,
7431345,3,110,0,345, 7435345,3,110,0,345,
74323,111,0,345,3, 74363,111,0,345,3,
@@ -7529,7 +7533,7 @@ public class yyLSLTokens : YyLexer {
7529345,3,106,0,345, 7533345,3,106,0,345,
75303,107,0,345,3, 75343,107,0,345,3,
7531108,0,345,721,11, 7535108,0,345,721,11,
75321,845,0,348,1, 75361,867,0,348,1,
7533-1,3,110,0,345, 7537-1,3,110,0,345,
75343,111,0,345,3, 75383,111,0,345,3,
7535112,0,345,3,113, 7539112,0,345,3,113,
@@ -7580,7 +7584,7 @@ public class yyLSLTokens : YyLexer {
75800,345,3,106,0, 75840,345,3,106,0,
7581345,3,107,0,345, 7585345,3,107,0,345,
75823,108,0,345,722, 75863,108,0,345,722,
758311,1,845,0,348, 758711,1,867,0,348,
75841,-1,3,118,0, 75881,-1,3,118,0,
7585345,3,119,0,345, 7589345,3,119,0,345,
75863,120,0,345,3, 75903,120,0,345,3,
@@ -7625,9 +7629,9 @@ public class yyLSLTokens : YyLexer {
7625345,3,106,0,345, 7629345,3,106,0,345,
76263,107,0,345,3, 76303,107,0,345,3,
7627108,0,345,723,11, 7631108,0,345,723,11,
76281,845,0,348,1, 76321,867,0,348,1,
7629-1,3,107,0,724, 7633-1,3,107,0,724,
763012,1,34367,725,5, 763412,1,36429,725,5,
763163,3,109,0,345, 763563,3,109,0,345,
76323,110,0,345,3, 76363,110,0,345,3,
7633111,0,345,3,112, 7637111,0,345,3,112,
@@ -7673,7 +7677,7 @@ public class yyLSLTokens : YyLexer {
767398,0,345,3,99, 767798,0,345,3,99,
76740,345,3,100,0, 76780,345,3,100,0,
7675345,3,101,0,726, 7679345,3,101,0,726,
767612,1,34414,727,5, 768012,1,36476,727,5,
767763,3,109,0,345, 768163,3,109,0,345,
76783,110,0,345,3, 76823,110,0,345,3,
7679111,0,345,3,112, 7683111,0,345,3,112,
@@ -7685,7 +7689,7 @@ public class yyLSLTokens : YyLexer {
7685345,3,119,0,345, 7689345,3,119,0,345,
76863,120,0,345,3, 76903,120,0,345,3,
7687121,0,728,12,1, 7691121,0,728,12,1,
768834454,729,5,63,3, 769236516,729,5,63,3,
7689109,0,345,3,110, 7693109,0,345,3,110,
76900,345,3,111,0, 76940,345,3,111,0,
7691345,3,112,0,345, 7695345,3,112,0,345,
@@ -7782,16 +7786,16 @@ public class yyLSLTokens : YyLexer {
77823,106,0,345,3, 77863,106,0,345,3,
7783107,0,345,3,108, 7787107,0,345,3,108,
77840,345,732,11,1, 77880,345,732,11,1,
7785845,0,348,1,-1, 7789867,0,348,1,-1,
77863,102,0,345,3, 77903,102,0,345,3,
7787103,0,345,3,104, 7791103,0,345,3,104,
77880,345,3,105,0, 77920,345,3,105,0,
7789345,3,106,0,345, 7793345,3,106,0,345,
77903,107,0,345,3, 77943,107,0,345,3,
7791108,0,345,733,11, 7795108,0,345,733,11,
77921,845,0,348,1, 77961,867,0,348,1,
7793-1,3,108,0,734, 7797-1,3,108,0,734,
779412,1,34728,735,5, 779812,1,36790,735,5,
779563,3,109,0,345, 779963,3,109,0,345,
77963,110,0,345,3, 78003,110,0,345,3,
7797111,0,345,3,112, 7801111,0,345,3,112,
@@ -7834,10 +7838,10 @@ public class yyLSLTokens : YyLexer {
78340,345,3,90,0, 78380,345,3,90,0,
7835345,3,95,0,345, 7839345,3,95,0,345,
78363,97,0,736,12, 78403,97,0,736,12,
78371,34771,737,5,63, 78411,36833,737,5,63,
78383,109,0,345,3, 78423,109,0,345,3,
7839110,0,738,12,1, 7843110,0,738,12,1,
784034800,739,5,63,3, 784436862,739,5,63,3,
7841109,0,345,3,110, 7845109,0,345,3,110,
78420,345,3,111,0, 78460,345,3,111,0,
7843345,3,112,0,345, 7847345,3,112,0,345,
@@ -7882,7 +7886,7 @@ public class yyLSLTokens : YyLexer {
78820,345,3,98,0, 78860,345,3,98,0,
7883345,3,99,0,345, 7887345,3,99,0,345,
78843,100,0,740,12, 78883,100,0,740,12,
78851,34846,741,5,63, 78891,36908,741,5,63,
78863,109,0,345,3, 78903,109,0,345,3,
7887110,0,345,3,111, 7891110,0,345,3,111,
78880,345,3,112,0, 78920,345,3,112,0,
@@ -7924,7 +7928,7 @@ public class yyLSLTokens : YyLexer {
79240,345,3,89,0, 79280,345,3,89,0,
7925345,3,90,0,345, 7929345,3,90,0,345,
79263,95,0,742,12, 79303,95,0,742,12,
79271,34932,743,5,63, 79311,36994,743,5,63,
79283,109,0,345,3, 79323,109,0,345,3,
7929110,0,345,3,111, 7933110,0,345,3,111,
79300,345,3,112,0, 79340,345,3,112,0,
@@ -7968,11 +7972,11 @@ public class yyLSLTokens : YyLexer {
79683,95,0,345,3, 79723,95,0,345,3,
796997,0,345,3,98, 797397,0,345,3,98,
79700,345,3,99,0, 79740,345,3,99,0,
7971744,12,1,34977,745, 7975744,12,1,37039,745,
79725,63,3,109,0, 79765,63,3,109,0,
7973345,3,110,0,345, 7977345,3,110,0,345,
79743,111,0,746,12, 79783,111,0,746,12,
79751,35007,747,5,63, 79791,37069,747,5,63,
79763,109,0,345,3, 79803,109,0,345,3,
7977110,0,345,3,111, 7981110,0,345,3,111,
79780,345,3,112,0, 79820,345,3,112,0,
@@ -8023,7 +8027,7 @@ public class yyLSLTokens : YyLexer {
8023345,3,105,0,345, 8027345,3,105,0,345,
80243,106,0,345,3, 80283,106,0,345,3,
8025107,0,345,3,108, 8029107,0,345,3,108,
80260,748,12,1,35061, 80300,748,12,1,37123,
8027749,5,63,3,109, 8031749,5,63,3,109,
80280,345,3,110,0, 80320,345,3,110,0,
8029345,3,111,0,345, 8033345,3,111,0,345,
@@ -8075,7 +8079,7 @@ public class yyLSLTokens : YyLexer {
8075105,0,345,3,106, 8079105,0,345,3,106,
80760,345,3,107,0, 80800,345,3,107,0,
8077345,3,108,0,750, 8081345,3,108,0,750,
807812,1,35115,751,5, 808212,1,37177,751,5,
807963,3,109,0,345, 808363,3,109,0,345,
80803,110,0,345,3, 80843,110,0,345,3,
8081111,0,345,3,112, 8085111,0,345,3,112,
@@ -8124,14 +8128,14 @@ public class yyLSLTokens : YyLexer {
81243,102,0,345,3, 81283,102,0,345,3,
8125103,0,345,3,104, 8129103,0,345,3,104,
81260,345,3,105,0, 81300,345,3,105,0,
8127752,12,1,35166,753, 8131752,12,1,37228,753,
81285,63,3,109,0, 81325,63,3,109,0,
8129345,3,110,0,345, 8133345,3,110,0,345,
81303,111,0,345,3, 81343,111,0,345,3,
8131112,0,345,3,113, 8135112,0,345,3,113,
81320,345,3,114,0, 81360,345,3,114,0,
8133345,3,115,0,754, 8137345,3,115,0,754,
813412,1,35200,755,5, 813812,1,37262,755,5,
813563,3,109,0,345, 813963,3,109,0,345,
81363,110,0,345,3, 81403,110,0,345,3,
8137111,0,345,3,112, 8141111,0,345,3,112,
@@ -8180,14 +8184,14 @@ public class yyLSLTokens : YyLexer {
81803,102,0,345,3, 81843,102,0,345,3,
8181103,0,345,3,104, 8185103,0,345,3,104,
81820,345,3,105,0, 81860,345,3,105,0,
8183756,12,1,35251,757, 8187756,12,1,37313,757,
81845,63,3,109,0, 81885,63,3,109,0,
8185345,3,110,0,345, 8189345,3,110,0,345,
81863,111,0,758,12, 81903,111,0,758,12,
81871,35281,759,5,63, 81911,37343,759,5,63,
81883,109,0,345,3, 81923,109,0,345,3,
8189110,0,760,12,1, 8193110,0,760,12,1,
819035310,761,5,63,3, 819437372,761,5,63,3,
8191109,0,345,3,110, 8195109,0,345,3,110,
81920,345,3,111,0, 81960,345,3,111,0,
8193345,3,112,0,345, 8197345,3,112,0,345,
@@ -8229,13 +8233,13 @@ public class yyLSLTokens : YyLexer {
8229345,3,89,0,345, 8233345,3,89,0,345,
82303,90,0,345,3, 82343,90,0,345,3,
823195,0,762,12,1, 823595,0,762,12,1,
823235396,763,5,63,3, 823637458,763,5,63,3,
8233109,0,345,3,110, 8237109,0,345,3,110,
82340,345,3,111,0, 82380,345,3,111,0,
8235345,3,112,0,345, 8239345,3,112,0,345,
82363,113,0,345,3, 82403,113,0,345,3,
8237114,0,345,3,115, 8241114,0,345,3,115,
82380,764,12,1,35430, 82420,764,12,1,37492,
8239765,5,63,3,109, 8243765,5,63,3,109,
82400,345,3,110,0, 82440,345,3,110,0,
8241345,3,111,0,345, 8245345,3,111,0,345,
@@ -8243,7 +8247,7 @@ public class yyLSLTokens : YyLexer {
8243113,0,345,3,114, 8247113,0,345,3,114,
82440,345,3,115,0, 82480,345,3,115,0,
8245345,3,116,0,766, 8249345,3,116,0,766,
824612,1,35465,767,5, 825012,1,37527,767,5,
824763,3,109,0,345, 825163,3,109,0,345,
82483,110,0,345,3, 82523,110,0,345,3,
8249111,0,345,3,112, 8253111,0,345,3,112,
@@ -8286,20 +8290,20 @@ public class yyLSLTokens : YyLexer {
82860,345,3,90,0, 82900,345,3,90,0,
8287345,3,95,0,345, 8291345,3,95,0,345,
82883,97,0,768,12, 82923,97,0,768,12,
82891,35508,769,5,63, 82931,37570,769,5,63,
82903,109,0,345,3, 82943,109,0,345,3,
8291110,0,345,3,111, 8295110,0,345,3,111,
82920,345,3,112,0, 82960,345,3,112,0,
8293345,3,113,0,345, 8297345,3,113,0,345,
82943,114,0,770,12, 82983,114,0,770,12,
82951,35541,771,5,63, 82991,37603,771,5,63,
82963,109,0,345,3, 83003,109,0,345,3,
8297110,0,345,3,111, 8301110,0,345,3,111,
82980,345,3,112,0, 83020,345,3,112,0,
8299345,3,113,0,345, 8303345,3,113,0,345,
83003,114,0,345,3, 83043,114,0,345,3,
8301115,0,345,3,116, 8305115,0,345,3,116,
83020,772,12,1,35576, 83060,772,12,1,37638,
8303773,5,63,3,109, 8307773,5,63,3,109,
83040,345,3,110,0, 83080,345,3,110,0,
8305345,3,111,0,345, 8309345,3,111,0,345,
@@ -8408,7 +8412,7 @@ public class yyLSLTokens : YyLexer {
84083,106,0,345,3, 84123,106,0,345,3,
8409107,0,345,3,108, 8413107,0,345,3,108,
84100,345,776,11,1, 84140,345,776,11,1,
8411845,0,348,1,-1, 8415867,0,348,1,-1,
84123,115,0,345,3, 84163,115,0,345,3,
8413116,0,345,3,117, 8417116,0,345,3,117,
84140,345,3,118,0, 84180,345,3,118,0,
@@ -8455,7 +8459,7 @@ public class yyLSLTokens : YyLexer {
8455345,3,106,0,345, 8459345,3,106,0,345,
84563,107,0,345,3, 84603,107,0,345,3,
8457108,0,345,777,11, 8461108,0,345,777,11,
84581,845,0,348,1, 84621,867,0,348,1,
8459-1,3,98,0,345, 8463-1,3,98,0,345,
84603,99,0,345,3, 84643,99,0,345,3,
8461100,0,345,3,101, 8465100,0,345,3,101,
@@ -8465,7 +8469,7 @@ public class yyLSLTokens : YyLexer {
8465105,0,345,3,106, 8469105,0,345,3,106,
84660,345,3,107,0, 84700,345,3,107,0,
8467345,3,108,0,345, 8471345,3,108,0,345,
8468778,11,1,845,0, 8472778,11,1,867,0,
8469348,1,-1,3,117, 8473348,1,-1,3,117,
84700,345,3,118,0, 84740,345,3,118,0,
8471345,3,119,0,345, 8475345,3,119,0,345,
@@ -8511,7 +8515,7 @@ public class yyLSLTokens : YyLexer {
8511345,3,106,0,345, 8515345,3,106,0,345,
85123,107,0,345,3, 85163,107,0,345,3,
8513108,0,345,779,11, 8517108,0,345,779,11,
85141,845,0,348,1, 85181,867,0,348,1,
8515-1,3,116,0,345, 8519-1,3,116,0,345,
85163,117,0,345,3, 85203,117,0,345,3,
8517118,0,345,3,119, 8521118,0,345,3,119,
@@ -8551,10 +8555,10 @@ public class yyLSLTokens : YyLexer {
8551345,3,98,0,345, 8555345,3,98,0,345,
85523,99,0,345,3, 85563,99,0,345,3,
8553100,0,345,3,101, 8557100,0,345,3,101,
85540,780,12,1,36043, 85580,780,12,1,38105,
8555781,5,63,3,109, 8559781,5,63,3,109,
85560,345,3,110,0, 85600,345,3,110,0,
8557782,12,1,36072,783, 8561782,12,1,38134,783,
85585,63,3,109,0, 85625,63,3,109,0,
8559345,3,110,0,345, 8563345,3,110,0,345,
85603,111,0,345,3, 85643,111,0,345,3,
@@ -8599,7 +8603,7 @@ public class yyLSLTokens : YyLexer {
8599345,3,97,0,345, 8603345,3,97,0,345,
86003,98,0,345,3, 86043,98,0,345,3,
860199,0,345,3,100, 860599,0,345,3,100,
86020,784,12,1,36118, 86060,784,12,1,38180,
8603785,5,63,3,109, 8607785,5,63,3,109,
86040,345,3,110,0, 86080,345,3,110,0,
8605345,3,111,0,345, 8609345,3,111,0,345,
@@ -8669,7 +8673,7 @@ public class yyLSLTokens : YyLexer {
8669105,0,345,3,106, 8673105,0,345,3,106,
86700,345,3,107,0, 86740,345,3,107,0,
8671345,3,108,0,345, 8675345,3,108,0,345,
8672788,11,1,845,0, 8676788,11,1,867,0,
8673348,1,-1,3,111, 8677348,1,-1,3,111,
86740,345,3,112,0, 86780,345,3,112,0,
8675345,3,113,0,345, 8679345,3,113,0,345,
@@ -8720,14 +8724,14 @@ public class yyLSLTokens : YyLexer {
87203,106,0,345,3, 87243,106,0,345,3,
8721107,0,345,3,108, 8725107,0,345,3,108,
87220,345,789,11,1, 87260,345,789,11,1,
8723845,0,348,1,-1, 8727867,0,348,1,-1,
87243,102,0,345,3, 87283,102,0,345,3,
8725103,0,345,3,104, 8729103,0,345,3,104,
87260,345,3,105,0, 87300,345,3,105,0,
8727345,3,106,0,345, 8731345,3,106,0,345,
87283,107,0,345,3, 87323,107,0,345,3,
8729108,0,345,790,11, 8733108,0,345,790,11,
87301,845,0,348,1, 87341,867,0,348,1,
8731-1,3,97,0,345, 8735-1,3,97,0,345,
87323,98,0,345,3, 87363,98,0,345,3,
873399,0,345,3,100, 873799,0,345,3,100,
@@ -8797,7 +8801,7 @@ public class yyLSLTokens : YyLexer {
8797345,3,106,0,345, 8801345,3,106,0,345,
87983,107,0,345,3, 88023,107,0,345,3,
8799108,0,345,793,11, 8803108,0,345,793,11,
88001,845,0,348,1, 88041,867,0,348,1,
8801-1,3,112,0,345, 8805-1,3,112,0,345,
88023,113,0,345,3, 88063,113,0,345,3,
8803114,0,345,3,115, 8807114,0,345,3,115,
@@ -8846,11 +8850,11 @@ public class yyLSLTokens : YyLexer {
88463,105,0,345,3, 88503,105,0,345,3,
8847106,0,345,3,107, 8851106,0,345,3,107,
88480,345,3,108,0, 88520,345,3,108,0,
8849345,794,11,1,845, 8853345,794,11,1,867,
88500,348,1,-1,3, 88540,348,1,-1,3,
8851106,0,345,3,107, 8855106,0,345,3,107,
88520,345,3,108,0, 88560,345,3,108,0,
8853345,795,11,1,845, 8857345,795,11,1,867,
88540,348,1,-1,3, 88580,348,1,-1,3,
8855116,0,345,3,117, 8859116,0,345,3,117,
88560,345,3,118,0, 88600,345,3,118,0,
@@ -8897,14 +8901,14 @@ public class yyLSLTokens : YyLexer {
8897345,3,106,0,345, 8901345,3,106,0,345,
88983,107,0,345,3, 89023,107,0,345,3,
8899108,0,345,796,11, 8903108,0,345,796,11,
89001,845,0,348,1, 89041,867,0,348,1,
8901-1,3,106,0,345, 8905-1,3,106,0,345,
89023,107,0,345,3, 89063,107,0,345,3,
8903108,0,345,797,11, 8907108,0,345,797,11,
89041,845,0,348,1, 89081,867,0,348,1,
8905-1,798,11,1,845, 8909-1,798,11,1,867,
89060,348,1,-1,799, 89100,348,1,-1,799,
890711,1,845,0,348, 891111,1,867,0,348,
89081,-1,3,112,0, 89121,-1,3,112,0,
8909345,3,113,0,345, 8913345,3,113,0,345,
89103,114,0,345,3, 89143,114,0,345,3,
@@ -8954,7 +8958,7 @@ public class yyLSLTokens : YyLexer {
89543,106,0,345,3, 89583,106,0,345,3,
8955107,0,345,3,108, 8959107,0,345,3,108,
89560,345,800,11,1, 89600,345,800,11,1,
8957845,0,348,1,-1, 8961867,0,348,1,-1,
89583,100,0,345,3, 89623,100,0,345,3,
8959101,0,345,3,102, 8963101,0,345,3,102,
89600,345,3,103,0, 89640,345,3,103,0,
@@ -8962,7 +8966,7 @@ public class yyLSLTokens : YyLexer {
89623,105,0,345,3, 89663,105,0,345,3,
8963106,0,345,3,107, 8967106,0,345,3,107,
89640,345,3,108,0, 89680,345,3,108,0,
8965345,801,11,1,845, 8969345,801,11,1,867,
89660,348,1,-1,3, 89700,348,1,-1,3,
896797,0,345,3,98, 897197,0,345,3,98,
89680,345,3,99,0, 89720,345,3,99,0,
@@ -8974,7 +8978,7 @@ public class yyLSLTokens : YyLexer {
89743,106,0,345,3, 89783,106,0,345,3,
8975107,0,345,3,108, 8979107,0,345,3,108,
89760,345,802,11,1, 89800,345,802,11,1,
8977845,0,348,1,-1, 8981867,0,348,1,-1,
89783,101,0,345,3, 89823,101,0,345,3,
8979102,0,345,3,103, 8983102,0,345,3,103,
89800,345,3,104,0, 89840,345,3,104,0,
@@ -8982,7 +8986,7 @@ public class yyLSLTokens : YyLexer {
89823,106,0,345,3, 89863,106,0,345,3,
8983107,0,345,3,108, 8987107,0,345,3,108,
89840,345,803,11,1, 89880,345,803,11,1,
8985845,0,348,1,-1, 8989867,0,348,1,-1,
89863,111,0,345,3, 89903,111,0,345,3,
8987112,0,345,3,113, 8991112,0,345,3,113,
89880,345,3,114,0, 89920,345,3,114,0,
@@ -9032,7 +9036,7 @@ public class yyLSLTokens : YyLexer {
90320,345,3,106,0, 90360,345,3,106,0,
9033345,3,107,0,345, 9037345,3,107,0,345,
90343,108,0,345,804, 90383,108,0,345,804,
903511,1,845,0,348, 903911,1,867,0,348,
90361,-1,3,98,0, 90401,-1,3,98,0,
9037345,3,99,0,345, 9041345,3,99,0,345,
90383,100,0,345,3, 90423,100,0,345,3,
@@ -9040,10 +9044,10 @@ public class yyLSLTokens : YyLexer {
90400,345,3,103,0, 90440,345,3,103,0,
9041345,3,104,0,345, 9045345,3,104,0,345,
90423,105,0,805,12, 90463,105,0,805,12,
90431,37419,806,5,63, 90471,39481,806,5,63,
90443,109,0,345,3, 90483,109,0,345,3,
9045110,0,807,12,1, 9049110,0,807,12,1,
904637448,808,5,63,3, 905039510,808,5,63,3,
9047109,0,345,3,110, 9051109,0,345,3,110,
90480,345,3,111,0, 90520,345,3,111,0,
9049345,3,112,0,345, 9053345,3,112,0,345,
@@ -9093,7 +9097,7 @@ public class yyLSLTokens : YyLexer {
9093345,3,104,0,345, 9097345,3,104,0,345,
90943,105,0,345,3, 90983,105,0,345,3,
9095106,0,345,3,107, 9099106,0,345,3,107,
90960,809,12,1,37501, 91000,809,12,1,39563,
9097810,5,63,3,109, 9101810,5,63,3,109,
90980,345,3,110,0, 91020,345,3,110,0,
9099345,3,111,0,345, 9103345,3,111,0,345,
@@ -9135,9 +9139,9 @@ public class yyLSLTokens : YyLexer {
9135345,3,88,0,345, 9139345,3,88,0,345,
91363,89,0,345,3, 91403,89,0,345,3,
913790,0,345,3,95, 914190,0,345,3,95,
91380,811,12,1,37587, 91420,811,12,1,39649,
9139812,5,63,3,109, 9143812,5,63,3,109,
91400,813,12,1,37615, 91440,813,12,1,39677,
9141814,5,63,3,109, 9145814,5,63,3,109,
91420,345,3,110,0, 91460,345,3,110,0,
9143345,3,111,0,345, 9147345,3,111,0,345,
@@ -9183,21 +9187,21 @@ public class yyLSLTokens : YyLexer {
9183345,3,98,0,345, 9187345,3,98,0,345,
91843,99,0,345,3, 91883,99,0,345,3,
9185100,0,345,3,101, 9189100,0,345,3,101,
91860,815,12,1,37662, 91900,815,12,1,39724,
9187816,5,63,3,109, 9191816,5,63,3,109,
91880,345,3,110,0, 91920,345,3,110,0,
9189345,3,111,0,345, 9193345,3,111,0,345,
91903,112,0,345,3, 91943,112,0,345,3,
9191113,0,345,3,114, 9195113,0,345,3,114,
91920,345,3,115,0, 91960,345,3,115,0,
9193817,12,1,37696,818, 9197817,12,1,39758,818,
91945,63,3,109,0, 91985,63,3,109,0,
9195345,3,110,0,345, 9199345,3,110,0,345,
91963,111,0,345,3, 92003,111,0,345,3,
9197112,0,345,3,113, 9201112,0,345,3,113,
91980,345,3,114,0, 92020,345,3,114,0,
9199345,3,115,0,819, 9203345,3,115,0,819,
920012,1,37730,820,5, 920412,1,39792,820,5,
920163,3,109,0,345, 920563,3,109,0,345,
92023,110,0,345,3, 92063,110,0,345,3,
9203111,0,345,3,112, 9207111,0,345,3,112,
@@ -9240,7 +9244,7 @@ public class yyLSLTokens : YyLexer {
92400,345,3,90,0, 92440,345,3,90,0,
9241345,3,95,0,345, 9245345,3,95,0,345,
92423,97,0,821,12, 92463,97,0,821,12,
92431,37773,822,5,63, 92471,39835,822,5,63,
92443,109,0,345,3, 92483,109,0,345,3,
9245110,0,345,3,111, 9249110,0,345,3,111,
92460,345,3,112,0, 92500,345,3,112,0,
@@ -9287,7 +9291,7 @@ public class yyLSLTokens : YyLexer {
9287345,3,100,0,345, 9291345,3,100,0,345,
92883,101,0,345,3, 92923,101,0,345,3,
9289102,0,345,3,103, 9293102,0,345,3,103,
92900,823,12,1,37822, 92940,823,12,1,39884,
9291824,5,63,3,109, 9295824,5,63,3,109,
92920,345,3,110,0, 92960,345,3,110,0,
9293345,3,111,0,345, 9297345,3,111,0,345,
@@ -9333,7 +9337,7 @@ public class yyLSLTokens : YyLexer {
9333345,3,98,0,345, 9337345,3,98,0,345,
93343,99,0,345,3, 93383,99,0,345,3,
9335100,0,345,3,101, 9339100,0,345,3,101,
93360,825,12,1,37869, 93400,825,12,1,39931,
9337826,5,63,3,109, 9341826,5,63,3,109,
93380,345,3,110,0, 93420,345,3,110,0,
9339345,3,111,0,345, 9343345,3,111,0,345,
@@ -9400,13 +9404,13 @@ public class yyLSLTokens : YyLexer {
94000,345,3,106,0, 94040,345,3,106,0,
9401345,3,107,0,345, 9405345,3,107,0,345,
94023,108,0,345,829, 94063,108,0,345,829,
940311,1,845,0,348, 940711,1,867,0,348,
94041,-1,3,104,0, 94081,-1,3,104,0,
9405345,3,105,0,345, 9409345,3,105,0,345,
94063,106,0,345,3, 94103,106,0,345,3,
9407107,0,345,3,108, 9411107,0,345,3,108,
94080,345,830,11,1, 94120,345,830,11,1,
9409845,0,348,1,-1, 9413867,0,348,1,-1,
94103,98,0,345,3, 94143,98,0,345,3,
941199,0,345,3,100, 941599,0,345,3,100,
94120,345,3,101,0, 94160,345,3,101,0,
@@ -9416,7 +9420,7 @@ public class yyLSLTokens : YyLexer {
94160,345,3,106,0, 94200,345,3,106,0,
9417345,3,107,0,345, 9421345,3,107,0,345,
94183,108,0,345,831, 94223,108,0,345,831,
941911,1,845,0,348, 942311,1,867,0,348,
94201,-1,3,116,0, 94241,-1,3,116,0,
9421345,3,117,0,345, 9425345,3,117,0,345,
94223,118,0,345,3, 94263,118,0,345,3,
@@ -9462,7 +9466,7 @@ public class yyLSLTokens : YyLexer {
94623,105,0,345,3, 94663,105,0,345,3,
9463106,0,345,3,107, 9467106,0,345,3,107,
94640,345,3,108,0, 94680,345,3,108,0,
9465345,832,11,1,845, 9469345,832,11,1,867,
94660,348,1,-1,3, 94700,348,1,-1,3,
9467116,0,345,3,117, 9471116,0,345,3,117,
94680,345,3,118,0, 94720,345,3,118,0,
@@ -9509,14 +9513,14 @@ public class yyLSLTokens : YyLexer {
9509345,3,106,0,345, 9513345,3,106,0,345,
95103,107,0,345,3, 95143,107,0,345,3,
9511108,0,345,833,11, 9515108,0,345,833,11,
95121,845,0,348,1, 95161,867,0,348,1,
9513-1,3,102,0,345, 9517-1,3,102,0,345,
95143,103,0,345,3, 95183,103,0,345,3,
9515104,0,345,3,105, 9519104,0,345,3,105,
95160,345,3,106,0, 95200,345,3,106,0,
9517345,3,107,0,345, 9521345,3,107,0,345,
95183,108,0,345,834, 95223,108,0,345,834,
951911,1,845,0,348, 952311,1,867,0,348,
95201,-1,3,110,0, 95241,-1,3,110,0,
9521345,3,111,0,345, 9525345,3,111,0,345,
95223,112,0,345,3, 95263,112,0,345,3,
@@ -9567,7 +9571,7 @@ public class yyLSLTokens : YyLexer {
9567105,0,345,3,106, 9571105,0,345,3,106,
95680,345,3,107,0, 95720,345,3,107,0,
9569345,3,108,0,345, 9573345,3,108,0,345,
9570835,11,1,845,0, 9574835,11,1,867,0,
9571348,1,-1,3,97, 9575348,1,-1,3,97,
95720,345,3,98,0, 95760,345,3,98,0,
9573345,3,99,0,345, 9577345,3,99,0,345,
@@ -9578,15 +9582,15 @@ public class yyLSLTokens : YyLexer {
95783,105,0,345,3, 95823,105,0,345,3,
9579106,0,345,3,107, 9583106,0,345,3,107,
95800,345,3,108,0, 95840,345,3,108,0,
9581345,836,11,1,845, 9585345,836,11,1,867,
95820,348,1,-1,3, 95860,348,1,-1,3,
9583108,0,345,837,11, 9587108,0,345,837,11,
95841,845,0,348,1, 95881,867,0,348,1,
9585-1,3,111,0,345, 9589-1,3,111,0,345,
95863,112,0,345,3, 95903,112,0,345,3,
9587113,0,345,3,114, 9591113,0,345,3,114,
95880,345,3,115,0, 95920,345,3,115,0,
9589838,12,1,38653,839, 9593838,12,1,40715,839,
95905,63,3,109,0, 95945,63,3,109,0,
9591345,3,110,0,345, 9595345,3,110,0,345,
95923,111,0,345,3, 95963,111,0,345,3,
@@ -9594,7 +9598,7 @@ public class yyLSLTokens : YyLexer {
95940,345,3,114,0, 95980,345,3,114,0,
9595345,3,115,0,345, 9599345,3,115,0,345,
95963,116,0,840,12, 96003,116,0,840,12,
95971,38688,841,5,63, 96011,40750,841,5,63,
95983,109,0,345,3, 96023,109,0,345,3,
9599110,0,345,3,111, 9603110,0,345,3,111,
96000,345,3,112,0, 96040,345,3,112,0,
@@ -9640,10 +9644,10 @@ public class yyLSLTokens : YyLexer {
96400,345,3,99,0, 96440,345,3,99,0,
9641345,3,100,0,345, 9645345,3,100,0,345,
96423,101,0,842,12, 96463,101,0,842,12,
96431,38735,843,5,63, 96471,40797,843,5,63,
96443,109,0,345,3, 96483,109,0,345,3,
9645110,0,844,12,1, 9649110,0,844,12,1,
964638764,845,5,63,3, 965040826,845,5,63,3,
9647109,0,345,3,110, 9651109,0,345,3,110,
96480,345,3,111,0, 96520,345,3,111,0,
9649345,3,112,0,345, 9653345,3,112,0,345,
@@ -9750,7 +9754,7 @@ public class yyLSLTokens : YyLexer {
97500,345,3,106,0, 97540,345,3,106,0,
9751345,3,107,0,345, 9755345,3,107,0,345,
97523,108,0,345,848, 97563,108,0,345,848,
975311,1,845,0,348, 975711,1,867,0,348,
97541,-1,3,102,0, 97581,-1,3,102,0,
9755345,3,103,0,345, 9759345,3,103,0,345,
97563,104,0,345,3, 97603,104,0,345,3,
@@ -9807,7 +9811,7 @@ public class yyLSLTokens : YyLexer {
9807345,3,106,0,345, 9811345,3,106,0,345,
98083,107,0,345,3, 98123,107,0,345,3,
9809108,0,345,851,11, 9813108,0,345,851,11,
98101,845,0,348,1, 98141,867,0,348,1,
9811-1,3,116,0,345, 9815-1,3,116,0,345,
98123,117,0,345,3, 98163,117,0,345,3,
9813118,0,345,3,119, 9817118,0,345,3,119,
@@ -9853,20 +9857,20 @@ public class yyLSLTokens : YyLexer {
9853105,0,345,3,106, 9857105,0,345,3,106,
98540,345,3,107,0, 98580,345,3,107,0,
9855345,3,108,0,345, 9859345,3,108,0,345,
9856852,11,1,845,0, 9860852,11,1,867,0,
9857348,1,-1,3,106, 9861348,1,-1,3,106,
98580,345,3,107,0, 98620,345,3,107,0,
9859345,3,108,0,345, 9863345,3,108,0,345,
9860853,11,1,845,0, 9864853,11,1,867,0,
9861348,1,-1,3,109, 9865348,1,-1,3,109,
98620,854,12,1,1942, 98660,854,12,1,1964,
9863855,5,63,3,109, 9867855,5,63,3,109,
98640,345,3,110,0, 98680,345,3,110,0,
9865345,3,111,0,856, 9869345,3,111,0,856,
986612,1,1972,857,5, 987012,1,1994,857,5,
986763,3,109,0,345, 987163,3,109,0,345,
98683,110,0,858,12, 98723,110,0,858,12,
98691,2001,859,5,63, 98731,2023,859,5,63,
98703,109,0,345,3, 98743,109,0,345,3,
9871110,0,345,3,111, 9875110,0,345,3,111,
98720,345,3,112,0, 98760,345,3,112,0,
@@ -9912,7 +9916,7 @@ public class yyLSLTokens : YyLexer {
99120,345,3,99,0, 99160,345,3,99,0,
9913345,3,100,0,345, 9917345,3,100,0,345,
99143,101,0,860,12, 99183,101,0,860,12,
99151,2048,861,5,63, 99191,2070,861,5,63,
99163,109,0,345,3, 99203,109,0,345,3,
9917110,0,345,3,111, 9921110,0,345,3,111,
99180,345,3,112,0, 99220,345,3,112,0,
@@ -9923,7 +9927,7 @@ public class yyLSLTokens : YyLexer {
9923345,3,118,0,345, 9927345,3,118,0,345,
99243,119,0,345,3, 99283,119,0,345,3,
9925120,0,345,3,121, 9929120,0,345,3,121,
99260,862,12,1,2088, 99300,862,12,1,2110,
9927863,5,63,3,109, 9931863,5,63,3,109,
99280,345,3,110,0, 99320,345,3,110,0,
9929345,3,111,0,345, 9933345,3,111,0,345,
@@ -10022,14 +10026,14 @@ public class yyLSLTokens : YyLexer {
100223,106,0,345,3, 100263,106,0,345,3,
10023107,0,345,3,108, 10027107,0,345,3,108,
100240,345,866,11,1, 100280,345,866,11,1,
10025845,0,348,1,-1, 10029867,0,348,1,-1,
100263,102,0,345,3, 100303,102,0,345,3,
10027103,0,345,3,104, 10031103,0,345,3,104,
100280,345,3,105,0, 100320,345,3,105,0,
10029345,3,106,0,345, 10033345,3,106,0,345,
100303,107,0,345,3, 100343,107,0,345,3,
10031108,0,345,867,11, 10035108,0,345,867,11,
100321,845,0,348,1, 100361,867,0,348,1,
10033-1,3,111,0,345, 10037-1,3,111,0,345,
100343,112,0,345,3, 100383,112,0,345,3,
10035113,0,345,3,114, 10039113,0,345,3,114,
@@ -10037,7 +10041,7 @@ public class yyLSLTokens : YyLexer {
10037345,3,116,0,345, 10041345,3,116,0,345,
100383,117,0,345,3, 100423,117,0,345,3,
10039118,0,868,12,1, 10043118,0,868,12,1,
100402369,869,5,63,3, 100442391,869,5,63,3,
10041109,0,345,3,110, 10045109,0,345,3,110,
100420,345,3,111,0, 100460,345,3,111,0,
10043345,3,112,0,345, 10047345,3,112,0,345,
@@ -10086,10 +10090,10 @@ public class yyLSLTokens : YyLexer {
100860,345,3,103,0, 100900,345,3,103,0,
10087345,3,104,0,345, 10091345,3,104,0,345,
100883,105,0,870,12, 100923,105,0,870,12,
100891,2420,871,5,63, 100931,2442,871,5,63,
100903,109,0,345,3, 100943,109,0,345,3,
10091110,0,872,12,1, 10095110,0,872,12,1,
100922449,873,5,63,3, 100962471,873,5,63,3,
10093109,0,345,3,110, 10097109,0,345,3,110,
100940,345,3,111,0, 100980,345,3,111,0,
10095345,3,112,0,345, 10099345,3,112,0,345,
@@ -10136,7 +10140,7 @@ public class yyLSLTokens : YyLexer {
101363,100,0,345,3, 101403,100,0,345,3,
10137101,0,345,3,102, 10141101,0,345,3,102,
101380,345,3,103,0, 101420,345,3,103,0,
10139874,12,1,2498,875, 10143874,12,1,2520,875,
101405,63,3,109,0, 101445,63,3,109,0,
10141345,3,110,0,345, 10145345,3,110,0,345,
101423,111,0,345,3, 101463,111,0,345,3,
@@ -10178,14 +10182,14 @@ public class yyLSLTokens : YyLexer {
101783,88,0,345,3, 101823,88,0,345,3,
1017989,0,345,3,90, 1018389,0,345,3,90,
101800,345,3,95,0, 101840,345,3,95,0,
10181876,12,1,2584,877, 10185876,12,1,2606,877,
101825,63,3,109,0, 101865,63,3,109,0,
10183345,3,110,0,345, 10187345,3,110,0,345,
101843,111,0,345,3, 101883,111,0,345,3,
10185112,0,345,3,113, 10189112,0,345,3,113,
101860,345,3,114,0, 101900,345,3,114,0,
10187345,3,115,0,878, 10191345,3,115,0,878,
1018812,1,2618,879,5, 1019212,1,2640,879,5,
1018963,3,109,0,345, 1019363,3,109,0,345,
101903,110,0,345,3, 101943,110,0,345,3,
10191111,0,345,3,112, 10195111,0,345,3,112,
@@ -10193,7 +10197,7 @@ public class yyLSLTokens : YyLexer {
10193345,3,114,0,345, 10197345,3,114,0,345,
101943,115,0,345,3, 101983,115,0,345,3,
10195116,0,880,12,1, 10199116,0,880,12,1,
101962653,881,5,63,3, 102002675,881,5,63,3,
10197109,0,345,3,110, 10201109,0,345,3,110,
101980,345,3,111,0, 102020,345,3,111,0,
10199345,3,112,0,345, 10203345,3,112,0,345,
@@ -10235,13 +10239,13 @@ public class yyLSLTokens : YyLexer {
10235345,3,89,0,345, 10239345,3,89,0,345,
102363,90,0,345,3, 102403,90,0,345,3,
1023795,0,345,3,97, 1024195,0,345,3,97,
102380,882,12,1,2696, 102420,882,12,1,2718,
10239883,5,63,3,109, 10243883,5,63,3,109,
102400,345,3,110,0, 102440,345,3,110,0,
10241345,3,111,0,345, 10245345,3,111,0,345,
102423,112,0,345,3, 102463,112,0,345,3,
10243113,0,345,3,114, 10247113,0,345,3,114,
102440,884,12,1,2729, 102480,884,12,1,2751,
10245885,5,63,3,109, 10249885,5,63,3,109,
102460,345,3,110,0, 102500,345,3,110,0,
10247345,3,111,0,345, 10251345,3,111,0,345,
@@ -10249,7 +10253,7 @@ public class yyLSLTokens : YyLexer {
10249113,0,345,3,114, 10253113,0,345,3,114,
102500,345,3,115,0, 102540,345,3,115,0,
10251345,3,116,0,886, 10255345,3,116,0,886,
1025212,1,2764,887,5, 1025612,1,2786,887,5,
1025363,3,109,0,345, 1025763,3,109,0,345,
102543,110,0,345,3, 102583,110,0,345,3,
10255111,0,345,3,112, 10259111,0,345,3,112,
@@ -10354,7 +10358,7 @@ public class yyLSLTokens : YyLexer {
103540,345,3,106,0, 103580,345,3,106,0,
10355345,3,107,0,345, 10359345,3,107,0,345,
103563,108,0,345,890, 103603,108,0,345,890,
1035711,1,845,0,348, 1036111,1,867,0,348,
103581,-1,3,115,0, 103621,-1,3,115,0,
10359345,3,116,0,345, 10363345,3,116,0,345,
103603,117,0,345,3, 103643,117,0,345,3,
@@ -10401,7 +10405,7 @@ public class yyLSLTokens : YyLexer {
10401105,0,345,3,106, 10405105,0,345,3,106,
104020,345,3,107,0, 104060,345,3,107,0,
10403345,3,108,0,345, 10407345,3,108,0,345,
10404891,11,1,845,0, 10408891,11,1,867,0,
10405348,1,-1,3,98, 10409348,1,-1,3,98,
104060,345,3,99,0, 104100,345,3,99,0,
10407345,3,100,0,345, 10411345,3,100,0,345,
@@ -10412,7 +10416,7 @@ public class yyLSLTokens : YyLexer {
104123,106,0,345,3, 104163,106,0,345,3,
10413107,0,345,3,108, 10417107,0,345,3,108,
104140,345,892,11,1, 104180,345,892,11,1,
10415845,0,348,1,-1, 10419867,0,348,1,-1,
104163,117,0,345,3, 104203,117,0,345,3,
10417118,0,345,3,119, 10421118,0,345,3,119,
104180,345,3,120,0, 104220,345,3,120,0,
@@ -10457,7 +10461,7 @@ public class yyLSLTokens : YyLexer {
10457105,0,345,3,106, 10461105,0,345,3,106,
104580,345,3,107,0, 104620,345,3,107,0,
10459345,3,108,0,345, 10463345,3,108,0,345,
10460893,11,1,845,0, 10464893,11,1,867,0,
10461348,1,-1,3,116, 10465348,1,-1,3,116,
104620,345,3,117,0, 104660,345,3,117,0,
10463345,3,118,0,345, 10467345,3,118,0,345,
@@ -10498,10 +10502,10 @@ public class yyLSLTokens : YyLexer {
104980,345,3,99,0, 105020,345,3,99,0,
10499345,3,100,0,345, 10503345,3,100,0,345,
105003,101,0,894,12, 105043,101,0,894,12,
105011,3231,895,5,63, 105051,3253,895,5,63,
105023,109,0,345,3, 105063,109,0,345,3,
10503110,0,896,12,1, 10507110,0,896,12,1,
105043260,897,5,63,3, 105083282,897,5,63,3,
10505109,0,345,3,110, 10509109,0,345,3,110,
105060,345,3,111,0, 105100,345,3,111,0,
10507345,3,112,0,345, 10511345,3,112,0,345,
@@ -10546,7 +10550,7 @@ public class yyLSLTokens : YyLexer {
105460,345,3,98,0, 105500,345,3,98,0,
10547345,3,99,0,345, 10551345,3,99,0,345,
105483,100,0,898,12, 105523,100,0,898,12,
105491,3306,899,5,63, 105531,3328,899,5,63,
105503,109,0,345,3, 105543,109,0,345,3,
10551110,0,345,3,111, 10555110,0,345,3,111,
105520,345,3,112,0, 105560,345,3,112,0,
@@ -10612,7 +10616,7 @@ public class yyLSLTokens : YyLexer {
106123,105,0,345,3, 106163,105,0,345,3,
10613106,0,345,3,107, 10617106,0,345,3,107,
106140,345,3,108,0, 106180,345,3,108,0,
10615345,902,11,1,845, 10619345,902,11,1,867,
106160,348,1,-1,3, 106200,348,1,-1,3,
10617111,0,345,3,112, 10621111,0,345,3,112,
106180,345,3,113,0, 106220,345,3,113,0,
@@ -10663,14 +10667,14 @@ public class yyLSLTokens : YyLexer {
10663345,3,106,0,345, 10667345,3,106,0,345,
106643,107,0,345,3, 106683,107,0,345,3,
10665108,0,345,903,11, 10669108,0,345,903,11,
106661,845,0,348,1, 106701,867,0,348,1,
10667-1,3,102,0,345, 10671-1,3,102,0,345,
106683,103,0,345,3, 106723,103,0,345,3,
10669104,0,345,3,105, 10673104,0,345,3,105,
106700,345,3,106,0, 106740,345,3,106,0,
10671345,3,107,0,345, 10675345,3,107,0,345,
106723,108,0,345,904, 106763,108,0,345,904,
1067311,1,845,0,348, 1067711,1,867,0,348,
106741,-1,3,97,0, 106781,-1,3,97,0,
10675345,3,98,0,345, 10679345,3,98,0,345,
106763,99,0,345,3, 106803,99,0,345,3,
@@ -10681,13 +10685,13 @@ public class yyLSLTokens : YyLexer {
10681105,0,345,3,106, 10685105,0,345,3,106,
106820,345,3,107,0, 106860,345,3,107,0,
10683345,3,108,0,345, 10687345,3,108,0,345,
10684905,11,1,845,0, 10688905,11,1,867,0,
10685348,1,-1,3,104, 10689348,1,-1,3,104,
106860,345,3,105,0, 106900,345,3,105,0,
10687345,3,106,0,345, 10691345,3,106,0,345,
106883,107,0,345,3, 106923,107,0,345,3,
10689108,0,345,906,11, 10693108,0,345,906,11,
106901,845,0,348,1, 106941,867,0,348,1,
10691-1,3,111,0,345, 10695-1,3,111,0,345,
106923,112,0,345,3, 106963,112,0,345,3,
10693113,0,345,3,114, 10697113,0,345,3,114,
@@ -10737,11 +10741,11 @@ public class yyLSLTokens : YyLexer {
10737105,0,345,3,106, 10741105,0,345,3,106,
107380,345,3,107,0, 107420,345,3,107,0,
10739345,3,108,0,345, 10743345,3,108,0,345,
10740907,11,1,845,0, 10744907,11,1,867,0,
10741348,1,-1,3,106, 10745348,1,-1,3,106,
107420,345,3,107,0, 107460,345,3,107,0,
10743345,3,108,0,345, 10747345,3,108,0,345,
10744908,11,1,845,0, 10748908,11,1,867,0,
10745348,1,-1,3,119, 10749348,1,-1,3,119,
107460,345,3,120,0, 107500,345,3,120,0,
10747345,3,121,0,345, 10751345,3,121,0,345,
@@ -10785,7 +10789,7 @@ public class yyLSLTokens : YyLexer {
10785105,0,345,3,106, 10789105,0,345,3,106,
107860,345,3,107,0, 107900,345,3,107,0,
10787345,3,108,0,345, 10791345,3,108,0,345,
10788909,11,1,845,0, 10792909,11,1,867,0,
10789348,1,-1,3,112, 10793348,1,-1,3,112,
107900,345,3,113,0, 107940,345,3,113,0,
10791345,3,114,0,345, 10795345,3,114,0,345,
@@ -10835,20 +10839,20 @@ public class yyLSLTokens : YyLexer {
10835345,3,106,0,345, 10839345,3,106,0,345,
108363,107,0,345,3, 108403,107,0,345,3,
10837108,0,345,910,11, 10841108,0,345,910,11,
108381,845,0,348,1, 108421,867,0,348,1,
10839-1,3,110,0,911, 10843-1,3,110,0,911,
1084012,1,4103,912,5, 1084412,1,4125,912,5,
1084163,3,109,0,345, 1084563,3,109,0,345,
108423,110,0,345,3, 108463,110,0,345,3,
10843111,0,913,12,1, 10847111,0,913,12,1,
108444133,914,5,63,3, 108484155,914,5,63,3,
10845109,0,345,3,110, 10849109,0,345,3,110,
108460,345,3,111,0, 108500,345,3,111,0,
10847345,3,112,0,345, 10851345,3,112,0,345,
108483,113,0,345,3, 108523,113,0,345,3,
10849114,0,345,3,115, 10853114,0,345,3,115,
108500,345,3,116,0, 108540,345,3,116,0,
10851915,12,1,4168,916, 10855915,12,1,4190,916,
108525,63,3,109,0, 108565,63,3,109,0,
10853345,3,110,0,345, 10857345,3,110,0,345,
108543,111,0,345,3, 108583,111,0,345,3,
@@ -10890,7 +10894,7 @@ public class yyLSLTokens : YyLexer {
108903,88,0,345,3, 108943,88,0,345,3,
1089189,0,345,3,90, 1089589,0,345,3,90,
108920,345,3,95,0, 108960,345,3,95,0,
10893917,12,1,4254,918, 10897917,12,1,4276,918,
108945,63,3,109,0, 108985,63,3,109,0,
10895345,3,110,0,345, 10899345,3,110,0,345,
108963,111,0,345,3, 109003,111,0,345,3,
@@ -10933,7 +10937,7 @@ public class yyLSLTokens : YyLexer {
1093389,0,345,3,90, 1093789,0,345,3,90,
109340,345,3,95,0, 109380,345,3,95,0,
10935345,3,97,0,919, 10939345,3,97,0,919,
1093612,1,4297,920,5, 1094012,1,4319,920,5,
1093763,3,109,0,345, 1094163,3,109,0,345,
109383,110,0,345,3, 109423,110,0,345,3,
10939111,0,345,3,112, 10943111,0,345,3,112,
@@ -10941,7 +10945,7 @@ public class yyLSLTokens : YyLexer {
10941345,3,114,0,345, 10945345,3,114,0,345,
109423,115,0,345,3, 109463,115,0,345,3,
10943116,0,921,12,1, 10947116,0,921,12,1,
109444332,922,5,63,3, 109484354,922,5,63,3,
10945109,0,345,3,110, 10949109,0,345,3,110,
109460,345,3,111,0, 109500,345,3,111,0,
10947345,3,112,0,345, 10951345,3,112,0,345,
@@ -10983,16 +10987,16 @@ public class yyLSLTokens : YyLexer {
10983345,3,89,0,345, 10987345,3,89,0,345,
109843,90,0,345,3, 109883,90,0,345,3,
1098595,0,923,12,1, 1098995,0,923,12,1,
109864418,924,5,63,3, 109904440,924,5,63,3,
10987109,0,345,3,110, 10991109,0,345,3,110,
109880,345,3,111,0, 109920,345,3,111,0,
10989345,3,112,0,345, 10993345,3,112,0,345,
109903,113,0,345,3, 109943,113,0,345,3,
10991114,0,925,12,1, 10995114,0,925,12,1,
109924451,926,5,63,3, 109964473,926,5,63,3,
10993109,0,345,3,110, 10997109,0,345,3,110,
109940,345,3,111,0, 109980,345,3,111,0,
10995927,12,1,4481,928, 10999927,12,1,4503,928,
109965,63,3,109,0, 110005,63,3,109,0,
10997345,3,110,0,345, 11001345,3,110,0,345,
109983,111,0,345,3, 110023,111,0,345,3,
@@ -11000,7 +11004,7 @@ public class yyLSLTokens : YyLexer {
110000,345,3,114,0, 110040,345,3,114,0,
11001345,3,115,0,345, 11005345,3,115,0,345,
110023,116,0,929,12, 110063,116,0,929,12,
110031,4516,930,5,63, 110071,4538,930,5,63,
110043,109,0,345,3, 110083,109,0,345,3,
11005110,0,345,3,111, 11009110,0,345,3,111,
110060,345,3,112,0, 110100,345,3,112,0,
@@ -11042,14 +11046,14 @@ public class yyLSLTokens : YyLexer {
110420,345,3,89,0, 110460,345,3,89,0,
11043345,3,90,0,345, 11047345,3,90,0,345,
110443,95,0,931,12, 110483,95,0,931,12,
110451,4602,932,5,63, 110491,4624,932,5,63,
110463,109,0,345,3, 110503,109,0,345,3,
11047110,0,345,3,111, 11051110,0,345,3,111,
110480,345,3,112,0, 110520,345,3,112,0,
11049345,3,113,0,345, 11053345,3,113,0,345,
110503,114,0,345,3, 110543,114,0,345,3,
11051115,0,345,3,116, 11055115,0,345,3,116,
110520,933,12,1,4637, 110560,933,12,1,4659,
11053934,5,63,3,109, 11057934,5,63,3,109,
110540,345,3,110,0, 110580,345,3,110,0,
11055345,3,111,0,345, 11059345,3,111,0,345,
@@ -11092,13 +11096,13 @@ public class yyLSLTokens : YyLexer {
110923,89,0,345,3, 110963,89,0,345,3,
1109390,0,345,3,95, 1109790,0,345,3,95,
110940,345,3,97,0, 110980,345,3,97,0,
11095935,12,1,4680,936, 11099935,12,1,4702,936,
110965,63,3,109,0, 111005,63,3,109,0,
11097345,3,110,0,345, 11101345,3,110,0,345,
110983,111,0,345,3, 111023,111,0,345,3,
11099112,0,345,3,113, 11103112,0,345,3,113,
111000,345,3,114,0, 111040,345,3,114,0,
11101937,12,1,4713,938, 11105937,12,1,4735,938,
111025,63,3,109,0, 111065,63,3,109,0,
11103345,3,110,0,345, 11107345,3,110,0,345,
111043,111,0,345,3, 111083,111,0,345,3,
@@ -11146,7 +11150,7 @@ public class yyLSLTokens : YyLexer {
111460,345,3,101,0, 111500,345,3,101,0,
11147345,3,102,0,345, 11151345,3,102,0,345,
111483,103,0,939,12, 111523,103,0,939,12,
111491,4762,940,5,63, 111531,4784,940,5,63,
111503,109,0,345,3, 111543,109,0,345,3,
11151110,0,345,3,111, 11155110,0,345,3,111,
111520,345,3,112,0, 111560,345,3,112,0,
@@ -11192,14 +11196,14 @@ public class yyLSLTokens : YyLexer {
111920,345,3,99,0, 111960,345,3,99,0,
11193345,3,100,0,345, 11197345,3,100,0,345,
111943,101,0,941,12, 111983,101,0,941,12,
111951,4809,942,5,63, 111991,4831,942,5,63,
111963,109,0,345,3, 112003,109,0,345,3,
11197110,0,345,3,111, 11201110,0,345,3,111,
111980,345,3,112,0, 112020,345,3,112,0,
11199345,3,113,0,345, 11203345,3,113,0,345,
112003,114,0,345,3, 112043,114,0,345,3,
11201115,0,345,3,116, 11205115,0,345,3,116,
112020,943,12,1,4844, 112060,943,12,1,4866,
11203944,5,63,3,109, 11207944,5,63,3,109,
112040,345,3,110,0, 112080,345,3,110,0,
11205345,3,111,0,345, 11209345,3,111,0,345,
@@ -11306,7 +11310,7 @@ public class yyLSLTokens : YyLexer {
113063,105,0,345,3, 113103,105,0,345,3,
11307106,0,345,3,107, 11311106,0,345,3,107,
113080,345,3,108,0, 113120,345,3,108,0,
11309345,947,11,1,845, 11313345,947,11,1,867,
113100,348,1,-1,3, 113140,348,1,-1,3,
11311102,0,345,3,103, 11315102,0,345,3,103,
113120,345,3,104,0, 113160,345,3,104,0,
@@ -11314,12 +11318,12 @@ public class yyLSLTokens : YyLexer {
113143,106,0,345,3, 113183,106,0,345,3,
11315107,0,345,3,108, 11319107,0,345,3,108,
113160,345,948,11,1, 113200,345,948,11,1,
11317845,0,348,1,-1, 11321867,0,348,1,-1,
113183,104,0,345,3, 113223,104,0,345,3,
11319105,0,345,3,106, 11323105,0,345,3,106,
113200,345,3,107,0, 113240,345,3,107,0,
11321345,3,108,0,345, 11325345,3,108,0,345,
11322949,11,1,845,0, 11326949,11,1,867,0,
11323348,1,-1,3,115, 11327348,1,-1,3,115,
113240,345,3,116,0, 113280,345,3,116,0,
11325345,3,117,0,345, 11329345,3,117,0,345,
@@ -11366,7 +11370,7 @@ public class yyLSLTokens : YyLexer {
113663,105,0,345,3, 113703,105,0,345,3,
11367106,0,345,3,107, 11371106,0,345,3,107,
113680,345,3,108,0, 113720,345,3,108,0,
11369345,950,11,1,845, 11373345,950,11,1,867,
113700,348,1,-1,3, 113740,348,1,-1,3,
1137198,0,345,3,99, 1137598,0,345,3,99,
113720,345,3,100,0, 113760,345,3,100,0,
@@ -11377,7 +11381,7 @@ public class yyLSLTokens : YyLexer {
11377345,3,106,0,345, 11381345,3,106,0,345,
113783,107,0,345,3, 113823,107,0,345,3,
11379108,0,345,951,11, 11383108,0,345,951,11,
113801,845,0,348,1, 113841,867,0,348,1,
11381-1,3,117,0,345, 11385-1,3,117,0,345,
113823,118,0,345,3, 113863,118,0,345,3,
11383119,0,345,3,120, 11387119,0,345,3,120,
@@ -11422,7 +11426,7 @@ public class yyLSLTokens : YyLexer {
114223,105,0,345,3, 114263,105,0,345,3,
11423106,0,345,3,107, 11427106,0,345,3,107,
114240,345,3,108,0, 114280,345,3,108,0,
11425345,952,11,1,845, 11429345,952,11,1,867,
114260,348,1,-1,3, 114300,348,1,-1,3,
1142797,0,345,3,98, 1143197,0,345,3,98,
114280,345,3,99,0, 114320,345,3,99,0,
@@ -11434,7 +11438,7 @@ public class yyLSLTokens : YyLexer {
114343,106,0,345,3, 114383,106,0,345,3,
11435107,0,345,3,108, 11439107,0,345,3,108,
114360,345,953,11,1, 114400,345,953,11,1,
11437845,0,348,1,-1, 11441867,0,348,1,-1,
114383,117,0,345,3, 114423,117,0,345,3,
11439118,0,345,3,119, 11443118,0,345,3,119,
114400,345,3,120,0, 114440,345,3,120,0,
@@ -11479,7 +11483,7 @@ public class yyLSLTokens : YyLexer {
11479105,0,345,3,106, 11483105,0,345,3,106,
114800,345,3,107,0, 114840,345,3,107,0,
11481345,3,108,0,345, 11485345,3,108,0,345,
11482954,11,1,845,0, 11486954,11,1,867,0,
11483348,1,-1,3,112, 11487348,1,-1,3,112,
114840,345,3,113,0, 114880,345,3,113,0,
11485345,3,114,0,345, 11489345,3,114,0,345,
@@ -11529,10 +11533,10 @@ public class yyLSLTokens : YyLexer {
11529345,3,106,0,345, 11533345,3,106,0,345,
115303,107,0,345,3, 115343,107,0,345,3,
11531108,0,345,955,11, 11535108,0,345,955,11,
115321,845,0,348,1, 115361,867,0,348,1,
11533-1,3,115,0,345, 11537-1,3,115,0,345,
115343,116,0,956,12, 115383,116,0,956,12,
115351,5653,957,5,63, 115391,5675,957,5,63,
115363,109,0,345,3, 115403,109,0,345,3,
11537110,0,345,3,111, 11541110,0,345,3,111,
115380,345,3,112,0, 115420,345,3,112,0,
@@ -11575,13 +11579,13 @@ public class yyLSLTokens : YyLexer {
11575345,3,90,0,345, 11579345,3,90,0,345,
115763,95,0,345,3, 115803,95,0,345,3,
1157797,0,958,12,1, 1158197,0,958,12,1,
115785696,959,5,63,3, 115825718,959,5,63,3,
11579109,0,345,3,110, 11583109,0,345,3,110,
115800,345,3,111,0, 115840,345,3,111,0,
11581345,3,112,0,345, 11585345,3,112,0,345,
115823,113,0,345,3, 115863,113,0,345,3,
11583114,0,960,12,1, 11587114,0,960,12,1,
115845729,961,5,63,3, 115885751,961,5,63,3,
11585109,0,345,3,110, 11589109,0,345,3,110,
115860,345,3,111,0, 115900,345,3,111,0,
11587345,3,112,0,345, 11591345,3,112,0,345,
@@ -11628,7 +11632,7 @@ public class yyLSLTokens : YyLexer {
116283,100,0,345,3, 116323,100,0,345,3,
11629101,0,345,3,102, 11633101,0,345,3,102,
116300,345,3,103,0, 116340,345,3,103,0,
11631962,12,1,5778,963, 11635962,12,1,5800,963,
116325,63,3,109,0, 116365,63,3,109,0,
11633345,3,110,0,345, 11637345,3,110,0,345,
116343,111,0,345,3, 116383,111,0,345,3,
@@ -11674,7 +11678,7 @@ public class yyLSLTokens : YyLexer {
116743,98,0,345,3, 116783,98,0,345,3,
1167599,0,345,3,100, 1167999,0,345,3,100,
116760,345,3,101,0, 116800,345,3,101,0,
11677964,12,1,5825,965, 11681964,12,1,5847,965,
116785,63,3,109,0, 116825,63,3,109,0,
11679345,3,110,0,345, 11683345,3,110,0,345,
116803,111,0,345,3, 116843,111,0,345,3,
@@ -11682,7 +11686,7 @@ public class yyLSLTokens : YyLexer {
116820,345,3,114,0, 116860,345,3,114,0,
11683345,3,115,0,345, 11687345,3,115,0,345,
116843,116,0,966,12, 116883,116,0,966,12,
116851,5860,967,5,63, 116891,5882,967,5,63,
116863,109,0,345,3, 116903,109,0,345,3,
11687110,0,345,3,111, 11691110,0,345,3,111,
116880,345,3,112,0, 116920,345,3,112,0,
@@ -11787,20 +11791,20 @@ public class yyLSLTokens : YyLexer {
11787105,0,345,3,106, 11791105,0,345,3,106,
117880,345,3,107,0, 117920,345,3,107,0,
11789345,3,108,0,345, 11793345,3,108,0,345,
11790970,11,1,845,0, 11794970,11,1,867,0,
11791348,1,-1,3,102, 11795348,1,-1,3,102,
117920,345,3,103,0, 117960,345,3,103,0,
11793345,3,104,0,345, 11797345,3,104,0,345,
117943,105,0,345,3, 117983,105,0,345,3,
11795106,0,345,3,107, 11799106,0,345,3,107,
117960,345,3,108,0, 118000,345,3,108,0,
11797345,971,11,1,845, 11801345,971,11,1,867,
117980,348,1,-1,3, 118020,348,1,-1,3,
11799104,0,345,3,105, 11803104,0,345,3,105,
118000,345,3,106,0, 118040,345,3,106,0,
11801345,3,107,0,345, 11805345,3,107,0,345,
118023,108,0,345,972, 118063,108,0,345,972,
1180311,1,845,0,348, 1180711,1,867,0,348,
118041,-1,3,115,0, 118081,-1,3,115,0,
11805345,3,116,0,345, 11809345,3,116,0,345,
118063,117,0,345,3, 118103,117,0,345,3,
@@ -11847,7 +11851,7 @@ public class yyLSLTokens : YyLexer {
11847105,0,345,3,106, 11851105,0,345,3,106,
118480,345,3,107,0, 118520,345,3,107,0,
11849345,3,108,0,345, 11853345,3,108,0,345,
11850973,11,1,845,0, 11854973,11,1,867,0,
11851348,1,-1,3,98, 11855348,1,-1,3,98,
118520,345,3,99,0, 118560,345,3,99,0,
11853345,3,100,0,345, 11857345,3,100,0,345,
@@ -11858,7 +11862,7 @@ public class yyLSLTokens : YyLexer {
118583,106,0,345,3, 118623,106,0,345,3,
11859107,0,345,3,108, 11863107,0,345,3,108,
118600,345,974,11,1, 118640,345,974,11,1,
11861845,0,348,1,-1, 11865867,0,348,1,-1,
118623,117,0,345,3, 118663,117,0,345,3,
11863118,0,345,3,119, 11867118,0,345,3,119,
118640,345,3,120,0, 118680,345,3,120,0,
@@ -11903,7 +11907,7 @@ public class yyLSLTokens : YyLexer {
11903105,0,345,3,106, 11907105,0,345,3,106,
119040,345,3,107,0, 119080,345,3,107,0,
11905345,3,108,0,345, 11909345,3,108,0,345,
11906975,11,1,845,0, 11910975,11,1,867,0,
11907348,1,-1,3,97, 11911348,1,-1,3,97,
119080,345,3,98,0, 119120,345,3,98,0,
11909345,3,99,0,345, 11913345,3,99,0,345,
@@ -11914,7 +11918,7 @@ public class yyLSLTokens : YyLexer {
119143,105,0,345,3, 119183,105,0,345,3,
11915106,0,345,3,107, 11919106,0,345,3,107,
119160,345,3,108,0, 119200,345,3,108,0,
11917345,976,11,1,845, 11921345,976,11,1,867,
119180,348,1,-1,3, 119220,348,1,-1,3,
11919117,0,345,3,118, 11923117,0,345,3,118,
119200,345,3,119,0, 119240,345,3,119,0,
@@ -11960,7 +11964,7 @@ public class yyLSLTokens : YyLexer {
119600,345,3,106,0, 119640,345,3,106,0,
11961345,3,107,0,345, 11965345,3,107,0,345,
119623,108,0,345,977, 119663,108,0,345,977,
1196311,1,845,0,348, 1196711,1,867,0,348,
119641,-1,3,98,0, 119681,-1,3,98,0,
11965345,3,99,0,345, 11969345,3,99,0,345,
119663,100,0,345,3, 119703,100,0,345,3,
@@ -11970,7 +11974,7 @@ public class yyLSLTokens : YyLexer {
119703,105,0,345,3, 119743,105,0,345,3,
11971106,0,345,3,107, 11975106,0,345,3,107,
119720,345,3,108,0, 119760,345,3,108,0,
11973345,978,11,1,845, 11977345,978,11,1,867,
119740,348,1,-1,3, 119780,348,1,-1,3,
1197597,0,345,3,98, 1197997,0,345,3,98,
119760,345,3,99,0, 119800,345,3,99,0,
@@ -11982,7 +11986,7 @@ public class yyLSLTokens : YyLexer {
119823,106,0,345,3, 119863,106,0,345,3,
11983107,0,345,3,108, 11987107,0,345,3,108,
119840,345,979,11,1, 119880,345,979,11,1,
11985845,0,348,1,-1, 11989867,0,348,1,-1,
119863,117,0,345,3, 119903,117,0,345,3,
11987118,0,345,3,119, 11991118,0,345,3,119,
119880,345,3,120,0, 119920,345,3,120,0,
@@ -12017,14 +12021,14 @@ public class yyLSLTokens : YyLexer {
12017345,3,88,0,345, 12021345,3,88,0,345,
120183,89,0,345,3, 120223,89,0,345,3,
1201990,0,345,3,95, 1202390,0,345,3,95,
120200,980,12,1,6739, 120240,980,12,1,6761,
12021981,5,63,3,109, 12025981,5,63,3,109,
120220,345,3,110,0, 120260,345,3,110,0,
12023345,3,111,0,345, 12027345,3,111,0,345,
120243,112,0,345,3, 120283,112,0,345,3,
12025113,0,345,3,114, 12029113,0,345,3,114,
120260,345,3,115,0, 120300,345,3,115,0,
12027982,12,1,6773,983, 12031982,12,1,6795,983,
120285,63,3,109,0, 120325,63,3,109,0,
12029345,3,110,0,345, 12033345,3,110,0,345,
120303,111,0,345,3, 120343,111,0,345,3,
@@ -12070,26 +12074,26 @@ public class yyLSLTokens : YyLexer {
120703,98,0,345,3, 120743,98,0,345,3,
1207199,0,345,3,100, 1207599,0,345,3,100,
120720,345,3,101,0, 120760,345,3,101,0,
12073984,12,1,6820,985, 12077984,12,1,6842,985,
120745,63,3,109,0, 120785,63,3,109,0,
12075345,3,110,0,986, 12079345,3,110,0,986,
1207612,1,6849,987,5, 1208012,1,6871,987,5,
1207763,3,109,0,345, 1208163,3,109,0,345,
120783,110,0,345,3, 120823,110,0,345,3,
12079111,0,345,3,112, 12083111,0,345,3,112,
120800,345,3,113,0, 120840,345,3,113,0,
12081345,3,114,0,345, 12085345,3,114,0,345,
120823,115,0,988,12, 120863,115,0,988,12,
120831,6883,989,5,63, 120871,6905,989,5,63,
120843,109,0,345,3, 120883,109,0,345,3,
12085110,0,345,3,111, 12089110,0,345,3,111,
120860,990,12,1,6913, 120900,990,12,1,6935,
12087991,5,63,3,109, 12091991,5,63,3,109,
120880,345,3,110,0, 120920,345,3,110,0,
12089345,3,111,0,345, 12093345,3,111,0,345,
120903,112,0,345,3, 120943,112,0,345,3,
12091113,0,345,3,114, 12095113,0,345,3,114,
120920,992,12,1,6946, 120960,992,12,1,6968,
12093993,5,63,3,109, 12097993,5,63,3,109,
120940,345,3,110,0, 120980,345,3,110,0,
12095345,3,111,0,345, 12099345,3,111,0,345,
@@ -12195,7 +12199,7 @@ public class yyLSLTokens : YyLexer {
12195345,3,106,0,345, 12199345,3,106,0,345,
121963,107,0,345,3, 122003,107,0,345,3,
12197108,0,345,996,11, 12201108,0,345,996,11,
121981,845,0,348,1, 122021,867,0,348,1,
12199-1,3,112,0,345, 12203-1,3,112,0,345,
122003,113,0,345,3, 122043,113,0,345,3,
12201114,0,345,3,115, 12205114,0,345,3,115,
@@ -12244,7 +12248,7 @@ public class yyLSLTokens : YyLexer {
122443,105,0,345,3, 122483,105,0,345,3,
12245106,0,345,3,107, 12249106,0,345,3,107,
122460,345,3,108,0, 122500,345,3,108,0,
12247345,997,11,1,845, 12251345,997,11,1,867,
122480,348,1,-1,3, 122520,348,1,-1,3,
12249116,0,345,3,117, 12253116,0,345,3,117,
122500,345,3,118,0, 122540,345,3,118,0,
@@ -12291,7 +12295,7 @@ public class yyLSLTokens : YyLexer {
12291345,3,106,0,345, 12295345,3,106,0,345,
122923,107,0,345,3, 122963,107,0,345,3,
12293108,0,345,998,11, 12297108,0,345,998,11,
122941,845,0,348,1, 122981,867,0,348,1,
12295-1,3,111,0,345, 12299-1,3,111,0,345,
122963,112,0,345,3, 123003,112,0,345,3,
12297113,0,345,3,114, 12301113,0,345,3,114,
@@ -12341,14 +12345,14 @@ public class yyLSLTokens : YyLexer {
12341105,0,345,3,106, 12345105,0,345,3,106,
123420,345,3,107,0, 123460,345,3,107,0,
12343345,3,108,0,345, 12347345,3,108,0,345,
12344999,11,1,845,0, 12348999,11,1,867,0,
12345348,1,-1,3,102, 12349348,1,-1,3,102,
123460,345,3,103,0, 123500,345,3,103,0,
12347345,3,104,0,345, 12351345,3,104,0,345,
123483,105,0,345,3, 123523,105,0,345,3,
12349106,0,345,3,107, 12353106,0,345,3,107,
123500,345,3,108,0, 123540,345,3,108,0,
12351345,1000,11,1,845, 12355345,1000,11,1,867,
123520,348,1,-1,3, 123560,348,1,-1,3,
12353116,0,345,3,117, 12357116,0,345,3,117,
123540,345,3,118,0, 123580,345,3,118,0,
@@ -12395,7 +12399,7 @@ public class yyLSLTokens : YyLexer {
12395345,3,106,0,345, 12399345,3,106,0,345,
123963,107,0,345,3, 124003,107,0,345,3,
12397108,0,345,1001,11, 12401108,0,345,1001,11,
123981,845,0,348,1, 124021,867,0,348,1,
12399-1,3,97,0,345, 12403-1,3,97,0,345,
124003,98,0,345,3, 124043,98,0,345,3,
1240199,0,345,3,100, 1240599,0,345,3,100,
@@ -12406,7 +12410,7 @@ public class yyLSLTokens : YyLexer {
124060,345,3,106,0, 124100,345,3,106,0,
12407345,3,107,0,345, 12411345,3,107,0,345,
124083,108,0,345,1002, 124123,108,0,345,1002,
1240911,1,845,0,348, 1241311,1,867,0,348,
124101,-1,3,112,0, 124141,-1,3,112,0,
12411345,3,113,0,345, 12415345,3,113,0,345,
124123,114,0,345,3, 124163,114,0,345,3,
@@ -12456,12 +12460,12 @@ public class yyLSLTokens : YyLexer {
124563,106,0,345,3, 124603,106,0,345,3,
12457107,0,345,3,108, 12461107,0,345,3,108,
124580,345,1003,11,1, 124620,345,1003,11,1,
12459845,0,348,1,-1, 12463867,0,348,1,-1,
124603,111,0,1004,12, 124643,111,0,1004,12,
124611,7704,1005,5,63, 124651,7726,1005,5,63,
124623,109,0,345,3, 124663,109,0,345,3,
12463110,0,1006,12,1, 12467110,0,1006,12,1,
124647733,1007,5,63,3, 124687755,1007,5,63,3,
12465109,0,345,3,110, 12469109,0,345,3,110,
124660,345,3,111,0, 124700,345,3,111,0,
12467345,3,112,0,345, 12471345,3,112,0,345,
@@ -12503,13 +12507,13 @@ public class yyLSLTokens : YyLexer {
12503345,3,89,0,345, 12507345,3,89,0,345,
125043,90,0,345,3, 125083,90,0,345,3,
1250595,0,1008,12,1, 1250995,0,1008,12,1,
125067819,1009,5,63,3, 125107841,1009,5,63,3,
12507109,0,345,3,110, 12511109,0,345,3,110,
125080,345,3,111,0, 125120,345,3,111,0,
12509345,3,112,0,345, 12513345,3,112,0,345,
125103,113,0,345,3, 125143,113,0,345,3,
12511114,0,1010,12,1, 12515114,0,1010,12,1,
125127852,1011,5,63,3, 125167874,1011,5,63,3,
12513109,0,345,3,110, 12517109,0,345,3,110,
125140,345,3,111,0, 125180,345,3,111,0,
12515345,3,112,0,345, 12519345,3,112,0,345,
@@ -12555,7 +12559,7 @@ public class yyLSLTokens : YyLexer {
12555345,3,99,0,345, 12559345,3,99,0,345,
125563,100,0,345,3, 125603,100,0,345,3,
12557101,0,1012,12,1, 12561101,0,1012,12,1,
125587899,1013,5,63,3, 125627921,1013,5,63,3,
12559109,0,345,3,110, 12563109,0,345,3,110,
125600,345,3,111,0, 125640,345,3,111,0,
12561345,3,112,0,345, 12565345,3,112,0,345,
@@ -12567,7 +12571,7 @@ public class yyLSLTokens : YyLexer {
12567119,0,345,3,120, 12571119,0,345,3,120,
125680,345,3,121,0, 125720,345,3,121,0,
12569345,3,122,0,1014, 12573345,3,122,0,1014,
1257012,1,7940,1015,5, 1257412,1,7962,1015,5,
1257163,3,109,0,345, 1257563,3,109,0,345,
125723,110,0,345,3, 125763,110,0,345,3,
12573111,0,345,3,112, 12577111,0,345,3,112,
@@ -12665,14 +12669,14 @@ public class yyLSLTokens : YyLexer {
12665345,3,106,0,345, 12669345,3,106,0,345,
126663,107,0,345,3, 126703,107,0,345,3,
12667108,0,345,1018,11, 12671108,0,345,1018,11,
126681,845,0,348,1, 126721,867,0,348,1,
12669-1,3,102,0,345, 12673-1,3,102,0,345,
126703,103,0,345,3, 126743,103,0,345,3,
12671104,0,345,3,105, 12675104,0,345,3,105,
126720,345,3,106,0, 126760,345,3,106,0,
12673345,3,107,0,345, 12677345,3,107,0,345,
126743,108,0,345,1019, 126783,108,0,345,1019,
1267511,1,845,0,348, 1267911,1,867,0,348,
126761,-1,3,115,0, 126801,-1,3,115,0,
12677345,3,116,0,345, 12681345,3,116,0,345,
126783,117,0,345,3, 126823,117,0,345,3,
@@ -12719,7 +12723,7 @@ public class yyLSLTokens : YyLexer {
12719105,0,345,3,106, 12723105,0,345,3,106,
127200,345,3,107,0, 127240,345,3,107,0,
12721345,3,108,0,345, 12725345,3,108,0,345,
127221020,11,1,845,0, 127261020,11,1,867,0,
12723348,1,-1,3,97, 12727348,1,-1,3,97,
127240,345,3,98,0, 127280,345,3,98,0,
12725345,3,99,0,345, 12729345,3,99,0,345,
@@ -12730,7 +12734,7 @@ public class yyLSLTokens : YyLexer {
127303,105,0,345,3, 127343,105,0,345,3,
12731106,0,345,3,107, 12735106,0,345,3,107,
127320,345,3,108,0, 127360,345,3,108,0,
12733345,1021,11,1,845, 12737345,1021,11,1,867,
127340,348,1,-1,3, 127380,348,1,-1,3,
12735111,0,345,3,112, 12739111,0,345,3,112,
127360,345,3,113,0, 127400,345,3,113,0,
@@ -12773,7 +12777,7 @@ public class yyLSLTokens : YyLexer {
12773345,3,95,0,345, 12777345,3,95,0,345,
127743,97,0,345,3, 127783,97,0,345,3,
1277598,0,1022,12,1, 1277998,0,1022,12,1,
127768348,1023,5,63,3, 127808370,1023,5,63,3,
12777109,0,345,3,110, 12781109,0,345,3,110,
127780,345,3,111,0, 127820,345,3,111,0,
12779345,3,112,0,345, 12783345,3,112,0,345,
@@ -12823,7 +12827,7 @@ public class yyLSLTokens : YyLexer {
12823345,3,104,0,345, 12827345,3,104,0,345,
128243,105,0,345,3, 128283,105,0,345,3,
12825106,0,1024,12,1, 12829106,0,1024,12,1,
128268400,1025,5,63,3, 128308422,1025,5,63,3,
12827109,0,345,3,110, 12831109,0,345,3,110,
128280,345,3,111,0, 128320,345,3,111,0,
12829345,3,112,0,345, 12833345,3,112,0,345,
@@ -12869,7 +12873,7 @@ public class yyLSLTokens : YyLexer {
12869345,3,99,0,345, 12873345,3,99,0,345,
128703,100,0,345,3, 128743,100,0,345,3,
12871101,0,1026,12,1, 12875101,0,1026,12,1,
128728447,1027,5,63,3, 128768469,1027,5,63,3,
12873109,0,345,3,110, 12877109,0,345,3,110,
128740,345,3,111,0, 128780,345,3,111,0,
12875345,3,112,0,345, 12879345,3,112,0,345,
@@ -12913,7 +12917,7 @@ public class yyLSLTokens : YyLexer {
1291395,0,345,3,97, 1291795,0,345,3,97,
129140,345,3,98,0, 129180,345,3,98,0,
12915345,3,99,0,1028, 12919345,3,99,0,1028,
1291612,1,8492,1029,5, 1292012,1,8514,1029,5,
1291763,3,109,0,345, 1292163,3,109,0,345,
129183,110,0,345,3, 129223,110,0,345,3,
12919111,0,345,3,112, 12923111,0,345,3,112,
@@ -12921,7 +12925,7 @@ public class yyLSLTokens : YyLexer {
12921345,3,114,0,345, 12925345,3,114,0,345,
129223,115,0,345,3, 129263,115,0,345,3,
12923116,0,1030,12,1, 12927116,0,1030,12,1,
129248527,1031,5,63,3, 129288549,1031,5,63,3,
12925109,0,345,3,110, 12929109,0,345,3,110,
129260,345,3,111,0, 129300,345,3,111,0,
12927345,3,112,0,345, 12931345,3,112,0,345,
@@ -12963,13 +12967,13 @@ public class yyLSLTokens : YyLexer {
12963345,3,89,0,345, 12967345,3,89,0,345,
129643,90,0,345,3, 129683,90,0,345,3,
1296595,0,1032,12,1, 1296995,0,1032,12,1,
129668613,1033,5,63,3, 129708635,1033,5,63,3,
12967109,0,345,3,110, 12971109,0,345,3,110,
129680,345,3,111,0, 129720,345,3,111,0,
12969345,3,112,0,345, 12973345,3,112,0,345,
129703,113,0,345,3, 129743,113,0,345,3,
12971114,0,1034,12,1, 12975114,0,1034,12,1,
129728646,1035,5,63,3, 129768668,1035,5,63,3,
12973109,0,345,3,110, 12977109,0,345,3,110,
129740,345,3,111,0, 129780,345,3,111,0,
12975345,3,112,0,345, 12979345,3,112,0,345,
@@ -13015,7 +13019,7 @@ public class yyLSLTokens : YyLexer {
13015345,3,99,0,345, 13019345,3,99,0,345,
130163,100,0,345,3, 130203,100,0,345,3,
13017101,0,1036,12,1, 13021101,0,1036,12,1,
130188693,1037,5,63,3, 130228715,1037,5,63,3,
13019109,0,345,3,110, 13023109,0,345,3,110,
130200,345,3,111,0, 130240,345,3,111,0,
13021345,3,112,0,345, 13025345,3,112,0,345,
@@ -13027,7 +13031,7 @@ public class yyLSLTokens : YyLexer {
13027119,0,345,3,120, 13031119,0,345,3,120,
130280,345,3,121,0, 130320,345,3,121,0,
13029345,3,122,0,1038, 13033345,3,122,0,1038,
1303012,1,8734,1039,5, 1303412,1,8756,1039,5,
1303163,3,109,0,345, 1303563,3,109,0,345,
130323,110,0,345,3, 130363,110,0,345,3,
13033111,0,345,3,112, 13037111,0,345,3,112,
@@ -13126,7 +13130,7 @@ public class yyLSLTokens : YyLexer {
131263,105,0,345,3, 131303,105,0,345,3,
13127106,0,345,3,107, 13131106,0,345,3,107,
131280,345,3,108,0, 131320,345,3,108,0,
13129345,1042,11,1,845, 13133345,1042,11,1,867,
131300,348,1,-1,3, 131340,348,1,-1,3,
13131102,0,345,3,103, 13135102,0,345,3,103,
131320,345,3,104,0, 131360,345,3,104,0,
@@ -13134,7 +13138,7 @@ public class yyLSLTokens : YyLexer {
131343,106,0,345,3, 131383,106,0,345,3,
13135107,0,345,3,108, 13139107,0,345,3,108,
131360,345,1043,11,1, 131400,345,1043,11,1,
13137845,0,348,1,-1, 13141867,0,348,1,-1,
131383,115,0,345,3, 131423,115,0,345,3,
13139116,0,345,3,117, 13143116,0,345,3,117,
131400,345,3,118,0, 131440,345,3,118,0,
@@ -13181,7 +13185,7 @@ public class yyLSLTokens : YyLexer {
13181345,3,106,0,345, 13185345,3,106,0,345,
131823,107,0,345,3, 131863,107,0,345,3,
13183108,0,345,1044,11, 13187108,0,345,1044,11,
131841,845,0,348,1, 131881,867,0,348,1,
13185-1,3,97,0,345, 13189-1,3,97,0,345,
131863,98,0,345,3, 131903,98,0,345,3,
1318799,0,345,3,100, 1319199,0,345,3,100,
@@ -13192,7 +13196,7 @@ public class yyLSLTokens : YyLexer {
131920,345,3,106,0, 131960,345,3,106,0,
13193345,3,107,0,345, 13197345,3,107,0,345,
131943,108,0,345,1045, 131983,108,0,345,1045,
1319511,1,845,0,348, 1319911,1,867,0,348,
131961,-1,3,117,0, 132001,-1,3,117,0,
13197345,3,118,0,345, 13201345,3,118,0,345,
131983,119,0,345,3, 132023,119,0,345,3,
@@ -13238,7 +13242,7 @@ public class yyLSLTokens : YyLexer {
132383,106,0,345,3, 132423,106,0,345,3,
13239107,0,345,3,108, 13243107,0,345,3,108,
132400,345,1046,11,1, 132440,345,1046,11,1,
13241845,0,348,1,-1, 13245867,0,348,1,-1,
132423,100,0,345,3, 132463,100,0,345,3,
13243101,0,345,3,102, 13247101,0,345,3,102,
132440,345,3,103,0, 132480,345,3,103,0,
@@ -13246,7 +13250,7 @@ public class yyLSLTokens : YyLexer {
132463,105,0,345,3, 132503,105,0,345,3,
13247106,0,345,3,107, 13251106,0,345,3,107,
132480,345,3,108,0, 132520,345,3,108,0,
13249345,1047,11,1,845, 13253345,1047,11,1,867,
132500,348,1,-1,3, 132540,348,1,-1,3,
13251102,0,345,3,103, 13255102,0,345,3,103,
132520,345,3,104,0, 132560,345,3,104,0,
@@ -13254,10 +13258,10 @@ public class yyLSLTokens : YyLexer {
132543,106,0,345,3, 132583,106,0,345,3,
13255107,0,345,3,108, 13259107,0,345,3,108,
132560,345,1048,11,1, 132600,345,1048,11,1,
13257845,0,348,1,-1, 13261867,0,348,1,-1,
132583,107,0,345,3, 132623,107,0,345,3,
13259108,0,345,1049,11, 13263108,0,345,1049,11,
132601,845,0,348,1, 132641,867,0,348,1,
13261-1,3,99,0,345, 13265-1,3,99,0,345,
132623,100,0,345,3, 132663,100,0,345,3,
13263101,0,345,3,102, 13267101,0,345,3,102,
@@ -13266,22 +13270,22 @@ public class yyLSLTokens : YyLexer {
132663,105,0,345,3, 132703,105,0,345,3,
13267106,0,345,3,107, 13271106,0,345,3,107,
132680,345,3,108,0, 132720,345,3,108,0,
13269345,1050,11,1,845, 13273345,1050,11,1,867,
132700,348,1,-1,3, 132740,348,1,-1,3,
13271112,0,343,3,113, 13275112,0,343,3,113,
132720,343,3,114,0, 132760,343,3,114,0,
132731051,12,1,9507,1052, 132771051,12,1,9529,1052,
132745,63,3,109,0, 132785,63,3,109,0,
13275345,3,110,0,345, 13279345,3,110,0,345,
132763,111,0,1053,12, 132803,111,0,1053,12,
132771,9537,1054,5,63, 132811,9559,1054,5,63,
132783,109,0,345,3, 132823,109,0,345,3,
13279110,0,345,3,111, 13283110,0,345,3,111,
132800,345,3,112,0, 132840,345,3,112,0,
13281345,3,113,0,345, 13285345,3,113,0,345,
132823,114,0,345,3, 132863,114,0,345,3,
13283115,0,345,3,116, 13287115,0,345,3,116,
132840,1055,12,1,9572, 132880,1055,12,1,9594,
132851056,5,63,3,109, 132891056,5,63,3,109,
132860,345,3,110,0, 132900,345,3,110,0,
13287345,3,111,0,345, 13291345,3,111,0,345,
@@ -13324,7 +13328,7 @@ public class yyLSLTokens : YyLexer {
133243,89,0,345,3, 133283,89,0,345,3,
1332590,0,345,3,95, 1332990,0,345,3,95,
133260,345,3,97,0, 133300,345,3,97,0,
133271057,12,1,9615,1058, 133311057,12,1,9637,1058,
133285,63,3,109,0, 133325,63,3,109,0,
13329345,3,110,0,345, 13333345,3,110,0,345,
133303,111,0,345,3, 133343,111,0,345,3,
@@ -13332,7 +13336,7 @@ public class yyLSLTokens : YyLexer {
133320,345,3,114,0, 133360,345,3,114,0,
13333345,3,115,0,345, 13337345,3,115,0,345,
133343,116,0,1059,12, 133383,116,0,1059,12,
133351,9650,1060,5,63, 133391,9672,1060,5,63,
133363,109,0,345,3, 133403,109,0,345,3,
13337110,0,345,3,111, 13341110,0,345,3,111,
133380,345,3,112,0, 133420,345,3,112,0,
@@ -13381,13 +13385,13 @@ public class yyLSLTokens : YyLexer {
13381102,0,345,3,103, 13385102,0,345,3,103,
133820,345,3,104,0, 133860,345,3,104,0,
13383345,3,105,0,1061, 13387345,3,105,0,1061,
1338412,1,9701,1062,5, 1338812,1,9723,1062,5,
1338563,3,109,0,345, 1338963,3,109,0,345,
133863,110,0,345,3, 133903,110,0,345,3,
13387111,0,1063,12,1, 13391111,0,1063,12,1,
133889731,1064,5,63,3, 133929753,1064,5,63,3,
13389109,0,345,3,110, 13393109,0,345,3,110,
133900,1065,12,1,9760, 133940,1065,12,1,9782,
133911066,5,63,3,109, 133951066,5,63,3,109,
133920,345,3,110,0, 133960,345,3,110,0,
13393345,3,111,0,345, 13397345,3,111,0,345,
@@ -13495,7 +13499,7 @@ public class yyLSLTokens : YyLexer {
13495105,0,345,3,106, 13499105,0,345,3,106,
134960,345,3,107,0, 135000,345,3,107,0,
13497345,3,108,0,345, 13501345,3,108,0,345,
134981069,11,1,845,0, 135021069,11,1,867,0,
13499348,1,-1,3,112, 13503348,1,-1,3,112,
135000,345,3,113,0, 135040,345,3,113,0,
13501345,3,114,0,345, 13505345,3,114,0,345,
@@ -13545,11 +13549,11 @@ public class yyLSLTokens : YyLexer {
13545345,3,106,0,345, 13549345,3,106,0,345,
135463,107,0,345,3, 135503,107,0,345,3,
13547108,0,345,1070,11, 13551108,0,345,1070,11,
135481,845,0,348,1, 135521,867,0,348,1,
13549-1,3,106,0,345, 13553-1,3,106,0,345,
135503,107,0,345,3, 135543,107,0,345,3,
13551108,0,345,1071,11, 13555108,0,345,1071,11,
135521,845,0,348,1, 135561,867,0,348,1,
13553-1,3,117,0,345, 13557-1,3,117,0,345,
135543,118,0,345,3, 135583,118,0,345,3,
13555119,0,345,3,120, 13559119,0,345,3,120,
@@ -13594,7 +13598,7 @@ public class yyLSLTokens : YyLexer {
135943,105,0,345,3, 135983,105,0,345,3,
13595106,0,345,3,107, 13599106,0,345,3,107,
135960,345,3,108,0, 136000,345,3,108,0,
13597345,1072,11,1,845, 13601345,1072,11,1,867,
135980,348,1,-1,3, 136020,348,1,-1,3,
1359998,0,345,3,99, 1360398,0,345,3,99,
136000,345,3,100,0, 136040,345,3,100,0,
@@ -13605,7 +13609,7 @@ public class yyLSLTokens : YyLexer {
13605345,3,106,0,345, 13609345,3,106,0,345,
136063,107,0,345,3, 136103,107,0,345,3,
13607108,0,345,1073,11, 13611108,0,345,1073,11,
136081,845,0,348,1, 136121,867,0,348,1,
13609-1,3,117,0,345, 13613-1,3,117,0,345,
136103,118,0,345,3, 136143,118,0,345,3,
13611119,0,345,3,120, 13615119,0,345,3,120,
@@ -13650,16 +13654,16 @@ public class yyLSLTokens : YyLexer {
136503,105,0,345,3, 136543,105,0,345,3,
13651106,0,345,3,107, 13655106,0,345,3,107,
136520,345,3,108,0, 136560,345,3,108,0,
13653345,1074,11,1,845, 13657345,1074,11,1,867,
136540,348,1,-1,3, 136580,348,1,-1,3,
13655112,0,345,3,113, 13659112,0,345,3,113,
136560,345,3,114,0, 136600,345,3,114,0,
13657345,3,115,0,345, 13661345,3,115,0,345,
136583,116,0,345,3, 136623,116,0,345,3,
13659117,0,1075,12,1, 13663117,0,1075,12,1,
1366010383,1076,5,63,3, 1366410405,1076,5,63,3,
13661109,0,345,3,110, 13665109,0,345,3,110,
136620,1077,12,1,10412, 136660,1077,12,1,10434,
136631078,5,63,3,109, 136671078,5,63,3,109,
136640,345,3,110,0, 136680,345,3,110,0,
13665345,3,111,0,345, 13669345,3,111,0,345,
@@ -13701,7 +13705,7 @@ public class yyLSLTokens : YyLexer {
13701345,3,88,0,345, 13705345,3,88,0,345,
137023,89,0,345,3, 137063,89,0,345,3,
1370390,0,345,3,95, 1370790,0,345,3,95,
137040,1079,12,1,10498, 137080,1079,12,1,10520,
137051080,5,63,3,109, 137091080,5,63,3,109,
137060,345,3,110,0, 137100,345,3,110,0,
13707345,3,111,0,345, 13711345,3,111,0,345,
@@ -13709,7 +13713,7 @@ public class yyLSLTokens : YyLexer {
13709113,0,345,3,114, 13713113,0,345,3,114,
137100,345,3,115,0, 137140,345,3,115,0,
13711345,3,116,0,1081, 13715345,3,116,0,1081,
1371212,1,10533,1082,5, 1371612,1,10555,1082,5,
1371363,3,109,0,345, 1371763,3,109,0,345,
137143,110,0,345,3, 137183,110,0,345,3,
13715111,0,345,3,112, 13719111,0,345,3,112,
@@ -13758,9 +13762,9 @@ public class yyLSLTokens : YyLexer {
137583,102,0,345,3, 137623,102,0,345,3,
13759103,0,345,3,104, 13763103,0,345,3,104,
137600,345,3,105,0, 137640,345,3,105,0,
137611083,12,1,10584,1084, 137651083,12,1,10606,1084,
137625,63,3,109,0, 137665,63,3,109,0,
137631085,12,1,10612,1086, 137671085,12,1,10634,1086,
137645,63,3,109,0, 137685,63,3,109,0,
13765345,3,110,0,345, 13769345,3,110,0,345,
137663,111,0,345,3, 137703,111,0,345,3,
@@ -13806,7 +13810,7 @@ public class yyLSLTokens : YyLexer {
138063,98,0,345,3, 138103,98,0,345,3,
1380799,0,345,3,100, 1381199,0,345,3,100,
138080,345,3,101,0, 138120,345,3,101,0,
138091087,12,1,10659,1088, 138131087,12,1,10681,1088,
138105,63,3,109,0, 138145,63,3,109,0,
13811345,3,110,0,345, 13815345,3,110,0,345,
138123,111,0,345,3, 138163,111,0,345,3,
@@ -13848,12 +13852,12 @@ public class yyLSLTokens : YyLexer {
138483,88,0,345,3, 138523,88,0,345,3,
1384989,0,345,3,90, 1385389,0,345,3,90,
138500,345,3,95,0, 138540,345,3,95,0,
138511089,12,1,10745,1090, 138551089,12,1,10767,1090,
138525,63,3,109,0, 138565,63,3,109,0,
13853345,3,110,0,345, 13857345,3,110,0,345,
138543,111,0,345,3, 138583,111,0,345,3,
13855112,0,1091,12,1, 13859112,0,1091,12,1,
1385610776,1092,5,63,3, 1386010798,1092,5,63,3,
13857109,0,345,3,110, 13861109,0,345,3,110,
138580,345,3,111,0, 138620,345,3,111,0,
13859345,3,112,0,345, 13863345,3,112,0,345,
@@ -13899,15 +13903,15 @@ public class yyLSLTokens : YyLexer {
13899345,3,99,0,345, 13903345,3,99,0,345,
139003,100,0,345,3, 139043,100,0,345,3,
13901101,0,1093,12,1, 13905101,0,1093,12,1,
1390210823,1094,5,63,3, 1390610845,1094,5,63,3,
13903109,0,345,3,110, 13907109,0,345,3,110,
139040,345,3,111,0, 139080,345,3,111,0,
13905345,3,112,0,345, 13909345,3,112,0,345,
139063,113,0,345,3, 139103,113,0,345,3,
13907114,0,1095,12,1, 13911114,0,1095,12,1,
1390810856,1096,5,63,3, 1391210878,1096,5,63,3,
13909109,0,1097,12,1, 13913109,0,1097,12,1,
1391010884,1098,5,63,3, 1391410906,1098,5,63,3,
13911109,0,345,3,110, 13915109,0,345,3,110,
139120,345,3,111,0, 139160,345,3,111,0,
13913345,3,112,0,345, 13917345,3,112,0,345,
@@ -13956,20 +13960,20 @@ public class yyLSLTokens : YyLexer {
139560,345,3,103,0, 139600,345,3,103,0,
13957345,3,104,0,345, 13961345,3,104,0,345,
139583,105,0,1099,12, 139623,105,0,1099,12,
139591,10935,1100,5,63, 139631,10957,1100,5,63,
139603,109,0,345,3, 139643,109,0,345,3,
13961110,0,345,3,111, 13965110,0,345,3,111,
139620,345,3,112,0, 139660,345,3,112,0,
13963345,3,113,0,345, 13967345,3,113,0,345,
139643,114,0,345,3, 139683,114,0,345,3,
13965115,0,1101,12,1, 13969115,0,1101,12,1,
1396610969,1102,5,63,3, 1397010991,1102,5,63,3,
13967109,0,345,3,110, 13971109,0,345,3,110,
139680,345,3,111,0, 139720,345,3,111,0,
13969345,3,112,0,345, 13973345,3,112,0,345,
139703,113,0,345,3, 139743,113,0,345,3,
13971114,0,345,3,115, 13975114,0,345,3,115,
139720,1103,12,1,11003, 139760,1103,12,1,11025,
139731104,5,63,3,109, 139771104,5,63,3,109,
139740,345,3,110,0, 139780,345,3,110,0,
13975345,3,111,0,345, 13979345,3,111,0,345,
@@ -14019,20 +14023,20 @@ public class yyLSLTokens : YyLexer {
14019345,3,103,0,345, 14023345,3,103,0,345,
140203,104,0,345,3, 140243,104,0,345,3,
14021105,0,1105,12,1, 14025105,0,1105,12,1,
1402211054,1106,5,63,3, 1402611076,1106,5,63,3,
14023109,0,345,3,110, 14027109,0,345,3,110,
140240,345,3,111,0, 140280,345,3,111,0,
140251107,12,1,11084,1108, 140291107,12,1,11106,1108,
140265,63,3,109,0, 140305,63,3,109,0,
14027345,3,110,0,1109, 14031345,3,110,0,1109,
1402812,1,11113,1110,5, 1403212,1,11135,1110,5,
1402963,3,109,0,345, 1403363,3,109,0,345,
140303,110,0,345,3, 140343,110,0,345,3,
14031111,0,345,3,112, 14035111,0,345,3,112,
140320,345,3,113,0, 140360,345,3,113,0,
14033345,3,114,0,345, 14037345,3,114,0,345,
140343,115,0,1111,12, 140383,115,0,1111,12,
140351,11147,1112,5,63, 140391,11169,1112,5,63,
140363,109,0,345,3, 140403,109,0,345,3,
14037110,0,345,3,111, 14041110,0,345,3,111,
140380,345,3,112,0, 140420,345,3,112,0,
@@ -14141,7 +14145,7 @@ public class yyLSLTokens : YyLexer {
14141345,3,106,0,345, 14145345,3,106,0,345,
141423,107,0,345,3, 141463,107,0,345,3,
14143108,0,345,1115,11, 14147108,0,345,1115,11,
141441,845,0,348,1, 141481,867,0,348,1,
14145-1,3,111,0,345, 14149-1,3,111,0,345,
141463,112,0,345,3, 141503,112,0,345,3,
14147113,0,345,3,114, 14151113,0,345,3,114,
@@ -14191,7 +14195,7 @@ public class yyLSLTokens : YyLexer {
14191105,0,345,3,106, 14195105,0,345,3,106,
141920,345,3,107,0, 141960,345,3,107,0,
14193345,3,108,0,345, 14197345,3,108,0,345,
141941116,11,1,845,0, 141981116,11,1,867,0,
14195348,1,-1,3,112, 14199348,1,-1,3,112,
141960,345,3,113,0, 142000,345,3,113,0,
14197345,3,114,0,345, 14201345,3,114,0,345,
@@ -14241,11 +14245,11 @@ public class yyLSLTokens : YyLexer {
14241345,3,106,0,345, 14245345,3,106,0,345,
142423,107,0,345,3, 142463,107,0,345,3,
14243108,0,345,1117,11, 14247108,0,345,1117,11,
142441,845,0,348,1, 142481,867,0,348,1,
14245-1,3,106,0,345, 14249-1,3,106,0,345,
142463,107,0,345,3, 142503,107,0,345,3,
14247108,0,345,1118,11, 14251108,0,345,1118,11,
142481,845,0,348,1, 142521,867,0,348,1,
14249-1,3,116,0,345, 14253-1,3,116,0,345,
142503,117,0,345,3, 142543,117,0,345,3,
14251118,0,345,3,119, 14255118,0,345,3,119,
@@ -14291,7 +14295,7 @@ public class yyLSLTokens : YyLexer {
14291105,0,345,3,106, 14295105,0,345,3,106,
142920,345,3,107,0, 142960,345,3,107,0,
14293345,3,108,0,345, 14297345,3,108,0,345,
142941119,11,1,845,0, 142981119,11,1,867,0,
14295348,1,-1,3,116, 14299348,1,-1,3,116,
142960,345,3,117,0, 143000,345,3,117,0,
14297345,3,118,0,345, 14301345,3,118,0,345,
@@ -14338,11 +14342,11 @@ public class yyLSLTokens : YyLexer {
143383,106,0,345,3, 143423,106,0,345,3,
14339107,0,345,3,108, 14343107,0,345,3,108,
143400,345,1120,11,1, 143440,345,1120,11,1,
14341845,0,348,1,-1, 14345867,0,348,1,-1,
143423,106,0,345,3, 143463,106,0,345,3,
14343107,0,345,3,108, 14347107,0,345,3,108,
143440,345,1121,11,1, 143480,345,1121,11,1,
14345845,0,348,1,-1, 14349867,0,348,1,-1,
143463,110,0,345,3, 143503,110,0,345,3,
14347111,0,345,3,112, 14351111,0,345,3,112,
143480,345,3,113,0, 143520,345,3,113,0,
@@ -14393,7 +14397,7 @@ public class yyLSLTokens : YyLexer {
14393345,3,106,0,345, 14397345,3,106,0,345,
143943,107,0,345,3, 143983,107,0,345,3,
14395108,0,345,1122,11, 14399108,0,345,1122,11,
143961,845,0,348,1, 144001,867,0,348,1,
14397-1,3,115,0,345, 14401-1,3,115,0,345,
143983,116,0,345,3, 144023,116,0,345,3,
14399117,0,345,3,118, 14403117,0,345,3,118,
@@ -14440,14 +14444,14 @@ public class yyLSLTokens : YyLexer {
144400,345,3,106,0, 144440,345,3,106,0,
14441345,3,107,0,345, 14445345,3,107,0,345,
144423,108,0,345,1123, 144463,108,0,345,1123,
1444311,1,845,0,348, 1444711,1,867,0,348,
144441,-1,3,102,0, 144481,-1,3,102,0,
14445345,3,103,0,345, 14449345,3,103,0,345,
144463,104,0,345,3, 144503,104,0,345,3,
14447105,0,345,3,106, 14451105,0,345,3,106,
144480,345,3,107,0, 144520,345,3,107,0,
14449345,3,108,0,345, 14453345,3,108,0,345,
144501124,11,1,845,0, 144541124,11,1,867,0,
14451348,1,-1,3,113, 14455348,1,-1,3,113,
144520,345,3,114,0, 144560,345,3,114,0,
14453345,3,115,0,345, 14457345,3,115,0,345,
@@ -14496,7 +14500,7 @@ public class yyLSLTokens : YyLexer {
144960,345,3,106,0, 145000,345,3,106,0,
14497345,3,107,0,345, 14501345,3,107,0,345,
144983,108,0,345,1125, 145023,108,0,345,1125,
1449911,1,845,0,348, 1450311,1,867,0,348,
145001,-1,3,97,0, 145041,-1,3,97,0,
14501345,3,98,0,345, 14505345,3,98,0,345,
145023,99,0,345,3, 145063,99,0,345,3,
@@ -14507,14 +14511,14 @@ public class yyLSLTokens : YyLexer {
14507105,0,345,3,106, 14511105,0,345,3,106,
145080,345,3,107,0, 145120,345,3,107,0,
14509345,3,108,0,345, 14513345,3,108,0,345,
145101126,11,1,845,0, 145141126,11,1,867,0,
14511348,1,-1,3,102, 14515348,1,-1,3,102,
145120,345,3,103,0, 145160,345,3,103,0,
14513345,3,104,0,345, 14517345,3,104,0,345,
145143,105,0,345,3, 145183,105,0,345,3,
14515106,0,345,3,107, 14519106,0,345,3,107,
145160,345,3,108,0, 145200,345,3,108,0,
14517345,1127,11,1,845, 14521345,1127,11,1,867,
145180,348,1,-1,3, 145220,348,1,-1,3,
14519110,0,345,3,111, 14523110,0,345,3,111,
145200,345,3,112,0, 145240,345,3,112,0,
@@ -14566,11 +14570,11 @@ public class yyLSLTokens : YyLexer {
145663,106,0,345,3, 145703,106,0,345,3,
14567107,0,345,3,108, 14571107,0,345,3,108,
145680,345,1128,11,1, 145720,345,1128,11,1,
14569845,0,348,1,-1, 14573867,0,348,1,-1,
145703,106,0,345,3, 145743,106,0,345,3,
14571107,0,345,3,108, 14575107,0,345,3,108,
145720,345,1129,11,1, 145760,345,1129,11,1,
14573845,0,348,1,-1, 14577867,0,348,1,-1,
145743,117,0,345,3, 145783,117,0,345,3,
14575118,0,345,3,119, 14579118,0,345,3,119,
145760,345,3,120,0, 145800,345,3,120,0,
@@ -14615,7 +14619,7 @@ public class yyLSLTokens : YyLexer {
14615105,0,345,3,106, 14619105,0,345,3,106,
146160,345,3,107,0, 146200,345,3,107,0,
14617345,3,108,0,345, 14621345,3,108,0,345,
146181130,11,1,845,0, 146221130,11,1,867,0,
14619348,1,-1,3,97, 14623348,1,-1,3,97,
146200,345,3,98,0, 146240,345,3,98,0,
14621345,3,99,0,345, 14625345,3,99,0,345,
@@ -14626,7 +14630,7 @@ public class yyLSLTokens : YyLexer {
146263,105,0,345,3, 146303,105,0,345,3,
14627106,0,345,3,107, 14631106,0,345,3,107,
146280,345,3,108,0, 146320,345,3,108,0,
14629345,1131,11,1,845, 14633345,1131,11,1,867,
146300,348,1,-1,3, 146340,348,1,-1,3,
14631111,0,345,3,112, 14635111,0,345,3,112,
146320,345,3,113,0, 146360,345,3,113,0,
@@ -14677,7 +14681,7 @@ public class yyLSLTokens : YyLexer {
14677345,3,106,0,345, 14681345,3,106,0,345,
146783,107,0,345,3, 146823,107,0,345,3,
14679108,0,345,1132,11, 14683108,0,345,1132,11,
146801,845,0,348,1, 146841,867,0,348,1,
14681-1,3,118,0,345, 14685-1,3,118,0,345,
146823,119,0,345,3, 146863,119,0,345,3,
14683120,0,345,3,121, 14687120,0,345,3,121,
@@ -14716,12 +14720,12 @@ public class yyLSLTokens : YyLexer {
147160,345,3,99,0, 147200,345,3,99,0,
14717345,3,100,0,345, 14721345,3,100,0,345,
147183,101,0,1133,12, 147223,101,0,1133,12,
147191,12674,1134,5,63, 147231,12696,1134,5,63,
147203,109,0,1135,12, 147243,109,0,1135,12,
147211,12702,1136,5,63, 147251,12724,1136,5,63,
147223,109,0,345,3, 147263,109,0,345,3,
14723110,0,345,3,111, 14727110,0,345,3,111,
147240,1137,12,1,12732, 147280,1137,12,1,12754,
147251138,5,63,3,109, 147291138,5,63,3,109,
147260,345,3,110,0, 147300,345,3,110,0,
14727345,3,111,0,345, 14731345,3,111,0,345,
@@ -14729,7 +14733,7 @@ public class yyLSLTokens : YyLexer {
14729113,0,345,3,114, 14733113,0,345,3,114,
147300,345,3,115,0, 147340,345,3,115,0,
14731345,3,116,0,1139, 14735345,3,116,0,1139,
1473212,1,12767,1140,5, 1473612,1,12789,1140,5,
1473363,3,109,0,345, 1473763,3,109,0,345,
147343,110,0,345,3, 147383,110,0,345,3,
14735111,0,345,3,112, 14739111,0,345,3,112,
@@ -14775,7 +14779,7 @@ public class yyLSLTokens : YyLexer {
1477598,0,345,3,99, 1477998,0,345,3,99,
147760,345,3,100,0, 147800,345,3,100,0,
14777345,3,101,0,1141, 14781345,3,101,0,1141,
1477812,1,12814,1142,5, 1478212,1,12836,1142,5,
1477963,3,109,0,345, 1478363,3,109,0,345,
147803,110,0,345,3, 147843,110,0,345,3,
14781111,0,345,3,112, 14785111,0,345,3,112,
@@ -14817,7 +14821,7 @@ public class yyLSLTokens : YyLexer {
1481788,0,345,3,89, 1482188,0,345,3,89,
148180,345,3,90,0, 148220,345,3,90,0,
14819345,3,95,0,1143, 14823345,3,95,0,1143,
1482012,1,12900,1144,5, 1482412,1,12922,1144,5,
1482163,3,109,0,345, 1482563,3,109,0,345,
148223,110,0,345,3, 148263,110,0,345,3,
14823111,0,345,3,112, 14827111,0,345,3,112,
@@ -14862,7 +14866,7 @@ public class yyLSLTokens : YyLexer {
148623,97,0,345,3, 148663,97,0,345,3,
1486398,0,345,3,99, 1486798,0,345,3,99,
148640,345,3,100,0, 148680,345,3,100,0,
148651145,12,1,12946,1146, 148691145,12,1,12968,1146,
148665,63,3,109,0, 148705,63,3,109,0,
14867345,3,110,0,345, 14871345,3,110,0,345,
148683,111,0,345,3, 148723,111,0,345,3,
@@ -14905,7 +14909,7 @@ public class yyLSLTokens : YyLexer {
1490589,0,345,3,90, 1490989,0,345,3,90,
149060,345,3,95,0, 149100,345,3,95,0,
14907345,3,97,0,1147, 14911345,3,97,0,1147,
1490812,1,12989,1148,5, 1491212,1,13011,1148,5,
1490963,3,109,0,345, 1491363,3,109,0,345,
149103,110,0,345,3, 149143,110,0,345,3,
14911111,0,345,3,112, 14915111,0,345,3,112,
@@ -14913,7 +14917,7 @@ public class yyLSLTokens : YyLexer {
14913345,3,114,0,345, 14917345,3,114,0,345,
149143,115,0,345,3, 149183,115,0,345,3,
14915116,0,1149,12,1, 14919116,0,1149,12,1,
1491613024,1150,5,63,3, 1492013046,1150,5,63,3,
14917109,0,345,3,110, 14921109,0,345,3,110,
149180,345,3,111,0, 149220,345,3,111,0,
14919345,3,112,0,345, 14923345,3,112,0,345,
@@ -14955,7 +14959,7 @@ public class yyLSLTokens : YyLexer {
14955345,3,89,0,345, 14959345,3,89,0,345,
149563,90,0,345,3, 149603,90,0,345,3,
1495795,0,345,3,97, 1496195,0,345,3,97,
149580,1151,12,1,13067, 149620,1151,12,1,13089,
149591152,5,63,3,109, 149631152,5,63,3,109,
149600,345,3,110,0, 149640,345,3,110,0,
14961345,3,111,0,345, 14965345,3,111,0,345,
@@ -15025,7 +15029,7 @@ public class yyLSLTokens : YyLexer {
15025345,3,106,0,345, 15029345,3,106,0,345,
150263,107,0,345,3, 150303,107,0,345,3,
15027108,0,345,1155,11, 15031108,0,345,1155,11,
150281,845,0,348,1, 150321,867,0,348,1,
15029-1,3,117,0,345, 15033-1,3,117,0,345,
150303,118,0,345,3, 150343,118,0,345,3,
15031119,0,345,3,120, 15035119,0,345,3,120,
@@ -15070,7 +15074,7 @@ public class yyLSLTokens : YyLexer {
150703,105,0,345,3, 150743,105,0,345,3,
15071106,0,345,3,107, 15075106,0,345,3,107,
150720,345,3,108,0, 150760,345,3,108,0,
15073345,1156,11,1,845, 15077345,1156,11,1,867,
150740,348,1,-1,3, 150780,348,1,-1,3,
1507598,0,345,3,99, 1507998,0,345,3,99,
150760,345,3,100,0, 150800,345,3,100,0,
@@ -15081,7 +15085,7 @@ public class yyLSLTokens : YyLexer {
15081345,3,106,0,345, 15085345,3,106,0,345,
150823,107,0,345,3, 150863,107,0,345,3,
15083108,0,345,1157,11, 15087108,0,345,1157,11,
150841,845,0,348,1, 150881,867,0,348,1,
15085-1,3,101,0,345, 15089-1,3,101,0,345,
150863,102,0,345,3, 150903,102,0,345,3,
15087103,0,345,3,104, 15091103,0,345,3,104,
@@ -15089,7 +15093,7 @@ public class yyLSLTokens : YyLexer {
15089345,3,106,0,345, 15093345,3,106,0,345,
150903,107,0,345,3, 150943,107,0,345,3,
15091108,0,345,1158,11, 15095108,0,345,1158,11,
150921,845,0,348,1, 150961,867,0,348,1,
15093-1,3,97,0,345, 15097-1,3,97,0,345,
150943,98,0,345,3, 150983,98,0,345,3,
1509599,0,345,3,100, 1509999,0,345,3,100,
@@ -15100,14 +15104,14 @@ public class yyLSLTokens : YyLexer {
151000,345,3,106,0, 151040,345,3,106,0,
15101345,3,107,0,345, 15105345,3,107,0,345,
151023,108,0,345,1159, 151063,108,0,345,1159,
1510311,1,845,0,348, 1510711,1,867,0,348,
151041,-1,3,102,0, 151081,-1,3,102,0,
15105345,3,103,0,345, 15109345,3,103,0,345,
151063,104,0,345,3, 151103,104,0,345,3,
15107105,0,345,3,106, 15111105,0,345,3,106,
151080,345,3,107,0, 151120,345,3,107,0,
15109345,3,108,0,345, 15113345,3,108,0,345,
151101160,11,1,845,0, 151141160,11,1,867,0,
15111348,1,-1,3,117, 15115348,1,-1,3,117,
151120,345,3,118,0, 151160,345,3,118,0,
15113345,3,119,0,345, 15117345,3,119,0,345,
@@ -15153,7 +15157,7 @@ public class yyLSLTokens : YyLexer {
15153345,3,106,0,345, 15157345,3,106,0,345,
151543,107,0,345,3, 151583,107,0,345,3,
15155108,0,345,1161,11, 15159108,0,345,1161,11,
151561,845,0,348,1, 151601,867,0,348,1,
15157-1,3,112,0,345, 15161-1,3,112,0,345,
151583,113,0,345,3, 151623,113,0,345,3,
15159114,0,345,3,115, 15163114,0,345,3,115,
@@ -15202,14 +15206,14 @@ public class yyLSLTokens : YyLexer {
152023,105,0,345,3, 152063,105,0,345,3,
15203106,0,345,3,107, 15207106,0,345,3,107,
152040,345,3,108,0, 152080,345,3,108,0,
15205345,1162,11,1,845, 15209345,1162,11,1,867,
152060,348,1,-1,3, 152100,348,1,-1,3,
15207110,0,345,3,111, 15211110,0,345,3,111,
152080,345,3,112,0, 152120,345,3,112,0,
15209345,3,113,0,345, 15213345,3,113,0,345,
152103,114,0,345,3, 152143,114,0,345,3,
15211115,0,345,3,116, 15215115,0,345,3,116,
152120,1163,12,1,13789, 152160,1163,12,1,13811,
152131164,5,63,3,109, 152171164,5,63,3,109,
152140,345,3,110,0, 152180,345,3,110,0,
15215345,3,111,0,345, 15219345,3,111,0,345,
@@ -15218,16 +15222,16 @@ public class yyLSLTokens : YyLexer {
152180,345,3,115,0, 152220,345,3,115,0,
15219345,3,116,0,345, 15223345,3,116,0,345,
152203,117,0,1165,12, 152243,117,0,1165,12,
152211,13825,1166,5,63, 152251,13847,1166,5,63,
152223,109,0,345,3, 152263,109,0,345,3,
15223110,0,345,3,111, 15227110,0,345,3,111,
152240,345,3,112,0, 152280,345,3,112,0,
15225345,3,113,0,345, 15229345,3,113,0,345,
152263,114,0,1167,12, 152303,114,0,1167,12,
152271,13858,1168,5,63, 152311,13880,1168,5,63,
152283,109,0,345,3, 152323,109,0,345,3,
15229110,0,1169,12,1, 15233110,0,1169,12,1,
1523013887,1170,5,63,3, 1523413909,1170,5,63,3,
15231109,0,345,3,110, 15235109,0,345,3,110,
152320,345,3,111,0, 152360,345,3,111,0,
15233345,3,112,0,345, 15237345,3,112,0,345,
@@ -15332,7 +15336,7 @@ public class yyLSLTokens : YyLexer {
153323,106,0,345,3, 153363,106,0,345,3,
15333107,0,345,3,108, 15337107,0,345,3,108,
153340,345,1173,11,1, 153380,345,1173,11,1,
15335845,0,348,1,-1, 15339867,0,348,1,-1,
153363,115,0,345,3, 153403,115,0,345,3,
15337116,0,345,3,117, 15341116,0,345,3,117,
153380,345,3,118,0, 153420,345,3,118,0,
@@ -15379,7 +15383,7 @@ public class yyLSLTokens : YyLexer {
15379345,3,106,0,345, 15383345,3,106,0,345,
153803,107,0,345,3, 153843,107,0,345,3,
15381108,0,345,1174,11, 15385108,0,345,1174,11,
153821,845,0,348,1, 153861,867,0,348,1,
15383-1,3,118,0,345, 15387-1,3,118,0,345,
153843,119,0,345,3, 153883,119,0,345,3,
15385120,0,345,3,121, 15389120,0,345,3,121,
@@ -15424,7 +15428,7 @@ public class yyLSLTokens : YyLexer {
154243,106,0,345,3, 154283,106,0,345,3,
15425107,0,345,3,108, 15429107,0,345,3,108,
154260,345,1175,11,1, 154300,345,1175,11,1,
15427845,0,348,1,-1, 15431867,0,348,1,-1,
154283,117,0,345,3, 154323,117,0,345,3,
15429118,0,345,3,119, 15433118,0,345,3,119,
154300,345,3,120,0, 154340,345,3,120,0,
@@ -15469,30 +15473,30 @@ public class yyLSLTokens : YyLexer {
15469105,0,345,3,106, 15473105,0,345,3,106,
154700,345,3,107,0, 154740,345,3,107,0,
15471345,3,108,0,345, 15475345,3,108,0,345,
154721176,11,1,845,0, 154761176,11,1,867,0,
15473348,1,-1,3,102, 15477348,1,-1,3,102,
154740,345,3,103,0, 154780,345,3,103,0,
15475345,3,104,0,345, 15479345,3,104,0,345,
154763,105,0,345,3, 154803,105,0,345,3,
15477106,0,345,3,107, 15481106,0,345,3,107,
154780,345,3,108,0, 154820,345,3,108,0,
15479345,1177,11,1,845, 15483345,1177,11,1,867,
154800,348,1,-1,3, 154840,348,1,-1,3,
15481115,0,1178,12,1, 15485115,0,1178,12,1,
1548214428,1179,5,63,3, 1548614450,1179,5,63,3,
15483109,0,345,3,110, 15487109,0,345,3,110,
154840,345,3,111,0, 154880,345,3,111,0,
15485345,3,112,0,345, 15489345,3,112,0,345,
154863,113,0,345,3, 154903,113,0,345,3,
15487114,0,345,3,115, 15491114,0,345,3,115,
154880,345,3,116,0, 154920,345,3,116,0,
154891180,12,1,14463,1181, 154931180,12,1,14485,1181,
154905,63,3,109,0, 154945,63,3,109,0,
15491345,3,110,0,345, 15495345,3,110,0,345,
154923,111,0,345,3, 154963,111,0,345,3,
15493112,0,345,3,113, 15497112,0,345,3,113,
154940,345,3,114,0, 154980,345,3,114,0,
154951182,12,1,14496,1183, 154991182,12,1,14518,1183,
154965,63,3,109,0, 155005,63,3,109,0,
15497345,3,110,0,345, 15501345,3,110,0,345,
154983,111,0,345,3, 155023,111,0,345,3,
@@ -15541,10 +15545,10 @@ public class yyLSLTokens : YyLexer {
15541345,3,102,0,345, 15545345,3,102,0,345,
155423,103,0,345,3, 155463,103,0,345,3,
15543104,0,345,3,105, 15547104,0,345,3,105,
155440,1184,12,1,14547, 155480,1184,12,1,14569,
155451185,5,63,3,109, 155491185,5,63,3,109,
155460,345,3,110,0, 155500,345,3,110,0,
155471186,12,1,14576,1187, 155511186,12,1,14598,1187,
155485,63,3,109,0, 155525,63,3,109,0,
15549345,3,110,0,345, 15553345,3,110,0,345,
155503,111,0,345,3, 155543,111,0,345,3,
@@ -15592,7 +15596,7 @@ public class yyLSLTokens : YyLexer {
155920,345,3,101,0, 155960,345,3,101,0,
15593345,3,102,0,345, 15597345,3,102,0,345,
155943,103,0,1188,12, 155983,103,0,1188,12,
155951,14625,1189,5,63, 155991,14647,1189,5,63,
155963,109,0,345,3, 156003,109,0,345,3,
15597110,0,345,3,111, 15601110,0,345,3,111,
155980,345,3,112,0, 156020,345,3,112,0,
@@ -15654,7 +15658,7 @@ public class yyLSLTokens : YyLexer {
156540,345,3,106,0, 156580,345,3,106,0,
15655345,3,107,0,345, 15659345,3,107,0,345,
156563,108,0,345,1192, 156603,108,0,345,1192,
1565711,1,845,0,348, 1566111,1,867,0,348,
156581,-1,3,111,0, 156621,-1,3,111,0,
15659345,3,112,0,345, 15663345,3,112,0,345,
156603,113,0,345,3, 156643,113,0,345,3,
@@ -15704,11 +15708,11 @@ public class yyLSLTokens : YyLexer {
157043,105,0,345,3, 157083,105,0,345,3,
15705106,0,345,3,107, 15709106,0,345,3,107,
157060,345,3,108,0, 157100,345,3,108,0,
15707345,1193,11,1,845, 15711345,1193,11,1,867,
157080,348,1,-1,3, 157120,348,1,-1,3,
15709106,0,345,3,107, 15713106,0,345,3,107,
157100,345,3,108,0, 157140,345,3,108,0,
15711345,1194,11,1,845, 15715345,1194,11,1,867,
157120,348,1,-1,3, 157160,348,1,-1,3,
15713115,0,345,3,116, 15717115,0,345,3,116,
157140,345,3,117,0, 157180,345,3,117,0,
@@ -15747,14 +15751,14 @@ public class yyLSLTokens : YyLexer {
15747345,3,90,0,345, 15751345,3,90,0,345,
157483,95,0,345,3, 157523,95,0,345,3,
1574997,0,1195,12,1, 1575397,0,1195,12,1,
1575014986,1196,5,63,3, 1575415008,1196,5,63,3,
15751109,0,345,3,110, 15755109,0,345,3,110,
157520,345,3,111,0, 157560,345,3,111,0,
15753345,3,112,0,345, 15757345,3,112,0,345,
157543,113,0,345,3, 157583,113,0,345,3,
15755114,0,345,3,115, 15759114,0,345,3,115,
157560,345,3,116,0, 157600,345,3,116,0,
157571197,12,1,15021,1198, 157611197,12,1,15043,1198,
157585,63,3,109,0, 157625,63,3,109,0,
15759345,3,110,0,345, 15763345,3,110,0,345,
157603,111,0,345,3, 157643,111,0,345,3,
@@ -15800,7 +15804,7 @@ public class yyLSLTokens : YyLexer {
158003,98,0,345,3, 158043,98,0,345,3,
1580199,0,345,3,100, 1580599,0,345,3,100,
158020,345,3,101,0, 158060,345,3,101,0,
158031199,12,1,15068,1200, 158071199,12,1,15090,1200,
158045,63,3,109,0, 158085,63,3,109,0,
15805345,3,110,0,345, 15809345,3,110,0,345,
158063,111,0,345,3, 158103,111,0,345,3,
@@ -15842,7 +15846,7 @@ public class yyLSLTokens : YyLexer {
158423,88,0,345,3, 158463,88,0,345,3,
1584389,0,345,3,90, 1584789,0,345,3,90,
158440,345,3,95,0, 158480,345,3,95,0,
158451201,12,1,15154,1202, 158491201,12,1,15176,1202,
158465,63,3,109,0, 158505,63,3,109,0,
15847345,3,110,0,345, 15851345,3,110,0,345,
158483,111,0,345,3, 158523,111,0,345,3,
@@ -15888,10 +15892,10 @@ public class yyLSLTokens : YyLexer {
158883,98,0,345,3, 158923,98,0,345,3,
1588999,0,345,3,100, 1589399,0,345,3,100,
158900,345,3,101,0, 158940,345,3,101,0,
158911203,12,1,15201,1204, 158951203,12,1,15223,1204,
158925,63,3,109,0, 158965,63,3,109,0,
15893345,3,110,0,1205, 15897345,3,110,0,1205,
1589412,1,15230,1206,5, 1589812,1,15252,1206,5,
1589563,3,109,0,345, 1589963,3,109,0,345,
158963,110,0,345,3, 159003,110,0,345,3,
15897111,0,345,3,112, 15901111,0,345,3,112,
@@ -15899,13 +15903,13 @@ public class yyLSLTokens : YyLexer {
15899345,3,114,0,345, 15903345,3,114,0,345,
159003,115,0,345,3, 159043,115,0,345,3,
15901116,0,1207,12,1, 15905116,0,1207,12,1,
1590215265,1208,5,63,3, 1590615287,1208,5,63,3,
15903109,0,345,3,110, 15907109,0,345,3,110,
159040,345,3,111,0, 159080,345,3,111,0,
15905345,3,112,0,345, 15909345,3,112,0,345,
159063,113,0,345,3, 159103,113,0,345,3,
15907114,0,1209,12,1, 15911114,0,1209,12,1,
1590815298,1210,5,63,3, 1591215320,1210,5,63,3,
15909109,0,345,3,110, 15913109,0,345,3,110,
159100,345,3,111,0, 159140,345,3,111,0,
15911345,3,112,0,345, 15915345,3,112,0,345,
@@ -15916,7 +15920,7 @@ public class yyLSLTokens : YyLexer {
159163,118,0,345,3, 159203,118,0,345,3,
15917119,0,345,3,120, 15921119,0,345,3,120,
159180,345,3,121,0, 159220,345,3,121,0,
159191211,12,1,15338,1212, 159231211,12,1,15360,1212,
159205,63,3,109,0, 159245,63,3,109,0,
15921345,3,110,0,345, 15925345,3,110,0,345,
159223,111,0,345,3, 159263,111,0,345,3,
@@ -16017,7 +16021,7 @@ public class yyLSLTokens : YyLexer {
16017345,3,106,0,345, 16021345,3,106,0,345,
160183,107,0,345,3, 160223,107,0,345,3,
16019108,0,345,1215,11, 16023108,0,345,1215,11,
160201,845,0,348,1, 160241,867,0,348,1,
16021-1,3,115,0,345, 16025-1,3,115,0,345,
160223,116,0,345,3, 160263,116,0,345,3,
16023117,0,345,3,118, 16027117,0,345,3,118,
@@ -16064,7 +16068,7 @@ public class yyLSLTokens : YyLexer {
160640,345,3,106,0, 160680,345,3,106,0,
16065345,3,107,0,345, 16069345,3,107,0,345,
160663,108,0,345,1216, 160703,108,0,345,1216,
1606711,1,845,0,348, 1607111,1,867,0,348,
160681,-1,3,117,0, 160721,-1,3,117,0,
16069345,3,118,0,345, 16073345,3,118,0,345,
160703,119,0,345,3, 160743,119,0,345,3,
@@ -16110,7 +16114,7 @@ public class yyLSLTokens : YyLexer {
161103,106,0,345,3, 161143,106,0,345,3,
16111107,0,345,3,108, 16115107,0,345,3,108,
161120,345,1217,11,1, 161160,345,1217,11,1,
16113845,0,348,1,-1, 16117867,0,348,1,-1,
161143,111,0,345,3, 161183,111,0,345,3,
16115112,0,345,3,113, 16119112,0,345,3,113,
161160,345,3,114,0, 161200,345,3,114,0,
@@ -16119,7 +16123,7 @@ public class yyLSLTokens : YyLexer {
16119117,0,345,3,118, 16123117,0,345,3,118,
161200,345,3,119,0, 161240,345,3,119,0,
16121345,3,120,0,1218, 16125345,3,120,0,1218,
1612212,1,15720,1219,5, 1612612,1,15742,1219,5,
1612363,3,109,0,345, 1612763,3,109,0,345,
161243,110,0,345,3, 161283,110,0,345,3,
16125111,0,345,3,112, 16129111,0,345,3,112,
@@ -16168,7 +16172,7 @@ public class yyLSLTokens : YyLexer {
161683,102,0,345,3, 161723,102,0,345,3,
16169103,0,345,3,104, 16173103,0,345,3,104,
161700,345,3,105,0, 161740,345,3,105,0,
161711220,12,1,15771,1221, 161751220,12,1,15793,1221,
161725,63,3,109,0, 161765,63,3,109,0,
16173345,3,110,0,345, 16177345,3,110,0,345,
161743,111,0,345,3, 161783,111,0,345,3,
@@ -16176,7 +16180,7 @@ public class yyLSLTokens : YyLexer {
161760,345,3,114,0, 161800,345,3,114,0,
16177345,3,115,0,345, 16181345,3,115,0,345,
161783,116,0,1222,12, 161823,116,0,1222,12,
161791,15806,1223,5,63, 161831,15828,1223,5,63,
161803,109,0,345,3, 161843,109,0,345,3,
16181110,0,345,3,111, 16185110,0,345,3,111,
161820,345,3,112,0, 161860,345,3,112,0,
@@ -16280,11 +16284,11 @@ public class yyLSLTokens : YyLexer {
162800,345,3,106,0, 162840,345,3,106,0,
16281345,3,107,0,345, 16285345,3,107,0,345,
162823,108,0,345,1226, 162863,108,0,345,1226,
1628311,1,845,0,348, 1628711,1,867,0,348,
162841,-1,3,106,0, 162881,-1,3,106,0,
16285345,3,107,0,345, 16289345,3,107,0,345,
162863,108,0,345,1227, 162903,108,0,345,1227,
1628711,1,845,0,348, 1629111,1,867,0,348,
162881,-1,3,121,0, 162921,-1,3,121,0,
16289345,3,122,0,345, 16293345,3,122,0,345,
162903,48,0,345,3, 162943,48,0,345,3,
@@ -16326,7 +16330,7 @@ public class yyLSLTokens : YyLexer {
163263,105,0,345,3, 163303,105,0,345,3,
16327106,0,345,3,107, 16331106,0,345,3,107,
163280,345,3,108,0, 163320,345,3,108,0,
16329345,1228,11,1,845, 16333345,1228,11,1,867,
163300,348,1,-1,3, 163340,348,1,-1,3,
16331102,0,345,3,103, 16335102,0,345,3,103,
163320,345,3,104,0, 163360,345,3,104,0,
@@ -16334,7 +16338,7 @@ public class yyLSLTokens : YyLexer {
163343,106,0,345,3, 163383,106,0,345,3,
16335107,0,345,3,108, 16339107,0,345,3,108,
163360,345,1229,11,1, 163400,345,1229,11,1,
16337845,0,348,1,-1, 16341867,0,348,1,-1,
163383,97,0,345,3, 163423,97,0,345,3,
1633998,0,345,3,99, 1634398,0,345,3,99,
163400,345,3,100,0, 163440,345,3,100,0,
@@ -16354,7 +16358,7 @@ public class yyLSLTokens : YyLexer {
163543,105,0,345,3, 163583,105,0,345,3,
16355106,0,345,3,107, 16359106,0,345,3,107,
163560,345,3,108,0, 163600,345,3,108,0,
16357345,1232,11,1,845, 16361345,1232,11,1,867,
163580,348,1,-1,3, 163620,348,1,-1,3,
16359117,0,345,3,118, 16363117,0,345,3,118,
163600,345,3,119,0, 163640,345,3,119,0,
@@ -16400,7 +16404,7 @@ public class yyLSLTokens : YyLexer {
164000,345,3,106,0, 164040,345,3,106,0,
16401345,3,107,0,345, 16405345,3,107,0,345,
164023,108,0,345,1233, 164063,108,0,345,1233,
1640311,1,845,0,348, 1640711,1,867,0,348,
164041,-1,3,98,0, 164081,-1,3,98,0,
16405345,3,99,0,345, 16409345,3,99,0,345,
164063,100,0,345,3, 164103,100,0,345,3,
@@ -16410,7 +16414,7 @@ public class yyLSLTokens : YyLexer {
164103,105,0,345,3, 164143,105,0,345,3,
16411106,0,345,3,107, 16415106,0,345,3,107,
164120,345,3,108,0, 164160,345,3,108,0,
16413345,1234,11,1,845, 16417345,1234,11,1,867,
164140,348,1,-1,3, 164180,348,1,-1,3,
16415117,0,345,3,118, 16419117,0,345,3,118,
164160,345,3,119,0, 164200,345,3,119,0,
@@ -16450,26 +16454,26 @@ public class yyLSLTokens : YyLexer {
164503,98,0,345,3, 164543,98,0,345,3,
1645199,0,345,3,100, 1645599,0,345,3,100,
164520,345,3,101,0, 164560,345,3,101,0,
164531235,12,1,16515,1236, 164571235,12,1,16537,1236,
164545,63,3,109,0, 164585,63,3,109,0,
16455345,3,110,0,1237, 16459345,3,110,0,1237,
1645612,1,16544,1238,5, 1646012,1,16566,1238,5,
1645763,3,109,0,345, 1646163,3,109,0,345,
164583,110,0,345,3, 164623,110,0,345,3,
16459111,0,345,3,112, 16463111,0,345,3,112,
164600,345,3,113,0, 164640,345,3,113,0,
16461345,3,114,0,345, 16465345,3,114,0,345,
164623,115,0,1239,12, 164663,115,0,1239,12,
164631,16578,1240,5,63, 164671,16600,1240,5,63,
164643,109,0,345,3, 164683,109,0,345,3,
16465110,0,345,3,111, 16469110,0,345,3,111,
164660,1241,12,1,16608, 164700,1241,12,1,16630,
164671242,5,63,3,109, 164711242,5,63,3,109,
164680,345,3,110,0, 164720,345,3,110,0,
16469345,3,111,0,345, 16473345,3,111,0,345,
164703,112,0,345,3, 164743,112,0,345,3,
16471113,0,345,3,114, 16475113,0,345,3,114,
164720,1243,12,1,16641, 164760,1243,12,1,16663,
164731244,5,63,3,109, 164771244,5,63,3,109,
164740,345,3,110,0, 164780,345,3,110,0,
16475345,3,111,0,345, 16479345,3,111,0,345,
@@ -16574,7 +16578,7 @@ public class yyLSLTokens : YyLexer {
165743,106,0,345,3, 165783,106,0,345,3,
16575107,0,345,3,108, 16579107,0,345,3,108,
165760,345,1247,11,1, 165800,345,1247,11,1,
16577845,0,348,1,-1, 16581867,0,348,1,-1,
165783,112,0,345,3, 165823,112,0,345,3,
16579113,0,345,3,114, 16583113,0,345,3,114,
165800,345,3,115,0, 165840,345,3,115,0,
@@ -16623,7 +16627,7 @@ public class yyLSLTokens : YyLexer {
16623105,0,345,3,106, 16627105,0,345,3,106,
166240,345,3,107,0, 166280,345,3,107,0,
16625345,3,108,0,345, 16629345,3,108,0,345,
166261248,11,1,845,0, 166301248,11,1,867,0,
16627348,1,-1,3,116, 16631348,1,-1,3,116,
166280,345,3,117,0, 166320,345,3,117,0,
16629345,3,118,0,345, 16633345,3,118,0,345,
@@ -16670,7 +16674,7 @@ public class yyLSLTokens : YyLexer {
166703,106,0,345,3, 166743,106,0,345,3,
16671107,0,345,3,108, 16675107,0,345,3,108,
166720,345,1249,11,1, 166760,345,1249,11,1,
16673845,0,348,1,-1, 16677867,0,348,1,-1,
166743,111,0,345,3, 166783,111,0,345,3,
16675112,0,345,3,113, 16679112,0,345,3,113,
166760,345,3,114,0, 166800,345,3,114,0,
@@ -16720,20 +16724,20 @@ public class yyLSLTokens : YyLexer {
167200,345,3,106,0, 167240,345,3,106,0,
16721345,3,107,0,345, 16725345,3,107,0,345,
167223,108,0,345,1250, 167263,108,0,345,1250,
1672311,1,845,0,348, 1672711,1,867,0,348,
167241,-1,3,102,0, 167281,-1,3,102,0,
16725345,3,103,0,345, 16729345,3,103,0,345,
167263,104,0,345,3, 167303,104,0,345,3,
16727105,0,345,3,106, 16731105,0,345,3,106,
167280,345,3,107,0, 167320,345,3,107,0,
16729345,3,108,0,345, 16733345,3,108,0,345,
167301251,11,1,845,0, 167341251,11,1,867,0,
16731348,1,-1,3,116, 16735348,1,-1,3,116,
167320,1252,12,1,17189, 167360,1252,12,1,17211,
167331253,5,63,3,109, 167371253,5,63,3,109,
167340,345,3,110,0, 167380,345,3,110,0,
16735345,3,111,0,1254, 16739345,3,111,0,1254,
1673612,1,17219,1255,5, 1674012,1,17241,1255,5,
1673763,3,109,0,345, 1674163,3,109,0,345,
167383,110,0,345,3, 167423,110,0,345,3,
16739111,0,345,3,112, 16743111,0,345,3,112,
@@ -16741,7 +16745,7 @@ public class yyLSLTokens : YyLexer {
16741345,3,114,0,345, 16745345,3,114,0,345,
167423,115,0,345,3, 167463,115,0,345,3,
16743116,0,345,3,117, 16747116,0,345,3,117,
167440,1256,12,1,17255, 167480,1256,12,1,17277,
167451257,5,63,3,109, 167491257,5,63,3,109,
167460,345,3,110,0, 167500,345,3,110,0,
16747345,3,111,0,345, 16751345,3,111,0,345,
@@ -16786,7 +16790,7 @@ public class yyLSLTokens : YyLexer {
167860,345,3,97,0, 167900,345,3,97,0,
16787345,3,98,0,345, 16791345,3,98,0,345,
167883,99,0,1258,12, 167923,99,0,1258,12,
167891,17300,1259,5,63, 167931,17322,1259,5,63,
167903,109,0,345,3, 167943,109,0,345,3,
16791110,0,345,3,111, 16795110,0,345,3,111,
167920,345,3,112,0, 167960,345,3,112,0,
@@ -16834,7 +16838,7 @@ public class yyLSLTokens : YyLexer {
168343,101,0,345,3, 168383,101,0,345,3,
16835102,0,345,3,103, 16839102,0,345,3,103,
168360,345,3,104,0, 168400,345,3,104,0,
168371260,12,1,17350,1261, 168411260,12,1,17372,1261,
168385,63,3,109,0, 168425,63,3,109,0,
16839345,3,110,0,345, 16843345,3,110,0,345,
168403,111,0,345,3, 168443,111,0,345,3,
@@ -16876,14 +16880,14 @@ public class yyLSLTokens : YyLexer {
168763,88,0,345,3, 168803,88,0,345,3,
1687789,0,345,3,90, 1688189,0,345,3,90,
168780,345,3,95,0, 168820,345,3,95,0,
168791262,12,1,17436,1263, 168831262,12,1,17458,1263,
168805,63,3,109,0, 168845,63,3,109,0,
16881345,3,110,0,345, 16885345,3,110,0,345,
168823,111,0,345,3, 168863,111,0,345,3,
16883112,0,345,3,113, 16887112,0,345,3,113,
168840,345,3,114,0, 168880,345,3,114,0,
16885345,3,115,0,1264, 16889345,3,115,0,1264,
1688612,1,17470,1265,5, 1689012,1,17492,1265,5,
1688763,3,109,0,345, 1689163,3,109,0,345,
168883,110,0,345,3, 168923,110,0,345,3,
16889111,0,345,3,112, 16893111,0,345,3,112,
@@ -16891,7 +16895,7 @@ public class yyLSLTokens : YyLexer {
16891345,3,114,0,345, 16895345,3,114,0,345,
168923,115,0,345,3, 168963,115,0,345,3,
16893116,0,1266,12,1, 16897116,0,1266,12,1,
1689417505,1267,5,63,3, 1689817527,1267,5,63,3,
16895109,0,345,3,110, 16899109,0,345,3,110,
168960,345,3,111,0, 169000,345,3,111,0,
16897345,3,112,0,345, 16901345,3,112,0,345,
@@ -16933,13 +16937,13 @@ public class yyLSLTokens : YyLexer {
16933345,3,89,0,345, 16937345,3,89,0,345,
169343,90,0,345,3, 169383,90,0,345,3,
1693595,0,345,3,97, 1693995,0,345,3,97,
169360,1268,12,1,17548, 169400,1268,12,1,17570,
169371269,5,63,3,109, 169411269,5,63,3,109,
169380,345,3,110,0, 169420,345,3,110,0,
16939345,3,111,0,345, 16943345,3,111,0,345,
169403,112,0,345,3, 169443,112,0,345,3,
16941113,0,345,3,114, 16945113,0,345,3,114,
169420,1270,12,1,17581, 169460,1270,12,1,17603,
169431271,5,63,3,109, 169471271,5,63,3,109,
169440,345,3,110,0, 169480,345,3,110,0,
16945345,3,111,0,345, 16949345,3,111,0,345,
@@ -16947,7 +16951,7 @@ public class yyLSLTokens : YyLexer {
16947113,0,345,3,114, 16951113,0,345,3,114,
169480,345,3,115,0, 169520,345,3,115,0,
16949345,3,116,0,1272, 16953345,3,116,0,1272,
1695012,1,17616,1273,5, 1695412,1,17638,1273,5,
1695163,3,109,0,345, 1695563,3,109,0,345,
169523,110,0,345,3, 169563,110,0,345,3,
16953111,0,345,3,112, 16957111,0,345,3,112,
@@ -17052,7 +17056,7 @@ public class yyLSLTokens : YyLexer {
170523,106,0,345,3, 170563,106,0,345,3,
17053107,0,345,3,108, 17057107,0,345,3,108,
170540,345,1276,11,1, 170580,345,1276,11,1,
17055845,0,348,1,-1, 17059867,0,348,1,-1,
170563,115,0,345,3, 170603,115,0,345,3,
17057116,0,345,3,117, 17061116,0,345,3,117,
170580,345,3,118,0, 170620,345,3,118,0,
@@ -17099,7 +17103,7 @@ public class yyLSLTokens : YyLexer {
17099345,3,106,0,345, 17103345,3,106,0,345,
171003,107,0,345,3, 171043,107,0,345,3,
17101108,0,345,1277,11, 17105108,0,345,1277,11,
171021,845,0,348,1, 171061,867,0,348,1,
17103-1,3,98,0,345, 17107-1,3,98,0,345,
171043,99,0,345,3, 171083,99,0,345,3,
17105100,0,345,3,101, 17109100,0,345,3,101,
@@ -17109,7 +17113,7 @@ public class yyLSLTokens : YyLexer {
17109105,0,345,3,106, 17113105,0,345,3,106,
171100,345,3,107,0, 171140,345,3,107,0,
17111345,3,108,0,345, 17115345,3,108,0,345,
171121278,11,1,845,0, 171161278,11,1,867,0,
17113348,1,-1,3,117, 17117348,1,-1,3,117,
171140,345,3,118,0, 171180,345,3,118,0,
17115345,3,119,0,345, 17119345,3,119,0,345,
@@ -17155,7 +17159,7 @@ public class yyLSLTokens : YyLexer {
17155345,3,106,0,345, 17159345,3,106,0,345,
171563,107,0,345,3, 171603,107,0,345,3,
17157108,0,345,1279,11, 17161108,0,345,1279,11,
171581,845,0,348,1, 171621,867,0,348,1,
17159-1,3,116,0,345, 17163-1,3,116,0,345,
171603,117,0,345,3, 171643,117,0,345,3,
17161118,0,345,3,119, 17165118,0,345,3,119,
@@ -17195,10 +17199,10 @@ public class yyLSLTokens : YyLexer {
17195345,3,98,0,345, 17199345,3,98,0,345,
171963,99,0,345,3, 172003,99,0,345,3,
17197100,0,345,3,101, 17201100,0,345,3,101,
171980,1280,12,1,18083, 172020,1280,12,1,18105,
171991281,5,63,3,109, 172031281,5,63,3,109,
172000,345,3,110,0, 172040,345,3,110,0,
172011282,12,1,18112,1283, 172051282,12,1,18134,1283,
172025,63,3,109,0, 172065,63,3,109,0,
17203345,3,110,0,345, 17207345,3,110,0,345,
172043,111,0,345,3, 172083,111,0,345,3,
@@ -17243,7 +17247,7 @@ public class yyLSLTokens : YyLexer {
17243345,3,97,0,345, 17247345,3,97,0,345,
172443,98,0,345,3, 172483,98,0,345,3,
1724599,0,345,3,100, 1724999,0,345,3,100,
172460,1284,12,1,18158, 172500,1284,12,1,18180,
172471285,5,63,3,109, 172511285,5,63,3,109,
172480,345,3,110,0, 172520,345,3,110,0,
17249345,3,111,0,345, 17253345,3,111,0,345,
@@ -17310,7 +17314,7 @@ public class yyLSLTokens : YyLexer {
173103,106,0,345,3, 173143,106,0,345,3,
17311107,0,345,3,108, 17315107,0,345,3,108,
173120,345,1288,11,1, 173160,345,1288,11,1,
17313845,0,348,1,-1, 17317867,0,348,1,-1,
173143,111,0,345,3, 173183,111,0,345,3,
17315112,0,345,3,113, 17319112,0,345,3,113,
173160,345,3,114,0, 173200,345,3,114,0,
@@ -17360,14 +17364,14 @@ public class yyLSLTokens : YyLexer {
173600,345,3,106,0, 173640,345,3,106,0,
17361345,3,107,0,345, 17365345,3,107,0,345,
173623,108,0,345,1289, 173663,108,0,345,1289,
1736311,1,845,0,348, 1736711,1,867,0,348,
173641,-1,3,102,0, 173681,-1,3,102,0,
17365345,3,103,0,345, 17369345,3,103,0,345,
173663,104,0,345,3, 173703,104,0,345,3,
17367105,0,345,3,106, 17371105,0,345,3,106,
173680,345,3,107,0, 173720,345,3,107,0,
17369345,3,108,0,345, 17373345,3,108,0,345,
173701290,11,1,845,0, 173741290,11,1,867,0,
17371348,1,-1,3,97, 17375348,1,-1,3,97,
173720,345,3,98,0, 173760,345,3,98,0,
17373345,3,99,0,345, 17377345,3,99,0,345,
@@ -17388,7 +17392,7 @@ public class yyLSLTokens : YyLexer {
173880,345,3,106,0, 173920,345,3,106,0,
17389345,3,107,0,345, 17393345,3,107,0,345,
173903,108,0,345,1293, 173943,108,0,345,1293,
1739111,1,845,0,348, 1739511,1,867,0,348,
173921,-1,3,100,0, 173961,-1,3,100,0,
17393345,3,101,0,345, 17397345,3,101,0,345,
173943,102,0,345,3, 173983,102,0,345,3,
@@ -17397,7 +17401,7 @@ public class yyLSLTokens : YyLexer {
17397345,3,106,0,345, 17401345,3,106,0,345,
173983,107,0,345,3, 174023,107,0,345,3,
17399108,0,345,1294,11, 17403108,0,345,1294,11,
174001,845,0,348,1, 174041,867,0,348,1,
17401-1,3,118,0,345, 17405-1,3,118,0,345,
174023,119,0,345,3, 174063,119,0,345,3,
17403120,0,345,3,121, 17407120,0,345,3,121,
@@ -17442,7 +17446,13 @@ public class yyLSLTokens : YyLexer {
174423,106,0,345,3, 174463,106,0,345,3,
17443107,0,345,3,108, 17447107,0,345,3,108,
174440,345,1295,11,1, 174480,345,1295,11,1,
17445845,0,348,1,-1, 17449867,0,348,1,-1,
174503,112,0,345,3,
17451113,0,345,3,114,
174520,1296,12,1,18804,
174531297,5,63,3,109,
174540,345,3,110,0,
17455345,3,111,0,345,
174463,112,0,345,3, 174563,112,0,345,3,
17447113,0,345,3,114, 17457113,0,345,3,114,
174480,345,3,115,0, 174580,345,3,115,0,
@@ -17482,16 +17492,60 @@ public class yyLSLTokens : YyLexer {
174823,89,0,345,3, 174923,89,0,345,3,
1748390,0,345,3,95, 1749390,0,345,3,95,
174840,345,3,97,0, 174940,345,3,97,0,
17485345,3,98,0,345, 174951298,12,1,18847,1299,
174863,99,0,345,3, 174965,63,3,109,0,
17487100,0,345,3,101, 17497345,3,110,0,1300,
174880,345,3,102,0, 1749812,1,18876,1301,5,
17489345,3,103,0,345, 1749963,3,109,0,345,
174903,104,0,345,3, 175003,110,0,345,3,
17491105,0,1296,12,1, 17501111,0,345,3,112,
1749218800,1297,5,63,3, 175020,345,3,113,0,
17493109,0,1298,12,1, 17503345,3,114,0,345,
1749418828,1299,5,63,3, 175043,115,0,1302,12,
175051,18910,1303,5,63,
175063,109,0,345,3,
17507110,0,345,3,111,
175080,345,3,112,0,
17509345,3,113,0,345,
175103,114,0,345,3,
17511115,0,345,3,116,
175120,345,3,117,0,
17513345,3,118,0,345,
175143,119,0,345,3,
17515120,0,345,3,121,
175160,345,3,122,0,
17517345,3,48,0,345,
175183,49,0,345,3,
1751950,0,345,3,51,
175200,345,3,52,0,
17521345,3,53,0,345,
175223,54,0,345,3,
1752355,0,345,3,56,
175240,345,3,57,0,
17525345,3,65,0,345,
175263,66,0,345,3,
1752767,0,345,3,68,
175280,345,3,69,0,
17529345,3,70,0,345,
175303,71,0,345,3,
1753172,0,345,3,73,
175320,345,3,74,0,
17533345,3,75,0,345,
175343,76,0,345,3,
1753577,0,345,3,78,
175360,345,3,79,0,
17537345,3,80,0,345,
175383,81,0,345,3,
1753982,0,345,3,83,
175400,345,3,84,0,
17541345,3,85,0,345,
175423,86,0,345,3,
1754387,0,345,3,88,
175440,345,3,89,0,
17545345,3,90,0,345,
175463,95,0,345,3,
1754797,0,1304,12,1,
1754818953,1305,5,63,3,
17495109,0,345,3,110, 17549109,0,345,3,110,
174960,345,3,111,0, 175500,345,3,111,0,
17497345,3,112,0,345, 17551345,3,112,0,345,
@@ -17534,16 +17588,240 @@ public class yyLSLTokens : YyLexer {
175343,90,0,345,3, 175883,90,0,345,3,
1753595,0,345,3,97, 1758995,0,345,3,97,
175360,345,3,98,0, 175900,345,3,98,0,
17537345,3,99,0,345, 17591345,3,99,0,1306,
175383,100,0,345,3, 1759212,1,18998,1307,5,
17539101,0,1300,12,1, 1759363,3,109,0,345,
1754018875,1301,5,63,3, 175943,110,0,345,3,
17595111,0,345,3,112,
175960,345,3,113,0,
17597345,3,114,0,345,
175983,115,0,345,3,
17599116,0,1308,12,1,
1760019033,1309,5,63,3,
17541109,0,345,3,110, 17601109,0,345,3,110,
175420,345,3,111,0, 176020,345,3,111,0,
17543345,3,112,0,345, 17603345,3,112,0,345,
175443,113,0,345,3, 176043,113,0,345,3,
17545114,0,1302,12,1, 17605114,0,345,3,115,
1754618908,1303,5,63,3, 176060,345,3,116,0,
17607345,3,117,0,345,
176083,118,0,345,3,
17609119,0,345,3,120,
176100,345,3,121,0,
17611345,3,122,0,345,
176123,48,0,345,3,
1761349,0,345,3,50,
176140,345,3,51,0,
17615345,3,52,0,345,
176163,53,0,345,3,
1761754,0,345,3,55,
176180,345,3,56,0,
17619345,3,57,0,345,
176203,65,0,345,3,
1762166,0,345,3,67,
176220,345,3,68,0,
17623345,3,69,0,345,
176243,70,0,345,3,
1762571,0,345,3,72,
176260,345,3,73,0,
17627345,3,74,0,345,
176283,75,0,345,3,
1762976,0,345,3,77,
176300,345,3,78,0,
17631345,3,79,0,345,
176323,80,0,345,3,
1763381,0,345,3,82,
176340,345,3,83,0,
17635345,3,84,0,345,
176363,85,0,345,3,
1763786,0,345,3,87,
176380,345,3,88,0,
17639345,3,89,0,345,
176403,90,0,345,3,
1764195,0,345,3,97,
176420,345,3,98,0,
17643345,3,99,0,345,
176443,100,0,345,3,
17645101,0,345,3,102,
176460,345,3,103,0,
17647345,3,104,0,345,
176483,105,0,1310,12,
176491,19084,1311,5,63,
176503,109,0,345,3,
17651110,0,345,3,111,
176520,1312,12,1,19114,
176531313,5,63,3,109,
176540,345,3,110,0,
176551314,12,1,19143,1315,
176565,63,3,109,0,
17657345,3,110,0,345,
176583,111,0,345,3,
17659112,0,345,3,113,
176600,345,3,114,0,
17661345,3,115,0,345,
176623,116,0,345,3,
17663117,0,345,3,118,
176640,345,3,119,0,
17665345,3,120,0,345,
176663,121,0,345,3,
17667122,0,345,3,48,
176680,345,3,49,0,
17669345,3,50,0,345,
176703,51,0,345,3,
1767152,0,345,3,53,
176720,345,3,54,0,
17673345,3,55,0,345,
176743,56,0,345,3,
1767557,0,345,3,65,
176760,345,3,66,0,
17677345,3,67,0,345,
176783,68,0,345,3,
1767969,0,345,3,70,
176800,345,3,71,0,
17681345,3,72,0,345,
176823,73,0,345,3,
1768374,0,345,3,75,
176840,345,3,76,0,
17685345,3,77,0,345,
176863,78,0,345,3,
1768779,0,345,3,80,
176880,345,3,81,0,
17689345,3,82,0,345,
176903,83,0,345,3,
1769184,0,345,3,85,
176920,345,3,86,0,
17693345,3,87,0,345,
176943,88,0,345,3,
1769589,0,345,3,90,
176960,345,3,95,0,
176971316,12,1,19229,1317,
176985,63,3,109,0,
17699345,3,110,0,345,
177003,111,0,345,3,
17701112,0,345,3,113,
177020,345,3,114,0,
177031318,12,1,19262,1319,
177045,63,3,109,0,
17705345,3,110,0,345,
177063,111,0,345,3,
17707112,0,345,3,113,
177080,345,3,114,0,
17709345,3,115,0,345,
177103,116,0,345,3,
17711117,0,345,3,118,
177120,345,3,119,0,
17713345,3,120,0,345,
177143,121,0,345,3,
17715122,0,345,3,48,
177160,345,3,49,0,
17717345,3,50,0,345,
177183,51,0,345,3,
1771952,0,345,3,53,
177200,345,3,54,0,
17721345,3,55,0,345,
177223,56,0,345,3,
1772357,0,345,3,65,
177240,345,3,66,0,
17725345,3,67,0,345,
177263,68,0,345,3,
1772769,0,345,3,70,
177280,345,3,71,0,
17729345,3,72,0,345,
177303,73,0,345,3,
1773174,0,345,3,75,
177320,345,3,76,0,
17733345,3,77,0,345,
177343,78,0,345,3,
1773579,0,345,3,80,
177360,345,3,81,0,
17737345,3,82,0,345,
177383,83,0,345,3,
1773984,0,345,3,85,
177400,345,3,86,0,
17741345,3,87,0,345,
177423,88,0,345,3,
1774389,0,345,3,90,
177440,345,3,95,0,
17745345,3,97,0,345,
177463,98,0,345,3,
1774799,0,345,3,100,
177480,345,3,101,0,
177491320,12,1,19309,1321,
177505,63,3,109,0,
17751345,3,110,0,345,
177523,111,0,345,3,
17753112,0,345,3,113,
177540,345,3,114,0,
17755345,3,115,0,1322,
1775612,1,19343,1323,5,
1775763,3,109,0,345,
177583,110,0,345,3,
17759111,0,345,3,112,
177600,345,3,113,0,
17761345,3,114,0,345,
177623,115,0,345,3,
17763116,0,345,3,117,
177640,1324,12,1,19379,
177651325,5,63,3,109,
177660,345,3,110,0,
17767345,3,111,0,345,
177683,112,0,345,3,
17769113,0,345,3,114,
177700,345,3,115,0,
17771345,3,116,0,345,
177723,117,0,345,3,
17773118,0,345,3,119,
177740,345,3,120,0,
17775345,3,121,0,345,
177763,122,0,345,3,
1777748,0,345,3,49,
177780,345,3,50,0,
17779345,3,51,0,345,
177803,52,0,345,3,
1778153,0,345,3,54,
177820,345,3,55,0,
17783345,3,56,0,345,
177843,57,0,345,3,
1778565,0,345,3,66,
177860,345,3,67,0,
17787345,3,68,0,345,
177883,69,0,345,3,
1778970,0,345,3,71,
177900,345,3,72,0,
17791345,3,73,0,345,
177923,74,0,345,3,
1779375,0,345,3,76,
177940,345,3,77,0,
17795345,3,78,0,345,
177963,79,0,345,3,
1779780,0,345,3,81,
177980,345,3,82,0,
17799345,3,83,0,345,
178003,84,0,345,3,
1780185,0,345,3,86,
178020,345,3,87,0,
17803345,3,88,0,345,
178043,89,0,345,3,
1780590,0,345,3,95,
178060,345,3,97,0,
17807345,3,98,0,345,
178083,99,0,345,3,
17809100,0,345,3,101,
178100,345,3,102,0,
17811345,3,103,0,345,
178123,104,0,345,3,
17813105,0,345,3,106,
178140,345,3,107,0,
17815345,3,108,0,1326,
1781612,1,19433,1327,5,
1781763,3,109,0,345,
178183,110,0,345,3,
17819111,0,345,3,112,
178200,345,3,113,0,
17821345,3,114,0,345,
178223,115,0,345,3,
17823116,0,1328,12,1,
1782419468,1329,5,63,3,
17547109,0,345,3,110, 17825109,0,345,3,110,
175480,345,3,111,0, 178260,345,3,111,0,
17549345,3,112,0,345, 17827345,3,112,0,345,
@@ -17594,15 +17872,65 @@ public class yyLSLTokens : YyLexer {
175943,105,0,345,3, 178723,105,0,345,3,
17595106,0,345,3,107, 17873106,0,345,3,107,
175960,345,3,108,0, 178740,345,3,108,0,
17597345,1304,11,1,783, 17875345,1330,11,1,845,
175980,1305,4,22,84, 178760,1331,4,48,84,
175990,73,0,77,0, 178770,82,0,65,0,
1760069,0,82,0,95, 1787878,0,83,0,65,
176010,69,0,86,0, 178790,67,0,84,0,
1760269,0,78,0,84, 1788073,0,79,0,78,
176030,1,-1,3,115, 178810,95,0,82,0,
176040,345,3,116,0, 1788269,0,83,0,85,
17605345,3,117,0,345, 178830,76,0,84,0,
1788495,0,69,0,86,
178850,69,0,78,0,
1788684,0,1,-1,3,
17887117,0,345,3,118,
178880,345,3,119,0,
17889345,3,120,0,345,
178903,121,0,345,3,
17891122,0,345,3,48,
178920,345,3,49,0,
17893345,3,50,0,345,
178943,51,0,345,3,
1789552,0,345,3,53,
178960,345,3,54,0,
17897345,3,55,0,345,
178983,56,0,345,3,
1789957,0,345,3,65,
179000,345,3,66,0,
17901345,3,67,0,345,
179023,68,0,345,3,
1790369,0,345,3,70,
179040,345,3,71,0,
17905345,3,72,0,345,
179063,73,0,345,3,
1790774,0,345,3,75,
179080,345,3,76,0,
17909345,3,77,0,345,
179103,78,0,345,3,
1791179,0,345,3,80,
179120,345,3,81,0,
17913345,3,82,0,345,
179143,83,0,345,3,
1791584,0,345,3,85,
179160,345,3,86,0,
17917345,3,87,0,345,
179183,88,0,345,3,
1791989,0,345,3,90,
179200,345,3,95,0,
17921345,3,97,0,345,
179223,98,0,345,3,
1792399,0,345,3,100,
179240,345,3,101,0,
17925345,3,102,0,345,
179263,103,0,345,3,
17927104,0,345,3,105,
179280,345,3,106,0,
17929345,3,107,0,345,
179303,108,0,345,1332,
1793111,1,867,0,348,
179321,-1,1333,11,1,
17933867,0,348,1,-1,
176063,118,0,345,3, 179343,118,0,345,3,
17607119,0,345,3,120, 17935119,0,345,3,120,
176080,345,3,121,0, 179360,345,3,121,0,
@@ -17646,20 +17974,8 @@ public class yyLSLTokens : YyLexer {
176463,105,0,345,3, 179743,105,0,345,3,
17647106,0,345,3,107, 17975106,0,345,3,107,
176480,345,3,108,0, 179760,345,3,108,0,
17649345,1306,11,1,845, 17977345,1334,11,1,867,
176500,348,1,-1,3, 179780,348,1,-1,3,
17651102,0,345,3,103,
176520,345,3,104,0,
17653345,3,105,0,345,
176543,106,0,345,3,
17655107,0,345,3,108,
176560,345,1307,11,1,
17657845,0,348,1,-1,
176583,110,0,345,3,
17659111,0,345,3,112,
176600,345,3,113,0,
17661345,3,114,0,345,
176623,115,0,345,3,
17663116,0,345,3,117, 17979116,0,345,3,117,
176640,345,3,118,0, 179800,345,3,118,0,
17665345,3,119,0,345, 17981345,3,119,0,345,
@@ -17704,179 +18020,15 @@ public class yyLSLTokens : YyLexer {
177040,345,3,105,0, 180200,345,3,105,0,
17705345,3,106,0,345, 18021345,3,106,0,345,
177063,107,0,345,3, 180223,107,0,345,3,
17707108,0,345,1308,11, 18023108,0,345,1335,11,
177081,845,0,348,1, 180241,867,0,348,1,
17709-1,3,106,0,345, 18025-1,3,102,0,345,
177103,107,0,345,3, 180263,103,0,345,3,
17711108,0,345,1309,11, 18027104,0,345,3,105,
177121,845,0,348,1, 180280,345,3,106,0,
17713-1,3,117,0,343, 18029345,3,107,0,345,
177143,118,0,1310,12, 180303,108,0,345,1336,
177151,19351,1311,5,63, 1803111,1,867,0,348,
177163,109,0,345,3,
17717110,0,345,3,111,
177180,345,3,112,0,
17719345,3,113,0,345,
177203,114,0,345,3,
17721115,0,345,3,116,
177220,345,3,117,0,
17723345,3,118,0,345,
177243,119,0,345,3,
17725120,0,345,3,121,
177260,345,3,122,0,
17727345,3,48,0,345,
177283,49,0,345,3,
1772950,0,345,3,51,
177300,345,3,52,0,
17731345,3,53,0,345,
177323,54,0,345,3,
1773355,0,345,3,56,
177340,345,3,57,0,
17735345,3,65,0,345,
177363,66,0,345,3,
1773767,0,345,3,68,
177380,345,3,69,0,
17739345,3,70,0,345,
177403,71,0,345,3,
1774172,0,345,3,73,
177420,345,3,74,0,
17743345,3,75,0,345,
177443,76,0,345,3,
1774577,0,345,3,78,
177460,345,3,79,0,
17747345,3,80,0,345,
177483,81,0,345,3,
1774982,0,345,3,83,
177500,345,3,84,0,
17751345,3,85,0,345,
177523,86,0,345,3,
1775387,0,345,3,88,
177540,345,3,89,0,
17755345,3,90,0,345,
177563,95,0,345,3,
1775797,0,345,3,98,
177580,345,3,99,0,
17759345,3,100,0,345,
177603,101,0,1312,12,
177611,19398,1313,5,63,
177623,109,0,345,3,
17763110,0,345,3,111,
177640,345,3,112,0,
17765345,3,113,0,345,
177663,114,0,345,3,
17767115,0,345,3,116,
177680,345,3,117,0,
17769345,3,118,0,345,
177703,119,0,345,3,
17771120,0,345,3,121,
177720,345,3,122,0,
17773345,3,48,0,345,
177743,49,0,345,3,
1777550,0,345,3,51,
177760,345,3,52,0,
17777345,3,53,0,345,
177783,54,0,345,3,
1777955,0,345,3,56,
177800,345,3,57,0,
17781345,3,65,0,345,
177823,66,0,345,3,
1778367,0,345,3,68,
177840,345,3,69,0,
17785345,3,70,0,345,
177863,71,0,345,3,
1778772,0,345,3,73,
177880,345,3,74,0,
17789345,3,75,0,345,
177903,76,0,345,3,
1779177,0,345,3,78,
177920,345,3,79,0,
17793345,3,80,0,345,
177943,81,0,345,3,
1779582,0,345,3,83,
177960,345,3,84,0,
17797345,3,85,0,345,
177983,86,0,345,3,
1779987,0,345,3,88,
178000,345,3,89,0,
17801345,3,90,0,345,
178023,95,0,345,3,
1780397,0,345,3,98,
178040,345,3,99,0,
178051314,12,1,19443,1315,
178065,63,3,109,0,
17807345,3,110,0,345,
178083,111,0,345,3,
17809112,0,345,3,113,
178100,345,3,114,0,
17811345,3,115,0,345,
178123,116,0,1316,12,
178131,19478,1317,5,63,
178143,109,0,345,3,
17815110,0,345,3,111,
178160,1318,12,1,19508,
178171319,5,63,3,109,
178180,345,3,110,0,
17819345,3,111,0,345,
178203,112,0,345,3,
17821113,0,345,3,114,
178220,1320,12,1,19541,
178231321,5,63,3,109,
178240,345,3,110,0,
17825345,3,111,0,345,
178263,112,0,345,3,
17827113,0,345,3,114,
178280,345,3,115,0,
17829345,3,116,0,345,
178303,117,0,345,3,
17831118,0,345,3,119,
178320,345,3,120,0,
17833345,3,121,0,345,
178343,122,0,345,3,
1783548,0,345,3,49,
178360,345,3,50,0,
17837345,3,51,0,345,
178383,52,0,345,3,
1783953,0,345,3,54,
178400,345,3,55,0,
17841345,3,56,0,345,
178423,57,0,345,3,
1784365,0,345,3,66,
178440,345,3,67,0,
17845345,3,68,0,345,
178463,69,0,345,3,
1784770,0,345,3,71,
178480,345,3,72,0,
17849345,3,73,0,345,
178503,74,0,345,3,
1785175,0,345,3,76,
178520,345,3,77,0,
17853345,3,78,0,345,
178543,79,0,345,3,
1785580,0,345,3,81,
178560,345,3,82,0,
17857345,3,83,0,345,
178583,84,0,345,3,
1785985,0,345,3,86,
178600,345,3,87,0,
17861345,3,88,0,345,
178623,89,0,345,3,
1786390,0,345,3,95,
178640,345,3,97,0,
17865345,3,98,0,345,
178663,99,0,345,3,
17867100,0,345,3,101,
178680,345,3,102,0,
17869345,3,103,0,345,
178703,104,0,345,3,
17871105,0,345,3,106,
178720,345,3,107,0,
17873345,3,108,0,345,
178741322,11,1,320,0,
178751323,4,22,86,0,
1787669,0,67,0,84,
178770,79,0,82,0,
1787895,0,84,0,89,
178790,80,0,69,0,
178801,-1,3,115,0, 180321,-1,3,115,0,
17881345,3,116,0,345, 18033345,3,116,0,345,
178823,117,0,345,3, 180343,117,0,345,3,
@@ -17923,8 +18075,20 @@ public class yyLSLTokens : YyLexer {
17923105,0,345,3,106, 18075105,0,345,3,106,
179240,345,3,107,0, 180760,345,3,107,0,
17925345,3,108,0,345, 18077345,3,108,0,345,
179261324,11,1,845,0, 180781337,11,1,867,0,
17927348,1,-1,3,112, 18079348,1,-1,3,97,
180800,345,3,98,0,
18081345,3,99,0,345,
180823,100,0,345,3,
18083101,0,345,3,102,
180840,345,3,103,0,
18085345,3,104,0,345,
180863,105,0,345,3,
18087106,0,345,3,107,
180880,345,3,108,0,
18089345,1338,11,1,867,
180900,348,1,-1,3,
18091111,0,345,3,112,
179280,345,3,113,0, 180920,345,3,113,0,
17929345,3,114,0,345, 18093345,3,114,0,345,
179303,115,0,345,3, 180943,115,0,345,3,
@@ -17972,9 +18136,13 @@ public class yyLSLTokens : YyLexer {
179720,345,3,105,0, 181360,345,3,105,0,
17973345,3,106,0,345, 18137345,3,106,0,345,
179743,107,0,345,3, 181383,107,0,345,3,
17975108,0,345,1325,11, 18139108,0,345,1339,11,
179761,845,0,348,1, 181401,867,0,348,1,
17977-1,3,117,0,345, 18141-1,3,112,0,345,
181423,113,0,345,3,
18143114,0,345,3,115,
181440,345,3,116,0,
18145345,3,117,0,345,
179783,118,0,345,3, 181463,118,0,345,3,
17979119,0,345,3,120, 18147119,0,345,3,120,
179800,345,3,121,0, 181480,345,3,121,0,
@@ -18018,8 +18186,68 @@ public class yyLSLTokens : YyLexer {
180183,105,0,345,3, 181863,105,0,345,3,
18019106,0,345,3,107, 18187106,0,345,3,107,
180200,345,3,108,0, 181880,345,3,108,0,
18021345,1326,11,1,845, 18189345,1340,11,1,867,
181900,348,1,-1,3,
18191106,0,345,3,107,
181920,345,3,108,0,
18193345,1341,11,1,867,
180220,348,1,-1,3, 181940,348,1,-1,3,
18195117,0,345,3,118,
181960,345,3,119,0,
18197345,3,120,0,345,
181983,121,0,345,3,
18199122,0,345,3,48,
182000,345,3,49,0,
18201345,3,50,0,345,
182023,51,0,345,3,
1820352,0,345,3,53,
182040,345,3,54,0,
18205345,3,55,0,345,
182063,56,0,345,3,
1820757,0,345,3,65,
182080,345,3,66,0,
18209345,3,67,0,345,
182103,68,0,345,3,
1821169,0,345,3,70,
182120,345,3,71,0,
18213345,3,72,0,345,
182143,73,0,345,3,
1821574,0,345,3,75,
182160,345,3,76,0,
18217345,3,77,0,345,
182183,78,0,345,3,
1821979,0,345,3,80,
182200,345,3,81,0,
18221345,3,82,0,345,
182223,83,0,345,3,
1822384,0,345,3,85,
182240,345,3,86,0,
18225345,3,87,0,345,
182263,88,0,345,3,
1822789,0,345,3,90,
182280,345,3,95,0,
18229345,3,97,0,345,
182303,98,0,345,3,
1823199,0,345,3,100,
182320,345,3,101,0,
18233345,3,102,0,345,
182343,103,0,345,3,
18235104,0,345,3,105,
182360,345,3,106,0,
18237345,3,107,0,345,
182383,108,0,345,1342,
1823911,1,867,0,348,
182401,-1,3,100,0,
18241345,3,101,0,345,
182423,102,0,345,3,
18243103,0,345,3,104,
182440,345,3,105,0,
18245345,3,106,0,345,
182463,107,0,345,3,
18247108,0,345,1343,11,
182481,867,0,348,1,
18249-1,3,98,0,345,
182503,99,0,345,3,
18023100,0,345,3,101, 18251100,0,345,3,101,
180240,345,3,102,0, 182520,345,3,102,0,
18025345,3,103,0,345, 18253345,3,103,0,345,
@@ -18027,65 +18255,213 @@ public class yyLSLTokens : YyLexer {
18027105,0,345,3,106, 18255105,0,345,3,106,
180280,345,3,107,0, 182560,345,3,107,0,
18029345,3,108,0,345, 18257345,3,108,0,345,
180301327,11,1,845,0, 182581344,11,1,867,0,
18031348,1,-1,3,102, 18259348,1,-1,3,116,
182600,345,3,117,0,
18261345,3,118,0,345,
182623,119,0,345,3,
18263120,0,345,3,121,
182640,345,3,122,0,
18265345,3,48,0,345,
182663,49,0,345,3,
1826750,0,345,3,51,
182680,345,3,52,0,
18269345,3,53,0,345,
182703,54,0,345,3,
1827155,0,345,3,56,
182720,345,3,57,0,
18273345,3,65,0,345,
182743,66,0,345,3,
1827567,0,345,3,68,
182760,345,3,69,0,
18277345,3,70,0,345,
182783,71,0,345,3,
1827972,0,345,3,73,
182800,345,3,74,0,
18281345,3,75,0,345,
182823,76,0,345,3,
1828377,0,345,3,78,
182840,345,3,79,0,
18285345,3,80,0,345,
182863,81,0,345,3,
1828782,0,345,3,83,
182880,345,3,84,0,
18289345,3,85,0,345,
182903,86,0,345,3,
1829187,0,345,3,88,
182920,345,3,89,0,
18293345,3,90,0,345,
182943,95,0,345,3,
1829597,0,345,3,98,
182960,345,3,99,0,
18297345,3,100,0,345,
182983,101,0,345,3,
18299102,0,345,3,103,
183000,345,3,104,0,
18301345,3,105,0,345,
183023,106,0,345,3,
18303107,0,345,3,108,
183040,345,1345,11,1,
18305867,0,348,1,-1,
183063,111,0,345,3,
18307112,0,345,3,113,
183080,345,3,114,0,
18309345,3,115,0,345,
183103,116,0,345,3,
18311117,0,345,3,118,
183120,345,3,119,0,
18313345,3,120,0,345,
183143,121,0,345,3,
18315122,0,345,3,48,
183160,345,3,49,0,
18317345,3,50,0,345,
183183,51,0,345,3,
1831952,0,345,3,53,
183200,345,3,54,0,
18321345,3,55,0,345,
183223,56,0,345,3,
1832357,0,345,3,65,
183240,345,3,66,0,
18325345,3,67,0,345,
183263,68,0,345,3,
1832769,0,345,3,70,
183280,345,3,71,0,
18329345,3,72,0,345,
183303,73,0,345,3,
1833174,0,345,3,75,
183320,345,3,76,0,
18333345,3,77,0,345,
183343,78,0,345,3,
1833579,0,345,3,80,
183360,345,3,81,0,
18337345,3,82,0,345,
183383,83,0,345,3,
1833984,0,345,3,85,
183400,345,3,86,0,
18341345,3,87,0,345,
183423,88,0,345,3,
1834389,0,345,3,90,
183440,345,3,95,0,
18345345,3,97,0,345,
183463,98,0,345,3,
1834799,0,345,3,100,
183480,345,3,101,0,
18349345,3,102,0,345,
183503,103,0,345,3,
18351104,0,345,3,105,
183520,345,3,106,0,
18353345,3,107,0,345,
183543,108,0,345,1346,
1835511,1,867,0,348,
183561,-1,3,98,0,
18357345,3,99,0,345,
183583,100,0,345,3,
18359101,0,345,3,102,
180320,345,3,103,0, 183600,345,3,103,0,
18033345,3,104,0,345, 18361345,3,104,0,345,
180343,105,0,345,3, 183623,105,0,345,3,
18035106,0,345,3,107, 18363106,0,345,3,107,
180360,345,3,108,0, 183640,345,3,108,0,
18037345,1328,11,1,845, 18365345,1347,11,1,867,
180380,348,1,-1,3, 183660,348,1,-1,3,
18039119,0,1329,12,1, 18367115,0,345,3,116,
1804020072,1330,5,63,3, 183680,345,3,117,0,
18041109,0,345,3,110, 18369345,3,118,0,345,
180420,345,3,111,0, 183703,119,0,345,3,
18043345,3,112,0,345, 18371120,0,345,3,121,
180443,113,0,345,3, 183720,345,3,122,0,
18045114,0,345,3,115, 18373345,3,48,0,345,
180460,345,3,116,0, 183743,49,0,345,3,
18047345,3,117,0,345, 1837550,0,345,3,51,
180483,118,0,345,3, 183760,345,3,52,0,
18049119,0,345,3,120, 18377345,3,53,0,345,
180500,345,3,121,0, 183783,54,0,345,3,
18051345,3,122,0,345, 1837955,0,345,3,56,
180523,48,0,345,3, 183800,345,3,57,0,
1805349,0,345,3,50, 18381345,3,65,0,345,
180540,345,3,51,0, 183823,66,0,345,3,
18055345,3,52,0,345, 1838367,0,345,3,68,
180563,53,0,345,3, 183840,345,3,69,0,
1805754,0,345,3,55, 18385345,3,70,0,345,
180580,345,3,56,0, 183863,71,0,345,3,
18059345,3,57,0,345, 1838772,0,345,3,73,
180603,65,0,345,3, 183880,345,3,74,0,
1806166,0,345,3,67, 18389345,3,75,0,345,
180620,345,3,68,0, 183903,76,0,345,3,
18063345,3,69,0,345, 1839177,0,345,3,78,
180643,70,0,345,3, 183920,345,3,79,0,
1806571,0,345,3,72, 18393345,3,80,0,345,
180660,345,3,73,0, 183943,81,0,345,3,
18067345,3,74,0,345, 1839582,0,345,3,83,
180683,75,0,345,3, 183960,345,3,84,0,
1806976,0,345,3,77, 18397345,3,85,0,345,
180700,345,3,78,0, 183983,86,0,345,3,
18071345,3,79,0,345, 1839987,0,345,3,88,
180723,80,0,345,3, 184000,345,3,89,0,
1807381,0,345,3,82, 18401345,3,90,0,345,
180740,345,3,83,0, 184023,95,0,345,3,
18075345,3,84,0,345, 1840397,0,345,3,98,
180763,85,0,345,3, 184040,345,3,99,0,
1807786,0,345,3,87, 18405345,3,100,0,345,
180780,345,3,88,0, 184063,101,0,345,3,
18079345,3,89,0,345, 18407102,0,345,3,103,
180803,90,0,345,3, 184080,345,3,104,0,
1808195,0,345,3,97, 18409345,3,105,0,1348,
180820,345,3,98,0, 1841012,1,20862,1349,5,
18083345,3,99,0,345, 1841163,3,109,0,1350,
180843,100,0,345,3, 1841212,1,20890,1351,5,
18085101,0,345,3,102, 1841363,3,109,0,345,
180860,345,3,103,0, 184143,110,0,345,3,
18087345,3,104,0,1331, 18415111,0,345,3,112,
1808812,1,20122,1332,5, 184160,345,3,113,0,
18417345,3,114,0,345,
184183,115,0,345,3,
18419116,0,345,3,117,
184200,345,3,118,0,
18421345,3,119,0,345,
184223,120,0,345,3,
18423121,0,345,3,122,
184240,345,3,48,0,
18425345,3,49,0,345,
184263,50,0,345,3,
1842751,0,345,3,52,
184280,345,3,53,0,
18429345,3,54,0,345,
184303,55,0,345,3,
1843156,0,345,3,57,
184320,345,3,65,0,
18433345,3,66,0,345,
184343,67,0,345,3,
1843568,0,345,3,69,
184360,345,3,70,0,
18437345,3,71,0,345,
184383,72,0,345,3,
1843973,0,345,3,74,
184400,345,3,75,0,
18441345,3,76,0,345,
184423,77,0,345,3,
1844378,0,345,3,79,
184440,345,3,80,0,
18445345,3,81,0,345,
184463,82,0,345,3,
1844783,0,345,3,84,
184480,345,3,85,0,
18449345,3,86,0,345,
184503,87,0,345,3,
1845188,0,345,3,89,
184520,345,3,90,0,
18453345,3,95,0,345,
184543,97,0,345,3,
1845598,0,345,3,99,
184560,345,3,100,0,
18457345,3,101,0,1352,
1845812,1,20937,1353,5,
1845963,3,109,0,345,
184603,110,0,345,3,
18461111,0,345,3,112,
184620,345,3,113,0,
18463345,3,114,0,1354,
1846412,1,20970,1355,5,
1808963,3,109,0,345, 1846563,3,109,0,345,
180903,110,0,345,3, 184663,110,0,345,3,
18091111,0,345,3,112, 18467111,0,345,3,112,
@@ -18134,7 +18510,127 @@ public class yyLSLTokens : YyLexer {
181343,102,0,345,3, 185103,102,0,345,3,
18135103,0,345,3,104, 18511103,0,345,3,104,
181360,345,3,105,0, 185120,345,3,105,0,
181371333,12,1,20173,1334, 18513345,3,106,0,345,
185143,107,0,345,3,
18515108,0,345,1356,11,
185161,783,0,1357,4,
1851722,84,0,73,0,
1851877,0,69,0,82,
185190,95,0,69,0,
1852086,0,69,0,78,
185210,84,0,1,-1,
185223,115,0,345,3,
18523116,0,345,3,117,
185240,345,3,118,0,
18525345,3,119,0,345,
185263,120,0,345,3,
18527121,0,345,3,122,
185280,345,3,48,0,
18529345,3,49,0,345,
185303,50,0,345,3,
1853151,0,345,3,52,
185320,345,3,53,0,
18533345,3,54,0,345,
185343,55,0,345,3,
1853556,0,345,3,57,
185360,345,3,65,0,
18537345,3,66,0,345,
185383,67,0,345,3,
1853968,0,345,3,69,
185400,345,3,70,0,
18541345,3,71,0,345,
185423,72,0,345,3,
1854373,0,345,3,74,
185440,345,3,75,0,
18545345,3,76,0,345,
185463,77,0,345,3,
1854778,0,345,3,79,
185480,345,3,80,0,
18549345,3,81,0,345,
185503,82,0,345,3,
1855183,0,345,3,84,
185520,345,3,85,0,
18553345,3,86,0,345,
185543,87,0,345,3,
1855588,0,345,3,89,
185560,345,3,90,0,
18557345,3,95,0,345,
185583,97,0,345,3,
1855998,0,345,3,99,
185600,345,3,100,0,
18561345,3,101,0,345,
185623,102,0,345,3,
18563103,0,345,3,104,
185640,345,3,105,0,
18565345,3,106,0,345,
185663,107,0,345,3,
18567108,0,345,1358,11,
185681,867,0,348,1,
18569-1,3,102,0,345,
185703,103,0,345,3,
18571104,0,345,3,105,
185720,345,3,106,0,
18573345,3,107,0,345,
185743,108,0,345,1359,
1857511,1,867,0,348,
185761,-1,3,110,0,
18577345,3,111,0,345,
185783,112,0,345,3,
18579113,0,345,3,114,
185800,345,3,115,0,
18581345,3,116,0,345,
185823,117,0,345,3,
18583118,0,345,3,119,
185840,345,3,120,0,
18585345,3,121,0,345,
185863,122,0,345,3,
1858748,0,345,3,49,
185880,345,3,50,0,
18589345,3,51,0,345,
185903,52,0,345,3,
1859153,0,345,3,54,
185920,345,3,55,0,
18593345,3,56,0,345,
185943,57,0,345,3,
1859565,0,345,3,66,
185960,345,3,67,0,
18597345,3,68,0,345,
185983,69,0,345,3,
1859970,0,345,3,71,
186000,345,3,72,0,
18601345,3,73,0,345,
186023,74,0,345,3,
1860375,0,345,3,76,
186040,345,3,77,0,
18605345,3,78,0,345,
186063,79,0,345,3,
1860780,0,345,3,81,
186080,345,3,82,0,
18609345,3,83,0,345,
186103,84,0,345,3,
1861185,0,345,3,86,
186120,345,3,87,0,
18613345,3,88,0,345,
186143,89,0,345,3,
1861590,0,345,3,95,
186160,345,3,97,0,
18617345,3,98,0,345,
186183,99,0,345,3,
18619100,0,345,3,101,
186200,345,3,102,0,
18621345,3,103,0,345,
186223,104,0,345,3,
18623105,0,345,3,106,
186240,345,3,107,0,
18625345,3,108,0,345,
186261360,11,1,867,0,
18627348,1,-1,3,106,
186280,345,3,107,0,
18629345,3,108,0,345,
186301361,11,1,867,0,
18631348,1,-1,3,117,
186320,343,3,118,0,
186331362,12,1,21413,1363,
181385,63,3,109,0, 186345,63,3,109,0,
18139345,3,110,0,345, 18635345,3,110,0,345,
181403,111,0,345,3, 186363,111,0,345,3,
@@ -18180,13 +18676,69 @@ public class yyLSLTokens : YyLexer {
181803,98,0,345,3, 186763,98,0,345,3,
1818199,0,345,3,100, 1867799,0,345,3,100,
181820,345,3,101,0, 186780,345,3,101,0,
18183345,3,102,0,345, 186791364,12,1,21460,1365,
181843,103,0,345,3, 186805,63,3,109,0,
18185104,0,345,3,105, 18681345,3,110,0,345,
181860,345,3,106,0, 186823,111,0,345,3,
18187345,3,107,0,345, 18683112,0,345,3,113,
181883,108,0,1335,12, 186840,345,3,114,0,
181891,20227,1336,5,63, 18685345,3,115,0,345,
186863,116,0,345,3,
18687117,0,345,3,118,
186880,345,3,119,0,
18689345,3,120,0,345,
186903,121,0,345,3,
18691122,0,345,3,48,
186920,345,3,49,0,
18693345,3,50,0,345,
186943,51,0,345,3,
1869552,0,345,3,53,
186960,345,3,54,0,
18697345,3,55,0,345,
186983,56,0,345,3,
1869957,0,345,3,65,
187000,345,3,66,0,
18701345,3,67,0,345,
187023,68,0,345,3,
1870369,0,345,3,70,
187040,345,3,71,0,
18705345,3,72,0,345,
187063,73,0,345,3,
1870774,0,345,3,75,
187080,345,3,76,0,
18709345,3,77,0,345,
187103,78,0,345,3,
1871179,0,345,3,80,
187120,345,3,81,0,
18713345,3,82,0,345,
187143,83,0,345,3,
1871584,0,345,3,85,
187160,345,3,86,0,
18717345,3,87,0,345,
187183,88,0,345,3,
1871989,0,345,3,90,
187200,345,3,95,0,
18721345,3,97,0,345,
187223,98,0,345,3,
1872399,0,1366,12,1,
1872421505,1367,5,63,3,
18725109,0,345,3,110,
187260,345,3,111,0,
18727345,3,112,0,345,
187283,113,0,345,3,
18729114,0,345,3,115,
187300,345,3,116,0,
187311368,12,1,21540,1369,
187325,63,3,109,0,
18733345,3,110,0,345,
187343,111,0,1370,12,
187351,21570,1371,5,63,
187363,109,0,345,3,
18737110,0,345,3,111,
187380,345,3,112,0,
18739345,3,113,0,345,
187403,114,0,1372,12,
187411,21603,1373,5,63,
181903,109,0,345,3, 187423,109,0,345,3,
18191110,0,345,3,111, 18743110,0,345,3,111,
181920,345,3,112,0, 187440,345,3,112,0,
@@ -18231,13 +18783,19 @@ public class yyLSLTokens : YyLexer {
1823197,0,345,3,98, 1878397,0,345,3,98,
182320,345,3,99,0, 187840,345,3,99,0,
18233345,3,100,0,345, 18785345,3,100,0,345,
182343,101,0,1337,12, 187863,101,0,345,3,
182351,20274,1338,5,63, 18787102,0,345,3,103,
182363,109,0,345,3, 187880,345,3,104,0,
18237110,0,345,3,111, 18789345,3,105,0,345,
182380,345,3,112,0, 187903,106,0,345,3,
18239345,3,113,0,345, 18791107,0,345,3,108,
182403,114,0,345,3, 187920,345,1374,11,1,
18793320,0,1375,4,22,
1879486,0,69,0,67,
187950,84,0,79,0,
1879682,0,95,0,84,
187970,89,0,80,0,
1879869,0,1,-1,3,
18241115,0,345,3,116, 18799115,0,345,3,116,
182420,345,3,117,0, 188000,345,3,117,0,
18243345,3,118,0,345, 18801345,3,118,0,345,
@@ -18283,315 +18841,676 @@ public class yyLSLTokens : YyLexer {
18283345,3,105,0,345, 18841345,3,105,0,345,
182843,106,0,345,3, 188423,106,0,345,3,
18285107,0,345,3,108, 18843107,0,345,3,108,
182860,345,1339,11,1, 188440,345,1376,11,1,
18287229,0,1340,4,10, 18845867,0,348,1,-1,
1828887,0,72,0,73, 188463,112,0,345,3,
182890,76,0,69,0, 18847113,0,345,3,114,
182901,-1,3,102,0, 188480,345,3,115,0,
18849345,3,116,0,345,
188503,117,0,345,3,
18851118,0,345,3,119,
188520,345,3,120,0,
18853345,3,121,0,345,
188543,122,0,345,3,
1885548,0,345,3,49,
188560,345,3,50,0,
18857345,3,51,0,345,
188583,52,0,345,3,
1885953,0,345,3,54,
188600,345,3,55,0,
18861345,3,56,0,345,
188623,57,0,345,3,
1886365,0,345,3,66,
188640,345,3,67,0,
18865345,3,68,0,345,
188663,69,0,345,3,
1886770,0,345,3,71,
188680,345,3,72,0,
18869345,3,73,0,345,
188703,74,0,345,3,
1887175,0,345,3,76,
188720,345,3,77,0,
18873345,3,78,0,345,
188743,79,0,345,3,
1887580,0,345,3,81,
188760,345,3,82,0,
18877345,3,83,0,345,
188783,84,0,345,3,
1887985,0,345,3,86,
188800,345,3,87,0,
18881345,3,88,0,345,
188823,89,0,345,3,
1888390,0,345,3,95,
188840,345,3,97,0,
18885345,3,98,0,345,
188863,99,0,345,3,
18887100,0,345,3,101,
188880,345,3,102,0,
18291345,3,103,0,345, 18889345,3,103,0,345,
182923,104,0,345,3, 188903,104,0,345,3,
18293105,0,345,3,106, 18891105,0,345,3,106,
182940,345,3,107,0, 188920,345,3,107,0,
18295345,3,108,0,345, 18893345,3,108,0,345,
182961341,11,1,845,0, 188941377,11,1,867,0,
18297348,1,-1,1342,11, 18895348,1,-1,3,117,
182981,845,0,348,1, 188960,345,3,118,0,
18299-1,3,106,0,345, 18897345,3,119,0,345,
188983,120,0,345,3,
18899121,0,345,3,122,
189000,345,3,48,0,
18901345,3,49,0,345,
189023,50,0,345,3,
1890351,0,345,3,52,
189040,345,3,53,0,
18905345,3,54,0,345,
189063,55,0,345,3,
1890756,0,345,3,57,
189080,345,3,65,0,
18909345,3,66,0,345,
189103,67,0,345,3,
1891168,0,345,3,69,
189120,345,3,70,0,
18913345,3,71,0,345,
189143,72,0,345,3,
1891573,0,345,3,74,
189160,345,3,75,0,
18917345,3,76,0,345,
189183,77,0,345,3,
1891978,0,345,3,79,
189200,345,3,80,0,
18921345,3,81,0,345,
189223,82,0,345,3,
1892383,0,345,3,84,
189240,345,3,85,0,
18925345,3,86,0,345,
189263,87,0,345,3,
1892788,0,345,3,89,
189280,345,3,90,0,
18929345,3,95,0,345,
189303,97,0,345,3,
1893198,0,345,3,99,
189320,345,3,100,0,
18933345,3,101,0,345,
189343,102,0,345,3,
18935103,0,345,3,104,
189360,345,3,105,0,
18937345,3,106,0,345,
183003,107,0,345,3, 189383,107,0,345,3,
18301108,0,345,1343,11, 18939108,0,345,1378,11,
183021,845,0,348,1, 189401,867,0,348,1,
18303-1,3,105,0,345, 18941-1,3,100,0,345,
189423,101,0,345,3,
18943102,0,345,3,103,
189440,345,3,104,0,
18945345,3,105,0,345,
183043,106,0,345,3, 189463,106,0,345,3,
18305107,0,345,3,108, 18947107,0,345,3,108,
183060,345,1344,11,1, 189480,345,1379,11,1,
18307845,0,348,1,-1, 18949867,0,348,1,-1,
183083,120,0,343,3, 189503,102,0,345,3,
18309121,0,343,3,122, 18951103,0,345,3,104,
183100,343,3,123,0, 189520,345,3,105,0,
183111345,12,1,41003,1346, 18953345,3,106,0,345,
183125,0,1347,11,1, 189543,107,0,345,3,
1831351,0,1348,4,20, 18955108,0,345,1380,11,
1831476,0,69,0,70, 189561,867,0,348,1,
183150,84,0,95,0, 18957-1,3,119,0,1381,
1831666,0,82,0,65, 1895812,1,22134,1382,5,
183170,67,0,69,0, 1895963,3,109,0,345,
183181,-1,3,124,0, 189603,110,0,345,3,
183191349,12,1,43906,1350, 18961111,0,345,3,112,
183205,1,3,124,0, 189620,345,3,113,0,
183211351,12,1,44018,1352, 18963345,3,114,0,345,
183225,0,1353,11,1, 189643,115,0,345,3,
18323191,0,1354,4,26, 18965116,0,345,3,117,
1832483,0,84,0,82, 189660,345,3,118,0,
183250,79,0,75,0, 18967345,3,119,0,345,
1832669,0,95,0,83, 189683,120,0,345,3,
183270,84,0,82,0, 18969121,0,345,3,122,
1832879,0,75,0,69, 189700,345,3,48,0,
183290,1,-1,1355,11, 18971345,3,49,0,345,
183301,165,0,1356,4, 189723,50,0,345,3,
1833112,83,0,84,0, 1897351,0,345,3,52,
189740,345,3,53,0,
18975345,3,54,0,345,
189763,55,0,345,3,
1897756,0,345,3,57,
189780,345,3,65,0,
18979345,3,66,0,345,
189803,67,0,345,3,
1898168,0,345,3,69,
189820,345,3,70,0,
18983345,3,71,0,345,
189843,72,0,345,3,
1898573,0,345,3,74,
189860,345,3,75,0,
18987345,3,76,0,345,
189883,77,0,345,3,
1898978,0,345,3,79,
189900,345,3,80,0,
18991345,3,81,0,345,
189923,82,0,345,3,
1899383,0,345,3,84,
189940,345,3,85,0,
18995345,3,86,0,345,
189963,87,0,345,3,
1899788,0,345,3,89,
189980,345,3,90,0,
18999345,3,95,0,345,
190003,97,0,345,3,
1900198,0,345,3,99,
190020,345,3,100,0,
19003345,3,101,0,345,
190043,102,0,345,3,
19005103,0,345,3,104,
190060,1383,12,1,22184,
190071384,5,63,3,109,
190080,345,3,110,0,
19009345,3,111,0,345,
190103,112,0,345,3,
19011113,0,345,3,114,
190120,345,3,115,0,
19013345,3,116,0,345,
190143,117,0,345,3,
19015118,0,345,3,119,
190160,345,3,120,0,
19017345,3,121,0,345,
190183,122,0,345,3,
1901948,0,345,3,49,
190200,345,3,50,0,
19021345,3,51,0,345,
190223,52,0,345,3,
1902353,0,345,3,54,
190240,345,3,55,0,
19025345,3,56,0,345,
190263,57,0,345,3,
1902765,0,345,3,66,
190280,345,3,67,0,
19029345,3,68,0,345,
190303,69,0,345,3,
1903170,0,345,3,71,
190320,345,3,72,0,
19033345,3,73,0,345,
190343,74,0,345,3,
1903575,0,345,3,76,
190360,345,3,77,0,
19037345,3,78,0,345,
190383,79,0,345,3,
1903980,0,345,3,81,
190400,345,3,82,0,
19041345,3,83,0,345,
190423,84,0,345,3,
1904385,0,345,3,86,
190440,345,3,87,0,
19045345,3,88,0,345,
190463,89,0,345,3,
1904790,0,345,3,95,
190480,345,3,97,0,
19049345,3,98,0,345,
190503,99,0,345,3,
19051100,0,345,3,101,
190520,345,3,102,0,
19053345,3,103,0,345,
190543,104,0,345,3,
19055105,0,1385,12,1,
1905622235,1386,5,63,3,
19057109,0,345,3,110,
190580,345,3,111,0,
19059345,3,112,0,345,
190603,113,0,345,3,
19061114,0,345,3,115,
190620,345,3,116,0,
19063345,3,117,0,345,
190643,118,0,345,3,
19065119,0,345,3,120,
190660,345,3,121,0,
19067345,3,122,0,345,
190683,48,0,345,3,
1906949,0,345,3,50,
190700,345,3,51,0,
19071345,3,52,0,345,
190723,53,0,345,3,
1907354,0,345,3,55,
190740,345,3,56,0,
19075345,3,57,0,345,
190763,65,0,345,3,
1907766,0,345,3,67,
190780,345,3,68,0,
19079345,3,69,0,345,
190803,70,0,345,3,
1908171,0,345,3,72,
190820,345,3,73,0,
19083345,3,74,0,345,
190843,75,0,345,3,
1908576,0,345,3,77,
190860,345,3,78,0,
19087345,3,79,0,345,
190883,80,0,345,3,
1908981,0,345,3,82,
190900,345,3,83,0,
19091345,3,84,0,345,
190923,85,0,345,3,
1909386,0,345,3,87,
190940,345,3,88,0,
19095345,3,89,0,345,
190963,90,0,345,3,
1909795,0,345,3,97,
190980,345,3,98,0,
19099345,3,99,0,345,
191003,100,0,345,3,
19101101,0,345,3,102,
191020,345,3,103,0,
19103345,3,104,0,345,
191043,105,0,345,3,
19105106,0,345,3,107,
191060,345,3,108,0,
191071387,12,1,22289,1388,
191085,63,3,109,0,
19109345,3,110,0,345,
191103,111,0,345,3,
19111112,0,345,3,113,
191120,345,3,114,0,
19113345,3,115,0,345,
191143,116,0,345,3,
19115117,0,345,3,118,
191160,345,3,119,0,
19117345,3,120,0,345,
191183,121,0,345,3,
19119122,0,345,3,48,
191200,345,3,49,0,
19121345,3,50,0,345,
191223,51,0,345,3,
1912352,0,345,3,53,
191240,345,3,54,0,
19125345,3,55,0,345,
191263,56,0,345,3,
1912757,0,345,3,65,
191280,345,3,66,0,
19129345,3,67,0,345,
191303,68,0,345,3,
1913169,0,345,3,70,
191320,345,3,71,0,
19133345,3,72,0,345,
191343,73,0,345,3,
1913574,0,345,3,75,
191360,345,3,76,0,
19137345,3,77,0,345,
191383,78,0,345,3,
1913979,0,345,3,80,
191400,345,3,81,0,
19141345,3,82,0,345,
191423,83,0,345,3,
1914384,0,345,3,85,
191440,345,3,86,0,
19145345,3,87,0,345,
191463,88,0,345,3,
1914789,0,345,3,90,
191480,345,3,95,0,
19149345,3,97,0,345,
191503,98,0,345,3,
1915199,0,345,3,100,
191520,345,3,101,0,
191531389,12,1,22336,1390,
191545,63,3,109,0,
19155345,3,110,0,345,
191563,111,0,345,3,
19157112,0,345,3,113,
191580,345,3,114,0,
19159345,3,115,0,345,
191603,116,0,345,3,
19161117,0,345,3,118,
191620,345,3,119,0,
19163345,3,120,0,345,
191643,121,0,345,3,
19165122,0,345,3,48,
191660,345,3,49,0,
19167345,3,50,0,345,
191683,51,0,345,3,
1916952,0,345,3,53,
191700,345,3,54,0,
19171345,3,55,0,345,
191723,56,0,345,3,
1917357,0,345,3,65,
191740,345,3,66,0,
19175345,3,67,0,345,
191763,68,0,345,3,
1917769,0,345,3,70,
191780,345,3,71,0,
19179345,3,72,0,345,
191803,73,0,345,3,
1918174,0,345,3,75,
191820,345,3,76,0,
19183345,3,77,0,345,
191843,78,0,345,3,
1918579,0,345,3,80,
191860,345,3,81,0,
19187345,3,82,0,345,
191883,83,0,345,3,
1918984,0,345,3,85,
191900,345,3,86,0,
19191345,3,87,0,345,
191923,88,0,345,3,
1919389,0,345,3,90,
191940,345,3,95,0,
19195345,3,97,0,345,
191963,98,0,345,3,
1919799,0,345,3,100,
191980,345,3,101,0,
19199345,3,102,0,345,
192003,103,0,345,3,
19201104,0,345,3,105,
192020,345,3,106,0,
19203345,3,107,0,345,
192043,108,0,345,1391,
1920511,1,229,0,1392,
192064,10,87,0,72,
192070,73,0,76,0,
1920869,0,1,-1,3,
19209102,0,345,3,103,
192100,345,3,104,0,
19211345,3,105,0,345,
192123,106,0,345,3,
19213107,0,345,3,108,
192140,345,1393,11,1,
19215867,0,348,1,-1,
192161394,11,1,867,0,
19217348,1,-1,3,106,
192180,345,3,107,0,
19219345,3,108,0,345,
192201395,11,1,867,0,
19221348,1,-1,3,105,
192220,345,3,106,0,
19223345,3,107,0,345,
192243,108,0,345,1396,
1922511,1,867,0,348,
192261,-1,3,120,0,
19227343,3,121,0,343,
192283,122,0,343,3,
19229123,0,1397,12,1,
1923043065,1398,5,0,1399,
1923111,1,51,0,1400,
192324,20,76,0,69,
192330,70,0,84,0,
1923495,0,66,0,82,
192350,65,0,67,0,
1923669,0,1,-1,3,
19237124,0,1401,12,1,
1923845968,1402,5,1,3,
19239124,0,1403,12,1,
1924046080,1404,5,0,1405,
1924111,1,191,0,1406,
192424,26,83,0,84,
192430,82,0,79,0,
1924475,0,69,0,95,
192450,83,0,84,0,
1833282,0,79,0,75, 1924682,0,79,0,75,
183330,69,0,1,-1, 192470,69,0,1,-1,
183343,125,0,1357,12, 192481407,11,1,165,0,
183351,41368,1358,5,0, 192491408,4,12,83,0,
183361359,11,1,56,0, 1925084,0,82,0,79,
183371360,4,22,82,0, 192510,75,0,69,0,
1833873,0,71,0,72, 192521,-1,3,125,0,
183390,84,0,95,0, 192531409,12,1,43430,1410,
1834066,0,82,0,65, 192545,0,1411,11,1,
183410,67,0,69,0, 1925556,0,1412,4,22,
183421,-1,3,126,0, 1925682,0,73,0,71,
183431361,12,1,44147,1362, 192570,72,0,84,0,
183445,0,1363,11,1, 1925895,0,66,0,82,
18345175,0,1364,4,10, 192590,65,0,67,0,
1834684,0,73,0,76, 1926069,0,1,-1,3,
183470,68,0,69,0, 19261126,0,1413,12,1,
183481,-1,0,165,1, 1926246209,1414,5,0,1415,
18349-1,1365,4,12,83, 1926311,1,175,0,1416,
183500,84,0,82,0, 192644,10,84,0,73,
1835173,0,78,0,71, 192650,76,0,68,0,
183520,1366,12,1,45715, 1926669,0,1,-1,0,
183531367,5,119,3,1, 19267165,1,-1,1417,4,
183540,1368,12,1,45716, 1926812,83,0,84,0,
183551369,5,0,1370,11, 1926982,0,73,0,78,
183561,946,0,165,1, 192700,71,0,1418,12,
18357-1,3,9,0,1368, 192711,47777,1419,5,119,
183583,10,0,1371,12, 192723,1,0,1420,12,
183591,45917,1372,5,0, 192731,47778,1421,5,0,
183601373,11,1,952,0, 192741422,11,1,968,0,
18361165,1,-1,3,13, 19275165,1,-1,3,9,
183620,1368,3,0,3, 192760,1420,3,10,0,
183631368,3,96,33,1368, 192771423,12,1,47979,1424,
183643,32,0,1368,3, 192785,0,1425,11,1,
1836533,0,1368,3,34, 19279974,0,165,1,-1,
183660,1374,12,1,46664, 192803,13,0,1420,3,
183671375,5,0,1376,11, 192810,3,1420,3,0,
183681,1010,0,165,1, 192826,1420,3,32,0,
18369-1,3,35,0,1368, 192831420,3,33,0,1420,
183703,36,0,1368,3, 192843,34,0,1426,12,
1837137,0,1368,3,38, 192851,48726,1427,5,0,
183720,1368,3,40,0, 192861428,11,1,1032,0,
183731368,3,41,0,1368, 19287165,1,-1,3,35,
183743,42,0,1368,3, 192880,1420,3,36,0,
1837543,0,1368,3,44, 192891420,3,37,0,1420,
183760,1368,3,45,0, 192903,38,0,1420,3,
183771368,3,46,0,1368, 1929140,0,1420,3,41,
183783,47,0,1368,3, 192920,1420,3,42,0,
183793,9,1368,3,49, 192931420,3,43,0,1420,
183800,1368,3,50,0, 192943,44,0,1420,3,
183811368,3,48,0,1368, 1929545,0,1420,3,46,
183823,52,0,1368,3, 192960,1420,3,47,0,
1838353,0,1368,3,51, 192971420,3,3,9,1420,
183840,1368,3,55,0, 192983,49,0,1420,3,
183851368,3,56,0,1368, 1929950,0,1420,3,48,
183863,54,0,1368,3, 193000,1420,3,52,0,
1838759,0,1368,3,57, 193011420,3,53,0,1420,
183880,1368,3,61,0, 193023,51,0,1420,3,
183891368,3,62,0,1368, 1930355,0,1420,3,56,
183903,60,0,1368,3, 193040,1420,3,54,0,
1839164,0,1368,3,65, 193051420,3,59,0,1420,
183920,1368,3,66,0, 193063,57,0,1420,3,
183931368,3,67,0,1368, 1930761,0,1420,3,62,
183943,68,0,1368,3, 193080,1420,3,60,0,
1839569,0,1368,3,70, 193091420,3,64,0,1420,
183960,1368,3,71,0, 193103,65,0,1420,3,
183971368,3,72,0,1368, 1931166,0,1420,3,67,
183983,73,0,1368,3, 193120,1420,3,68,0,
1839974,0,1368,3,75, 193131420,3,69,0,1420,
184000,1368,3,76,0, 193143,70,0,1420,3,
184011368,3,77,0,1368, 1931571,0,1420,3,72,
184023,78,0,1368,3, 193160,1420,3,73,0,
1840379,0,1368,3,80, 193171420,3,74,0,1420,
184040,1368,3,81,0, 193183,75,0,1420,3,
184051368,3,82,0,1368, 1931976,0,1420,3,77,
184063,83,0,1368,3, 193200,1420,3,78,0,
1840784,0,1368,3,85, 193211420,3,79,0,1420,
184080,1368,3,86,0, 193223,80,0,1420,3,
184091368,3,87,0,1368, 1932381,0,1420,3,82,
184103,88,0,1368,3, 193240,1420,3,83,0,
1841189,0,1368,3,90, 193251420,3,84,0,1420,
184120,1368,3,91,0, 193263,85,0,1420,3,
184131368,3,92,0,1377, 1932786,0,1420,3,87,
1841412,1,46060,1378,5, 193280,1420,3,88,0,
184154,3,110,0,1379, 193291420,3,89,0,1420,
1841612,1,46089,1380,5, 193303,90,0,1420,3,
184170,1381,11,1,957, 1933191,0,1420,3,92,
193320,1429,12,1,48122,
193331430,5,4,3,110,
193340,1431,12,1,48151,
193351432,5,0,1433,11,
193361,979,0,165,1,
19337-1,3,34,0,1434,
1933812,1,48591,1435,5,
193390,1436,11,1,1003,
184180,165,1,-1,3, 193400,165,1,-1,3,
1841934,0,1382,12,1, 1934192,0,1437,12,1,
1842046529,1383,5,0,1384, 1934248467,1438,5,0,1439,
1842111,1,981,0,165, 1934311,1,1015,0,165,
184221,-1,3,92,0, 193441,-1,3,116,0,
184231385,12,1,46405,1386, 193451440,12,1,48277,1441,
184245,0,1387,11,1, 193465,0,1442,11,1,
18425993,0,165,1,-1, 19347991,0,165,1,-1,
184263,116,0,1388,12, 193481443,11,1,1027,0,
184271,46215,1389,5,0, 19349165,1,-1,3,93,
184281390,11,1,969,0, 193500,1420,3,94,0,
18429165,1,-1,1391,11, 193511420,3,95,0,1420,
184301,1005,0,165,1, 193523,96,0,1420,3,
18431-1,3,93,0,1368, 19353238,22,1420,3,98,
184323,94,0,1368,3, 193540,1420,3,99,0,
1843395,0,1368,3,96, 193551420,3,100,0,1420,
184340,1368,3,97,0, 193563,101,0,1420,3,
184351368,3,98,0,1368, 1935797,0,1420,3,103,
184363,99,0,1368,3, 193580,1420,3,104,0,
18437100,0,1368,3,101, 193591420,3,105,0,1420,
184380,1368,3,102,0, 193603,106,0,1420,3,
184391368,3,103,0,1368, 19361102,0,1420,3,108,
184403,104,0,1368,3, 193620,1420,3,109,0,
18441105,0,1368,3,106, 193631420,3,110,0,1420,
184420,1368,3,107,0, 193643,111,0,1420,3,
184431368,3,108,0,1368, 19365112,0,1420,3,113,
184443,109,0,1368,3, 193660,1420,3,114,0,
18445110,0,1368,3,111, 193671420,3,115,0,1420,
184460,1368,3,112,0, 193683,116,0,1420,3,
184471368,3,113,0,1368, 19369117,0,1420,3,118,
184483,114,0,1368,3, 193700,1420,3,119,0,
18449115,0,1368,3,116, 193711420,3,120,0,1420,
184500,1368,3,117,0, 193723,121,0,1420,3,
184511368,3,118,0,1368, 19373122,0,1420,3,123,
184523,119,0,1368,3, 193740,1420,3,124,0,
18453120,0,1368,3,121, 193751420,3,125,0,1420,
184540,1368,3,122,0, 193763,96,6,1420,3,
184551368,3,123,0,1368, 19377107,0,1420,3,126,
184563,124,0,1368,3, 193780,1420,3,58,15,
18457125,0,1368,3,96, 193791420,3,59,15,1420,
184586,1368,3,126,0, 193803,136,4,1420,3,
184591368,3,58,15,1368, 19381160,0,1420,3,170,
184603,59,15,1368,3, 193820,1420,3,171,0,
18461136,4,1368,3,160, 193831420,3,172,0,1420,
184620,1368,3,15,7, 193843,173,0,1420,3,
184631368,3,170,0,1368, 19385178,0,1420,3,176,
184643,171,0,1368,3, 193862,1420,3,187,0,
18465172,0,1368,3,173, 193871420,3,187,1,1420,
184660,1368,3,178,0, 193883,192,0,1420,3,
184671368,3,176,2,1368, 1938941,32,1420,3,197,
184683,187,0,1368,3, 193901,1420,3,0,224,
18469187,1,1368,3,192, 193911420,3,40,32,1420,
184700,1368,3,41,32, 193923,63,32,1420,0,
184711368,3,197,1,1368, 19393165,1,-1,1444,5,
184723,0,224,1368,3, 1939494,251,1445,10,251,
1847340,32,1368,3,63, 193951,19,573,1446,10,
1847432,1368,0,165,1, 19396573,1,47,301,1447,
18475-1,1392,5,93,251, 1939710,301,1,94,1172,
184761393,10,251,1,19, 193981448,10,1172,1,50,
18477573,1394,10,573,1, 193991041,1449,10,1041,1,
1847847,301,1395,10,301, 1940080,1191,1450,10,1191,
184791,93,1172,1396,10, 194011,53,188,1451,10,
184801172,1,50,1041,1397, 19402188,1,37,602,1452,
1848110,1041,1,80,1191, 1940310,602,1,43,700,
184821398,10,1191,1,53, 194041453,10,700,1,51,
18483188,1399,10,188,1, 19405613,1454,10,613,1,
1848437,602,1400,10,602, 1940646,1331,1455,10,1331,
184851,43,700,1401,10, 194071,92,211,1456,10,
18486700,1,51,613,1402, 19408211,1,16,215,1457,
1848710,613,1,46,211, 1940910,215,1,17,672,
184881403,10,211,1,16, 194101458,10,672,1,68,
18489215,1404,10,215,1, 19411901,1459,10,901,1,
1849017,672,1405,10,672, 1941275,361,1460,10,361,
184911,68,901,1406,10, 194131,35,223,1461,10,
18492901,1,75,361,1407, 19414223,1,20,229,1462,
1849310,361,1,35,223, 1941510,229,1,6,199,
184941408,10,223,1,20, 194161463,10,199,1,22,
18495229,1409,10,229,1, 19417286,1464,10,286,1,
184966,199,1410,10,199, 1941821,265,1465,10,265,
184971,22,286,1411,10, 194191,96,1292,1466,10,
18498286,1,21,265,1412, 194201292,1,88,481,1467,
1849910,265,1,95,1292, 1942110,481,1,64,720,
185001413,10,1292,1,88, 194221468,10,720,1,49,
18501481,1414,10,481,1, 19423357,1469,10,357,1,
1850264,720,1415,10,720, 1942428,318,1470,10,318,
185031,49,357,1416,10, 194251,25,709,1471,10,
18504357,1,28,318,1417, 19426709,1,42,792,1472,
1850510,318,1,25,709, 1942710,792,1,69,1231,
185061418,10,709,1,42, 194281473,10,1231,1,48,
18507792,1419,10,792,1, 19429336,1474,10,336,1,
1850869,1231,1420,10,1231, 1943041,850,1475,10,850,
185091,48,336,1421,10, 194311,57,654,1476,10,
18510336,1,41,850,1422, 19432654,1,91,233,1477,
1851110,850,1,57,654, 1943310,233,1,4,342,
185121423,10,654,1,91, 194341478,10,342,1,23,
18513233,1424,10,233,1, 19435493,1479,10,493,1,
185144,342,1425,10,342, 1943663,1246,1480,10,1246,
185151,23,493,1426,10, 194371,84,324,1481,10,
18516493,1,63,1246,1427, 19438324,1,29,245,1482,
1851710,1246,1,84,324, 1943910,245,1,5,316,
185181428,10,324,1,29, 194401483,10,316,1,31,
18519245,1429,10,245,1, 19441624,1484,10,624,1,
185205,316,1430,10,316, 1944252,889,1485,10,889,
185211,31,624,1431,10, 194431,76,1114,1486,10,
18522624,1,52,889,1432, 194441114,1,83,1017,1487,
1852310,889,1,76,1114, 1944510,1017,1,81,995,
185241433,10,1114,1,83, 194461488,10,995,1,77,
185251017,1434,10,1017,1, 19447186,1489,10,186,1,
1852681,995,1435,10,995, 1944830,249,1490,10,249,
185271,77,186,1436,10, 194491,7,847,1491,10,
18528186,1,30,249,1437, 19450847,1,73,197,1492,
1852910,249,1,7,847, 1945110,197,1,10,353,
185301438,10,847,1,73, 194521493,10,353,1,27,
18531197,1439,10,197,1, 19453294,1494,10,294,1,
1853210,353,1440,10,353, 1945495,239,1495,10,239,
185331,27,294,1441,10, 194551,14,269,1496,10,
18534294,1,94,239,1442, 19456269,1,24,731,1497,
1853510,239,1,14,269, 1945710,731,1,54,281,
185361443,10,269,1,24, 194581498,10,281,1,9,
18537731,1444,10,731,1, 194591225,1499,10,1225,1,
1853854,281,1445,10,281, 1946086,498,1500,10,498,
185391,9,1225,1446,10, 194611,62,1501,4,30,
185401225,1,86,498,1447, 1946283,0,84,0,82,
1854110,498,1,62,1448, 194630,73,0,78,0,
185424,30,83,0,84, 1946471,0,95,0,67,
185430,82,0,73,0, 194650,79,0,78,0,
1854478,0,71,0,95, 1946683,0,84,0,65,
185450,67,0,79,0, 194670,78,0,84,0,
1854678,0,83,0,84, 194681502,10,1501,1,3,
185470,65,0,78,0, 194691392,1503,10,1392,1,
1854884,0,1449,10,1448, 1947045,348,1504,10,348,
185491,3,1340,1450,10, 194711,93,551,1505,10,
185501340,1,45,348,1451, 19472551,1,66,1068,1506,
1855110,348,1,92,551, 1947310,1068,1,56,402,
185521452,10,551,1,66, 194741507,10,402,1,58,
185531068,1453,10,1068,1, 194751400,1508,10,1400,1,
1855456,402,1454,10,402, 1947612,531,1509,10,531,
185551,58,1348,1455,10, 194771,44,312,1510,10,
185561348,1,12,531,1456, 19478312,1,40,1154,1511,
1855710,531,1,44,312, 1947910,1154,1,82,591,
185581457,10,312,1,40, 194801512,10,591,1,67,
185591154,1458,10,1154,1, 19481946,1513,10,946,1,
1856082,591,1459,10,591, 1948278,1416,1514,10,1416,
185611,67,946,1460,10, 194831,36,1408,1515,10,
18562946,1,78,1364,1461, 194841408,1,34,787,1516,
1856310,1364,1,36,1356, 1948510,787,1,70,1357,
185641462,10,1356,1,34, 194861517,10,1357,1,87,
18565787,1463,10,787,1, 19487865,1518,10,865,1,
1856670,1305,1464,10,1305, 1948874,338,1519,10,338,
185671,87,865,1465,10, 194891,26,425,1520,10,
18568865,1,74,338,1466, 19490425,1,59,207,1521,
1856910,338,1,26,425, 1949110,207,1,33,306,
185701467,10,425,1,59, 194921522,10,306,1,11,
18571207,1468,10,207,1, 19493205,1523,10,205,1,
1857233,306,1469,10,306, 1949438,519,1524,10,519,
185731,11,205,1470,10, 194951,61,828,1525,10,
18574205,1,38,519,1471, 19496828,1,72,1287,1526,
1857510,519,1,61,828, 1949710,1287,1,90,326,
185761472,10,828,1,72, 194981527,10,326,1,15,
185771287,1473,10,1287,1, 19499969,1528,10,969,1,
1857890,326,1474,10,326, 1950079,1406,1529,10,1406,
185791,15,969,1475,10, 195011,39,332,1530,10,
18580969,1,79,1354,1476, 19502332,1,32,1275,1531,
1858110,1354,1,39,332, 1950310,1275,1,89,375,
185821477,10,332,1,32, 195041532,10,375,1,60,
185831275,1478,10,1275,1, 195051375,1533,10,1375,1,
1858489,375,1479,10,375, 1950655,1412,1534,10,1412,
185851,60,1323,1480,10, 195071,13,1214,1535,10,
185861323,1,55,1360,1481, 195081214,1,85,235,1536,
1858710,1360,1,13,1214, 1950910,235,1,18,221,
185881482,10,1214,1,85, 195101537,10,221,1,8,
18589235,1483,10,235,1, 19511775,1538,10,775,1,
1859018,221,1484,10,221, 1951271,449,1539,10,449,
185911,8,775,1485,10, 195131,65,1540,5,0,0};
18592775,1,71,449,1486,
1859310,449,1,65,1487,
185945,0,0};
18595 new Tfactory(this,"MINUS",new TCreator(MINUS_factory)); 19514 new Tfactory(this,"MINUS",new TCreator(MINUS_factory));
18596 new Tfactory(this,"DEFAULT_STATE",new TCreator(DEFAULT_STATE_factory)); 19515 new Tfactory(this,"DEFAULT_STATE",new TCreator(DEFAULT_STATE_factory));
18597 new Tfactory(this,"INTEGER_CONSTANT",new TCreator(INTEGER_CONSTANT_factory)); 19516 new Tfactory(this,"INTEGER_CONSTANT",new TCreator(INTEGER_CONSTANT_factory));
@@ -18602,6 +19521,7 @@ public class yyLSLTokens : YyLexer {
18602 new Tfactory(this,"ELSE",new TCreator(ELSE_factory)); 19521 new Tfactory(this,"ELSE",new TCreator(ELSE_factory));
18603 new Tfactory(this,"INTEGER_TYPE",new TCreator(INTEGER_TYPE_factory)); 19522 new Tfactory(this,"INTEGER_TYPE",new TCreator(INTEGER_TYPE_factory));
18604 new Tfactory(this,"FOR",new TCreator(FOR_factory)); 19523 new Tfactory(this,"FOR",new TCreator(FOR_factory));
19524 new Tfactory(this,"TRANSACTION_RESULT_EVENT",new TCreator(TRANSACTION_RESULT_EVENT_factory));
18605 new Tfactory(this,"LEFT_PAREN",new TCreator(LEFT_PAREN_factory)); 19525 new Tfactory(this,"LEFT_PAREN",new TCreator(LEFT_PAREN_factory));
18606 new Tfactory(this,"RIGHT_PAREN",new TCreator(RIGHT_PAREN_factory)); 19526 new Tfactory(this,"RIGHT_PAREN",new TCreator(RIGHT_PAREN_factory));
18607 new Tfactory(this,"HTTP_RESPONSE_EVENT",new TCreator(HTTP_RESPONSE_EVENT_factory)); 19527 new Tfactory(this,"HTTP_RESPONSE_EVENT",new TCreator(HTTP_RESPONSE_EVENT_factory));
@@ -18696,6 +19616,7 @@ public static object EXCLAMATION_factory(Lexer yyl) { return new EXCLAMATION(yyl
18696public static object ELSE_factory(Lexer yyl) { return new ELSE(yyl);} 19616public static object ELSE_factory(Lexer yyl) { return new ELSE(yyl);}
18697public static object INTEGER_TYPE_factory(Lexer yyl) { return new INTEGER_TYPE(yyl);} 19617public static object INTEGER_TYPE_factory(Lexer yyl) { return new INTEGER_TYPE(yyl);}
18698public static object FOR_factory(Lexer yyl) { return new FOR(yyl);} 19618public static object FOR_factory(Lexer yyl) { return new FOR(yyl);}
19619public static object TRANSACTION_RESULT_EVENT_factory(Lexer yyl) { return new TRANSACTION_RESULT_EVENT(yyl);}
18699public static object LEFT_PAREN_factory(Lexer yyl) { return new LEFT_PAREN(yyl);} 19620public static object LEFT_PAREN_factory(Lexer yyl) { return new LEFT_PAREN(yyl);}
18700public static object RIGHT_PAREN_factory(Lexer yyl) { return new RIGHT_PAREN(yyl);} 19621public static object RIGHT_PAREN_factory(Lexer yyl) { return new RIGHT_PAREN(yyl);}
18701public static object HTTP_RESPONSE_EVENT_factory(Lexer yyl) { return new HTTP_RESPONSE_EVENT(yyl);} 19622public static object HTTP_RESPONSE_EVENT_factory(Lexer yyl) { return new HTTP_RESPONSE_EVENT(yyl);}
@@ -18782,35 +19703,35 @@ public static object CONTROL_EVENT_factory(Lexer yyl) { return new CONTROL_EVENT
18782public override TOKEN OldAction(Lexer yym,ref string yytext,int action, ref bool reject) { 19703public override TOKEN OldAction(Lexer yym,ref string yytext,int action, ref bool reject) {
18783 switch(action) { 19704 switch(action) {
18784 case -1: break; 19705 case -1: break;
18785 case 946: { ((LSLTokens)yym).str += yytext; } 19706 case 1015: { ((LSLTokens)yym).str += "\\\\"; }
18786 break; 19707 break;
18787 case 1010: { yym.yy_begin("YYINITIAL"); ((LSLTokens)yym).yytext = ((LSLTokens)yym).str; ((LSLTokens)yym).str = String.Empty; return new STRING_CONSTANT(yym); } 19708 case 991: { ((LSLTokens)yym).str += " "; }
18788 break; 19709 break;
18789 case 1015: { yym.yy_begin("COMMENT"); } 19710 case 963: { yym.yy_begin("STRING"); ((LSLTokens)yym).str = "";}
18790 break; 19711 break;
18791 case 1027: { yym.yy_begin("YYINITIAL"); } 19712 case 1037: { yym.yy_begin("COMMENT"); }
18792 break; 19713 break;
18793 case 1041: ; 19714 case 1049: { yym.yy_begin("YYINITIAL"); }
18794 break; 19715 break;
18795 case 1045: ; 19716 case 1027: { ((LSLTokens)yym).str += '\\'; }
18796 break; 19717 break;
18797 case 1054: ; 19718 case 1063: ;
18798 break; 19719 break;
18799 case 1005: { ((LSLTokens)yym).str += '\\'; } 19720 case 1076: ;
18800 break; 19721 break;
18801 case 1050: ; 19722 case 1032: { yym.yy_begin("YYINITIAL"); ((LSLTokens)yym).yytext = ((LSLTokens)yym).str; ((LSLTokens)yym).str = String.Empty; return new STRING_CONSTANT(yym); }
18802 break; 19723 break;
18803 case 941: { yym.yy_begin("STRING"); ((LSLTokens)yym).str = "";} 19724 case 1067: ;
18804 break; 19725 break;
18805 case 957: { ((LSLTokens)yym).str += "\\n"; } 19726 case 1072: ;
18806 break; 19727 break;
18807 case 969: { ((LSLTokens)yym).str += " "; } 19728 case 1003: { ((LSLTokens)yym).str += "\\\""; }
18808 break; 19729 break;
18809 case 981: { ((LSLTokens)yym).str += "\\\""; } 19730 case 974: { ((LSLTokens)yym).str += "\\n"; }
18810 break; 19731 break;
18811 case 952: { ((LSLTokens)yym).str += "\\n"; } 19732 case 979: { ((LSLTokens)yym).str += "\\n"; }
18812 break; 19733 break;
18813 case 993: { ((LSLTokens)yym).str += "\\\\"; } 19734 case 968: { ((LSLTokens)yym).str += yytext; }
18814 break; 19735 break;
18815 } 19736 }
18816 return null; 19737 return null;
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/lsl.parser.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/lsl.parser.cs
index 44957bd..5fef83c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/lsl.parser.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/lsl.parser.cs
@@ -1,6 +1,6 @@
1using System;using Tools; 1using System;using Tools;
2namespace OpenSim.Region.ScriptEngine.Shared.CodeTools { 2namespace OpenSim.Region.ScriptEngine.Shared.CodeTools {
3//%+LSLProgramRoot+96 3//%+LSLProgramRoot+97
4public class LSLProgramRoot : SYMBOL{ 4public class LSLProgramRoot : SYMBOL{
5 public LSLProgramRoot (Parser yyp, States s ):base(((LSLSyntax 5 public LSLProgramRoot (Parser yyp, States s ):base(((LSLSyntax
6)yyp)){ while (0< s . kids . Count ) kids . Add ( s . kids . Pop ()); 6)yyp)){ while (0< s . kids . Count ) kids . Add ( s . kids . Pop ());
@@ -11,9 +11,9 @@ public class LSLProgramRoot : SYMBOL{
11} 11}
12 12
13public override string yyname { get { return "LSLProgramRoot"; }} 13public override string yyname { get { return "LSLProgramRoot"; }}
14public override int yynum { get { return 96; }} 14public override int yynum { get { return 97; }}
15public LSLProgramRoot(Parser yyp):base(yyp){}} 15public LSLProgramRoot(Parser yyp):base(yyp){}}
16//%+GlobalDefinitions+97 16//%+GlobalDefinitions+98
17public class GlobalDefinitions : SYMBOL{ 17public class GlobalDefinitions : SYMBOL{
18 public GlobalDefinitions (Parser yyp, GlobalVariableDeclaration gvd ):base(((LSLSyntax 18 public GlobalDefinitions (Parser yyp, GlobalVariableDeclaration gvd ):base(((LSLSyntax
19)yyp)){ kids . Add ( gvd ); 19)yyp)){ kids . Add ( gvd );
@@ -31,9 +31,9 @@ public class GlobalDefinitions : SYMBOL{
31} 31}
32 32
33public override string yyname { get { return "GlobalDefinitions"; }} 33public override string yyname { get { return "GlobalDefinitions"; }}
34public override int yynum { get { return 97; }} 34public override int yynum { get { return 98; }}
35public GlobalDefinitions(Parser yyp):base(yyp){}} 35public GlobalDefinitions(Parser yyp):base(yyp){}}
36//%+GlobalVariableDeclaration+98 36//%+GlobalVariableDeclaration+99
37public class GlobalVariableDeclaration : SYMBOL{ 37public class GlobalVariableDeclaration : SYMBOL{
38 public GlobalVariableDeclaration (Parser yyp, Declaration d ):base(((LSLSyntax 38 public GlobalVariableDeclaration (Parser yyp, Declaration d ):base(((LSLSyntax
39)yyp)){ kids . Add ( d ); 39)yyp)){ kids . Add ( d );
@@ -43,9 +43,9 @@ public class GlobalVariableDeclaration : SYMBOL{
43} 43}
44 44
45public override string yyname { get { return "GlobalVariableDeclaration"; }} 45public override string yyname { get { return "GlobalVariableDeclaration"; }}
46public override int yynum { get { return 98; }} 46public override int yynum { get { return 99; }}
47public GlobalVariableDeclaration(Parser yyp):base(yyp){}} 47public GlobalVariableDeclaration(Parser yyp):base(yyp){}}
48//%+GlobalFunctionDefinition+99 48//%+GlobalFunctionDefinition+100
49public class GlobalFunctionDefinition : SYMBOL{ 49public class GlobalFunctionDefinition : SYMBOL{
50 private string m_returnType ; 50 private string m_returnType ;
51 private string m_name ; 51 private string m_name ;
@@ -65,9 +65,9 @@ public class GlobalFunctionDefinition : SYMBOL{
65} 65}
66 66
67public override string yyname { get { return "GlobalFunctionDefinition"; }} 67public override string yyname { get { return "GlobalFunctionDefinition"; }}
68public override int yynum { get { return 99; }} 68public override int yynum { get { return 100; }}
69public GlobalFunctionDefinition(Parser yyp):base(yyp){}} 69public GlobalFunctionDefinition(Parser yyp):base(yyp){}}
70//%+States+100 70//%+States+101
71public class States : SYMBOL{ 71public class States : SYMBOL{
72 public States (Parser yyp, State ds ):base(((LSLSyntax 72 public States (Parser yyp, State ds ):base(((LSLSyntax
73)yyp)){ kids . Add ( ds ); 73)yyp)){ kids . Add ( ds );
@@ -78,9 +78,9 @@ public class States : SYMBOL{
78} 78}
79 79
80public override string yyname { get { return "States"; }} 80public override string yyname { get { return "States"; }}
81public override int yynum { get { return 100; }} 81public override int yynum { get { return 101; }}
82public States(Parser yyp):base(yyp){}} 82public States(Parser yyp):base(yyp){}}
83//%+State+101 83//%+State+102
84public class State : SYMBOL{ 84public class State : SYMBOL{
85 private string m_name ; 85 private string m_name ;
86 public State (Parser yyp, string name , StateBody sb ):base(((LSLSyntax 86 public State (Parser yyp, string name , StateBody sb ):base(((LSLSyntax
@@ -94,9 +94,9 @@ public class State : SYMBOL{
94} 94}
95 95
96public override string yyname { get { return "State"; }} 96public override string yyname { get { return "State"; }}
97public override int yynum { get { return 101; }} 97public override int yynum { get { return 102; }}
98public State(Parser yyp):base(yyp){}} 98public State(Parser yyp):base(yyp){}}
99//%+StateBody+102 99//%+StateBody+103
100public class StateBody : SYMBOL{ 100public class StateBody : SYMBOL{
101 public StateBody (Parser yyp, StateBody sb , StateEvent se ):base(((LSLSyntax 101 public StateBody (Parser yyp, StateBody sb , StateEvent se ):base(((LSLSyntax
102)yyp)){ while (0< sb . kids . Count ) kids . Add ( sb . kids . Pop ()); 102)yyp)){ while (0< sb . kids . Count ) kids . Add ( sb . kids . Pop ());
@@ -107,9 +107,9 @@ public class StateBody : SYMBOL{
107} 107}
108 108
109public override string yyname { get { return "StateBody"; }} 109public override string yyname { get { return "StateBody"; }}
110public override int yynum { get { return 102; }} 110public override int yynum { get { return 103; }}
111public StateBody(Parser yyp):base(yyp){}} 111public StateBody(Parser yyp):base(yyp){}}
112//%+StateEvent+103 112//%+StateEvent+104
113public class StateEvent : SYMBOL{ 113public class StateEvent : SYMBOL{
114 private string m_name ; 114 private string m_name ;
115 public StateEvent (Parser yyp, string name , CompoundStatement cs ):base(((LSLSyntax 115 public StateEvent (Parser yyp, string name , CompoundStatement cs ):base(((LSLSyntax
@@ -128,65 +128,65 @@ public class StateEvent : SYMBOL{
128} 128}
129 129
130public override string yyname { get { return "StateEvent"; }} 130public override string yyname { get { return "StateEvent"; }}
131public override int yynum { get { return 103; }} 131public override int yynum { get { return 104; }}
132public StateEvent(Parser yyp):base(yyp){}} 132public StateEvent(Parser yyp):base(yyp){}}
133//%+VoidArgStateEvent+104 133//%+VoidArgStateEvent+105
134public class VoidArgStateEvent : StateEvent{ 134public class VoidArgStateEvent : StateEvent{
135 public VoidArgStateEvent (Parser yyp, string name , CompoundStatement cs ):base(((LSLSyntax 135 public VoidArgStateEvent (Parser yyp, string name , CompoundStatement cs ):base(((LSLSyntax
136)yyp), name , cs ){} 136)yyp), name , cs ){}
137 137
138public override string yyname { get { return "VoidArgStateEvent"; }} 138public override string yyname { get { return "VoidArgStateEvent"; }}
139public override int yynum { get { return 104; }} 139public override int yynum { get { return 105; }}
140public VoidArgStateEvent(Parser yyp):base(yyp){}} 140public VoidArgStateEvent(Parser yyp):base(yyp){}}
141//%+KeyArgStateEvent+105 141//%+KeyArgStateEvent+106
142public class KeyArgStateEvent : StateEvent{ 142public class KeyArgStateEvent : StateEvent{
143 public KeyArgStateEvent (Parser yyp, string name , KeyArgumentDeclarationList adl , CompoundStatement cs ):base(((LSLSyntax 143 public KeyArgStateEvent (Parser yyp, string name , KeyArgumentDeclarationList adl , CompoundStatement cs ):base(((LSLSyntax
144)yyp), name , adl , cs ){} 144)yyp), name , adl , cs ){}
145 145
146public override string yyname { get { return "KeyArgStateEvent"; }} 146public override string yyname { get { return "KeyArgStateEvent"; }}
147public override int yynum { get { return 105; }} 147public override int yynum { get { return 106; }}
148public KeyArgStateEvent(Parser yyp):base(yyp){}} 148public KeyArgStateEvent(Parser yyp):base(yyp){}}
149//%+IntArgStateEvent+106 149//%+IntArgStateEvent+107
150public class IntArgStateEvent : StateEvent{ 150public class IntArgStateEvent : StateEvent{
151 public IntArgStateEvent (Parser yyp, string name , IntArgumentDeclarationList adl , CompoundStatement cs ):base(((LSLSyntax 151 public IntArgStateEvent (Parser yyp, string name , IntArgumentDeclarationList adl , CompoundStatement cs ):base(((LSLSyntax
152)yyp), name , adl , cs ){} 152)yyp), name , adl , cs ){}
153 153
154public override string yyname { get { return "IntArgStateEvent"; }} 154public override string yyname { get { return "IntArgStateEvent"; }}
155public override int yynum { get { return 106; }} 155public override int yynum { get { return 107; }}
156public IntArgStateEvent(Parser yyp):base(yyp){}} 156public IntArgStateEvent(Parser yyp):base(yyp){}}
157//%+VectorArgStateEvent+107 157//%+VectorArgStateEvent+108
158public class VectorArgStateEvent : StateEvent{ 158public class VectorArgStateEvent : StateEvent{
159 public VectorArgStateEvent (Parser yyp, string name , VectorArgumentDeclarationList adl , CompoundStatement cs ):base(((LSLSyntax 159 public VectorArgStateEvent (Parser yyp, string name , VectorArgumentDeclarationList adl , CompoundStatement cs ):base(((LSLSyntax
160)yyp), name , adl , cs ){} 160)yyp), name , adl , cs ){}
161 161
162public override string yyname { get { return "VectorArgStateEvent"; }} 162public override string yyname { get { return "VectorArgStateEvent"; }}
163public override int yynum { get { return 107; }} 163public override int yynum { get { return 108; }}
164public VectorArgStateEvent(Parser yyp):base(yyp){}} 164public VectorArgStateEvent(Parser yyp):base(yyp){}}
165//%+IntRotRotArgStateEvent+108 165//%+IntRotRotArgStateEvent+109
166public class IntRotRotArgStateEvent : StateEvent{ 166public class IntRotRotArgStateEvent : StateEvent{
167 public IntRotRotArgStateEvent (Parser yyp, string name , IntRotRotArgumentDeclarationList adl , CompoundStatement cs ):base(((LSLSyntax 167 public IntRotRotArgStateEvent (Parser yyp, string name , IntRotRotArgumentDeclarationList adl , CompoundStatement cs ):base(((LSLSyntax
168)yyp), name , adl , cs ){} 168)yyp), name , adl , cs ){}
169 169
170public override string yyname { get { return "IntRotRotArgStateEvent"; }} 170public override string yyname { get { return "IntRotRotArgStateEvent"; }}
171public override int yynum { get { return 108; }} 171public override int yynum { get { return 109; }}
172public IntRotRotArgStateEvent(Parser yyp):base(yyp){}} 172public IntRotRotArgStateEvent(Parser yyp):base(yyp){}}
173//%+IntVecVecArgStateEvent+109 173//%+IntVecVecArgStateEvent+110
174public class IntVecVecArgStateEvent : StateEvent{ 174public class IntVecVecArgStateEvent : StateEvent{
175 public IntVecVecArgStateEvent (Parser yyp, string name , IntVecVecArgumentDeclarationList adl , CompoundStatement cs ):base(((LSLSyntax 175 public IntVecVecArgStateEvent (Parser yyp, string name , IntVecVecArgumentDeclarationList adl , CompoundStatement cs ):base(((LSLSyntax
176)yyp), name , adl , cs ){} 176)yyp), name , adl , cs ){}
177 177
178public override string yyname { get { return "IntVecVecArgStateEvent"; }} 178public override string yyname { get { return "IntVecVecArgStateEvent"; }}
179public override int yynum { get { return 109; }} 179public override int yynum { get { return 110; }}
180public IntVecVecArgStateEvent(Parser yyp):base(yyp){}} 180public IntVecVecArgStateEvent(Parser yyp):base(yyp){}}
181//%+KeyIntIntArgStateEvent+110 181//%+KeyIntIntArgStateEvent+111
182public class KeyIntIntArgStateEvent : StateEvent{ 182public class KeyIntIntArgStateEvent : StateEvent{
183 public KeyIntIntArgStateEvent (Parser yyp, string name , KeyIntIntArgumentDeclarationList adl , CompoundStatement cs ):base(((LSLSyntax 183 public KeyIntIntArgStateEvent (Parser yyp, string name , KeyIntIntArgumentDeclarationList adl , CompoundStatement cs ):base(((LSLSyntax
184)yyp), name , adl , cs ){} 184)yyp), name , adl , cs ){}
185 185
186public override string yyname { get { return "KeyIntIntArgStateEvent"; }} 186public override string yyname { get { return "KeyIntIntArgStateEvent"; }}
187public override int yynum { get { return 110; }} 187public override int yynum { get { return 111; }}
188public KeyIntIntArgStateEvent(Parser yyp):base(yyp){}} 188public KeyIntIntArgStateEvent(Parser yyp):base(yyp){}}
189//%+ArgumentDeclarationList+111 189//%+ArgumentDeclarationList+112
190public class ArgumentDeclarationList : SYMBOL{ 190public class ArgumentDeclarationList : SYMBOL{
191 public ArgumentDeclarationList (Parser yyp, Declaration d ):base(((LSLSyntax 191 public ArgumentDeclarationList (Parser yyp, Declaration d ):base(((LSLSyntax
192)yyp)){ kids . Add ( d ); 192)yyp)){ kids . Add ( d );
@@ -206,57 +206,57 @@ public class ArgumentDeclarationList : SYMBOL{
206} 206}
207 207
208public override string yyname { get { return "ArgumentDeclarationList"; }} 208public override string yyname { get { return "ArgumentDeclarationList"; }}
209public override int yynum { get { return 111; }} 209public override int yynum { get { return 112; }}
210public ArgumentDeclarationList(Parser yyp):base(yyp){}} 210public ArgumentDeclarationList(Parser yyp):base(yyp){}}
211//%+KeyArgumentDeclarationList+112 211//%+KeyArgumentDeclarationList+113
212public class KeyArgumentDeclarationList : ArgumentDeclarationList{ 212public class KeyArgumentDeclarationList : ArgumentDeclarationList{
213 public KeyArgumentDeclarationList (Parser yyp, KeyDeclaration d ):base(((LSLSyntax 213 public KeyArgumentDeclarationList (Parser yyp, KeyDeclaration d ):base(((LSLSyntax
214)yyp), d ){} 214)yyp), d ){}
215 215
216public override string yyname { get { return "KeyArgumentDeclarationList"; }} 216public override string yyname { get { return "KeyArgumentDeclarationList"; }}
217public override int yynum { get { return 112; }} 217public override int yynum { get { return 113; }}
218public KeyArgumentDeclarationList(Parser yyp):base(yyp){}} 218public KeyArgumentDeclarationList(Parser yyp):base(yyp){}}
219//%+IntArgumentDeclarationList+113 219//%+IntArgumentDeclarationList+114
220public class IntArgumentDeclarationList : ArgumentDeclarationList{ 220public class IntArgumentDeclarationList : ArgumentDeclarationList{
221 public IntArgumentDeclarationList (Parser yyp, IntDeclaration d ):base(((LSLSyntax 221 public IntArgumentDeclarationList (Parser yyp, IntDeclaration d ):base(((LSLSyntax
222)yyp), d ){} 222)yyp), d ){}
223 223
224public override string yyname { get { return "IntArgumentDeclarationList"; }} 224public override string yyname { get { return "IntArgumentDeclarationList"; }}
225public override int yynum { get { return 113; }} 225public override int yynum { get { return 114; }}
226public IntArgumentDeclarationList(Parser yyp):base(yyp){}} 226public IntArgumentDeclarationList(Parser yyp):base(yyp){}}
227//%+VectorArgumentDeclarationList+114 227//%+VectorArgumentDeclarationList+115
228public class VectorArgumentDeclarationList : ArgumentDeclarationList{ 228public class VectorArgumentDeclarationList : ArgumentDeclarationList{
229 public VectorArgumentDeclarationList (Parser yyp, VecDeclaration d ):base(((LSLSyntax 229 public VectorArgumentDeclarationList (Parser yyp, VecDeclaration d ):base(((LSLSyntax
230)yyp), d ){} 230)yyp), d ){}
231 231
232public override string yyname { get { return "VectorArgumentDeclarationList"; }} 232public override string yyname { get { return "VectorArgumentDeclarationList"; }}
233public override int yynum { get { return 114; }} 233public override int yynum { get { return 115; }}
234public VectorArgumentDeclarationList(Parser yyp):base(yyp){}} 234public VectorArgumentDeclarationList(Parser yyp):base(yyp){}}
235//%+IntRotRotArgumentDeclarationList+115 235//%+IntRotRotArgumentDeclarationList+116
236public class IntRotRotArgumentDeclarationList : ArgumentDeclarationList{ 236public class IntRotRotArgumentDeclarationList : ArgumentDeclarationList{
237 public IntRotRotArgumentDeclarationList (Parser yyp, Declaration d1 , Declaration d2 , Declaration d3 ):base(((LSLSyntax 237 public IntRotRotArgumentDeclarationList (Parser yyp, Declaration d1 , Declaration d2 , Declaration d3 ):base(((LSLSyntax
238)yyp), d1 , d2 , d3 ){} 238)yyp), d1 , d2 , d3 ){}
239 239
240public override string yyname { get { return "IntRotRotArgumentDeclarationList"; }} 240public override string yyname { get { return "IntRotRotArgumentDeclarationList"; }}
241public override int yynum { get { return 115; }} 241public override int yynum { get { return 116; }}
242public IntRotRotArgumentDeclarationList(Parser yyp):base(yyp){}} 242public IntRotRotArgumentDeclarationList(Parser yyp):base(yyp){}}
243//%+IntVecVecArgumentDeclarationList+116 243//%+IntVecVecArgumentDeclarationList+117
244public class IntVecVecArgumentDeclarationList : ArgumentDeclarationList{ 244public class IntVecVecArgumentDeclarationList : ArgumentDeclarationList{
245 public IntVecVecArgumentDeclarationList (Parser yyp, Declaration d1 , Declaration d2 , Declaration d3 ):base(((LSLSyntax 245 public IntVecVecArgumentDeclarationList (Parser yyp, Declaration d1 , Declaration d2 , Declaration d3 ):base(((LSLSyntax
246)yyp), d1 , d2 , d3 ){} 246)yyp), d1 , d2 , d3 ){}
247 247
248public override string yyname { get { return "IntVecVecArgumentDeclarationList"; }} 248public override string yyname { get { return "IntVecVecArgumentDeclarationList"; }}
249public override int yynum { get { return 116; }} 249public override int yynum { get { return 117; }}
250public IntVecVecArgumentDeclarationList(Parser yyp):base(yyp){}} 250public IntVecVecArgumentDeclarationList(Parser yyp):base(yyp){}}
251//%+KeyIntIntArgumentDeclarationList+117 251//%+KeyIntIntArgumentDeclarationList+118
252public class KeyIntIntArgumentDeclarationList : ArgumentDeclarationList{ 252public class KeyIntIntArgumentDeclarationList : ArgumentDeclarationList{
253 public KeyIntIntArgumentDeclarationList (Parser yyp, Declaration d1 , Declaration d2 , Declaration d3 ):base(((LSLSyntax 253 public KeyIntIntArgumentDeclarationList (Parser yyp, Declaration d1 , Declaration d2 , Declaration d3 ):base(((LSLSyntax
254)yyp), d1 , d2 , d3 ){} 254)yyp), d1 , d2 , d3 ){}
255 255
256public override string yyname { get { return "KeyIntIntArgumentDeclarationList"; }} 256public override string yyname { get { return "KeyIntIntArgumentDeclarationList"; }}
257public override int yynum { get { return 117; }} 257public override int yynum { get { return 118; }}
258public KeyIntIntArgumentDeclarationList(Parser yyp):base(yyp){}} 258public KeyIntIntArgumentDeclarationList(Parser yyp):base(yyp){}}
259//%+Declaration+118 259//%+Declaration+119
260public class Declaration : SYMBOL{ 260public class Declaration : SYMBOL{
261 private string m_datatype ; 261 private string m_datatype ;
262 private string m_id ; 262 private string m_id ;
@@ -276,41 +276,41 @@ public class Declaration : SYMBOL{
276} 276}
277 277
278public override string yyname { get { return "Declaration"; }} 278public override string yyname { get { return "Declaration"; }}
279public override int yynum { get { return 118; }} 279public override int yynum { get { return 119; }}
280public Declaration(Parser yyp):base(yyp){}} 280public Declaration(Parser yyp):base(yyp){}}
281//%+KeyDeclaration+119 281//%+KeyDeclaration+120
282public class KeyDeclaration : Declaration{ 282public class KeyDeclaration : Declaration{
283 public KeyDeclaration (Parser yyp, string type , string id ):base(((LSLSyntax 283 public KeyDeclaration (Parser yyp, string type , string id ):base(((LSLSyntax
284)yyp), type , id ){} 284)yyp), type , id ){}
285 285
286public override string yyname { get { return "KeyDeclaration"; }} 286public override string yyname { get { return "KeyDeclaration"; }}
287public override int yynum { get { return 119; }} 287public override int yynum { get { return 120; }}
288public KeyDeclaration(Parser yyp):base(yyp){}} 288public KeyDeclaration(Parser yyp):base(yyp){}}
289//%+IntDeclaration+120 289//%+IntDeclaration+121
290public class IntDeclaration : Declaration{ 290public class IntDeclaration : Declaration{
291 public IntDeclaration (Parser yyp, string type , string id ):base(((LSLSyntax 291 public IntDeclaration (Parser yyp, string type , string id ):base(((LSLSyntax
292)yyp), type , id ){} 292)yyp), type , id ){}
293 293
294public override string yyname { get { return "IntDeclaration"; }} 294public override string yyname { get { return "IntDeclaration"; }}
295public override int yynum { get { return 120; }} 295public override int yynum { get { return 121; }}
296public IntDeclaration(Parser yyp):base(yyp){}} 296public IntDeclaration(Parser yyp):base(yyp){}}
297//%+VecDeclaration+121 297//%+VecDeclaration+122
298public class VecDeclaration : Declaration{ 298public class VecDeclaration : Declaration{
299 public VecDeclaration (Parser yyp, string type , string id ):base(((LSLSyntax 299 public VecDeclaration (Parser yyp, string type , string id ):base(((LSLSyntax
300)yyp), type , id ){} 300)yyp), type , id ){}
301 301
302public override string yyname { get { return "VecDeclaration"; }} 302public override string yyname { get { return "VecDeclaration"; }}
303public override int yynum { get { return 121; }} 303public override int yynum { get { return 122; }}
304public VecDeclaration(Parser yyp):base(yyp){}} 304public VecDeclaration(Parser yyp):base(yyp){}}
305//%+RotDeclaration+122 305//%+RotDeclaration+123
306public class RotDeclaration : Declaration{ 306public class RotDeclaration : Declaration{
307 public RotDeclaration (Parser yyp, string type , string id ):base(((LSLSyntax 307 public RotDeclaration (Parser yyp, string type , string id ):base(((LSLSyntax
308)yyp), type , id ){} 308)yyp), type , id ){}
309 309
310public override string yyname { get { return "RotDeclaration"; }} 310public override string yyname { get { return "RotDeclaration"; }}
311public override int yynum { get { return 122; }} 311public override int yynum { get { return 123; }}
312public RotDeclaration(Parser yyp):base(yyp){}} 312public RotDeclaration(Parser yyp):base(yyp){}}
313//%+Typename+123 313//%+Typename+124
314public class Typename : SYMBOL{ 314public class Typename : SYMBOL{
315 public string yytext ; 315 public string yytext ;
316 public Typename (Parser yyp, string text ):base(((LSLSyntax 316 public Typename (Parser yyp, string text ):base(((LSLSyntax
@@ -318,9 +318,9 @@ public class Typename : SYMBOL{
318} 318}
319 319
320public override string yyname { get { return "Typename"; }} 320public override string yyname { get { return "Typename"; }}
321public override int yynum { get { return 123; }} 321public override int yynum { get { return 124; }}
322public Typename(Parser yyp):base(yyp){}} 322public Typename(Parser yyp):base(yyp){}}
323//%+Event+124 323//%+Event+125
324public class Event : SYMBOL{ 324public class Event : SYMBOL{
325 public string yytext ; 325 public string yytext ;
326 public Event (Parser yyp, string text ):base(((LSLSyntax 326 public Event (Parser yyp, string text ):base(((LSLSyntax
@@ -328,65 +328,65 @@ public class Event : SYMBOL{
328} 328}
329 329
330public override string yyname { get { return "Event"; }} 330public override string yyname { get { return "Event"; }}
331public override int yynum { get { return 124; }} 331public override int yynum { get { return 125; }}
332public Event(Parser yyp):base(yyp){}} 332public Event(Parser yyp):base(yyp){}}
333//%+VoidArgEvent+125 333//%+VoidArgEvent+126
334public class VoidArgEvent : Event{ 334public class VoidArgEvent : Event{
335 public VoidArgEvent (Parser yyp, string text ):base(((LSLSyntax 335 public VoidArgEvent (Parser yyp, string text ):base(((LSLSyntax
336)yyp), text ){} 336)yyp), text ){}
337 337
338public override string yyname { get { return "VoidArgEvent"; }} 338public override string yyname { get { return "VoidArgEvent"; }}
339public override int yynum { get { return 125; }} 339public override int yynum { get { return 126; }}
340public VoidArgEvent(Parser yyp):base(yyp){}} 340public VoidArgEvent(Parser yyp):base(yyp){}}
341//%+KeyArgEvent+126 341//%+KeyArgEvent+127
342public class KeyArgEvent : Event{ 342public class KeyArgEvent : Event{
343 public KeyArgEvent (Parser yyp, string text ):base(((LSLSyntax 343 public KeyArgEvent (Parser yyp, string text ):base(((LSLSyntax
344)yyp), text ){} 344)yyp), text ){}
345 345
346public override string yyname { get { return "KeyArgEvent"; }} 346public override string yyname { get { return "KeyArgEvent"; }}
347public override int yynum { get { return 126; }} 347public override int yynum { get { return 127; }}
348public KeyArgEvent(Parser yyp):base(yyp){}} 348public KeyArgEvent(Parser yyp):base(yyp){}}
349//%+IntArgEvent+127 349//%+IntArgEvent+128
350public class IntArgEvent : Event{ 350public class IntArgEvent : Event{
351 public IntArgEvent (Parser yyp, string text ):base(((LSLSyntax 351 public IntArgEvent (Parser yyp, string text ):base(((LSLSyntax
352)yyp), text ){} 352)yyp), text ){}
353 353
354public override string yyname { get { return "IntArgEvent"; }} 354public override string yyname { get { return "IntArgEvent"; }}
355public override int yynum { get { return 127; }} 355public override int yynum { get { return 128; }}
356public IntArgEvent(Parser yyp):base(yyp){}} 356public IntArgEvent(Parser yyp):base(yyp){}}
357//%+VectorArgEvent+128 357//%+VectorArgEvent+129
358public class VectorArgEvent : Event{ 358public class VectorArgEvent : Event{
359 public VectorArgEvent (Parser yyp, string text ):base(((LSLSyntax 359 public VectorArgEvent (Parser yyp, string text ):base(((LSLSyntax
360)yyp), text ){} 360)yyp), text ){}
361 361
362public override string yyname { get { return "VectorArgEvent"; }} 362public override string yyname { get { return "VectorArgEvent"; }}
363public override int yynum { get { return 128; }} 363public override int yynum { get { return 129; }}
364public VectorArgEvent(Parser yyp):base(yyp){}} 364public VectorArgEvent(Parser yyp):base(yyp){}}
365//%+IntRotRotArgEvent+129 365//%+IntRotRotArgEvent+130
366public class IntRotRotArgEvent : Event{ 366public class IntRotRotArgEvent : Event{
367 public IntRotRotArgEvent (Parser yyp, string text ):base(((LSLSyntax 367 public IntRotRotArgEvent (Parser yyp, string text ):base(((LSLSyntax
368)yyp), text ){} 368)yyp), text ){}
369 369
370public override string yyname { get { return "IntRotRotArgEvent"; }} 370public override string yyname { get { return "IntRotRotArgEvent"; }}
371public override int yynum { get { return 129; }} 371public override int yynum { get { return 130; }}
372public IntRotRotArgEvent(Parser yyp):base(yyp){}} 372public IntRotRotArgEvent(Parser yyp):base(yyp){}}
373//%+IntVecVecArgEvent+130 373//%+IntVecVecArgEvent+131
374public class IntVecVecArgEvent : Event{ 374public class IntVecVecArgEvent : Event{
375 public IntVecVecArgEvent (Parser yyp, string text ):base(((LSLSyntax 375 public IntVecVecArgEvent (Parser yyp, string text ):base(((LSLSyntax
376)yyp), text ){} 376)yyp), text ){}
377 377
378public override string yyname { get { return "IntVecVecArgEvent"; }} 378public override string yyname { get { return "IntVecVecArgEvent"; }}
379public override int yynum { get { return 130; }} 379public override int yynum { get { return 131; }}
380public IntVecVecArgEvent(Parser yyp):base(yyp){}} 380public IntVecVecArgEvent(Parser yyp):base(yyp){}}
381//%+KeyIntIntArgEvent+131 381//%+KeyIntIntArgEvent+132
382public class KeyIntIntArgEvent : Event{ 382public class KeyIntIntArgEvent : Event{
383 public KeyIntIntArgEvent (Parser yyp, string text ):base(((LSLSyntax 383 public KeyIntIntArgEvent (Parser yyp, string text ):base(((LSLSyntax
384)yyp), text ){} 384)yyp), text ){}
385 385
386public override string yyname { get { return "KeyIntIntArgEvent"; }} 386public override string yyname { get { return "KeyIntIntArgEvent"; }}
387public override int yynum { get { return 131; }} 387public override int yynum { get { return 132; }}
388public KeyIntIntArgEvent(Parser yyp):base(yyp){}} 388public KeyIntIntArgEvent(Parser yyp):base(yyp){}}
389//%+CompoundStatement+132 389//%+CompoundStatement+133
390public class CompoundStatement : SYMBOL{ 390public class CompoundStatement : SYMBOL{
391 public CompoundStatement (Parser yyp):base(((LSLSyntax 391 public CompoundStatement (Parser yyp):base(((LSLSyntax
392)yyp)){} 392)yyp)){}
@@ -395,9 +395,9 @@ public class CompoundStatement : SYMBOL{
395} 395}
396 396
397public override string yyname { get { return "CompoundStatement"; }} 397public override string yyname { get { return "CompoundStatement"; }}
398public override int yynum { get { return 132; }} 398public override int yynum { get { return 133; }}
399} 399}
400//%+StatementList+133 400//%+StatementList+134
401public class StatementList : SYMBOL{ 401public class StatementList : SYMBOL{
402 private void AddStatement ( Statement s ){ if ( s . kids . Top is IfStatement || s . kids . Top is WhileStatement || s . kids . Top is DoWhileStatement || s . kids . Top is ForLoop ) kids . Add ( s . kids . Pop ()); 402 private void AddStatement ( Statement s ){ if ( s . kids . Top is IfStatement || s . kids . Top is WhileStatement || s . kids . Top is DoWhileStatement || s . kids . Top is ForLoop ) kids . Add ( s . kids . Pop ());
403 else kids . Add ( s ); 403 else kids . Add ( s );
@@ -411,9 +411,9 @@ public class StatementList : SYMBOL{
411} 411}
412 412
413public override string yyname { get { return "StatementList"; }} 413public override string yyname { get { return "StatementList"; }}
414public override int yynum { get { return 133; }} 414public override int yynum { get { return 134; }}
415public StatementList(Parser yyp):base(yyp){}} 415public StatementList(Parser yyp):base(yyp){}}
416//%+Statement+134 416//%+Statement+135
417public class Statement : SYMBOL{ 417public class Statement : SYMBOL{
418 public Statement (Parser yyp, Declaration d ):base(((LSLSyntax 418 public Statement (Parser yyp, Declaration d ):base(((LSLSyntax
419)yyp)){ kids . Add ( d ); 419)yyp)){ kids . Add ( d );
@@ -459,9 +459,9 @@ public class Statement : SYMBOL{
459} 459}
460 460
461public override string yyname { get { return "Statement"; }} 461public override string yyname { get { return "Statement"; }}
462public override int yynum { get { return 134; }} 462public override int yynum { get { return 135; }}
463public Statement(Parser yyp):base(yyp){}} 463public Statement(Parser yyp):base(yyp){}}
464//%+EmptyStatement+135 464//%+EmptyStatement+136
465public class EmptyStatement : SYMBOL{ 465public class EmptyStatement : SYMBOL{
466 public EmptyStatement (Parser yyp):base(((LSLSyntax 466 public EmptyStatement (Parser yyp):base(((LSLSyntax
467)yyp)){} 467)yyp)){}
@@ -469,9 +469,9 @@ public class EmptyStatement : SYMBOL{
469} 469}
470 470
471public override string yyname { get { return "EmptyStatement"; }} 471public override string yyname { get { return "EmptyStatement"; }}
472public override int yynum { get { return 135; }} 472public override int yynum { get { return 136; }}
473} 473}
474//%+Assignment+136 474//%+Assignment+137
475public class Assignment : SYMBOL{ 475public class Assignment : SYMBOL{
476 protected string m_assignmentType ; 476 protected string m_assignmentType ;
477 public Assignment (Parser yyp, SYMBOL lhs , SYMBOL rhs , string assignmentType ):base(((LSLSyntax 477 public Assignment (Parser yyp, SYMBOL lhs , SYMBOL rhs , string assignmentType ):base(((LSLSyntax
@@ -491,9 +491,9 @@ public class Assignment : SYMBOL{
491} 491}
492 492
493public override string yyname { get { return "Assignment"; }} 493public override string yyname { get { return "Assignment"; }}
494public override int yynum { get { return 136; }} 494public override int yynum { get { return 137; }}
495public Assignment(Parser yyp):base(yyp){}} 495public Assignment(Parser yyp):base(yyp){}}
496//%+SimpleAssignment+137 496//%+SimpleAssignment+138
497public class SimpleAssignment : Assignment{ 497public class SimpleAssignment : Assignment{
498 public SimpleAssignment (Parser yyp, SYMBOL lhs , SYMBOL rhs , string assignmentType ):base(((LSLSyntax 498 public SimpleAssignment (Parser yyp, SYMBOL lhs , SYMBOL rhs , string assignmentType ):base(((LSLSyntax
499)yyp)){ m_assignmentType = assignmentType ; 499)yyp)){ m_assignmentType = assignmentType ;
@@ -503,9 +503,9 @@ public class SimpleAssignment : Assignment{
503} 503}
504 504
505public override string yyname { get { return "SimpleAssignment"; }} 505public override string yyname { get { return "SimpleAssignment"; }}
506public override int yynum { get { return 137; }} 506public override int yynum { get { return 138; }}
507public SimpleAssignment(Parser yyp):base(yyp){}} 507public SimpleAssignment(Parser yyp):base(yyp){}}
508//%+ReturnStatement+138 508//%+ReturnStatement+139
509public class ReturnStatement : SYMBOL{ 509public class ReturnStatement : SYMBOL{
510 public ReturnStatement (Parser yyp):base(((LSLSyntax 510 public ReturnStatement (Parser yyp):base(((LSLSyntax
511)yyp)){} 511)yyp)){}
@@ -515,9 +515,9 @@ public class ReturnStatement : SYMBOL{
515} 515}
516 516
517public override string yyname { get { return "ReturnStatement"; }} 517public override string yyname { get { return "ReturnStatement"; }}
518public override int yynum { get { return 138; }} 518public override int yynum { get { return 139; }}
519} 519}
520//%+JumpLabel+139 520//%+JumpLabel+140
521public class JumpLabel : SYMBOL{ 521public class JumpLabel : SYMBOL{
522 private string m_labelName ; 522 private string m_labelName ;
523 public JumpLabel (Parser yyp, string labelName ):base(((LSLSyntax 523 public JumpLabel (Parser yyp, string labelName ):base(((LSLSyntax
@@ -530,9 +530,9 @@ public class JumpLabel : SYMBOL{
530} 530}
531 531
532public override string yyname { get { return "JumpLabel"; }} 532public override string yyname { get { return "JumpLabel"; }}
533public override int yynum { get { return 139; }} 533public override int yynum { get { return 140; }}
534public JumpLabel(Parser yyp):base(yyp){}} 534public JumpLabel(Parser yyp):base(yyp){}}
535//%+JumpStatement+140 535//%+JumpStatement+141
536public class JumpStatement : SYMBOL{ 536public class JumpStatement : SYMBOL{
537 private string m_targetName ; 537 private string m_targetName ;
538 public JumpStatement (Parser yyp, string targetName ):base(((LSLSyntax 538 public JumpStatement (Parser yyp, string targetName ):base(((LSLSyntax
@@ -545,9 +545,9 @@ public class JumpStatement : SYMBOL{
545} 545}
546 546
547public override string yyname { get { return "JumpStatement"; }} 547public override string yyname { get { return "JumpStatement"; }}
548public override int yynum { get { return 140; }} 548public override int yynum { get { return 141; }}
549public JumpStatement(Parser yyp):base(yyp){}} 549public JumpStatement(Parser yyp):base(yyp){}}
550//%+StateChange+141 550//%+StateChange+142
551public class StateChange : SYMBOL{ 551public class StateChange : SYMBOL{
552 private string m_newState ; 552 private string m_newState ;
553 public StateChange (Parser yyp, string newState ):base(((LSLSyntax 553 public StateChange (Parser yyp, string newState ):base(((LSLSyntax
@@ -558,9 +558,9 @@ public class StateChange : SYMBOL{
558} 558}
559 559
560public override string yyname { get { return "StateChange"; }} 560public override string yyname { get { return "StateChange"; }}
561public override int yynum { get { return 141; }} 561public override int yynum { get { return 142; }}
562public StateChange(Parser yyp):base(yyp){}} 562public StateChange(Parser yyp):base(yyp){}}
563//%+IfStatement+142 563//%+IfStatement+143
564public class IfStatement : SYMBOL{ 564public class IfStatement : SYMBOL{
565 private void AddStatement ( Statement s ){ if (0< s . kids . Count && s . kids . Top is CompoundStatement ) kids . Add ( s . kids . Pop ()); 565 private void AddStatement ( Statement s ){ if (0< s . kids . Count && s . kids . Top is CompoundStatement ) kids . Add ( s . kids . Pop ());
566 else kids . Add ( s ); 566 else kids . Add ( s );
@@ -577,9 +577,9 @@ public class IfStatement : SYMBOL{
577} 577}
578 578
579public override string yyname { get { return "IfStatement"; }} 579public override string yyname { get { return "IfStatement"; }}
580public override int yynum { get { return 142; }} 580public override int yynum { get { return 143; }}
581public IfStatement(Parser yyp):base(yyp){}} 581public IfStatement(Parser yyp):base(yyp){}}
582//%+WhileStatement+143 582//%+WhileStatement+144
583public class WhileStatement : SYMBOL{ 583public class WhileStatement : SYMBOL{
584 public WhileStatement (Parser yyp, SYMBOL s , Statement st ):base(((LSLSyntax 584 public WhileStatement (Parser yyp, SYMBOL s , Statement st ):base(((LSLSyntax
585)yyp)){ kids . Add ( s ); 585)yyp)){ kids . Add ( s );
@@ -588,9 +588,9 @@ public class WhileStatement : SYMBOL{
588} 588}
589 589
590public override string yyname { get { return "WhileStatement"; }} 590public override string yyname { get { return "WhileStatement"; }}
591public override int yynum { get { return 143; }} 591public override int yynum { get { return 144; }}
592public WhileStatement(Parser yyp):base(yyp){}} 592public WhileStatement(Parser yyp):base(yyp){}}
593//%+DoWhileStatement+144 593//%+DoWhileStatement+145
594public class DoWhileStatement : SYMBOL{ 594public class DoWhileStatement : SYMBOL{
595 public DoWhileStatement (Parser yyp, SYMBOL s , Statement st ):base(((LSLSyntax 595 public DoWhileStatement (Parser yyp, SYMBOL s , Statement st ):base(((LSLSyntax
596)yyp)){ if (0< st . kids . Count && st . kids . Top is CompoundStatement ) kids . Add ( st . kids . Pop ()); 596)yyp)){ if (0< st . kids . Count && st . kids . Top is CompoundStatement ) kids . Add ( st . kids . Pop ());
@@ -599,9 +599,9 @@ public class DoWhileStatement : SYMBOL{
599} 599}
600 600
601public override string yyname { get { return "DoWhileStatement"; }} 601public override string yyname { get { return "DoWhileStatement"; }}
602public override int yynum { get { return 144; }} 602public override int yynum { get { return 145; }}
603public DoWhileStatement(Parser yyp):base(yyp){}} 603public DoWhileStatement(Parser yyp):base(yyp){}}
604//%+ForLoop+145 604//%+ForLoop+146
605public class ForLoop : SYMBOL{ 605public class ForLoop : SYMBOL{
606 public ForLoop (Parser yyp, ForLoopStatement flsa , Expression e , ForLoopStatement flsb , Statement s ):base(((LSLSyntax 606 public ForLoop (Parser yyp, ForLoopStatement flsa , Expression e , ForLoopStatement flsb , Statement s ):base(((LSLSyntax
607)yyp)){ kids . Add ( flsa ); 607)yyp)){ kids . Add ( flsa );
@@ -612,9 +612,9 @@ public class ForLoop : SYMBOL{
612} 612}
613 613
614public override string yyname { get { return "ForLoop"; }} 614public override string yyname { get { return "ForLoop"; }}
615public override int yynum { get { return 145; }} 615public override int yynum { get { return 146; }}
616public ForLoop(Parser yyp):base(yyp){}} 616public ForLoop(Parser yyp):base(yyp){}}
617//%+ForLoopStatement+146 617//%+ForLoopStatement+147
618public class ForLoopStatement : SYMBOL{ 618public class ForLoopStatement : SYMBOL{
619 public ForLoopStatement (Parser yyp, Expression e ):base(((LSLSyntax 619 public ForLoopStatement (Parser yyp, Expression e ):base(((LSLSyntax
620)yyp)){ kids . Add ( e ); 620)yyp)){ kids . Add ( e );
@@ -632,9 +632,9 @@ public class ForLoopStatement : SYMBOL{
632} 632}
633 633
634public override string yyname { get { return "ForLoopStatement"; }} 634public override string yyname { get { return "ForLoopStatement"; }}
635public override int yynum { get { return 146; }} 635public override int yynum { get { return 147; }}
636public ForLoopStatement(Parser yyp):base(yyp){}} 636public ForLoopStatement(Parser yyp):base(yyp){}}
637//%+FunctionCall+147 637//%+FunctionCall+148
638public class FunctionCall : SYMBOL{ 638public class FunctionCall : SYMBOL{
639 private string m_id ; 639 private string m_id ;
640 public FunctionCall (Parser yyp, string id , ArgumentList al ):base(((LSLSyntax 640 public FunctionCall (Parser yyp, string id , ArgumentList al ):base(((LSLSyntax
@@ -648,9 +648,9 @@ public class FunctionCall : SYMBOL{
648} 648}
649 649
650public override string yyname { get { return "FunctionCall"; }} 650public override string yyname { get { return "FunctionCall"; }}
651public override int yynum { get { return 147; }} 651public override int yynum { get { return 148; }}
652public FunctionCall(Parser yyp):base(yyp){}} 652public FunctionCall(Parser yyp):base(yyp){}}
653//%+ArgumentList+148 653//%+ArgumentList+149
654public class ArgumentList : SYMBOL{ 654public class ArgumentList : SYMBOL{
655 public ArgumentList (Parser yyp, Argument a ):base(((LSLSyntax 655 public ArgumentList (Parser yyp, Argument a ):base(((LSLSyntax
656)yyp)){ AddArgument ( a ); 656)yyp)){ AddArgument ( a );
@@ -664,14 +664,14 @@ public class ArgumentList : SYMBOL{
664} 664}
665 665
666public override string yyname { get { return "ArgumentList"; }} 666public override string yyname { get { return "ArgumentList"; }}
667public override int yynum { get { return 148; }} 667public override int yynum { get { return 149; }}
668public ArgumentList(Parser yyp):base(yyp){}} 668public ArgumentList(Parser yyp):base(yyp){}}
669//%+Argument+149 669//%+Argument+150
670public class Argument : SYMBOL{ 670public class Argument : SYMBOL{
671public override string yyname { get { return "Argument"; }} 671public override string yyname { get { return "Argument"; }}
672public override int yynum { get { return 149; }} 672public override int yynum { get { return 150; }}
673public Argument(Parser yyp):base(yyp){}} 673public Argument(Parser yyp):base(yyp){}}
674//%+ExpressionArgument+150 674//%+ExpressionArgument+151
675public class ExpressionArgument : Argument{ 675public class ExpressionArgument : Argument{
676 public ExpressionArgument (Parser yyp, Expression e ):base(((LSLSyntax 676 public ExpressionArgument (Parser yyp, Expression e ):base(((LSLSyntax
677)yyp)){ if ( e is ConstantExpression ) while (0< e . kids . Count ) kids . Add ( e . kids . Pop ()); 677)yyp)){ if ( e is ConstantExpression ) while (0< e . kids . Count ) kids . Add ( e . kids . Pop ());
@@ -679,9 +679,9 @@ public class ExpressionArgument : Argument{
679} 679}
680 680
681public override string yyname { get { return "ExpressionArgument"; }} 681public override string yyname { get { return "ExpressionArgument"; }}
682public override int yynum { get { return 150; }} 682public override int yynum { get { return 151; }}
683public ExpressionArgument(Parser yyp):base(yyp){}} 683public ExpressionArgument(Parser yyp):base(yyp){}}
684//%+Constant+151 684//%+Constant+152
685public class Constant : SYMBOL{ 685public class Constant : SYMBOL{
686 private string m_type ; 686 private string m_type ;
687 private string m_val ; 687 private string m_val ;
@@ -703,9 +703,9 @@ public class Constant : SYMBOL{
703} 703}
704 704
705public override string yyname { get { return "Constant"; }} 705public override string yyname { get { return "Constant"; }}
706public override int yynum { get { return 151; }} 706public override int yynum { get { return 152; }}
707public Constant(Parser yyp):base(yyp){}} 707public Constant(Parser yyp):base(yyp){}}
708//%+VectorConstant+152 708//%+VectorConstant+153
709public class VectorConstant : Constant{ 709public class VectorConstant : Constant{
710 public VectorConstant (Parser yyp, Expression valX , Expression valY , Expression valZ ):base(((LSLSyntax 710 public VectorConstant (Parser yyp, Expression valX , Expression valY , Expression valZ ):base(((LSLSyntax
711)yyp),"vector", null ){ kids . Add ( valX ); 711)yyp),"vector", null ){ kids . Add ( valX );
@@ -714,9 +714,9 @@ public class VectorConstant : Constant{
714} 714}
715 715
716public override string yyname { get { return "VectorConstant"; }} 716public override string yyname { get { return "VectorConstant"; }}
717public override int yynum { get { return 152; }} 717public override int yynum { get { return 153; }}
718public VectorConstant(Parser yyp):base(yyp){}} 718public VectorConstant(Parser yyp):base(yyp){}}
719//%+RotationConstant+153 719//%+RotationConstant+154
720public class RotationConstant : Constant{ 720public class RotationConstant : Constant{
721 public RotationConstant (Parser yyp, Expression valX , Expression valY , Expression valZ , Expression valS ):base(((LSLSyntax 721 public RotationConstant (Parser yyp, Expression valX , Expression valY , Expression valZ , Expression valS ):base(((LSLSyntax
722)yyp),"rotation", null ){ kids . Add ( valX ); 722)yyp),"rotation", null ){ kids . Add ( valX );
@@ -726,36 +726,36 @@ public class RotationConstant : Constant{
726} 726}
727 727
728public override string yyname { get { return "RotationConstant"; }} 728public override string yyname { get { return "RotationConstant"; }}
729public override int yynum { get { return 153; }} 729public override int yynum { get { return 154; }}
730public RotationConstant(Parser yyp):base(yyp){}} 730public RotationConstant(Parser yyp):base(yyp){}}
731//%+ListConstant+154 731//%+ListConstant+155
732public class ListConstant : Constant{ 732public class ListConstant : Constant{
733 public ListConstant (Parser yyp, ArgumentList al ):base(((LSLSyntax 733 public ListConstant (Parser yyp, ArgumentList al ):base(((LSLSyntax
734)yyp),"list", null ){ kids . Add ( al ); 734)yyp),"list", null ){ kids . Add ( al );
735} 735}
736 736
737public override string yyname { get { return "ListConstant"; }} 737public override string yyname { get { return "ListConstant"; }}
738public override int yynum { get { return 154; }} 738public override int yynum { get { return 155; }}
739public ListConstant(Parser yyp):base(yyp){}} 739public ListConstant(Parser yyp):base(yyp){}}
740//%+Expression+155 740//%+Expression+156
741public class Expression : SYMBOL{ 741public class Expression : SYMBOL{
742 protected void AddExpression ( Expression e ){ if ( e is ConstantExpression ) while (0< e . kids . Count ) kids . Add ( e . kids . Pop ()); 742 protected void AddExpression ( Expression e ){ if ( e is ConstantExpression ) while (0< e . kids . Count ) kids . Add ( e . kids . Pop ());
743 else kids . Add ( e ); 743 else kids . Add ( e );
744} 744}
745 745
746public override string yyname { get { return "Expression"; }} 746public override string yyname { get { return "Expression"; }}
747public override int yynum { get { return 155; }} 747public override int yynum { get { return 156; }}
748public Expression(Parser yyp):base(yyp){}} 748public Expression(Parser yyp):base(yyp){}}
749//%+ConstantExpression+156 749//%+ConstantExpression+157
750public class ConstantExpression : Expression{ 750public class ConstantExpression : Expression{
751 public ConstantExpression (Parser yyp, Constant c ):base(((LSLSyntax 751 public ConstantExpression (Parser yyp, Constant c ):base(((LSLSyntax
752)yyp)){ kids . Add ( c ); 752)yyp)){ kids . Add ( c );
753} 753}
754 754
755public override string yyname { get { return "ConstantExpression"; }} 755public override string yyname { get { return "ConstantExpression"; }}
756public override int yynum { get { return 156; }} 756public override int yynum { get { return 157; }}
757public ConstantExpression(Parser yyp):base(yyp){}} 757public ConstantExpression(Parser yyp):base(yyp){}}
758//%+IdentExpression+157 758//%+IdentExpression+158
759public class IdentExpression : Expression{ 759public class IdentExpression : Expression{
760 protected string m_name ; 760 protected string m_name ;
761 public IdentExpression (Parser yyp, string name ):base(((LSLSyntax 761 public IdentExpression (Parser yyp, string name ):base(((LSLSyntax
@@ -768,9 +768,9 @@ public class IdentExpression : Expression{
768} 768}
769 769
770public override string yyname { get { return "IdentExpression"; }} 770public override string yyname { get { return "IdentExpression"; }}
771public override int yynum { get { return 157; }} 771public override int yynum { get { return 158; }}
772public IdentExpression(Parser yyp):base(yyp){}} 772public IdentExpression(Parser yyp):base(yyp){}}
773//%+IdentDotExpression+158 773//%+IdentDotExpression+159
774public class IdentDotExpression : IdentExpression{ 774public class IdentDotExpression : IdentExpression{
775 private string m_member ; 775 private string m_member ;
776 public IdentDotExpression (Parser yyp, string name , string member ):base(((LSLSyntax 776 public IdentDotExpression (Parser yyp, string name , string member ):base(((LSLSyntax
@@ -784,18 +784,18 @@ public class IdentDotExpression : IdentExpression{
784} 784}
785 785
786public override string yyname { get { return "IdentDotExpression"; }} 786public override string yyname { get { return "IdentDotExpression"; }}
787public override int yynum { get { return 158; }} 787public override int yynum { get { return 159; }}
788public IdentDotExpression(Parser yyp):base(yyp){}} 788public IdentDotExpression(Parser yyp):base(yyp){}}
789//%+FunctionCallExpression+159 789//%+FunctionCallExpression+160
790public class FunctionCallExpression : Expression{ 790public class FunctionCallExpression : Expression{
791 public FunctionCallExpression (Parser yyp, FunctionCall fc ):base(((LSLSyntax 791 public FunctionCallExpression (Parser yyp, FunctionCall fc ):base(((LSLSyntax
792)yyp)){ kids . Add ( fc ); 792)yyp)){ kids . Add ( fc );
793} 793}
794 794
795public override string yyname { get { return "FunctionCallExpression"; }} 795public override string yyname { get { return "FunctionCallExpression"; }}
796public override int yynum { get { return 159; }} 796public override int yynum { get { return 160; }}
797public FunctionCallExpression(Parser yyp):base(yyp){}} 797public FunctionCallExpression(Parser yyp):base(yyp){}}
798//%+BinaryExpression+160 798//%+BinaryExpression+161
799public class BinaryExpression : Expression{ 799public class BinaryExpression : Expression{
800 private string m_expressionSymbol ; 800 private string m_expressionSymbol ;
801 public BinaryExpression (Parser yyp, Expression lhs , Expression rhs , string expressionSymbol ):base(((LSLSyntax 801 public BinaryExpression (Parser yyp, Expression lhs , Expression rhs , string expressionSymbol ):base(((LSLSyntax
@@ -810,9 +810,9 @@ public class BinaryExpression : Expression{
810} 810}
811 811
812public override string yyname { get { return "BinaryExpression"; }} 812public override string yyname { get { return "BinaryExpression"; }}
813public override int yynum { get { return 160; }} 813public override int yynum { get { return 161; }}
814public BinaryExpression(Parser yyp):base(yyp){}} 814public BinaryExpression(Parser yyp):base(yyp){}}
815//%+UnaryExpression+161 815//%+UnaryExpression+162
816public class UnaryExpression : Expression{ 816public class UnaryExpression : Expression{
817 private string m_unarySymbol ; 817 private string m_unarySymbol ;
818 public UnaryExpression (Parser yyp, string unarySymbol , Expression e ):base(((LSLSyntax 818 public UnaryExpression (Parser yyp, string unarySymbol , Expression e ):base(((LSLSyntax
@@ -826,9 +826,9 @@ public class UnaryExpression : Expression{
826} 826}
827 827
828public override string yyname { get { return "UnaryExpression"; }} 828public override string yyname { get { return "UnaryExpression"; }}
829public override int yynum { get { return 161; }} 829public override int yynum { get { return 162; }}
830public UnaryExpression(Parser yyp):base(yyp){}} 830public UnaryExpression(Parser yyp):base(yyp){}}
831//%+TypecastExpression+162 831//%+TypecastExpression+163
832public class TypecastExpression : Expression{ 832public class TypecastExpression : Expression{
833 private string m_typecastType ; 833 private string m_typecastType ;
834 public TypecastExpression (Parser yyp, string typecastType , SYMBOL rhs ):base(((LSLSyntax 834 public TypecastExpression (Parser yyp, string typecastType , SYMBOL rhs ):base(((LSLSyntax
@@ -842,18 +842,18 @@ public class TypecastExpression : Expression{
842} 842}
843 843
844public override string yyname { get { return "TypecastExpression"; }} 844public override string yyname { get { return "TypecastExpression"; }}
845public override int yynum { get { return 162; }} 845public override int yynum { get { return 163; }}
846public TypecastExpression(Parser yyp):base(yyp){}} 846public TypecastExpression(Parser yyp):base(yyp){}}
847//%+ParenthesisExpression+163 847//%+ParenthesisExpression+164
848public class ParenthesisExpression : Expression{ 848public class ParenthesisExpression : Expression{
849 public ParenthesisExpression (Parser yyp, SYMBOL s ):base(((LSLSyntax 849 public ParenthesisExpression (Parser yyp, SYMBOL s ):base(((LSLSyntax
850)yyp)){ kids . Add ( s ); 850)yyp)){ kids . Add ( s );
851} 851}
852 852
853public override string yyname { get { return "ParenthesisExpression"; }} 853public override string yyname { get { return "ParenthesisExpression"; }}
854public override int yynum { get { return 163; }} 854public override int yynum { get { return 164; }}
855public ParenthesisExpression(Parser yyp):base(yyp){}} 855public ParenthesisExpression(Parser yyp):base(yyp){}}
856//%+IncrementDecrementExpression+164 856//%+IncrementDecrementExpression+165
857public class IncrementDecrementExpression : Expression{ 857public class IncrementDecrementExpression : Expression{
858 private string m_name ; 858 private string m_name ;
859 private string m_operation ; 859 private string m_operation ;
@@ -881,7 +881,7 @@ public class IncrementDecrementExpression : Expression{
881} 881}
882 882
883public override string yyname { get { return "IncrementDecrementExpression"; }} 883public override string yyname { get { return "IncrementDecrementExpression"; }}
884public override int yynum { get { return 164; }} 884public override int yynum { get { return 165; }}
885public IncrementDecrementExpression(Parser yyp):base(yyp){}} 885public IncrementDecrementExpression(Parser yyp):base(yyp){}}
886 886
887public class LSLProgramRoot_1 : LSLProgramRoot { 887public class LSLProgramRoot_1 : LSLProgramRoot {
@@ -2234,6 +2234,11 @@ public class Event_8 : Event {
2234 ((HTTP_REQUEST_EVENT)(yyq.StackAt(0).m_value)) 2234 ((HTTP_REQUEST_EVENT)(yyq.StackAt(0).m_value))
2235 .yytext){}} 2235 .yytext){}}
2236 2236
2237public class Event_9 : Event {
2238 public Event_9(Parser yyq):base(yyq,
2239 ((TRANSACTION_RESULT_EVENT)(yyq.StackAt(0).m_value))
2240 .yytext){}}
2241
2237public class VoidArgEvent_1 : VoidArgEvent { 2242public class VoidArgEvent_1 : VoidArgEvent {
2238 public VoidArgEvent_1(Parser yyq):base(yyq, 2243 public VoidArgEvent_1(Parser yyq):base(yyq,
2239 ((STATE_ENTRY_EVENT)(yyq.StackAt(0).m_value)) 2244 ((STATE_ENTRY_EVENT)(yyq.StackAt(0).m_value))
@@ -2376,12 +2381,12 @@ public class ArgumentDeclarationList_3 : ArgumentDeclarationList {
2376public class ArgumentList_3 : ArgumentList { 2381public class ArgumentList_3 : ArgumentList {
2377 public ArgumentList_3(Parser yyq):base(yyq){}} 2382 public ArgumentList_3(Parser yyq):base(yyq){}}
2378 2383
2379public class ArgumentDeclarationList_4 : ArgumentDeclarationList {
2380 public ArgumentDeclarationList_4(Parser yyq):base(yyq){}}
2381
2382public class ArgumentList_4 : ArgumentList { 2384public class ArgumentList_4 : ArgumentList {
2383 public ArgumentList_4(Parser yyq):base(yyq){}} 2385 public ArgumentList_4(Parser yyq):base(yyq){}}
2384 2386
2387public class ArgumentDeclarationList_4 : ArgumentDeclarationList {
2388 public ArgumentDeclarationList_4(Parser yyq):base(yyq){}}
2389
2385public class ArgumentDeclarationList_5 : ArgumentDeclarationList { 2390public class ArgumentDeclarationList_5 : ArgumentDeclarationList {
2386 public ArgumentDeclarationList_5(Parser yyq):base(yyq){}} 2391 public ArgumentDeclarationList_5(Parser yyq):base(yyq){}}
2387public yyLSLSyntax 2392public yyLSLSyntax
@@ -2394,10 +2399,10 @@ public yyLSLSyntax
23940,103,0,114,0, 23990,103,0,114,0,
239597,0,109,0,82, 240097,0,109,0,82,
23960,111,0,111,0, 24010,111,0,111,0,
2397116,0,1,96,1, 2402116,0,1,97,1,
23982,104,18,1,2841, 24032,104,18,1,2845,
2399102,2,0,105,5, 2404102,2,0,105,5,
2400394,1,0,106,18, 2405395,1,0,106,18,
24011,0,0,2,0, 24061,0,0,2,0,
24021,1,107,18,1, 24071,1,107,18,1,
24031,108,20,109,4, 24081,108,20,109,4,
@@ -2458,12 +2463,12 @@ public yyLSLSyntax
2458121,0,112,0,101, 2463121,0,112,0,101,
24590,110,0,97,0, 24640,110,0,97,0,
2460109,0,101,0,1, 2465109,0,101,0,1,
2461123,1,2,2,0, 2466124,1,2,2,0,
24621,9,131,18,1, 24671,9,131,18,1,
24639,132,20,133,4, 24689,132,20,133,4,
246410,73,0,68,0, 246910,73,0,68,0,
246569,0,78,0,84, 247069,0,78,0,84,
24660,1,92,1,1, 24710,1,93,1,1,
24672,0,1,10,134, 24722,0,1,10,134,
246818,1,10,135,20, 247318,1,10,135,20,
2469136,4,20,76,0, 2474136,4,20,76,0,
@@ -2487,48 +2492,50 @@ public yyLSLSyntax
2487105,0,111,0,110, 2492105,0,111,0,110,
24880,76,0,105,0, 24930,76,0,105,0,
2489115,0,116,0,1, 2494115,0,116,0,1,
2490111,1,2,2,0, 2495112,1,2,2,0,
24911,21,142,18,1, 24961,21,142,18,1,
249221,143,20,144,4, 249721,143,20,144,4,
249310,67,0,79,0, 249810,67,0,79,0,
249477,0,77,0,65, 249977,0,77,0,65,
24950,1,14,1,1, 25000,1,14,1,1,
24962,0,1,2807,145, 25012,0,1,1694,145,
249718,1,2807,146,20, 250218,1,1694,146,20,
2498147,4,18,83,0, 2503147,4,32,70,0,
249969,0,77,0,73,
25000,67,0,79,0,
250176,0,79,0,78,
25020,1,11,1,1,
25032,0,1,1694,148,
250418,1,1694,149,20,
2505150,4,32,70,0,
2506111,0,114,0,76, 2504111,0,114,0,76,
25070,111,0,111,0, 25050,111,0,111,0,
2508112,0,83,0,116, 2506112,0,83,0,116,
25090,97,0,116,0, 25070,97,0,116,0,
2510101,0,109,0,101, 2508101,0,109,0,101,
25110,110,0,116,0, 25090,110,0,116,0,
25121,146,1,2,2, 25101,147,1,2,2,
25130,1,1695,151,18, 25110,1,1695,148,18,
25141,1695,143,2,0, 25121,1695,143,2,0,
25131,2811,149,18,1,
25142811,150,20,151,4,
251518,83,0,69,0,
251677,0,73,0,67,
25170,79,0,76,0,
251879,0,78,0,1,
251911,1,1,2,0,
25151,2645,152,18,1, 25201,2645,152,18,1,
25162645,153,20,154,4, 25212645,153,20,154,4,
251734,86,0,111,0, 252232,73,0,110,0,
2518105,0,100,0,65, 2523116,0,65,0,114,
25190,114,0,103,0, 25240,103,0,83,0,
252083,0,116,0,97, 2525116,0,97,0,116,
25210,116,0,101,0, 25260,101,0,69,0,
252269,0,118,0,101, 2527118,0,101,0,110,
25230,110,0,116,0, 25280,116,0,1,107,
25241,104,1,2,2, 25291,2,2,0,1,
25250,1,2646,155,18, 25302646,155,18,1,2646,
25261,2646,156,20,157, 2531156,20,157,4,32,
25274,20,83,0,116, 253275,0,101,0,121,
25330,65,0,114,0,
2534103,0,83,0,116,
25280,97,0,116,0, 25350,97,0,116,0,
2529101,0,69,0,118, 2536101,0,69,0,118,
25300,101,0,110,0, 25370,101,0,110,0,
2531116,0,1,103,1, 2538116,0,1,106,1,
25322,2,0,1,30, 25392,2,0,1,30,
2533158,18,1,30,159, 2540158,18,1,30,159,
253420,160,4,22,68, 254120,160,4,22,68,
@@ -2536,7 +2543,7 @@ public yyLSLSyntax
2536108,0,97,0,114, 2543108,0,97,0,114,
25370,97,0,116,0, 25440,97,0,116,0,
2538105,0,111,0,110, 2545105,0,111,0,110,
25390,1,118,1,2, 25460,1,119,1,2,
25402,0,1,31,161, 25472,0,1,31,161,
254118,1,31,162,20, 254818,1,31,162,20,
2542163,4,22,82,0, 2549163,4,22,82,0,
@@ -2554,728 +2561,753 @@ public yyLSLSyntax
255469,0,1,12,1, 256169,0,1,12,1,
25551,2,0,1,2650, 25621,2,0,1,2650,
2556167,18,1,2650,168, 2563167,18,1,2650,168,
255720,169,4,44,73, 256420,169,4,44,75,
25580,110,0,116,0, 25650,101,0,121,0,
255982,0,111,0,116, 256673,0,110,0,116,
25600,82,0,111,0, 25670,73,0,110,0,
2561116,0,65,0,114, 2568116,0,65,0,114,
25620,103,0,83,0, 25690,103,0,83,0,
2563116,0,97,0,116, 2570116,0,97,0,116,
25640,101,0,69,0, 25710,101,0,69,0,
2565118,0,101,0,110, 2572118,0,101,0,110,
25660,116,0,1,108, 25730,116,0,1,111,
25671,2,2,0,1, 25741,2,2,0,1,
25682819,170,18,1,2819, 25752651,170,18,1,2651,
2569171,20,172,4,34, 2576171,20,172,4,44,
257071,0,108,0,111, 257773,0,110,0,116,
25710,98,0,97,0, 25780,86,0,101,0,
2572108,0,68,0,101, 257999,0,86,0,101,
25800,99,0,65,0,
2581114,0,103,0,83,
25820,116,0,97,0,
2583116,0,101,0,69,
25840,118,0,101,0,
2585110,0,116,0,1,
2586110,1,2,2,0,
25871,1114,173,18,1,
25881114,132,2,0,1,
25892654,174,18,1,2654,
2590153,2,0,1,1152,
2591175,18,1,1152,176,
259220,177,4,32,83,
25930,105,0,109,0,
2594112,0,108,0,101,
25950,65,0,115,0,
2596115,0,105,0,103,
25970,110,0,109,0,
2598101,0,110,0,116,
25990,1,138,1,2,
26002,0,1,1117,178,
260118,1,1117,179,20,
2602180,4,28,80,0,
260369,0,82,0,67,
26040,69,0,78,0,
260584,0,95,0,69,
26060,81,0,85,0,
260765,0,76,0,83,
26080,1,10,1,1,
26092,0,1,40,181,
261018,1,40,132,2,
26110,1,41,182,18,
26121,41,135,2,0,
26131,42,183,18,1,
261442,184,20,185,4,
261520,69,0,120,0,
2616112,0,114,0,101,
26170,115,0,115,0,
2618105,0,111,0,110,
26190,1,156,1,2,
26202,0,1,43,186,
262118,1,43,187,20,
2622188,4,22,82,0,
262373,0,71,0,72,
26240,84,0,95,0,
262583,0,72,0,73,
26260,70,0,84,0,
26271,41,1,1,2,
26280,1,44,189,18,
26291,44,132,2,0,
26301,1159,190,18,1,
26311159,184,2,0,1,
263246,191,18,1,46,
2633192,20,193,4,12,
263480,0,69,0,82,
26350,73,0,79,0,
263668,0,1,24,1,
26371,2,0,1,47,
2638194,18,1,47,132,
26392,0,1,48,195,
264018,1,48,196,20,
2641197,4,18,68,0,
264269,0,67,0,82,
26430,69,0,77,0,
264469,0,78,0,84,
26450,1,5,1,1,
26462,0,1,49,198,
264718,1,49,199,20,
2648200,4,18,73,0,
264978,0,67,0,82,
26500,69,0,77,0,
265169,0,78,0,84,
26520,1,4,1,1,
26532,0,1,50,201,
265418,1,50,196,2,
26550,1,51,202,18,
26561,51,199,2,0,
26571,52,203,18,1,
265852,135,2,0,1,
26592281,204,18,1,2281,
2660176,2,0,1,2841,
2661205,18,1,2841,206,
266220,207,4,48,71,
26630,108,0,111,0,
266498,0,97,0,108,
26650,70,0,117,0,
2666110,0,99,0,116,
26670,105,0,111,0,
2668110,0,68,0,101,
25730,102,0,105,0, 26690,102,0,105,0,
2574110,0,105,0,116, 2670110,0,105,0,116,
25750,105,0,111,0, 26710,105,0,111,0,
2576110,0,115,0,1, 2672110,0,1,100,1,
257797,1,2,2,0, 26732,2,0,1,2842,
25781,2652,173,18,1, 2674208,18,1,2842,209,
25792652,174,20,175,4, 267520,210,4,50,71,
258032,73,0,110,0, 26760,108,0,111,0,
2581116,0,65,0,114, 267798,0,97,0,108,
25820,103,0,83,0, 26780,86,0,97,0,
2583116,0,97,0,116, 2679114,0,105,0,97,
25840,101,0,69,0, 26800,98,0,108,0,
2585118,0,101,0,110, 2681101,0,68,0,101,
25860,116,0,1,106, 26820,99,0,108,0,
25871,2,2,0,1, 268397,0,114,0,97,
25881114,176,18,1,1114, 26840,116,0,105,0,
2589132,2,0,1,2654, 2685111,0,110,0,1,
2590177,18,1,2654,153, 268699,1,2,2,0,
25912,0,1,1152,178, 26871,2755,211,18,1,
259218,1,1152,179,20, 26882755,212,20,213,4,
2593180,4,32,83,0, 268922,82,0,73,0,
2594105,0,109,0,112, 269071,0,72,0,84,
25950,108,0,101,0, 26910,95,0,66,0,
259665,0,115,0,115, 269282,0,65,0,67,
25970,105,0,103,0, 26930,69,0,1,13,
2598110,0,109,0,101, 26941,1,2,0,1,
25990,110,0,116,0, 26951730,214,18,1,1730,
26001,137,1,2,2, 2696176,2,0,1,1731,
26010,1,1117,181,18, 2697215,18,1,1731,150,
26021,1117,182,20,183, 26982,0,1,61,216,
26034,28,80,0,69, 269918,1,61,129,2,
26040,82,0,67,0, 27000,1,62,217,18,
260569,0,78,0,84, 27011,62,162,2,0,
26060,95,0,69,0, 27021,63,218,18,1,
260781,0,85,0,65, 270363,132,2,0,1,
26080,76,0,83,0, 270465,219,18,1,65,
26091,10,1,1,2, 2705192,2,0,1,66,
26100,1,40,184,18, 2706220,18,1,66,132,
26111,40,132,2,0, 27072,0,1,67,221,
26121,41,185,18,1, 270818,1,67,196,2,
261341,135,2,0,1, 27090,1,68,222,18,
261442,186,18,1,42, 27101,68,199,2,0,
2615187,20,188,4,20, 27111,69,223,18,1,
261669,0,120,0,112, 271269,196,2,0,1,
26170,114,0,101,0, 271370,224,18,1,70,
2618115,0,115,0,105, 2714199,2,0,1,71,
26190,111,0,110,0, 2715225,18,1,71,135,
26201,155,1,2,2, 27162,0,1,73,226,
26210,1,43,189,18, 271718,1,73,184,2,
26221,43,190,20,191, 27180,1,74,227,18,
26234,22,82,0,73, 27191,74,162,2,0,
26240,71,0,72,0, 27201,1189,228,18,1,
262584,0,95,0,83, 27211189,229,20,230,4,
26260,72,0,73,0, 272222,83,0,84,0,
262770,0,84,0,1, 272365,0,82,0,95,
262841,1,1,2,0, 27240,69,0,81,0,
26291,44,192,18,1, 272585,0,65,0,76,
263044,132,2,0,1, 27260,83,0,1,8,
26311159,193,18,1,1159, 27271,1,2,0,1,
2632187,2,0,1,46, 272876,231,18,1,76,
2633194,18,1,46,195, 2729232,20,233,4,20,
263420,196,4,12,80, 273076,0,69,0,70,
26350,69,0,82,0, 27310,84,0,95,0,
263673,0,79,0,68, 273283,0,72,0,73,
26370,1,24,1,1, 27330,70,0,84,0,
26382,0,1,47,197, 27341,40,1,1,2,
263918,1,47,132,2, 27350,1,1153,234,18,
26400,1,48,198,18, 27361,1153,235,20,236,
26411,48,199,20,200, 27374,24,83,0,76,
26424,18,68,0,69, 27380,65,0,83,0,
26430,67,0,82,0, 273972,0,95,0,69,
264469,0,77,0,69, 27400,81,0,85,0,
26450,78,0,84,0, 274165,0,76,0,83,
26461,5,1,1,2, 27420,1,9,1,1,
26470,1,49,201,18, 27432,0,1,79,237,
26481,49,202,20,203, 274418,1,79,238,20,
26494,18,73,0,78, 2745239,4,10,84,0,
26500,67,0,82,0, 274673,0,76,0,68,
265169,0,77,0,69, 27470,69,0,1,36,
26520,78,0,84,0, 27481,1,2,0,1,
26531,4,1,1,2, 27491195,240,18,1,1195,
26540,1,50,204,18, 2750184,2,0,1,82,
26551,50,199,2,0, 2751241,18,1,82,184,
26561,51,205,18,1, 27522,0,1,1123,242,
265751,202,2,0,1, 275318,1,1123,184,2,
265852,206,18,1,52, 27540,1,85,243,18,
2659135,2,0,1,2281, 27551,85,244,20,245,
2660207,18,1,2281,179, 27564,26,83,0,84,
26612,0,1,2839,208, 27570,82,0,79,0,
266218,1,2839,209,20, 275875,0,69,0,95,
2663210,4,48,71,0, 27590,83,0,84,0,
2664108,0,111,0,98, 276082,0,79,0,75,
26650,97,0,108,0, 27610,69,0,1,39,
266670,0,117,0,110, 27621,1,2,0,1,
26670,99,0,116,0, 27632547,246,18,1,2547,
2668105,0,111,0,110, 2764247,20,248,4,28,
26690,68,0,101,0, 276582,0,111,0,116,
2670102,0,105,0,110,
26710,105,0,116,0,
2672105,0,111,0,110,
26730,1,99,1,2,
26742,0,1,2840,211,
267518,1,2840,212,20,
2676213,4,50,71,0,
2677108,0,111,0,98,
26780,97,0,108,0,
267986,0,97,0,114,
26800,105,0,97,0,
268198,0,108,0,101,
26820,68,0,101,0, 27660,68,0,101,0,
268399,0,108,0,97, 276799,0,108,0,97,
26840,114,0,97,0, 27680,114,0,97,0,
2685116,0,105,0,111, 2769116,0,105,0,111,
26860,110,0,1,98, 27700,110,0,1,123,
26871,2,2,0,1, 27711,2,2,0,1,
26882841,104,1,2842,214, 277289,249,18,1,89,
268918,1,2842,215,23, 2773250,20,251,4,10,
2690216,4,6,69,0, 277477,0,73,0,78,
269179,0,70,0,1, 27750,85,0,83,0,
26922,1,6,2,0, 27761,19,1,1,2,
26931,1730,217,18,1, 27770,1,2318,252,18,
26941730,179,2,0,1, 27781,2318,150,2,0,
26951731,218,18,1,1731, 27791,93,253,18,1,
2696146,2,0,1,61, 278093,184,2,0,1,
2697219,18,1,61,129, 27812792,254,18,1,2792,
26982,0,1,62,220, 2782184,2,0,1,97,
269918,1,62,162,2, 2783255,18,1,97,256,
27000,1,63,221,18, 278420,257,4,14,65,
27011,63,132,2,0, 27850,77,0,80,0,
27021,65,222,18,1, 278695,0,65,0,77,
270365,195,2,0,1, 27870,80,0,1,38,
270466,223,18,1,66, 27881,1,2,0,1,
2705132,2,0,1,67, 2789102,258,18,1,102,
2706224,18,1,67,199, 2790259,20,260,4,22,
27072,0,1,68,225, 279169,0,88,0,67,
270818,1,68,202,2, 27920,76,0,65,0,
27090,1,69,226,18, 279377,0,65,0,84,
27101,69,199,2,0, 27940,73,0,79,0,
27111,70,227,18,1, 279578,0,1,37,1,
271270,202,2,0,1, 27961,2,0,1,1775,
271371,228,18,1,71, 2797261,18,1,1775,162,
2714135,2,0,1,73, 27982,0,1,107,262,
2715229,18,1,73,187, 279918,1,107,184,2,
27162,0,1,74,230, 28000,1,2337,263,18,
271718,1,74,162,2, 28011,2337,162,2,0,
27180,1,1189,231,18, 28021,1224,264,18,1,
27191,1189,232,20,233, 28031224,176,2,0,1,
27204,22,83,0,84, 28041225,265,18,1,1225,
27210,65,0,82,0, 2805266,20,267,4,24,
280677,0,73,0,78,
28070,85,0,83,0,
272295,0,69,0,81, 280895,0,69,0,81,
27230,85,0,65,0, 28090,85,0,65,0,
272476,0,83,0,1, 281076,0,83,0,1,
27258,1,1,2,0, 28117,1,1,2,0,
27261,76,234,18,1, 28121,112,268,18,1,
272776,235,20,236,4, 2813112,269,20,270,4,
272820,76,0,69,0, 281428,71,0,82,0,
272970,0,84,0,95, 281569,0,65,0,84,
27300,83,0,72,0, 28160,69,0,82,0,
273173,0,70,0,84, 281795,0,69,0,81,
27320,1,40,1,1, 28180,85,0,65,0,
27332,0,1,1153,237, 281976,0,83,0,1,
273418,1,1153,238,20, 282032,1,1,2,0,
2735239,4,24,83,0, 28211,1188,271,18,1,
273676,0,65,0,83, 28221188,176,2,0,1,
27370,72,0,95,0, 28231231,272,18,1,1231,
273869,0,81,0,85, 2824184,2,0,1,118,
27390,65,0,76,0, 2825273,18,1,118,184,
274083,0,1,9,1, 28262,0,1,1737,274,
27411,2,0,1,79, 282718,1,1737,184,2,
2742240,18,1,79,241, 28280,1,124,275,18,
274320,242,4,10,84, 28291,124,276,20,277,
27440,73,0,76,0, 28304,22,76,0,69,
274568,0,69,0,1, 28310,83,0,83,0,
274636,1,1,2,0, 283295,0,69,0,81,
27471,1195,243,18,1, 28330,85,0,65,0,
27481195,187,2,0,1, 283476,0,83,0,1,
274982,244,18,1,82, 283531,1,1,2,0,
2750187,2,0,1,1123, 28361,2657,278,18,1,
2751245,18,1,1123,187, 28372657,279,20,280,4,
27522,0,1,85,246, 283820,83,0,116,0,
275318,1,85,247,20, 283997,0,116,0,101,
2754248,4,26,83,0, 28400,69,0,118,0,
275584,0,82,0,79, 2841101,0,110,0,116,
27560,75,0,69,0, 28420,1,104,1,2,
275795,0,83,0,84, 28432,0,1,2658,281,
27580,82,0,79,0, 284418,1,2658,282,20,
275975,0,69,0,1, 2845283,4,26,68,0,
276039,1,1,2,0, 284669,0,70,0,65,
27611,2547,249,18,1, 28470,85,0,76,0,
27622547,250,20,251,4, 284884,0,95,0,83,
276364,73,0,110,0, 28490,84,0,65,0,
2764116,0,82,0,111, 285084,0,69,0,1,
27650,116,0,82,0, 285147,1,1,2,0,
2766111,0,116,0,65, 28521,2659,284,18,1,
27670,114,0,103,0, 28532659,165,2,0,1,
2768117,0,109,0,101, 2854130,285,18,1,130,
27690,110,0,116,0, 2855184,2,0,1,2843,
277068,0,101,0,99, 2856286,18,1,2843,206,
27710,108,0,97,0, 28572,0,1,1803,287,
2772114,0,97,0,116, 285818,1,1803,288,20,
27730,105,0,111,0, 2859289,4,18,83,0,
2774110,0,76,0,105, 2860116,0,97,0,116,
27750,115,0,116,0, 28610,101,0,109,0,
27761,115,1,2,2, 2862101,0,110,0,116,
27770,1,89,252,18, 28630,1,135,1,2,
27781,89,253,20,254, 28642,0,1,1804,290,
27794,10,77,0,73, 286518,1,1804,291,20,
27800,78,0,85,0, 2866292,4,4,68,0,
278183,0,1,19,1, 286779,0,1,44,1,
27821,2,0,1,2318, 28681,2,0,1,2591,
2783255,18,1,2318,146, 2869293,18,1,2591,140,
27842,0,1,2788,256, 28702,0,1,2364,294,
278518,1,2788,187,2, 287118,1,2364,288,2,
27860,1,93,257,18, 28720,1,137,295,18,
27871,93,187,2,0, 28731,137,296,20,297,
27881,97,258,18,1, 28744,36,69,0,88,
278997,259,20,260,4,
279014,65,0,77,0,
279180,0,95,0,65,
27920,77,0,80,0,
27931,38,1,1,2,
27940,1,102,261,18,
27951,102,262,20,263,
27964,22,69,0,88,
27970,67,0,76,0, 28750,67,0,76,0,
279865,0,77,0,65, 287665,0,77,0,65,
27990,84,0,73,0, 28770,84,0,73,0,
280079,0,78,0,1, 287879,0,78,0,95,
280137,1,1,2,0, 28790,69,0,81,0,
28021,1775,264,18,1, 288085,0,65,0,76,
28031775,162,2,0,1, 28810,83,0,1,30,
2804107,265,18,1,107,
2805187,2,0,1,2337,
2806266,18,1,2337,162,
28072,0,1,1224,267,
280818,1,1224,179,2,
28090,1,1225,268,18,
28101,1225,269,20,270,
28114,24,77,0,73,
28120,78,0,85,0,
281383,0,95,0,69,
28140,81,0,85,0,
281565,0,76,0,83,
28160,1,7,1,1,
28172,0,1,112,271,
281818,1,112,272,20,
2819273,4,28,71,0,
282082,0,69,0,65,
28210,84,0,69,0,
282282,0,95,0,69,
28230,81,0,85,0,
282465,0,76,0,83,
28250,1,32,1,1,
28262,0,1,1188,274,
282718,1,1188,179,2,
28280,1,1231,275,18,
28291,1231,187,2,0,
28301,118,276,18,1,
2831118,187,2,0,1,
28321737,277,18,1,1737,
2833187,2,0,1,2818,
2834278,18,1,2818,146,
28352,0,1,124,279,
283618,1,124,280,20,
2837281,4,22,76,0,
283869,0,83,0,83,
28390,95,0,69,0,
284081,0,85,0,65,
28410,76,0,83,0,
28421,31,1,1,2,
28430,1,2657,282,18,
28441,2657,165,2,0,
28451,130,283,18,1,
2846130,187,2,0,1,
28471803,284,18,1,1803,
2848285,20,286,4,18,
284983,0,116,0,97,
28500,116,0,101,0,
2851109,0,101,0,110,
28520,116,0,1,134,
28531,2,2,0,1,
28541804,287,18,1,1804,
2855288,20,289,4,4,
285668,0,79,0,1,
285744,1,1,2,0,
28581,2830,290,18,1,
28592830,291,20,292,4,
286012,83,0,116,0,
286197,0,116,0,101,
28620,115,0,1,100,
28631,2,2,0,1,
28642364,293,18,1,2364,
2865285,2,0,1,137,
2866294,18,1,137,295,
286720,296,4,36,69,
28680,88,0,67,0,
286976,0,65,0,77,
28700,65,0,84,0,
287173,0,79,0,78,
28720,95,0,69,0,
287381,0,85,0,65,
28740,76,0,83,0,
28751,30,1,1,2,
28760,1,2293,297,18,
28771,2293,146,2,0,
28781,1701,298,18,1,
28791701,187,2,0,1,
28801756,299,18,1,1756,
2881146,2,0,1,2527,
2882300,18,1,2527,132,
28832,0,1,143,301,
288418,1,143,187,2,
28850,1,2299,302,18,
28861,2299,187,2,0,
28871,1260,303,18,1,
28881260,179,2,0,1,
28891261,304,18,1,1261,
2890305,20,306,4,22,
289180,0,76,0,85,
28920,83,0,95,0,
289369,0,81,0,85,
28940,65,0,76,0,
289583,0,1,6,1,
28961,2,0,1,2528,
2897307,18,1,2528,308,
289820,309,4,28,86,
28990,101,0,99,0,
290068,0,101,0,99,
29010,108,0,97,0,
2902114,0,97,0,116,
29030,105,0,111,0,
2904110,0,1,121,1,
29052,2,0,1,151,
2906310,18,1,151,311,
290720,312,4,26,69,
29080,81,0,85,0,
290965,0,76,0,83,
29100,95,0,69,0,
291181,0,85,0,65,
29120,76,0,83,0,
29131,29,1,1,2,
29140,1,1267,313,18,
29151,1267,187,2,0,
29161,2765,314,18,1,
29172765,132,2,0,1,
2918157,315,18,1,157,
2919187,2,0,1,1773,
2920316,18,1,1773,149,
29212,0,1,1832,317,
292218,1,1832,285,2,
29230,1,1833,318,18,
29241,1833,319,20,320,
29254,10,87,0,72,
29260,73,0,76,0,
292769,0,1,45,1,
29281,2,0,1,1834,
2929321,18,1,1834,135,
29302,0,1,166,322,
293118,1,166,323,20,
2932324,4,20,76,0,
293369,0,70,0,84,
29340,95,0,65,0,
293578,0,71,0,76,
29360,69,0,1,25,
29371,1,2,0,1, 28821,1,2,0,1,
29381840,325,18,1,1840, 28832293,298,18,1,2293,
2939187,2,0,1,2779, 2884150,2,0,1,2834,
2940326,18,1,2779,327, 2885299,18,1,2834,300,
294120,328,4,34,67, 288620,301,4,12,83,
29420,111,0,109,0, 28870,116,0,97,0,
2943112,0,111,0,117, 2888116,0,101,0,115,
29440,110,0,100,0, 28890,1,101,1,2,
294583,0,116,0,97, 28902,0,1,1701,302,
29460,116,0,101,0, 289118,1,1701,184,2,
2947109,0,101,0,110, 28920,1,1756,303,18,
29480,116,0,1,132, 28931,1756,150,2,0,
28941,2527,304,18,1,
28952527,114,2,0,1,
2896143,305,18,1,143,
2897184,2,0,1,2299,
2898306,18,1,2299,184,
28992,0,1,1260,307,
290018,1,1260,176,2,
29010,1,1261,308,18,
29021,1261,309,20,310,
29034,22,80,0,76,
29040,85,0,83,0,
290595,0,69,0,81,
29060,85,0,65,0,
290776,0,83,0,1,
29086,1,1,2,0,
29091,2528,311,18,1,
29102528,132,2,0,1,
29112844,312,18,1,2844,
2912209,2,0,1,2845,
2913104,1,151,313,18,
29141,151,314,20,315,
29154,26,69,0,81,
29160,85,0,65,0,
291776,0,83,0,95,
29180,69,0,81,0,
291985,0,65,0,76,
29200,83,0,1,29,
29211,1,2,0,1,
29221267,316,18,1,1267,
2923184,2,0,1,157,
2924317,18,1,157,184,
29252,0,1,2767,318,
292618,1,2767,319,20,
2927320,4,10,83,0,
2928116,0,97,0,116,
29290,101,0,1,102,
29491,2,2,0,1, 29301,2,2,0,1,
2950172,329,18,1,172, 29311773,321,18,1,1773,
2951187,2,0,1,2335, 2932146,2,0,1,1832,
2952330,18,1,2335,149, 2933322,18,1,1832,288,
29532,0,1,1296,331, 29342,0,1,1833,323,
295418,1,1296,179,2, 293518,1,1833,324,20,
29550,1,1297,332,18, 2936325,4,10,87,0,
29561,1297,333,20,334, 293772,0,73,0,76,
29380,69,0,1,45,
29391,1,2,0,1,
29401834,326,18,1,1834,
2941135,2,0,1,166,
2942327,18,1,166,328,
294320,329,4,20,76,
29440,69,0,70,0,
294584,0,95,0,65,
29460,78,0,71,0,
294776,0,69,0,1,
294825,1,1,2,0,
29491,1840,330,18,1,
29501840,184,2,0,1,
29512779,331,18,1,2779,
2952140,2,0,1,172,
2953332,18,1,172,184,
29542,0,1,2785,333,
295518,1,2785,159,2,
29560,1,2786,334,18,
29571,2786,335,20,336,
29574,12,69,0,81, 29584,12,69,0,81,
29580,85,0,65,0, 29590,85,0,65,0,
295976,0,83,0,1, 296076,0,83,0,1,
296015,1,1,2,0, 296115,1,1,2,0,
29611,2413,335,18,1, 29621,2335,337,18,1,
29622413,336,20,337,4, 29632335,146,2,0,1,
296326,83,0,116,0, 29641296,338,18,1,1296,
296497,0,116,0,101, 2965176,2,0,1,1297,
29650,109,0,101,0, 2966339,18,1,1297,335,
2966110,0,116,0,76, 29672,0,1,2413,340,
29670,105,0,115,0, 296818,1,2413,341,20,
2968116,0,1,133,1, 2969342,4,26,83,0,
29692,2,0,1,1859, 2970116,0,97,0,116,
2970338,18,1,1859,162, 29710,101,0,109,0,
29712,0,1,1860,339, 2972101,0,110,0,116,
297218,1,1860,146,2, 29730,76,0,105,0,
29730,1,188,340,18, 2974115,0,116,0,1,
29741,188,187,2,0, 2975134,1,2,2,0,
29751,182,341,18,1, 29761,1859,343,18,1,
2976182,342,20,343,4, 29771859,162,2,0,1,
297722,82,0,73,0, 29781860,344,18,1,1860,
297871,0,72,0,84, 2979150,2,0,1,188,
29790,95,0,65,0, 2980345,18,1,188,184,
298078,0,71,0,76, 29812,0,1,182,346,
29810,69,0,1,26, 298218,1,182,347,20,
29821,1,2,0,1, 2983348,4,22,82,0,
2983199,344,18,1,199, 298473,0,71,0,72,
2984345,20,346,4,10, 29850,84,0,95,0,
298567,0,65,0,82, 298665,0,78,0,71,
29860,69,0,84,0, 29870,76,0,69,0,
29871,35,1,1,2, 29881,26,1,1,2,
29880,1,1871,347,18, 29890,1,199,349,18,
29891,1871,179,2,0, 29901,199,350,20,351,
29901,1872,348,18,1, 29914,10,67,0,65,
29911872,162,2,0,1, 29920,82,0,69,0,
29921873,349,18,1,1873, 299384,0,1,35,1,
2993146,2,0,1,1875, 29941,2,0,1,1871,
2994350,18,1,1875,319, 2995352,18,1,1871,176,
29952,0,1,205,351, 29962,0,1,1872,353,
299618,1,205,187,2, 299718,1,1872,162,2,
29970,1,2581,352,18, 29980,1,1873,354,18,
29981,2581,135,2,0, 29991,1873,150,2,0,
29991,1882,353,18,1, 30001,1875,355,18,1,
30001882,187,2,0,1, 30011875,324,2,0,1,
30012227,354,18,1,2227, 3002205,356,18,1,205,
3002285,2,0,1,2590, 3003184,2,0,1,2581,
3003355,18,1,2590,140, 3004357,18,1,2581,358,
30042,0,1,217,356, 300520,359,4,10,69,
300518,1,217,357,20, 30060,118,0,101,0,
3006358,4,12,83,0, 3007110,0,116,0,1,
3008125,1,2,2,0,
30091,2515,360,18,1,
30102515,143,2,0,1,
30111882,361,18,1,1882,
3012184,2,0,1,2227,
3013362,18,1,2227,288,
30142,0,1,217,363,
301518,1,217,364,20,
3016365,4,12,83,0,
300784,0,82,0,79, 301784,0,82,0,79,
30080,75,0,69,0, 30180,75,0,69,0,
30091,34,1,1,2, 30191,34,1,1,2,
30100,1,1332,359,18, 30200,1,1332,366,18,
30111,1332,179,2,0, 30211,1332,176,2,0,
30121,1335,360,18,1, 30221,1335,367,18,1,
30131335,182,2,0,1, 30231335,179,2,0,1,
3014223,361,18,1,223, 3024223,368,18,1,223,
3015187,2,0,1,1341, 3025184,2,0,1,2846,
3016362,18,1,1341,187, 3026369,18,1,2846,370,
30172,0,1,1901,363, 302723,371,4,6,69,
301818,1,1901,162,2, 30280,79,0,70,0,
30190,1,1303,364,18, 30291,2,1,6,2,
30201,1303,187,2,0, 30300,1,1341,372,18,
30211,2837,365,18,1, 30311,1341,184,2,0,
30222837,209,2,0,1, 30321,1901,373,18,1,
30232838,366,18,1,2838, 30331901,162,2,0,1,
3024212,2,0,1,2462, 30341303,374,18,1,1303,
3025367,18,1,2462,285, 3035184,2,0,1,2462,
30262,0,1,236,368, 3036375,18,1,2462,288,
302718,1,236,369,20, 30372,0,1,236,376,
3028370,4,6,65,0, 303818,1,236,377,20,
3039378,4,6,65,0,
302977,0,80,0,1, 304077,0,80,0,1,
303033,1,1,2,0, 304133,1,1,2,0,
30311,2466,371,18,1, 30421,2466,379,18,1,
30322466,327,2,0,1, 30432466,380,20,381,4,
30332467,372,18,1,2467, 304434,67,0,111,0,
3034159,2,0,1,2468, 3045109,0,112,0,111,
3035373,18,1,2468,374, 30460,117,0,110,0,
303620,375,4,10,83, 3047100,0,83,0,116,
30370,84,0,65,0, 30480,97,0,116,0,
303884,0,69,0,1, 3049101,0,109,0,101,
303948,1,1,2,0, 30500,110,0,116,0,
30401,2469,376,18,1, 30511,133,1,2,2,
30412469,132,2,0,1, 30520,1,2467,382,18,
3042242,377,18,1,242, 30531,2467,159,2,0,
3043187,2,0,1,2471, 30541,2468,383,18,1,
3044378,18,1,2471,379, 30552468,384,20,385,4,
304520,380,4,26,67, 305610,83,0,84,0,
30460,79,0,78,0, 305765,0,84,0,69,
304784,0,82,0,79, 30580,1,48,1,1,
30480,76,0,95,0, 30592,0,1,2469,386,
304969,0,86,0,69, 306018,1,2469,132,2,
30500,78,0,84,0, 30610,1,242,387,18,
30511,65,1,1,2, 30621,242,184,2,0,
30520,1,2472,381,18, 30631,2471,388,18,1,
30531,2472,382,20,383, 30642471,389,20,390,4,
30544,30,65,0,84, 306526,67,0,79,0,
30550,95,0,84,0, 306678,0,84,0,82,
305665,0,82,0,71, 30670,79,0,76,0,
30570,69,0,84,0,
305895,0,69,0,86, 306895,0,69,0,86,
30590,69,0,78,0, 30690,69,0,78,0,
306084,0,1,59,1, 307084,0,1,65,1,
30611,2,0,1,2473, 30711,2,0,1,2472,
3062384,18,1,2473,385, 3072391,18,1,2472,392,
306320,386,4,38,65, 307320,393,4,30,65,
30640,84,0,95,0, 30740,84,0,95,0,
306582,0,79,0,84, 307584,0,65,0,82,
30660,95,0,84,0, 30760,71,0,69,0,
306765,0,82,0,71, 307784,0,95,0,69,
30680,69,0,84,0, 30780,86,0,69,0,
306995,0,69,0,86, 307978,0,84,0,1,
30700,69,0,78,0, 308059,1,1,2,0,
307184,0,1,58,1, 30811,2473,394,18,1,
30721,2,0,1,2474, 30822473,395,20,396,4,
3073387,18,1,2474,388, 308338,65,0,84,0,
307420,389,4,52,76, 308495,0,82,0,79,
30750,65,0,78,0, 30850,84,0,95,0,
307668,0,95,0,67, 308684,0,65,0,82,
30770,79,0,76,0, 30870,71,0,69,0,
307876,0,73,0,83, 308884,0,95,0,69,
30790,73,0,79,0, 30890,86,0,69,0,
308078,0,95,0,83, 309078,0,84,0,1,
30810,84,0,65,0, 309158,1,1,2,0,
308282,0,84,0,95, 30921,2474,397,18,1,
30830,69,0,86,0, 30932474,398,20,399,4,
308469,0,78,0,84, 309452,76,0,65,0,
30850,1,71,1,1,
30862,0,1,2475,390,
308718,1,2475,391,20,
3088392,4,48,76,0,
308965,0,78,0,68,
30900,95,0,67,0,
309179,0,76,0,76,
30920,73,0,83,0,
309373,0,79,0,78,
30940,95,0,69,0,
309578,0,68,0,95, 309578,0,68,0,95,
30960,69,0,86,0, 30960,67,0,79,0,
309769,0,78,0,84, 309776,0,76,0,73,
30980,1,70,1,1, 30980,83,0,73,0,
30992,0,1,2476,393, 309979,0,78,0,95,
310018,1,2476,394,20, 31000,83,0,84,0,
3101395,4,40,76,0, 310165,0,82,0,84,
310265,0,78,0,68,
31030,95,0,67,0,
310479,0,76,0,76,
31050,73,0,83,0,
310673,0,79,0,78,
31070,95,0,69,0, 31020,95,0,69,0,
310886,0,69,0,78, 310386,0,69,0,78,
31090,84,0,1,69, 31040,84,0,1,71,
31101,1,2,0,1, 31051,1,2,0,1,
31112477,396,18,1,2477, 31062475,400,18,1,2475,
3112397,20,398,4,34, 3107401,20,402,4,48,
311384,0,79,0,85, 310876,0,65,0,78,
31140,67,0,72,0, 31090,68,0,95,0,
311595,0,83,0,84, 311067,0,79,0,76,
31160,65,0,82,0, 31110,76,0,73,0,
311784,0,95,0,69, 311283,0,73,0,79,
31180,86,0,69,0, 31130,78,0,95,0,
311978,0,84,0,1, 311469,0,78,0,68,
312089,1,1,2,0,
31211,2478,399,18,1,
31222478,400,20,401,4,
312330,84,0,79,0,
312485,0,67,0,72,
31250,95,0,69,0, 31150,95,0,69,0,
312678,0,68,0,95, 311686,0,69,0,78,
31270,69,0,86,0, 31170,84,0,1,70,
312869,0,78,0,84, 31181,1,2,0,1,
31290,1,90,1,1, 31192476,403,18,1,2476,
31302,0,1,2479,402, 3120404,20,405,4,40,
313118,1,2479,403,20, 312176,0,65,0,78,
3132404,4,22,84,0, 31220,68,0,95,0,
313379,0,85,0,67, 312367,0,79,0,76,
31340,72,0,95,0, 31240,76,0,73,0,
313569,0,86,0,69, 312583,0,73,0,79,
31360,78,0,84,0, 31260,78,0,95,0,
31371,88,1,1,2,
31380,1,2480,405,18,
31391,2480,406,20,407,
31404,24,83,0,69,
31410,78,0,83,0,
314279,0,82,0,95,
31430,69,0,86,0,
314469,0,78,0,84,
31450,1,84,1,1,
31462,0,1,2481,408,
314718,1,2481,409,20,
3148410,4,52,82,0,
314985,0,78,0,95,
31500,84,0,73,0,
315177,0,69,0,95,
31520,80,0,69,0,
315382,0,77,0,73,
31540,83,0,83,0,
315573,0,79,0,78,
31560,83,0,95,0,
315769,0,86,0,69, 312769,0,86,0,69,
31580,78,0,84,0, 31280,78,0,84,0,
31591,83,1,1,2, 31291,69,1,1,2,
31600,1,2482,411,18, 31300,1,2477,406,18,
31611,2482,412,20,413, 31311,2477,407,20,408,
31624,24,79,0,78, 31324,34,84,0,79,
31630,95,0,82,0, 31330,85,0,67,0,
316469,0,90,0,95, 313472,0,95,0,83,
31350,84,0,65,0,
313682,0,84,0,95,
31650,69,0,86,0, 31370,69,0,86,0,
316669,0,78,0,84, 313869,0,78,0,84,
31670,1,81,1,1, 31390,1,89,1,1,
31682,0,1,2483,414, 31402,0,1,2478,409,
316918,1,2483,415,20, 314118,1,2478,410,20,
3170416,4,42,67,0, 3142411,4,30,84,0,
317179,0,76,0,76, 314379,0,85,0,67,
31720,73,0,83,0, 31440,72,0,95,0,
317373,0,79,0,78, 314569,0,78,0,68,
31740,95,0,83,0,
317584,0,65,0,82,
31760,84,0,95,0,
317769,0,86,0,69,
31780,78,0,84,0,
31791,64,1,1,2,
31800,1,256,417,18,
31811,256,418,20,419,
31824,14,80,0,69,
31830,82,0,67,0,
318469,0,78,0,84,
31850,1,22,1,1,
31862,0,1,1371,420,
318718,1,1371,238,2,
31880,1,2486,421,18,
31891,2486,422,20,423,
31904,26,67,0,72,
31910,65,0,78,0,
319271,0,69,0,68,
31930,95,0,69,0, 31460,95,0,69,0,
319486,0,69,0,78, 314786,0,69,0,78,
31950,84,0,1,61, 31480,84,0,1,90,
31961,1,2,0,1, 31491,1,2,0,1,
31972487,424,18,1,2487, 31502479,412,18,1,2479,
3198425,20,426,4,32, 3151413,20,414,4,22,
319979,0,66,0,74, 315284,0,79,0,85,
32000,69,0,67,0, 31530,67,0,72,0,
320184,0,95,0,82,
32020,69,0,90,0,
320395,0,69,0,86, 315495,0,69,0,86,
32040,69,0,78,0, 31550,69,0,78,0,
320584,0,1,80,1, 315684,0,1,88,1,
32061,2,0,1,1931, 31571,2,0,1,2480,
3207427,18,1,1931,285, 3158415,18,1,2480,416,
32082,0,1,1932,428, 315920,417,4,24,83,
320918,1,1932,429,20, 31600,69,0,78,0,
3210430,4,4,73,0, 316183,0,79,0,82,
321170,0,1,42,1, 31620,95,0,69,0,
32121,2,0,1,262, 316386,0,69,0,78,
3213431,18,1,262,187, 31640,84,0,1,84,
32142,0,1,1377,432, 31651,1,2,0,1,
321518,1,1377,187,2, 31662481,418,18,1,2481,
32160,1,2492,433,18, 3167419,20,420,4,52,
32171,2492,434,20,435, 316882,0,85,0,78,
32184,30,78,0,79, 31690,95,0,84,0,
32190,95,0,83,0, 317073,0,77,0,69,
322069,0,78,0,83, 31710,95,0,80,0,
32210,79,0,82,0, 317269,0,82,0,77,
31730,73,0,83,0,
317483,0,73,0,79,
31750,78,0,83,0,
322295,0,69,0,86, 317695,0,69,0,86,
32230,69,0,78,0, 31770,69,0,78,0,
322484,0,1,77,1, 317884,0,1,83,1,
32251,2,0,1,1876, 31791,2,0,1,2482,
3226436,18,1,1876,135, 3180421,18,1,2482,422,
32272,0,1,2494,437, 318120,423,4,24,79,
322818,1,2494,438,20, 31820,78,0,95,0,
3229439,4,32,77,0, 318382,0,69,0,90,
323079,0,86,0,73, 31840,95,0,69,0,
32310,78,0,71,0, 318586,0,69,0,78,
323295,0,69,0,78, 31860,84,0,1,81,
31871,1,2,0,1,
31882483,424,18,1,2483,
3189425,20,426,4,42,
319067,0,79,0,76,
31910,76,0,73,0,
319283,0,73,0,79,
31930,78,0,95,0,
319483,0,84,0,65,
31950,82,0,84,0,
319695,0,69,0,86,
31970,69,0,78,0,
319884,0,1,64,1,
31991,2,0,1,256,
3200427,18,1,256,428,
320120,429,4,14,80,
32020,69,0,82,0,
320367,0,69,0,78,
32040,84,0,1,22,
32051,1,2,0,1,
32061371,430,18,1,1371,
3207235,2,0,1,2486,
3208431,18,1,2486,432,
320920,433,4,26,67,
32100,72,0,65,0,
321178,0,71,0,69,
32330,68,0,95,0, 32120,68,0,95,0,
323469,0,86,0,69, 321369,0,86,0,69,
32350,78,0,84,0, 32140,78,0,84,0,
32361,75,1,1,2, 32151,61,1,1,2,
32370,1,2495,440,18, 32160,1,2487,434,18,
32381,2495,441,20,442, 32171,2487,435,20,436,
32394,32,83,0,84, 32184,32,79,0,66,
32400,65,0,84,0, 32190,74,0,69,0,
324169,0,95,0,69, 322067,0,84,0,95,
32420,88,0,73,0, 32210,82,0,69,0,
324384,0,95,0,69, 322290,0,95,0,69,
32440,86,0,69,0, 32230,86,0,69,0,
324578,0,84,0,1, 322478,0,84,0,1,
324686,1,1,2,0, 322580,1,1,2,0,
32471,1939,443,18,1, 32261,1931,437,18,1,
32481939,187,2,0,1, 32271931,288,2,0,1,
32492497,444,18,1,2497, 32281932,438,18,1,1932,
3250445,20,446,4,36, 3229439,20,440,4,4,
325172,0,84,0,84, 323073,0,70,0,1,
32520,80,0,95,0, 323142,1,1,2,0,
325382,0,69,0,81, 32321,262,441,18,1,
32540,85,0,69,0, 3233262,184,2,0,1,
325583,0,84,0,95, 32341377,442,18,1,1377,
3235184,2,0,1,2492,
3236443,18,1,2492,444,
323720,445,4,30,78,
32380,79,0,95,0,
323983,0,69,0,78,
32400,83,0,79,0,
324182,0,95,0,69,
32420,86,0,69,0,
324378,0,84,0,1,
324477,1,1,2,0,
32451,1876,446,18,1,
32461876,135,2,0,1,
32472494,447,18,1,2494,
3248448,20,449,4,32,
324977,0,79,0,86,
32500,73,0,78,0,
325171,0,95,0,69,
32520,78,0,68,0,
325395,0,69,0,86,
32540,69,0,78,0,
325584,0,1,75,1,
32561,2,0,1,2495,
3257450,18,1,2495,451,
325820,452,4,32,83,
32590,84,0,65,0,
326084,0,69,0,95,
32610,69,0,88,0,
326273,0,84,0,95,
32560,69,0,86,0, 32630,69,0,86,0,
325769,0,78,0,84, 326469,0,78,0,84,
32580,1,91,1,1, 32650,1,86,1,1,
32592,0,1,827,447, 32662,0,1,1939,453,
326018,1,827,187,2, 326718,1,1939,184,2,
32610,1,2499,448,18, 32680,1,2497,454,18,
32621,2499,449,20,450, 32691,2497,455,20,456,
32704,48,84,0,82,
32710,65,0,78,0,
327283,0,65,0,67,
32730,84,0,73,0,
327479,0,78,0,95,
32750,82,0,69,0,
327683,0,85,0,76,
32770,84,0,95,0,
327869,0,86,0,69,
32790,78,0,84,0,
32801,92,1,1,2,
32810,1,827,457,18,
32821,827,184,2,0,
32831,2499,458,18,1,
32842499,459,20,460,4,
328534,82,0,69,0,
328677,0,79,0,84,
32870,69,0,95,0,
328868,0,65,0,84,
32890,65,0,95,0,
329069,0,86,0,69,
32910,78,0,84,0,
32921,82,1,1,2,
32930,1,2500,461,18,
32941,2500,462,20,463,
32634,22,77,0,79, 32954,22,77,0,79,
32640,78,0,69,0, 32960,78,0,69,0,
326589,0,95,0,69, 329789,0,95,0,69,
32660,86,0,69,0, 32980,86,0,69,0,
326778,0,84,0,1, 329978,0,84,0,1,
326874,1,1,2,0, 330074,1,1,2,0,
32691,2500,451,18,1, 33011,2501,464,18,1,
32702500,452,20,453,4, 33022501,465,20,466,4,
327124,76,0,73,0, 330324,76,0,73,0,
327283,0,84,0,69, 330483,0,84,0,69,
32730,78,0,95,0, 33050,78,0,95,0,
327469,0,86,0,69, 330669,0,86,0,69,
32750,78,0,84,0, 33070,78,0,84,0,
32761,73,1,1,2, 33081,73,1,1,2,
32770,1,2501,454,18, 33090,1,2502,467,18,
32781,2501,455,20,456, 33101,2502,468,20,469,
32794,36,76,0,73, 33114,36,76,0,73,
32800,78,0,75,0, 33120,78,0,75,0,
328195,0,77,0,69, 331395,0,77,0,69,
@@ -3285,8 +3317,8 @@ public yyLSLSyntax
328586,0,69,0,78, 331786,0,69,0,78,
32860,84,0,1,72, 33180,84,0,1,72,
32871,1,2,0,1, 33191,1,2,0,1,
32882502,457,18,1,2502, 33202503,470,18,1,2503,
3289458,20,459,4,38, 3321471,20,472,4,38,
329072,0,84,0,84, 332272,0,84,0,84,
32910,80,0,95,0, 33230,80,0,95,0,
329282,0,69,0,83, 332482,0,69,0,83,
@@ -3296,293 +3328,266 @@ public yyLSLSyntax
329686,0,69,0,78, 332886,0,69,0,78,
32970,84,0,1,68, 33290,84,0,1,68,
32981,1,2,0,1, 33301,1,2,0,1,
32992503,460,18,1,2503, 33312504,473,18,1,2504,
3300461,20,462,4,22, 3332474,20,475,4,22,
330169,0,77,0,65, 333369,0,77,0,65,
33020,73,0,76,0, 33340,73,0,76,0,
330395,0,69,0,86, 333595,0,69,0,86,
33040,69,0,78,0, 33360,69,0,78,0,
330584,0,1,67,1, 333784,0,1,67,1,
33061,2,0,1,2504, 33381,2,0,1,277,
3307463,18,1,2504,464, 3339476,18,1,277,477,
330820,465,4,32,68, 334020,478,4,10,83,
33090,65,0,84,0, 33410,76,0,65,0,
331065,0,83,0,69, 334283,0,72,0,1,
33110,82,0,86,0, 334321,1,1,2,0,
331269,0,82,0,95, 33441,2506,479,18,1,
33130,69,0,86,0, 33452506,480,20,481,4,
331469,0,78,0,84, 334634,75,0,101,0,
33150,1,66,1,1,
33162,0,1,277,466,
331718,1,277,467,20,
3318468,4,10,83,0,
331976,0,65,0,83,
33200,72,0,1,21,
33211,1,2,0,1,
33222506,469,18,1,2506,
3323135,2,0,1,2507,
3324470,18,1,2507,117,
33252,0,1,2508,471,
332618,1,2508,132,2,
33270,1,2509,472,18,
33281,2509,473,20,474,
33294,28,75,0,101,
33300,121,0,68,0,
3331101,0,99,0,108,
33320,97,0,114,0,
333397,0,116,0,105,
33340,111,0,110,0,
33351,119,1,2,2,
33360,1,2510,475,18,
33371,2510,143,2,0,
33381,283,476,18,1,
3339283,187,2,0,1,
33402512,477,18,1,2512,
3341132,2,0,1,2513,
3342478,18,1,2513,479,
334320,480,4,28,73,
33440,110,0,116,0,
334568,0,101,0,99,
33460,108,0,97,0,
3347114,0,97,0,116,
33480,105,0,111,0,
3349110,0,1,120,1,
33502,2,0,1,2514,
3351481,18,1,2514,143,
33522,0,1,1958,482,
335318,1,1958,162,2,
33540,1,2516,483,18,
33551,2516,479,2,0,
33561,2517,484,18,1,
33572517,485,20,486,4,
335864,75,0,101,0,
3359121,0,73,0,110, 3347121,0,73,0,110,
33600,116,0,73,0, 33480,116,0,73,0,
3361110,0,116,0,65, 3349110,0,116,0,65,
33620,114,0,103,0, 33500,114,0,103,0,
3363117,0,109,0,101, 335169,0,118,0,101,
33640,110,0,116,0, 33520,110,0,116,0,
33531,132,1,2,2,
33540,1,2507,482,18,
33551,2507,135,2,0,
33561,2508,483,18,1,
33572508,117,2,0,1,
33582509,484,18,1,2509,
3359132,2,0,1,2510,
3360485,18,1,2510,486,
336120,487,4,28,75,
33620,101,0,121,0,
336568,0,101,0,99, 336368,0,101,0,99,
33660,108,0,97,0, 33640,108,0,97,0,
3367114,0,97,0,116, 3365114,0,97,0,116,
33680,105,0,111,0, 33660,105,0,111,0,
3369110,0,76,0,105, 3367110,0,1,120,1,
33700,115,0,116,0, 33682,2,0,1,283,
33711,117,1,2,2, 3369488,18,1,283,184,
33720,1,2518,487,18, 33702,0,1,2512,489,
33731,2518,162,2,0, 337118,1,2512,126,2,
33741,1406,488,18,1, 33720,1,2513,490,18,
33751406,179,2,0,1, 33731,2513,132,2,0,
33761407,489,18,1,1407, 33741,2514,491,18,1,
3377232,2,0,1,2522, 33752514,492,20,493,4,
3378490,18,1,2522,135, 337628,73,0,110,0,
33792,0,1,2524,491, 3377116,0,68,0,101,
338018,1,2524,479,2, 33780,99,0,108,0,
33810,1,2525,492,18, 337997,0,114,0,97,
33821,2525,143,2,0, 33800,116,0,105,0,
33831,2526,493,18,1, 3381111,0,110,0,1,
33842526,114,2,0,1, 3382121,1,2,2,0,
3385299,494,18,1,299, 33831,1958,494,18,1,
3386495,20,496,4,8, 33841958,162,2,0,1,
338783,0,84,0,65, 33852517,495,18,1,2517,
33880,82,0,1,20, 3386492,2,0,1,2518,
33891,1,2,0,1, 3387496,18,1,2518,497,
33901370,497,18,1,1370, 338820,498,4,64,75,
3391179,2,0,1,2529, 33890,101,0,121,0,
3392498,18,1,2529,143, 339073,0,110,0,116,
33932,0,1,2531,499, 33910,73,0,110,0,
339418,1,2531,308,2, 3392116,0,65,0,114,
33950,1,2532,500,18, 33930,103,0,117,0,
33961,2532,501,20,502, 3394109,0,101,0,110,
33974,64,73,0,110, 33950,116,0,68,0,
3396101,0,99,0,108,
33970,97,0,114,0,
339897,0,116,0,105,
33990,111,0,110,0,
340076,0,105,0,115,
34010,116,0,1,118,
34021,2,2,0,1,
34032519,499,18,1,2519,
3404162,2,0,1,1406,
3405500,18,1,1406,176,
34062,0,1,1407,501,
340718,1,1407,229,2,
34080,1,2522,502,18,
34091,2522,503,20,504,
34104,34,73,0,110,
33980,116,0,86,0, 34110,116,0,86,0,
3399101,0,99,0,86, 3412101,0,99,0,86,
34000,101,0,99,0, 34130,101,0,99,0,
340165,0,114,0,103, 341465,0,114,0,103,
34020,117,0,109,0, 34150,69,0,118,0,
3403101,0,110,0,116, 3416101,0,110,0,116,
34040,68,0,101,0, 34170,1,131,1,2,
340599,0,108,0,97, 34182,0,1,2523,505,
34060,114,0,97,0, 341918,1,2523,135,2,
3407116,0,105,0,111, 34200,1,2525,506,18,
34080,110,0,76,0, 34211,2525,492,2,0,
3409105,0,115,0,116, 34221,2526,507,18,1,
34100,1,116,1,2, 34232526,143,2,0,1,
34112,0,1,305,503, 3424299,508,18,1,299,
341218,1,305,187,2, 3425509,20,510,4,8,
34130,1,2535,504,18, 342683,0,84,0,65,
34141,2535,327,2,0, 34270,82,0,1,20,
34151,2458,505,18,1, 34281,1,2,0,1,
34162458,285,2,0,1, 34291370,511,18,1,1370,
34172459,506,18,1,2459, 3430176,2,0,1,2529,
3418507,20,508,4,22, 3431512,18,1,2529,513,
341982,0,73,0,71, 343220,514,4,28,86,
34200,72,0,84,0,
342195,0,66,0,82,
34220,65,0,67,0,
342369,0,1,13,1,
34241,2,0,1,2539,
3425509,18,1,2539,479,
34262,0,1,2540,510,
342718,1,2540,143,2,
34280,1,2541,511,18,
34291,2541,111,2,0,
34301,2542,512,18,1,
34312542,132,2,0,1,
34322464,513,18,1,2464,
3433507,2,0,1,2544,
3434514,18,1,2544,143,
34352,0,1,1989,515,
343618,1,1989,285,2,
34370,1,1990,516,18,
34381,1990,517,20,518,
34394,8,69,0,76,
34400,83,0,69,0,
34411,43,1,1,2,
34420,1,2548,519,18,
34431,2548,162,2,0,
34441,2470,520,18,1,
34452470,165,2,0,1,
3446322,521,18,1,322,
3447253,2,0,1,2551,
3448522,18,1,2551,523,
344920,524,4,28,86,
34500,101,0,99,0, 34330,101,0,99,0,
3451116,0,111,0,114,
34520,65,0,114,0,
3453103,0,69,0,118,
34540,101,0,110,0,
3455116,0,1,128,1,
34562,2,0,1,1933,
3457525,18,1,1933,135,
34582,0,1,883,526,
345918,1,883,187,2,
34600,1,2555,527,18,
34611,2555,528,20,529,
34624,58,86,0,101,
34630,99,0,116,0,
3464111,0,114,0,65,
34650,114,0,103,0,
3466117,0,109,0,101,
34670,110,0,116,0,
346868,0,101,0,99, 343468,0,101,0,99,
34690,108,0,97,0, 34350,108,0,97,0,
3470114,0,97,0,116, 3436114,0,97,0,116,
34710,105,0,111,0, 34370,105,0,111,0,
3472110,0,76,0,105, 3438110,0,1,122,1,
34730,115,0,116,0, 34392,2,0,1,2530,
34741,114,1,2,2, 3440515,18,1,2530,143,
34750,1,328,530,18, 34412,0,1,2532,516,
34761,328,187,2,0, 344218,1,2532,513,2,
34771,1443,531,18,1, 34430,1,305,517,18,
34781443,269,2,0,1, 34441,305,184,2,0,
34792558,532,18,1,2558, 34451,2534,518,18,1,
3480327,2,0,1,2559, 34462534,162,2,0,1,
3481533,18,1,2559,534, 34472822,519,18,1,2822,
348220,535,4,22,73, 3448150,2,0,1,2458,
3449520,18,1,2458,288,
34502,0,1,2459,521,
345118,1,2459,212,2,
34520,1,2538,522,18,
34531,2538,135,2,0,
34541,2540,523,18,1,
34552540,492,2,0,1,
34562541,524,18,1,2541,
3457143,2,0,1,2542,
3458525,18,1,2542,111,
34592,0,1,2464,526,
346018,1,2464,212,2,
34610,1,2544,527,18,
34621,2544,247,2,0,
34631,2545,528,18,1,
34642545,143,2,0,1,
34651989,529,18,1,1989,
3466288,2,0,1,1990,
3467530,18,1,1990,531,
346820,532,4,8,69,
34690,76,0,83,0,
347069,0,1,43,1,
34711,2,0,1,2548,
3472533,18,1,2548,534,
347320,535,4,64,73,
34830,110,0,116,0, 34740,110,0,116,0,
348465,0,114,0,103, 347582,0,111,0,116,
34850,69,0,118,0, 34760,82,0,111,0,
3486101,0,110,0,116, 3477116,0,65,0,114,
34870,1,127,1,2, 34780,103,0,117,0,
34882,0,1,2560,536, 3479109,0,101,0,110,
348918,1,2560,135,2, 34800,116,0,68,0,
34900,1,2562,537,18, 3481101,0,99,0,108,
34911,2562,479,2,0, 34820,97,0,114,0,
34921,1449,538,18,1, 348397,0,116,0,105,
34931449,187,2,0,1, 34840,111,0,110,0,
34942485,539,18,1,2485, 348576,0,105,0,115,
3495540,20,541,4,30, 34860,116,0,1,116,
349667,0,79,0,76, 34871,2,2,0,1,
34970,76,0,73,0, 34882470,536,18,1,2470,
349883,0,73,0,79, 3489165,2,0,1,322,
34990,78,0,95,0, 3490537,18,1,322,250,
350069,0,86,0,69, 34912,0,1,2551,538,
35010,78,0,84,0, 349218,1,2551,380,2,
35021,62,1,1,2, 34930,1,1933,539,18,
35030,1,2566,542,18, 34941,1933,135,2,0,
35041,2566,327,2,0, 34951,2553,540,18,1,
35051,2488,543,18,1, 34962553,135,2,0,1,
35062488,544,20,545,4, 3497883,541,18,1,883,
350724,65,0,84,0, 3498184,2,0,1,2555,
350884,0,65,0,67, 3499542,18,1,2555,513,
35090,72,0,95,0, 35002,0,1,328,543,
351069,0,86,0,69, 350118,1,328,184,2,
35110,78,0,84,0, 35020,1,1443,544,18,
35121,60,1,1,2, 35031,1443,266,2,0,
35130,1,2489,546,18, 35041,2559,545,18,1,
35141,2489,547,20,548, 35052559,380,2,0,1,
35154,22,84,0,73, 35062560,546,18,1,2560,
35160,77,0,69,0, 3507547,20,548,4,22,
351782,0,95,0,69, 350873,0,110,0,116,
35180,86,0,69,0, 35090,65,0,114,0,
351978,0,84,0,1, 3510103,0,69,0,118,
352087,1,1,2,0, 35110,101,0,110,0,
35211,2490,549,18,1, 3512116,0,1,128,1,
35222490,550,20,551,4, 35132,2,0,1,2561,
352338,78,0,79,0, 3514549,18,1,2561,135,
352484,0,95,0,65, 35152,0,1,1449,550,
351618,1,1449,184,2,
35170,1,2485,551,18,
35181,2485,552,20,553,
35194,30,67,0,79,
35200,76,0,76,0,
352173,0,83,0,73,
35220,79,0,78,0,
352395,0,69,0,86,
35240,69,0,78,0,
352584,0,1,62,1,
35261,2,0,1,2565,
3527554,18,1,2565,162,
35282,0,1,2488,555,
352918,1,2488,556,20,
3530557,4,24,65,0,
353184,0,84,0,65,
35320,67,0,72,0,
353395,0,69,0,86,
35340,69,0,78,0,
353584,0,1,60,1,
35361,2,0,1,2489,
3537558,18,1,2489,559,
353820,560,4,22,84,
35390,73,0,77,0,
354069,0,82,0,95,
35410,69,0,86,0,
354269,0,78,0,84,
35430,1,87,1,1,
35442,0,1,2490,561,
354518,1,2490,562,20,
3546563,4,38,78,0,
354779,0,84,0,95,
35480,65,0,84,0,
354995,0,84,0,65,
35500,82,0,71,0,
355169,0,84,0,95,
35520,69,0,86,0,
355369,0,78,0,84,
35540,1,79,1,1,
35552,0,1,2491,564,
355618,1,2491,565,20,
3557566,4,46,78,0,
355879,0,84,0,95,
35590,65,0,84,0,
356095,0,82,0,79,
35250,84,0,95,0, 35610,84,0,95,0,
352684,0,65,0,82, 356284,0,65,0,82,
35270,71,0,69,0, 35630,71,0,69,0,
352884,0,95,0,69, 356484,0,95,0,69,
35290,86,0,69,0, 35650,86,0,69,0,
353078,0,84,0,1, 356678,0,84,0,1,
353179,1,1,2,0, 356778,1,1,2,0,
35321,2491,552,18,1, 35681,2571,567,18,1,
35332491,553,20,554,4, 35692571,486,2,0,1,
353446,78,0,79,0, 35702493,568,18,1,2493,
353584,0,95,0,65, 3571569,20,570,4,36,
35360,84,0,95,0, 357277,0,79,0,86,
353782,0,79,0,84, 35730,73,0,78,0,
35380,95,0,84,0, 357471,0,95,0,83,
353965,0,82,0,71, 35750,84,0,65,0,
35400,69,0,84,0, 357682,0,84,0,95,
354195,0,69,0,86, 35770,69,0,86,0,
35420,69,0,78,0, 357869,0,78,0,84,
354384,0,1,78,1, 35790,1,76,1,1,
35441,2,0,1,2571, 35802,0,1,1413,571,
3545555,18,1,2571,556, 358118,1,1413,184,2,
354620,557,4,52,75, 35820,1,346,572,18,
35470,101,0,121,0, 35831,346,573,20,574,
354865,0,114,0,103, 35844,8,80,0,76,
35490,117,0,109,0, 35850,85,0,83,0,
3550101,0,110,0,116, 35861,18,1,1,2,
35510,68,0,101,0, 35870,1,2575,575,18,
355299,0,108,0,97, 35881,2575,380,2,0,
35530,114,0,97,0, 35891,2496,576,18,1,
3554116,0,105,0,111, 35902496,577,20,578,4,
35550,110,0,76,0,
3556105,0,115,0,116,
35570,1,112,1,2,
35582,0,1,2493,558,
355918,1,2493,559,20,
3560560,4,36,77,0,
356179,0,86,0,73,
35620,78,0,71,0,
356395,0,83,0,84,
35640,65,0,82,0,
356584,0,95,0,69,
35660,86,0,69,0,
356778,0,84,0,1,
356876,1,1,2,0,
35691,1413,561,18,1,
35701413,187,2,0,1,
3571346,562,18,1,346,
3572563,20,564,4,8,
357380,0,76,0,85,
35740,83,0,1,18,
35751,1,2,0,1,
35762575,565,18,1,2575,
3577566,20,567,4,24,
357886,0,111,0,105,
35790,100,0,65,0,
3580114,0,103,0,69,
35810,118,0,101,0,
3582110,0,116,0,1,
3583125,1,2,2,0,
35841,2496,568,18,1,
35852496,569,20,570,4,
358634,83,0,84,0, 359134,83,0,84,0,
358765,0,84,0,69, 359265,0,84,0,69,
35880,95,0,69,0, 35930,95,0,69,0,
@@ -3591,420 +3596,253 @@ public yyLSLSyntax
359169,0,86,0,69, 359669,0,86,0,69,
35920,78,0,84,0, 35970,78,0,84,0,
35931,85,1,1,2, 35981,85,1,1,2,
35940,1,2577,571,18, 35990,1,2577,579,18,
35951,2577,162,2,0, 36001,2577,135,2,0,
35961,2021,572,18,1, 36011,2021,580,18,1,
35972021,285,2,0,1, 36022021,288,2,0,1,
35982022,573,18,1,2022, 36032022,581,18,1,2022,
3599374,2,0,1,352, 3604384,2,0,1,352,
3600574,18,1,352,187, 3605582,18,1,352,184,
36012,0,1,2024,575, 36062,0,1,2024,583,
360218,1,2024,132,2, 360718,1,2024,132,2,
36030,1,2025,576,18, 36080,1,2025,584,18,
36041,2025,577,20,578, 36091,2025,585,20,586,
36054,8,74,0,85, 36104,8,74,0,85,
36060,77,0,80,0, 36110,77,0,80,0,
36071,49,1,1,2, 36121,49,1,1,2,
36080,1,2026,579,18, 36130,1,2026,587,18,
36091,2026,132,2,0, 36141,2026,132,2,0,
36101,2027,580,18,1, 36151,2027,588,18,1,
36112027,581,20,582,4, 36162027,589,20,590,4,
36124,65,0,84,0, 36174,65,0,84,0,
36131,23,1,1,2, 36181,23,1,1,2,
36140,1,2028,583,18, 36190,1,2028,591,18,
36151,2028,132,2,0, 36201,2028,132,2,0,
36161,2029,584,18,1, 36211,2029,592,18,1,
36172029,327,2,0,1, 36222029,380,2,0,1,
36182030,585,18,1,2030, 36232030,593,18,1,2030,
3619586,20,587,4,14, 3624594,20,595,4,14,
362070,0,111,0,114, 362570,0,111,0,114,
36210,76,0,111,0, 36260,76,0,111,0,
3622111,0,112,0,1, 3627111,0,112,0,1,
3623145,1,2,2,0, 3628146,1,2,2,0,
36241,2031,588,18,1, 36291,2031,596,18,1,
36252031,589,20,590,4, 36302031,597,20,598,4,
362632,68,0,111,0, 363132,68,0,111,0,
362787,0,104,0,105, 363287,0,104,0,105,
36280,108,0,101,0, 36330,108,0,101,0,
362983,0,116,0,97, 363483,0,116,0,97,
36300,116,0,101,0, 36350,116,0,101,0,
3631109,0,101,0,110, 3636109,0,101,0,110,
36320,116,0,1,144, 36370,116,0,1,145,
36331,2,2,0,1, 36381,2,2,0,1,
36342032,591,18,1,2032, 36392032,599,18,1,2032,
3635592,20,593,4,28, 3640600,20,601,4,28,
363687,0,104,0,105, 364187,0,104,0,105,
36370,108,0,101,0, 36420,108,0,101,0,
363883,0,116,0,97, 364383,0,116,0,97,
36390,116,0,101,0, 36440,116,0,101,0,
3640109,0,101,0,110, 3645109,0,101,0,110,
36410,116,0,1,143, 36460,116,0,1,144,
36421,2,2,0,1, 36471,2,2,0,1,
36432033,594,18,1,2033, 36482033,602,18,1,2033,
3644595,20,596,4,22, 3649603,20,604,4,22,
364573,0,102,0,83, 365073,0,102,0,83,
36460,116,0,97,0, 36510,116,0,97,0,
3647116,0,101,0,109, 3652116,0,101,0,109,
36480,101,0,110,0, 36530,101,0,110,0,
3649116,0,1,142,1, 3654116,0,1,143,1,
36502,2,0,1,2034, 36552,2,0,1,2034,
3651597,18,1,2034,598, 3656605,18,1,2034,606,
365220,599,4,22,83, 365720,607,4,22,83,
36530,116,0,97,0, 36580,116,0,97,0,
3654116,0,101,0,67, 3659116,0,101,0,67,
36550,104,0,97,0, 36600,104,0,97,0,
3656110,0,103,0,101, 3661110,0,103,0,101,
36570,1,141,1,2, 36620,1,142,1,2,
36582,0,1,1478,600, 36632,0,1,1478,608,
365918,1,1478,179,2, 366418,1,1478,176,2,
36600,1,1479,601,18, 36650,1,1479,609,18,
36611,1479,305,2,0, 36661,1479,309,2,0,
36621,2037,602,18,1, 36671,2037,610,18,1,
36632037,146,2,0,1, 36682037,150,2,0,1,
36642038,603,18,1,2038, 36692038,611,18,1,2038,
3665604,20,605,4,18, 3670612,20,613,4,18,
366674,0,117,0,109, 367174,0,117,0,109,
36670,112,0,76,0, 36720,112,0,76,0,
366897,0,98,0,101, 367397,0,98,0,101,
36690,108,0,1,139, 36740,108,0,1,140,
36701,2,2,0,1, 36751,2,2,0,1,
36712039,606,18,1,2039, 36762039,614,18,1,2039,
3672146,2,0,1,2040, 3677150,2,0,1,2040,
3673607,18,1,2040,608, 3678615,18,1,2040,616,
367420,609,4,30,82, 367920,617,4,30,82,
36750,101,0,116,0, 36800,101,0,116,0,
3676117,0,114,0,110, 3681117,0,114,0,110,
36770,83,0,116,0, 36820,83,0,116,0,
367897,0,116,0,101, 368397,0,116,0,101,
36790,109,0,101,0, 36840,109,0,101,0,
3680110,0,116,0,1, 3685110,0,116,0,1,
3681138,1,2,2,0, 3686139,1,2,2,0,
36821,2041,610,18,1, 36871,2041,618,18,1,
36832041,146,2,0,1, 36882041,150,2,0,1,
36841485,611,18,1,1485, 36891485,619,18,1,1485,
3685187,2,0,1,372, 3690184,2,0,1,372,
3686612,18,1,372,199, 3691620,18,1,372,196,
36872,0,1,373,613, 36922,0,1,373,621,
368818,1,373,132,2, 369318,1,373,132,2,
36890,1,374,614,18, 36940,1,374,622,18,
36901,374,195,2,0, 36951,374,192,2,0,
36911,375,615,18,1, 36961,375,623,18,1,
3692375,132,2,0,1, 3697375,132,2,0,1,
3693376,616,18,1,376, 3698376,624,18,1,376,
3694202,2,0,1,377, 3699199,2,0,1,377,
3695617,18,1,377,132, 3700625,18,1,377,132,
36962,0,1,378,618, 37012,0,1,378,626,
369718,1,378,195,2, 370218,1,378,192,2,
36980,1,379,619,18, 37030,1,379,627,18,
36991,379,132,2,0, 37041,379,132,2,0,
37001,380,620,18,1, 37051,380,628,18,1,
3701380,621,20,622,4, 3706380,629,20,630,4,
370216,67,0,111,0, 370716,67,0,111,0,
3703110,0,115,0,116, 3708110,0,115,0,116,
37040,97,0,110,0, 37090,97,0,110,0,
3705116,0,1,151,1, 3710116,0,1,152,1,
37062,2,0,1,381, 37112,2,0,1,381,
3707623,18,1,381,323, 3712631,18,1,381,328,
37082,0,1,371,624, 37132,0,1,371,632,
370918,1,371,625,20, 371418,1,371,633,20,
3710626,4,24,70,0, 3715634,4,24,70,0,
3711117,0,110,0,99, 3716117,0,110,0,99,
37120,116,0,105,0, 37170,116,0,105,0,
3713111,0,110,0,67, 3718111,0,110,0,67,
37140,97,0,108,0, 37190,97,0,108,0,
3715108,0,1,147,1, 3720108,0,1,148,1,
37162,2,0,1,942, 37212,2,0,1,942,
3717627,18,1,942,187, 3722635,18,1,942,184,
37182,0,1,2533,628, 37232,0,1,2533,636,
371918,1,2533,162,2, 372418,1,2533,637,20,
37200,1,387,629,18, 3725638,4,64,73,0,
37211,387,187,2,0, 3726110,0,116,0,86,
37221,2536,630,18,1, 37270,101,0,99,0,
37232536,631,20,632,4, 372886,0,101,0,99,
372434,73,0,110,0, 37290,65,0,114,0,
3725116,0,82,0,111, 3730103,0,117,0,109,
37260,116,0,82,0, 37310,101,0,110,0,
3727111,0,116,0,65,
37280,114,0,103,0,
372969,0,118,0,101,
37300,110,0,116,0,
37311,129,1,2,2,
37320,1,2537,633,18,
37331,2537,135,2,0,
37341,2543,634,18,1,
37352543,635,20,636,4,
373628,82,0,111,0,
3737116,0,68,0,101, 3732116,0,68,0,101,
37380,99,0,108,0, 37330,99,0,108,0,
373997,0,114,0,97, 373497,0,114,0,97,
37400,116,0,105,0, 37350,116,0,105,0,
3741111,0,110,0,1, 3736111,0,110,0,76,
3742122,1,2,2,0, 37370,105,0,115,0,
37431,2546,637,18,1, 3738116,0,1,117,1,
37442546,635,2,0,1, 37392,2,0,1,387,
37451514,638,18,1,1514, 3740639,18,1,387,184,
3746179,2,0,1,1515, 37412,0,1,2536,640,
3747639,18,1,1515,333, 374218,1,2536,380,2,
37482,0,1,2074,640, 37430,1,2537,641,18,
374918,1,2074,179,2, 37441,2537,642,20,643,
37500,1,2075,641,18, 37454,34,73,0,110,
37511,2075,162,2,0, 37460,116,0,82,0,
37521,2552,642,18,1, 3747111,0,116,0,82,
37532552,135,2,0,1, 37480,111,0,116,0,
3754406,643,18,1,406,
3755143,2,0,1,1521,
3756644,18,1,1521,187,
37572,0,1,2556,645,
375818,1,2556,162,2,
37590,1,2639,646,18,
37601,2639,647,20,648,
37614,44,75,0,101,
37620,121,0,73,0,
3763110,0,116,0,73,
37640,110,0,116,0,
376565,0,114,0,103, 374965,0,114,0,103,
37660,83,0,116,0,
376797,0,116,0,101,
37680,69,0,118,0, 37500,69,0,118,0,
3769101,0,110,0,116, 3751101,0,110,0,116,
37700,1,110,1,2, 37520,1,130,1,2,
37712,0,1,412,649, 37532,0,1,2543,644,
377218,1,412,187,2, 375418,1,2543,132,2,
37730,1,2641,650,18, 37550,1,2823,645,18,
37741,2641,168,2,0, 37561,2823,646,20,647,
37751,2484,651,18,1, 37574,34,71,0,108,
37762484,652,20,653,4, 37580,111,0,98,0,
377738,67,0,79,0, 375997,0,108,0,68,
377876,0,76,0,73, 37600,101,0,102,0,
37790,83,0,73,0, 3761105,0,110,0,105,
378079,0,78,0,95, 37620,116,0,105,0,
37810,69,0,78,0, 3763111,0,110,0,115,
378268,0,95,0,69, 37640,1,98,1,2,
37830,86,0,69,0, 37652,0,1,1514,648,
378478,0,84,0,1, 376618,1,1514,176,2,
378563,1,1,2,0, 37670,1,1515,649,18,
37861,2643,654,18,1, 37681,1515,335,2,0,
37872643,174,2,0,1, 37691,2549,650,18,1,
37882644,655,18,1,2644, 37702549,162,2,0,1,
3789656,20,657,4,32, 37712074,651,18,1,2074,
379075,0,101,0,121, 3772176,2,0,1,2075,
3773652,18,1,2075,162,
37742,0,1,2552,653,
377518,1,2552,654,20,
3776655,4,28,86,0,
3777101,0,99,0,116,
37780,111,0,114,0,
377965,0,114,0,103,
37800,69,0,118,0,
3781101,0,110,0,116,
37820,1,129,1,2,
37832,0,1,406,656,
378418,1,406,143,2,
37850,1,1521,657,18,
37861,1521,184,2,0,
37871,2556,658,18,1,
37882556,659,20,660,4,
378958,86,0,101,0,
379099,0,116,0,111,
37910,114,0,65,0,
3792114,0,103,0,117,
37930,109,0,101,0,
3794110,0,116,0,68,
37950,101,0,99,0,
3796108,0,97,0,114,
37970,97,0,116,0,
3798105,0,111,0,110,
37990,76,0,105,0,
3800115,0,116,0,1,
3801115,1,2,2,0,
38021,2557,661,18,1,
38032557,162,2,0,1,
3804412,662,18,1,412,
3805184,2,0,1,2641,
3806663,18,1,2641,168,
38072,0,1,2484,664,
380818,1,2484,665,20,
3809666,4,38,67,0,
381079,0,76,0,76,
38110,73,0,83,0,
381273,0,79,0,78,
38130,95,0,69,0,
381478,0,68,0,95,
38150,69,0,86,0,
381669,0,78,0,84,
38170,1,63,1,1,
38182,0,1,2643,667,
381918,1,2643,668,20,
3820669,4,44,73,0,
3821110,0,116,0,82,
38220,111,0,116,0,
382382,0,111,0,116,
37910,65,0,114,0, 38240,65,0,114,0,
3792103,0,83,0,116, 3825103,0,83,0,116,
37930,97,0,116,0, 38260,97,0,116,0,
3794101,0,69,0,118, 3827101,0,69,0,118,
37950,101,0,110,0, 38280,101,0,110,0,
3796116,0,1,105,1, 3829116,0,1,109,1,
37972,2,0,1,2023, 38302,2,0,1,2644,
3798658,18,1,2023,659, 3831670,18,1,2644,671,
379920,660,4,26,68, 383220,672,4,38,86,
38000,69,0,70,0,
380165,0,85,0,76,
38020,84,0,95,0,
380383,0,84,0,65,
38040,84,0,69,0,
38051,47,1,1,2,
38060,1,2564,661,18,
38071,2564,162,2,0,
38081,2647,662,18,1,
38092647,507,2,0,1,
38102648,663,18,1,2648,
3811647,2,0,1,2567,
3812664,18,1,2567,665,
381320,666,4,22,75,
38140,101,0,121,0,
381565,0,114,0,103,
38160,69,0,118,0,
3817101,0,110,0,116,
38180,1,126,1,2,
38192,0,1,1442,667,
382018,1,1442,179,2,
38210,1,2651,668,18,
38221,2651,669,20,670,
38234,38,86,0,101,
38240,99,0,116,0,
3825111,0,114,0,65,
38260,114,0,103,0,
382783,0,116,0,97,
38280,116,0,101,0,
382969,0,118,0,101,
38300,110,0,116,0,
38311,107,1,2,2,
38320,1,2570,671,18,
38331,2570,473,2,0,
38341,2653,672,18,1,
38352653,656,2,0,1,
38362572,673,18,1,2572,
3837162,2,0,1,2655,
3838674,18,1,2655,156,
38392,0,1,2574,675,
384018,1,2574,327,2,
38410,1,2035,676,18,
38421,2035,146,2,0,
38431,2036,677,18,1,
38442036,678,20,679,4,
384526,74,0,117,0,
3846109,0,112,0,83,
38470,116,0,97,0,
3848116,0,101,0,109,
38490,101,0,110,0,
3850116,0,1,140,1,
38512,2,0,1,431,
3852680,18,1,431,143,
38532,0,1,2579,681,
385418,1,2579,327,2,
38550,1,2105,682,18,
38561,2105,285,2,0,
38571,2106,683,18,1,
38582106,517,2,0,1,
38591550,684,18,1,1550,
3860179,2,0,1,437,
3861685,18,1,437,187,
38622,0,1,2044,686,
386318,1,2044,687,20,
3864688,4,28,69,0,
3865109,0,112,0,116,
38660,121,0,83,0,
3867116,0,97,0,116,
38680,101,0,109,0,
3869101,0,110,0,116,
38700,1,135,1,2,
38712,0,1,2045,689,
387218,1,2045,146,2,
38730,1,1555,690,18,
38741,1555,187,2,0,
38751,2511,691,18,1,
38762511,126,2,0,1,
38771001,692,18,1,1001,
3878625,2,0,1,1002,
3879693,18,1,1002,621,
38802,0,1,447,694,
388118,1,447,342,2,
38820,1,2594,695,18,
38831,2594,327,2,0,
38841,2596,696,18,1,
38852596,697,20,698,4,
388618,83,0,116,0,
388797,0,116,0,101,
38880,66,0,111,0,
3889100,0,121,0,1,
3890102,1,2,2,0,
38911,2520,699,18,1,
38922520,327,2,0,1,
38931010,700,18,1,1010,
3894179,2,0,1,1011,
3895701,18,1,1011,162,
38962,0,1,1012,702,
389718,1,1012,187,2,
38980,1,1013,703,18,
38991,1013,162,2,0,
39001,459,704,18,1,
3901459,705,20,706,4,
390224,76,0,69,0,
390370,0,84,0,95,
39040,66,0,82,0,
390565,0,67,0,75,
39060,69,0,84,0,
39071,27,1,1,2,
39080,1,1574,707,18,
39091,1574,146,2,0,
39101,461,708,18,1,
3911461,709,20,710,4,
391224,65,0,114,0,
3913103,0,117,0,109,
39140,101,0,110,0,
3915116,0,76,0,105,
39160,115,0,116,0,
39171,148,1,2,2,
39180,1,462,711,18,
39191,462,143,2,0,
39201,464,712,18,1,
3921464,713,20,714,4,
392216,65,0,114,0,
3923103,0,117,0,109,
39240,101,0,110,0,
3925116,0,1,149,1,
39262,2,0,1,2136,
3927715,18,1,2136,285,
39282,0,1,1585,716,
392918,1,1585,717,20,
3930718,4,12,82,0,
393169,0,84,0,85,
39320,82,0,78,0,
39331,50,1,1,2,
39340,1,2700,719,18,
39351,2700,697,2,0,
39361,476,720,18,1,
3937476,721,20,722,4,
393830,83,0,84,0,
393982,0,73,0,78,
39400,71,0,95,0,
394167,0,79,0,78,
39420,83,0,84,0,
394365,0,78,0,84,
39440,1,3,1,1,
39452,0,1,477,723,
394618,1,477,724,20,
3947725,4,28,70,0,
394876,0,79,0,65,
39490,84,0,95,0,
395067,0,79,0,78,
39510,83,0,84,0,
395265,0,78,0,84,
39530,1,95,1,1,
39542,0,1,478,726,
395518,1,478,727,20,
3956728,4,40,72,0,
395769,0,88,0,95,
39580,73,0,78,0,
395984,0,69,0,71,
39600,69,0,82,0,
396195,0,67,0,79,
39620,78,0,83,0,
396384,0,65,0,78,
39640,84,0,1,94,
39651,1,2,0,1,
3966479,729,18,1,479,
3967730,20,731,4,32,
396873,0,78,0,84,
39690,69,0,71,0,
397069,0,82,0,95,
39710,67,0,79,0,
397278,0,83,0,84,
39730,65,0,78,0,
397484,0,1,93,1,
39751,2,0,1,480,
3976732,18,1,480,733,
397720,734,4,26,82,
39780,73,0,71,0,
397972,0,84,0,95,
39800,66,0,82,0,
398165,0,67,0,75,
39820,69,0,84,0,
39831,28,1,1,2,
39840,1,481,735,18,
39851,481,713,2,0,
39861,2550,736,18,1,
39872550,327,2,0,1,
39882554,737,18,1,2554,
3989308,2,0,1,1048,
3990738,18,1,1048,187,
39912,0,1,2640,739,
399218,1,2640,740,20,
3993741,4,44,73,0,
3994110,0,116,0,86,
39950,101,0,99,0, 38330,101,0,99,0,
399686,0,101,0,99, 3834116,0,111,0,114,
39970,65,0,114,0, 38350,65,0,114,0,
3998103,0,83,0,116, 3836103,0,83,0,116,
39990,97,0,116,0, 38370,97,0,116,0,
4000101,0,69,0,118, 3838101,0,69,0,118,
40010,101,0,110,0, 38390,101,0,110,0,
4002116,0,1,109,1, 3840116,0,1,108,1,
40032,2,0,1,2642, 38412,2,0,1,2023,
4004742,18,1,2642,669, 3842673,18,1,2023,282,
40052,0,1,2563,743, 38432,0,1,2564,674,
400618,1,2563,744,20, 384418,1,2564,675,20,
4007745,4,52,73,0, 3845676,4,52,73,0,
4008110,0,116,0,65, 3846110,0,116,0,65,
40090,114,0,103,0, 38470,114,0,103,0,
4010117,0,109,0,101, 3848117,0,109,0,101,
@@ -4015,159 +3853,351 @@ public yyLSLSyntax
40150,105,0,111,0, 38530,105,0,111,0,
4016110,0,76,0,105, 3854110,0,76,0,105,
40170,115,0,116,0, 38550,115,0,116,0,
40181,113,1,2,2, 38561,114,1,2,2,
40190,1,2042,746,18, 38570,1,2647,677,18,
40201,2042,747,20,748, 38581,2647,678,20,679,
40214,20,65,0,115, 38594,34,86,0,111,
40220,115,0,105,0, 38600,105,0,100,0,
4023103,0,110,0,109, 386165,0,114,0,103,
40240,101,0,110,0, 38620,83,0,116,0,
4025116,0,1,136,1,
40262,2,0,1,2043,
4027749,18,1,2043,146,
40282,0,1,2568,750,
402918,1,2568,135,2,
40300,1,2649,751,18,
40311,2649,740,2,0,
40321,1620,752,18,1,
40331620,179,2,0,1,
40341621,753,18,1,1621,
4035159,2,0,1,1622,
4036754,18,1,1622,333,
40372,0,1,509,755,
403818,1,509,143,2,
40390,1,2498,756,18,
40401,2498,757,20,758,
40414,34,82,0,69,
40420,77,0,79,0,
404384,0,69,0,95,
40440,68,0,65,0,
404584,0,65,0,95,
40460,69,0,86,0,
404769,0,78,0,84,
40480,1,82,1,1,
40492,0,1,2576,759,
405018,1,2576,135,2,
40510,1,2656,760,18,
40521,2656,659,2,0,
40531,1628,761,18,1,
40541628,187,2,0,1,
4055515,762,18,1,515,
4056187,2,0,1,2580,
4057763,18,1,2580,764,
405820,765,4,10,69,
40590,118,0,101,0,
4060110,0,116,0,1,
4061124,1,2,2,0,
40621,2505,766,18,1,
40632505,767,20,768,4,
406434,75,0,101,0,
4065121,0,73,0,110,
40660,116,0,73,0,
4067110,0,116,0,65,
40680,114,0,103,0,
406969,0,118,0,101,
40700,110,0,116,0,
40711,131,1,2,2,
40720,1,2751,769,18,
40731,2751,507,2,0,
40741,525,770,18,1,
4075525,342,2,0,1,
40762197,771,18,1,2197,
4077179,2,0,1,2198,
4078772,18,1,2198,162,
40792,0,1,1591,773,
408018,1,1591,187,2,
40810,1,2592,774,18,
40821,2592,162,2,0,
40831,2760,775,18,1,
40842760,291,2,0,1,
40852521,776,18,1,2521,
4086777,20,778,4,34,
408773,0,110,0,116,
40880,86,0,101,0,
408999,0,86,0,101,
40900,99,0,65,0,
4091114,0,103,0,69,
40920,118,0,101,0,
4093110,0,116,0,1,
4094130,1,2,2,0,
40951,2763,779,18,1,
40962763,780,20,781,4,
409710,83,0,116,0,
409897,0,116,0,101, 386397,0,116,0,101,
40990,1,101,1,2, 38640,69,0,118,0,
41002,0,1,2764,782, 3865101,0,110,0,116,
410118,1,2764,780,2, 38660,1,105,1,2,
41020,1,1094,783,18, 38672,0,1,2648,680,
41031,1094,709,2,0, 386818,1,2648,279,2,
41041,2766,784,18,1, 38690,1,2567,681,18,
41052766,135,2,0,1, 38701,2567,380,2,0,
41061096,785,18,1,1096, 38711,1442,682,18,1,
4107162,2,0,1,1657, 38721442,176,2,0,1,
4108786,18,1,1657,146, 38732569,683,18,1,2569,
41092,0,1,1658,787, 3874135,2,0,1,2652,
411018,1,1658,788,20, 3875684,18,1,2652,668,
4111789,4,6,70,0, 38762,0,1,2653,685,
411279,0,82,0,1, 387718,1,2653,671,2,
411346,1,1,2,0, 38780,1,2572,686,18,
41141,1659,790,18,1, 38791,2572,687,20,688,
41151659,135,2,0,1, 38804,52,75,0,101,
41162775,791,18,1,2775, 38810,121,0,65,0,
4117140,2,0,1,2777, 3882114,0,103,0,117,
4118792,18,1,2777,162, 38830,109,0,101,0,
41192,0,1,1665,793, 3884110,0,116,0,68,
412018,1,1665,187,2, 38850,101,0,99,0,
41210,1,2781,794,18, 3886108,0,97,0,114,
41221,2781,159,2,0, 38870,97,0,116,0,
41231,2782,795,18,1, 3888105,0,111,0,110,
41242782,333,2,0,1, 38890,76,0,105,0,
41251113,796,18,1,1113, 3890115,0,116,0,1,
4126195,2,0,797,5, 3891113,1,2,2,0,
41270,798,5,379,1, 38921,2573,689,18,1,
41282,799,19,216,1, 38932573,162,2,0,1,
41292,800,5,6,1, 38942656,690,18,1,2656,
41302764,801,17,802,15, 3895678,2,0,1,2035,
4131803,4,14,37,0, 3896691,18,1,2035,150,
413283,0,116,0,97, 38972,0,1,2036,692,
41330,116,0,101,0, 389818,1,2036,693,20,
4134115,0,1,-1,1, 3899694,4,26,74,0,
41355,804,20,805,4, 3900117,0,109,0,112,
413616,83,0,116,0, 39010,83,0,116,0,
413797,0,116,0,101, 390297,0,116,0,101,
41380,115,0,95,0, 39030,109,0,101,0,
413949,0,1,176,1, 3904110,0,116,0,1,
41403,1,2,1,1, 3905141,1,2,2,0,
4141806,22,1,11,1, 39061,431,695,18,1,
41422751,807,17,808,15, 3907431,143,2,0,1,
4143809,4,12,37,0, 39082578,696,18,1,2578,
3909162,2,0,1,2105,
3910697,18,1,2105,288,
39112,0,1,2106,698,
391218,1,2106,531,2,
39130,1,1550,699,18,
39141,1550,176,2,0,
39151,437,700,18,1,
3916437,184,2,0,1,
39172044,701,18,1,2044,
3918702,20,703,4,28,
391969,0,109,0,112,
39200,116,0,121,0,
414483,0,116,0,97, 392183,0,116,0,97,
41450,116,0,101,0, 39220,116,0,101,0,
41461,-1,1,5,810, 3923109,0,101,0,110,
414720,811,4,14,83, 39240,116,0,1,136,
41480,116,0,97,0, 39251,2,2,0,1,
4149116,0,101,0,95, 39262045,704,18,1,2045,
41500,49,0,1,178, 3927150,2,0,1,1555,
41511,3,1,5,1, 3928705,18,1,1555,184,
41524,812,22,1,13, 39292,0,1,2511,706,
41531,2763,813,17,814, 393018,1,2511,143,2,
415415,803,1,-1,1, 39310,1,1001,707,18,
41555,815,20,816,4, 39321,1001,633,2,0,
415616,83,0,116,0, 39331,1002,708,18,1,
415797,0,116,0,101, 39341002,629,2,0,1,
41580,115,0,95,0, 3935447,709,18,1,447,
415950,0,1,177,1, 3936347,2,0,1,2593,
41603,1,3,1,2, 3937710,18,1,2593,162,
4161817,22,1,12,1, 39382,0,1,2595,711,
41622830,818,17,819,15, 393918,1,2595,380,2,
4163820,4,30,37,0, 39400,1,2597,712,18,
39411,2597,713,20,714,
39424,18,83,0,116,
39430,97,0,116,0,
3944101,0,66,0,111,
39450,100,0,121,0,
39461,103,1,2,2,
39470,1,1010,715,18,
39481,1010,176,2,0,
39491,1011,716,18,1,
39501011,162,2,0,1,
39511012,717,18,1,1012,
3952184,2,0,1,1013,
3953718,18,1,1013,162,
39542,0,1,459,719,
395518,1,459,720,20,
3956721,4,24,76,0,
395769,0,70,0,84,
39580,95,0,66,0,
395982,0,65,0,67,
39600,75,0,69,0,
396184,0,1,27,1,
39621,2,0,1,1574,
3963722,18,1,1574,150,
39642,0,1,461,723,
396518,1,461,724,20,
3966725,4,24,65,0,
3967114,0,103,0,117,
39680,109,0,101,0,
3969110,0,116,0,76,
39700,105,0,115,0,
3971116,0,1,149,1,
39722,2,0,1,462,
3973726,18,1,462,143,
39742,0,1,464,727,
397518,1,464,728,20,
3976729,4,16,65,0,
3977114,0,103,0,117,
39780,109,0,101,0,
3979110,0,116,0,1,
3980150,1,2,2,0,
39811,2136,730,18,1,
39822136,288,2,0,1,
39831585,731,18,1,1585,
3984732,20,733,4,12,
398582,0,69,0,84,
39860,85,0,82,0,
398778,0,1,50,1,
39881,2,0,1,2703,
3989734,18,1,2703,713,
39902,0,1,476,735,
399118,1,476,736,20,
3992737,4,30,83,0,
399384,0,82,0,73,
39940,78,0,71,0,
399595,0,67,0,79,
39960,78,0,83,0,
399784,0,65,0,78,
39980,84,0,1,3,
39991,1,2,0,1,
4000477,738,18,1,477,
4001739,20,740,4,28,
400270,0,76,0,79,
40030,65,0,84,0,
400495,0,67,0,79,
40050,78,0,83,0,
400684,0,65,0,78,
40070,84,0,1,96,
40081,1,2,0,1,
4009478,741,18,1,478,
4010742,20,743,4,40,
401172,0,69,0,88,
40120,95,0,73,0,
401378,0,84,0,69,
40140,71,0,69,0,
401582,0,95,0,67,
40160,79,0,78,0,
401783,0,84,0,65,
40180,78,0,84,0,
40191,95,1,1,2,
40200,1,479,744,18,
40211,479,745,20,746,
40224,32,73,0,78,
40230,84,0,69,0,
402471,0,69,0,82,
40250,95,0,67,0,
402679,0,78,0,83,
40270,84,0,65,0,
402878,0,84,0,1,
402994,1,1,2,0,
40301,480,747,18,1,
4031480,748,20,749,4,
403226,82,0,73,0,
403371,0,72,0,84,
40340,95,0,66,0,
403582,0,65,0,67,
40360,75,0,69,0,
403784,0,1,28,1,
40381,2,0,1,481,
4039750,18,1,481,728,
40402,0,1,1048,751,
404118,1,1048,184,2,
40420,1,2642,752,18,
40431,2642,171,2,0,
40441,2563,753,18,1,
40452563,492,2,0,1,
40462042,754,18,1,2042,
4047755,20,756,4,20,
404865,0,115,0,115,
40490,105,0,103,0,
4050110,0,109,0,101,
40510,110,0,116,0,
40521,137,1,2,2,
40530,1,2043,757,18,
40541,2043,150,2,0,
40551,2568,758,18,1,
40562568,759,20,760,4,
405722,75,0,101,0,
4058121,0,65,0,114,
40590,103,0,69,0,
4060118,0,101,0,110,
40610,116,0,1,127,
40621,2,2,0,1,
40632649,761,18,1,2649,
4064212,2,0,1,1620,
4065762,18,1,1620,176,
40662,0,1,1621,763,
406718,1,1621,159,2,
40680,1,1622,764,18,
40691,1622,335,2,0,
40701,509,765,18,1,
4071509,143,2,0,1,
40722498,766,18,1,2498,
4073767,20,768,4,36,
407472,0,84,0,84,
40750,80,0,95,0,
407682,0,69,0,81,
40770,85,0,69,0,
407883,0,84,0,95,
40790,69,0,86,0,
408069,0,78,0,84,
40810,1,91,1,1,
40822,0,1,2655,769,
408318,1,2655,156,2,
40840,1,2576,770,18,
40851,2576,771,20,772,
40864,24,86,0,111,
40870,105,0,100,0,
408865,0,114,0,103,
40890,69,0,118,0,
4090101,0,110,0,116,
40910,1,126,1,2,
40922,0,1,1628,773,
409318,1,1628,184,2,
40940,1,515,774,18,
40951,515,184,2,0,
40961,2580,775,18,1,
40972580,380,2,0,1,
40982505,776,18,1,2505,
4099777,20,778,4,32,
410068,0,65,0,84,
41010,65,0,83,0,
410269,0,82,0,86,
41030,69,0,82,0,
410495,0,69,0,86,
41050,69,0,78,0,
410684,0,1,66,1,
41071,2,0,1,2582,
4108779,18,1,2582,135,
41092,0,1,525,780,
411018,1,525,347,2,
41110,1,2197,781,18,
41121,2197,176,2,0,
41131,2198,782,18,1,
41142198,162,2,0,1,
41151591,783,18,1,1591,
4116184,2,0,1,2521,
4117784,18,1,2521,380,
41182,0,1,2764,785,
411918,1,2764,300,2,
41200,1,1094,786,18,
41211,1094,724,2,0,
41221,1096,787,18,1,
41231096,162,2,0,1,
41242768,788,18,1,2768,
4125319,2,0,1,2769,
4126789,18,1,2769,132,
41272,0,1,2770,790,
412818,1,2770,135,2,
41290,1,1657,791,18,
41301,1657,150,2,0,
41311,1658,792,18,1,
41321658,793,20,794,4,
41336,70,0,79,0,
413482,0,1,46,1,
41351,2,0,1,1659,
4136795,18,1,1659,135,
41372,0,1,1665,796,
413818,1,1665,184,2,
41390,1,2781,797,18,
41401,2781,162,2,0,
41411,2783,798,18,1,
41422783,380,2,0,1,
41431113,799,18,1,1113,
4144192,2,0,800,5,
41450,801,5,381,1,
41462,802,19,371,1,
41472,803,5,6,1,
41482764,804,17,805,15,
4149806,4,30,37,0,
416476,0,83,0,76, 415076,0,83,0,76,
41650,80,0,114,0, 41510,80,0,114,0,
4166111,0,103,0,114, 4152111,0,103,0,114,
41670,97,0,109,0, 41530,97,0,109,0,
416882,0,111,0,111, 415482,0,111,0,111,
41690,116,0,1,-1, 41550,116,0,1,-1,
41701,5,821,20,822, 41561,5,807,20,808,
41574,32,76,0,83,
41580,76,0,80,0,
4159114,0,111,0,103,
41600,114,0,97,0,
4161109,0,82,0,111,
41620,111,0,116,0,
416395,0,50,0,1,
4164168,1,3,1,2,
41651,1,809,22,1,
41662,1,2768,810,17,
4167811,15,812,4,14,
416837,0,83,0,116,
41690,97,0,116,0,
4170101,0,115,0,1,
4171-1,1,5,813,20,
4172814,4,16,83,0,
4173116,0,97,0,116,
41740,101,0,115,0,
417595,0,49,0,1,
4176177,1,3,1,2,
41771,1,815,22,1,
417811,1,2755,816,17,
4179817,15,818,4,12,
418037,0,83,0,116,
41810,97,0,116,0,
4182101,0,1,-1,1,
41835,819,20,820,4,
418414,83,0,116,0,
418597,0,116,0,101,
41860,95,0,49,0,
41871,179,1,3,1,
41885,1,4,821,22,
41891,13,1,2767,822,
419017,823,15,812,1,
4191-1,1,5,824,20,
4192825,4,16,83,0,
4193116,0,97,0,116,
41940,101,0,115,0,
419595,0,50,0,1,
4196178,1,3,1,3,
41971,2,826,22,1,
419812,1,2834,827,17,
4199828,15,806,1,-1,
42001,5,829,20,830,
41714,32,76,0,83, 42014,32,76,0,83,
41720,76,0,80,0, 42020,76,0,80,0,
4173114,0,111,0,103, 4203114,0,111,0,103,
@@ -4175,233 +4205,221 @@ public yyLSLSyntax
4175109,0,82,0,111, 4205109,0,82,0,111,
41760,111,0,116,0, 42060,111,0,116,0,
417795,0,49,0,1, 420795,0,49,0,1,
4178166,1,3,1,3, 4208167,1,3,1,3,
41791,2,823,22,1, 42091,2,831,22,1,
41801,1,2647,824,17, 42101,1,2649,832,17,
4181825,15,809,1,-1, 4211833,15,818,1,-1,
41821,5,826,20,827, 42121,5,834,20,835,
41834,14,83,0,116, 42134,14,83,0,116,
41840,97,0,116,0, 42140,97,0,116,0,
4185101,0,95,0,50, 4215101,0,95,0,50,
41860,1,179,1,3, 42160,1,180,1,3,
41871,6,1,5,828, 42171,6,1,5,836,
418822,1,14,1,2760, 421822,1,14,1,3,
4189829,17,830,15,820, 4219837,19,737,1,3,
41901,-1,1,5,831, 4220838,5,95,1,256,
419120,832,4,32,76, 4221839,16,0,735,1,
41920,83,0,76,0, 42221261,840,16,0,735,
419380,0,114,0,111, 42231,509,841,16,0,
41940,103,0,114,0, 4224735,1,1515,842,16,
419597,0,109,0,82, 42250,735,1,2021,843,
41960,111,0,111,0, 422617,844,15,845,4,
4197116,0,95,0,50,
41980,1,167,1,3,
41991,2,1,1,833,
420022,1,2,1,3,
4201834,19,722,1,3,
4202835,5,95,1,256,
4203836,16,0,720,1,
42041261,837,16,0,720,
42051,509,838,16,0,
4206720,1,1515,839,16,
42070,720,1,2021,840,
420817,841,15,842,4,
420924,37,0,73,0, 422724,37,0,73,0,
4210102,0,83,0,116, 4228102,0,83,0,116,
42110,97,0,116,0, 42290,97,0,116,0,
4212101,0,109,0,101, 4230101,0,109,0,101,
42130,110,0,116,0, 42310,110,0,116,0,
42141,-1,1,5,843, 42321,-1,1,5,846,
421520,844,4,26,73, 423320,847,4,26,73,
42160,102,0,83,0, 42340,102,0,83,0,
4217116,0,97,0,116, 4235116,0,97,0,116,
42180,101,0,109,0, 42360,101,0,109,0,
4219101,0,110,0,116, 4237101,0,110,0,116,
42200,95,0,50,0, 42380,95,0,50,0,
42211,240,1,3,1, 42391,241,1,3,1,
42228,1,7,845,22, 42408,1,7,848,22,
42231,76,1,1775,846, 42411,76,1,1775,849,
422416,0,720,1,2029, 424216,0,735,1,2029,
4225847,17,848,15,849, 4243850,17,851,15,852,
42264,20,37,0,83, 42444,20,37,0,83,
42270,116,0,97,0, 42450,116,0,97,0,
4228116,0,101,0,109, 4246116,0,101,0,109,
42290,101,0,110,0, 42470,101,0,110,0,
4230116,0,1,-1,1, 4248116,0,1,-1,1,
42315,850,20,851,4, 42495,853,20,854,4,
423224,83,0,116,0, 425024,83,0,116,0,
423397,0,116,0,101, 425197,0,116,0,101,
42340,109,0,101,0, 42520,109,0,101,0,
4235110,0,116,0,95, 4253110,0,116,0,95,
42360,49,0,51,0, 42540,49,0,51,0,
42371,234,1,3,1, 42551,235,1,3,1,
42382,1,1,852,22, 42562,1,1,855,22,
42391,70,1,2030,853, 42571,70,1,2030,856,
424017,854,15,849,1, 425817,857,15,852,1,
4241-1,1,5,855,20, 4259-1,1,5,858,20,
4242856,4,24,83,0, 4260859,4,24,83,0,
4243116,0,97,0,116, 4261116,0,97,0,116,
42440,101,0,109,0, 42620,101,0,109,0,
4245101,0,110,0,116, 4263101,0,110,0,116,
42460,95,0,49,0, 42640,95,0,49,0,
424750,0,1,233,1, 426550,0,1,234,1,
42483,1,2,1,1, 42663,1,2,1,1,
4249857,22,1,69,1, 4267860,22,1,69,1,
42502031,858,17,859,15, 42682031,861,17,862,15,
4251849,1,-1,1,5, 4269852,1,-1,1,5,
4252860,20,861,4,24, 4270863,20,864,4,24,
425383,0,116,0,97, 427183,0,116,0,97,
42540,116,0,101,0, 42720,116,0,101,0,
4255109,0,101,0,110, 4273109,0,101,0,110,
42560,116,0,95,0, 42740,116,0,95,0,
425749,0,49,0,1, 427549,0,49,0,1,
4258232,1,3,1,2, 4276233,1,3,1,2,
42591,1,862,22,1, 42771,1,865,22,1,
426068,1,2032,863,17, 427868,1,2032,866,17,
4261864,15,849,1,-1, 4279867,15,852,1,-1,
42621,5,865,20,866, 42801,5,868,20,869,
42634,24,83,0,116, 42814,24,83,0,116,
42640,97,0,116,0, 42820,97,0,116,0,
4265101,0,109,0,101, 4283101,0,109,0,101,
42660,110,0,116,0, 42840,110,0,116,0,
426795,0,49,0,48, 428595,0,49,0,48,
42680,1,231,1,3, 42860,1,232,1,3,
42691,2,1,1,867, 42871,2,1,1,870,
427022,1,67,1,2033, 428822,1,67,1,2033,
4271868,17,869,15,849, 4289871,17,872,15,852,
42721,-1,1,5,870, 42901,-1,1,5,873,
427320,871,4,22,83, 429120,874,4,22,83,
42740,116,0,97,0, 42920,116,0,97,0,
4275116,0,101,0,109, 4293116,0,101,0,109,
42760,101,0,110,0, 42940,101,0,110,0,
4277116,0,95,0,57, 4295116,0,95,0,57,
42780,1,230,1,3, 42960,1,231,1,3,
42791,2,1,1,872, 42971,2,1,1,875,
428022,1,66,1,277, 429822,1,66,1,277,
4281873,16,0,720,1, 4299876,16,0,735,1,
42822035,874,17,875,15, 43002035,877,17,878,15,
4283849,1,-1,1,5, 4301852,1,-1,1,5,
4284876,20,877,4,22, 4302879,20,880,4,22,
428583,0,116,0,97, 430383,0,116,0,97,
42860,116,0,101,0, 43040,116,0,101,0,
4287109,0,101,0,110, 4305109,0,101,0,110,
42880,116,0,95,0, 43060,116,0,95,0,
428956,0,1,229,1, 430756,0,1,230,1,
42903,1,3,1,2, 43083,1,3,1,2,
4291878,22,1,65,1, 4309881,22,1,65,1,
42922037,879,17,880,15, 43102037,882,17,883,15,
4293849,1,-1,1,5, 4311852,1,-1,1,5,
4294881,20,882,4,22, 4312884,20,885,4,22,
429583,0,116,0,97, 431383,0,116,0,97,
42960,116,0,101,0, 43140,116,0,101,0,
4297109,0,101,0,110, 4315109,0,101,0,110,
42980,116,0,95,0, 43160,116,0,95,0,
429955,0,1,228,1, 431755,0,1,229,1,
43003,1,3,1,2, 43183,1,3,1,2,
4301883,22,1,64,1, 4319886,22,1,64,1,
43022039,884,17,885,15, 43202039,887,17,888,15,
4303849,1,-1,1,5, 4321852,1,-1,1,5,
4304886,20,887,4,22, 4322889,20,890,4,22,
430583,0,116,0,97, 432383,0,116,0,97,
43060,116,0,101,0, 43240,116,0,101,0,
4307109,0,101,0,110, 4325109,0,101,0,110,
43080,116,0,95,0, 43260,116,0,95,0,
430954,0,1,227,1, 432754,0,1,228,1,
43103,1,3,1,2, 43283,1,3,1,2,
4311888,22,1,63,1, 4329891,22,1,63,1,
431232,889,16,0,720, 433032,892,16,0,735,
43131,2041,890,17,891, 43311,2041,893,17,894,
431415,849,1,-1,1, 433215,852,1,-1,1,
43155,892,20,893,4, 43335,895,20,896,4,
431622,83,0,116,0, 433422,83,0,116,0,
431797,0,116,0,101, 433597,0,116,0,101,
43180,109,0,101,0, 43360,109,0,101,0,
4319110,0,116,0,95, 4337110,0,116,0,95,
43200,53,0,1,226, 43380,53,0,1,227,
43211,3,1,3,1, 43391,3,1,3,1,
43222,894,22,1,62, 43402,897,22,1,62,
43231,2293,895,16,0, 43411,2293,898,16,0,
4324720,1,2043,896,17, 4342735,1,2043,899,17,
4325897,15,849,1,-1, 4343900,15,852,1,-1,
43261,5,898,20,899, 43441,5,901,20,902,
43274,22,83,0,116, 43454,22,83,0,116,
43280,97,0,116,0, 43460,97,0,116,0,
4329101,0,109,0,101, 4347101,0,109,0,101,
43300,110,0,116,0, 43480,110,0,116,0,
433195,0,51,0,1, 434995,0,51,0,1,
4332224,1,3,1,3, 4350225,1,3,1,3,
43331,2,900,22,1, 43511,2,903,22,1,
433460,1,2045,901,17, 435260,1,2045,904,17,
4335902,15,849,1,-1, 4353905,15,852,1,-1,
43361,5,903,20,904, 43541,5,906,20,907,
43374,22,83,0,116, 43554,22,83,0,116,
43380,97,0,116,0, 43560,97,0,116,0,
4339101,0,109,0,101, 4357101,0,109,0,101,
43400,110,0,116,0, 43580,110,0,116,0,
434195,0,49,0,1, 435995,0,49,0,1,
4342222,1,3,1,3, 4360223,1,3,1,3,
43431,2,905,22,1, 43611,2,908,22,1,
434458,1,41,906,16, 436258,1,41,909,16,
43450,720,1,1297,907, 43630,735,1,1297,910,
434616,0,720,1,43, 436416,0,735,1,43,
4347908,16,0,720,1, 4365911,16,0,735,1,
43481803,909,17,910,15, 43661803,912,17,913,15,
4349911,4,16,37,0, 4367914,4,16,37,0,
435070,0,111,0,114, 436870,0,111,0,114,
43510,76,0,111,0, 43690,76,0,111,0,
4352111,0,112,0,1, 4370111,0,112,0,1,
4353-1,1,5,912,20, 4371-1,1,5,915,20,
4354913,4,18,70,0, 4372916,4,18,70,0,
4355111,0,114,0,76, 4373111,0,114,0,76,
43560,111,0,111,0, 43740,111,0,111,0,
4357112,0,95,0,49, 4375112,0,95,0,49,
43580,1,247,1,3, 43760,1,248,1,3,
43591,10,1,9,914, 43771,10,1,9,917,
436022,1,83,1,1804, 437822,1,83,1,1804,
4361915,16,0,720,1, 4379918,16,0,735,1,
4362299,916,16,0,720, 4380299,919,16,0,735,
43631,52,917,16,0, 43811,52,920,16,0,
4364720,1,2318,918,16, 4382735,1,2318,921,16,
43650,720,1,62,919, 43830,735,1,62,922,
436616,0,720,1,2075, 438416,0,735,1,2075,
4367920,16,0,720,1, 4385923,16,0,735,1,
43681574,921,17,922,15, 43861574,924,17,925,15,
4369849,1,-1,1,5, 4387852,1,-1,1,5,
4370923,20,924,4,22, 4388926,20,927,4,22,
437183,0,116,0,97, 438983,0,116,0,97,
43720,116,0,101,0, 43900,116,0,101,0,
4373109,0,101,0,110, 4391109,0,101,0,110,
43740,116,0,95,0, 43920,116,0,95,0,
437552,0,1,225,1, 439352,0,1,226,1,
43763,1,3,1,2, 43943,1,3,1,2,
4377925,22,1,61,1, 4395928,22,1,61,1,
437871,926,16,0,720, 439671,929,16,0,735,
43791,76,927,16,0, 43971,76,930,16,0,
4380720,1,1834,928,16, 4398735,1,1834,931,16,
43810,720,1,2337,929, 43990,735,1,2337,932,
438216,0,720,1,79, 440016,0,735,1,79,
4383930,16,0,720,1, 4401933,16,0,735,1,
43841335,931,16,0,720, 44021335,934,16,0,735,
43851,322,932,16,0, 44031,322,935,16,0,
4386720,1,85,933,16, 4404735,1,85,936,16,
43870,720,1,89,934, 44050,735,1,89,937,
438816,0,720,1,346, 440616,0,735,1,346,
4389935,16,0,720,1, 4407938,16,0,735,1,
43902105,936,17,937,15, 44082105,939,17,940,15,
4391842,1,-1,1,5, 4409845,1,-1,1,5,
4392938,20,939,4,26, 4410941,20,942,4,26,
439373,0,102,0,83, 441173,0,102,0,83,
43940,116,0,97,0, 44120,116,0,97,0,
4395116,0,101,0,109, 4413116,0,101,0,109,
43960,101,0,110,0, 44140,101,0,110,0,
4397116,0,95,0,51, 4415116,0,95,0,51,
43980,1,241,1,3, 44160,1,242,1,3,
43991,6,1,5,940, 44171,6,1,5,943,
440022,1,77,1,2106, 441822,1,77,1,2106,
4401941,16,0,720,1, 4419944,16,0,735,1,
440297,942,16,0,720, 442097,945,16,0,735,
44031,1860,943,17,944, 44211,1860,946,17,947,
440415,945,4,34,37, 442215,948,4,34,37,
44050,68,0,111,0, 44230,68,0,111,0,
440687,0,104,0,105, 442487,0,104,0,105,
44070,108,0,101,0, 44250,108,0,101,0,
@@ -4409,7 +4427,7 @@ public yyLSLSyntax
44090,116,0,101,0, 44270,116,0,101,0,
4410109,0,101,0,110, 4428109,0,101,0,110,
44110,116,0,1,-1, 44290,116,0,1,-1,
44121,5,946,20,947, 44301,5,949,20,950,
44134,36,68,0,111, 44314,36,68,0,111,
44140,87,0,104,0, 44320,87,0,104,0,
4415105,0,108,0,101, 4433105,0,108,0,101,
@@ -4417,26 +4435,26 @@ public yyLSLSyntax
441797,0,116,0,101, 443597,0,116,0,101,
44180,109,0,101,0, 44360,109,0,101,0,
4419110,0,116,0,95, 4437110,0,116,0,95,
44200,49,0,1,245, 44380,49,0,1,246,
44211,3,1,8,1, 44391,3,1,8,1,
44227,948,22,1,81, 44407,951,22,1,81,
44231,2364,949,17,950, 44411,2364,952,17,953,
442415,911,1,-1,1, 444215,914,1,-1,1,
44255,951,20,952,4, 44435,954,20,955,4,
442618,70,0,111,0, 444418,70,0,111,0,
4427114,0,76,0,111, 4445114,0,76,0,111,
44280,111,0,112,0, 44460,111,0,112,0,
442995,0,50,0,1, 444795,0,50,0,1,
4430248,1,3,1,9, 4448249,1,3,1,9,
44311,8,953,22,1, 44491,8,956,22,1,
443284,1,102,954,16, 445084,1,102,957,16,
44330,720,1,2782,955, 44510,735,1,112,958,
443416,0,720,1,112, 445216,0,735,1,1117,
4435956,16,0,720,1, 4453959,16,0,735,1,
44361117,957,16,0,720, 44542786,960,16,0,735,
44371,1873,958,17,959, 44551,1873,961,17,962,
443815,945,1,-1,1, 445615,948,1,-1,1,
44395,960,20,961,4, 44575,963,20,964,4,
444036,68,0,111,0, 445836,68,0,111,0,
444187,0,104,0,105, 445987,0,104,0,105,
44420,108,0,101,0, 44600,108,0,101,0,
@@ -4444,39 +4462,39 @@ public yyLSLSyntax
44440,116,0,101,0, 44620,116,0,101,0,
4445109,0,101,0,110, 4463109,0,101,0,110,
44460,116,0,95,0, 44640,116,0,95,0,
444750,0,1,246,1, 446550,0,1,247,1,
44483,1,8,1,7, 44663,1,8,1,7,
4449962,22,1,82,1, 4467965,22,1,82,1,
44501876,963,16,0,720, 44681876,966,16,0,735,
44511,124,964,16,0, 44691,124,967,16,0,
4452720,1,2136,965,17, 4470735,1,2136,968,17,
4453966,15,842,1,-1, 4471969,15,845,1,-1,
44541,5,967,20,968, 44721,5,970,20,971,
44554,26,73,0,102, 44734,26,73,0,102,
44560,83,0,116,0, 44740,83,0,116,0,
445797,0,116,0,101, 447597,0,116,0,101,
44580,109,0,101,0, 44760,109,0,101,0,
4459110,0,116,0,95, 4477110,0,116,0,95,
44600,52,0,1,242, 44780,52,0,1,243,
44611,3,1,8,1, 44791,3,1,8,1,
44627,969,22,1,78, 44807,972,22,1,78,
44631,381,970,16,0, 44811,381,973,16,0,
4464720,1,525,971,16, 4482735,1,525,974,16,
44650,720,1,137,972, 44830,735,1,137,975,
446616,0,720,1,1901, 448416,0,735,1,1901,
4467973,16,0,720,1, 4485976,16,0,735,1,
44681153,974,16,0,720, 44861153,977,16,0,735,
44691,151,975,16,0, 44871,151,978,16,0,
4470720,1,1407,976,16, 4488735,1,1407,979,16,
44710,720,1,1659,977, 44890,735,1,1659,980,
447216,0,720,1,2413, 449016,0,735,1,2413,
4473978,16,0,720,1, 4491981,16,0,735,1,
4474406,979,16,0,720, 4492406,982,16,0,735,
44751,1371,980,16,0, 44931,1371,983,16,0,
4476720,1,166,981,16, 4494735,1,166,984,16,
44770,720,1,1622,982, 44950,735,1,1622,985,
447816,0,720,1,1931, 449616,0,735,1,1931,
4479983,17,984,15,985, 4497986,17,987,15,988,
44804,30,37,0,87, 44984,30,37,0,87,
44810,104,0,105,0, 44990,104,0,105,0,
4482108,0,101,0,83, 4500108,0,101,0,83,
@@ -4484,46 +4502,46 @@ public yyLSLSyntax
4484116,0,101,0,109, 4502116,0,101,0,109,
44850,101,0,110,0, 45030,101,0,110,0,
4486116,0,1,-1,1, 4504116,0,1,-1,1,
44875,986,20,987,4, 45055,989,20,990,4,
448832,87,0,104,0, 450632,87,0,104,0,
4489105,0,108,0,101, 4507105,0,108,0,101,
44900,83,0,116,0, 45080,83,0,116,0,
449197,0,116,0,101, 450997,0,116,0,101,
44920,109,0,101,0, 45100,109,0,101,0,
4493110,0,116,0,95, 4511110,0,116,0,95,
44940,49,0,1,243, 45120,49,0,1,244,
44951,3,1,6,1, 45131,3,1,6,1,
44965,988,22,1,79, 45145,991,22,1,79,
44971,1933,989,16,0, 45151,1933,992,16,0,
4498720,1,431,990,16, 4516735,1,431,993,16,
44990,720,1,1585,991, 45170,735,1,1585,994,
450016,0,720,1,182, 451816,0,735,1,182,
4501992,16,0,720,1, 4519995,16,0,735,1,
45021189,993,16,0,720, 45201189,996,16,0,735,
45031,1443,994,16,0, 45211,1443,997,16,0,
4504720,1,1695,995,16, 4522735,1,1695,998,16,
45050,720,1,2198,996, 45230,735,1,2198,999,
450616,0,720,1,447, 452416,0,735,1,447,
4507997,16,0,720,1, 45251000,16,0,735,1,
45082458,998,17,999,15, 45262458,1001,17,1002,15,
45091000,4,28,37,0, 45271003,4,28,37,0,
451083,0,116,0,97, 452883,0,116,0,97,
45110,116,0,101,0, 45290,116,0,101,0,
4512109,0,101,0,110, 4530109,0,101,0,110,
45130,116,0,76,0, 45310,116,0,76,0,
4514105,0,115,0,116, 4532105,0,115,0,116,
45150,1,-1,1,5, 45330,1,-1,1,5,
45161001,20,1002,4,30, 45341004,20,1005,4,30,
451783,0,116,0,97, 453583,0,116,0,97,
45180,116,0,101,0, 45360,116,0,101,0,
4519109,0,101,0,110, 4537109,0,101,0,110,
45200,116,0,76,0, 45380,116,0,76,0,
4521105,0,115,0,116, 4539105,0,115,0,116,
45220,95,0,50,0, 45400,95,0,50,0,
45231,220,1,3,1, 45411,221,1,3,1,
45243,1,2,1003,22, 45423,1,2,1006,22,
45251,56,1,2459,1004, 45431,56,1,2459,1007,
452617,1005,15,1006,4, 454417,1008,15,1009,4,
452736,37,0,67,0, 454536,37,0,67,0,
4528111,0,109,0,112, 4546111,0,109,0,112,
45290,111,0,117,0, 45470,111,0,117,0,
@@ -4532,7 +4550,7 @@ public yyLSLSyntax
4532116,0,101,0,109, 4550116,0,101,0,109,
45330,101,0,110,0, 45510,101,0,110,0,
4534116,0,1,-1,1, 4552116,0,1,-1,1,
45355,1007,20,1008,4, 45535,1010,20,1011,4,
453638,67,0,111,0, 455438,67,0,111,0,
4537109,0,112,0,111, 4555109,0,112,0,111,
45380,117,0,110,0, 45560,117,0,110,0,
@@ -4541,34 +4559,34 @@ public yyLSLSyntax
4541101,0,109,0,101, 4559101,0,109,0,101,
45420,110,0,116,0, 45600,110,0,116,0,
454395,0,50,0,1, 456195,0,50,0,1,
4544218,1,3,1,4, 4562219,1,3,1,4,
45451,3,1009,22,1, 45631,3,1012,22,1,
454654,1,1958,1010,16, 456454,1,1958,1013,16,
45470,720,1,2462,1011, 45650,735,1,2462,1014,
454817,1012,15,1000,1, 456617,1015,15,1003,1,
4549-1,1,5,1013,20, 4567-1,1,5,1016,20,
45501014,4,30,83,0, 45681017,4,30,83,0,
4551116,0,97,0,116, 4569116,0,97,0,116,
45520,101,0,109,0, 45700,101,0,109,0,
4553101,0,110,0,116, 4571101,0,110,0,116,
45540,76,0,105,0, 45720,76,0,105,0,
4555115,0,116,0,95, 4573115,0,116,0,95,
45560,49,0,1,219, 45740,49,0,1,220,
45571,3,1,2,1, 45751,3,1,2,1,
45581,1015,22,1,55, 45761,1018,22,1,55,
45591,1657,1016,17,1017, 45771,1657,1019,17,1020,
456015,849,1,-1,1, 457815,852,1,-1,1,
45615,1018,20,1019,4, 45795,1021,20,1022,4,
456222,83,0,116,0, 458022,83,0,116,0,
456397,0,116,0,101, 458197,0,116,0,101,
45640,109,0,101,0, 45820,109,0,101,0,
4565110,0,116,0,95, 4583110,0,116,0,95,
45660,50,0,1,223, 45840,50,0,1,224,
45671,3,1,3,1, 45851,3,1,3,1,
45682,1020,22,1,59, 45862,1023,22,1,59,
45691,2464,1021,17,1022, 45871,2464,1024,17,1025,
457015,1006,1,-1,1, 458815,1009,1,-1,1,
45715,1023,20,1024,4, 45895,1026,20,1027,4,
457238,67,0,111,0, 459038,67,0,111,0,
4573109,0,112,0,111, 4591109,0,112,0,111,
45740,117,0,110,0, 45920,117,0,110,0,
@@ -4577,280 +4595,280 @@ public yyLSLSyntax
4577101,0,109,0,101, 4595101,0,109,0,101,
45780,110,0,116,0, 45960,110,0,116,0,
457995,0,49,0,1, 459795,0,49,0,1,
4580217,1,3,1,3, 4598218,1,3,1,3,
45811,2,1025,22,1, 45991,2,1028,22,1,
458253,1,199,1026,16, 460053,1,199,1029,16,
45830,720,1,459,1027, 46010,735,1,459,1030,
458416,0,720,1,462, 460216,0,735,1,462,
45851028,16,0,720,1, 46031031,16,0,735,1,
4586217,1029,16,0,720, 4604217,1032,16,0,735,
45871,2227,1030,17,1031, 46051,2227,1033,17,1034,
458815,985,1,-1,1, 460615,988,1,-1,1,
45895,1032,20,1033,4, 46075,1035,20,1036,4,
459032,87,0,104,0, 460832,87,0,104,0,
4591105,0,108,0,101, 4609105,0,108,0,101,
45920,83,0,116,0, 46100,83,0,116,0,
459397,0,116,0,101, 461197,0,116,0,101,
45940,109,0,101,0, 46120,109,0,101,0,
4595110,0,116,0,95, 4613110,0,116,0,95,
45960,50,0,1,244, 46140,50,0,1,245,
45971,3,1,6,1, 46151,3,1,6,1,
45985,1034,22,1,80, 46165,1037,22,1,80,
45991,1225,1035,16,0, 46171,1225,1038,16,0,
4600720,1,1479,1036,16, 4618735,1,1479,1039,16,
46010,720,1,1731,1037, 46190,735,1,1731,1040,
460216,0,720,1,1989, 462016,0,735,1,1989,
46031038,17,1039,15,842, 46211041,17,1042,15,845,
46041,-1,1,5,1040, 46221,-1,1,5,1043,
460520,1041,4,26,73, 462320,1044,4,26,73,
46060,102,0,83,0, 46240,102,0,83,0,
4607116,0,97,0,116, 4625116,0,97,0,116,
46080,101,0,109,0, 46260,101,0,109,0,
4609101,0,110,0,116, 4627101,0,110,0,116,
46100,95,0,49,0, 46280,95,0,49,0,
46111,239,1,3,1, 46291,240,1,3,1,
46126,1,5,1042,22, 46306,1,5,1045,22,
46131,75,1,1990,1043, 46311,75,1,1990,1046,
461416,0,720,1,236, 463216,0,735,1,236,
46151044,16,0,720,1, 46331047,16,0,735,1,
46161756,1045,16,0,720, 46341756,1048,16,0,735,
46171,4,1046,19,203, 46351,4,1049,19,200,
46181,4,1047,5,100, 46361,4,1050,5,100,
46191,256,1048,16,0, 46371,256,1051,16,0,
4620616,1,1261,1049,16, 4638624,1,1261,1052,16,
46210,616,1,509,1050, 46390,624,1,509,1053,
462216,0,616,1,1515, 464016,0,624,1,1515,
46231051,16,0,616,1, 46411054,16,0,624,1,
46242021,840,1,1775,1052, 46422021,843,1,1775,1055,
462516,0,616,1,2029, 464316,0,624,1,2029,
4626847,1,2030,853,1, 4644850,1,2030,856,1,
46272031,858,1,2032,863, 46452031,861,1,2032,866,
46281,2033,868,1,277, 46461,2033,871,1,277,
46291053,16,0,616,1, 46471056,16,0,624,1,
46302035,874,1,2037,879, 46482035,877,1,2037,882,
46311,2039,884,1,32, 46491,2039,887,1,32,
46321054,16,0,616,1, 46501057,16,0,624,1,
46332041,890,1,2293,1055, 46512041,893,1,2293,1058,
463416,0,616,1,2043, 465216,0,624,1,2043,
4635896,1,2045,901,1, 4653899,1,2045,904,1,
463640,1056,16,0,205, 465440,1059,16,0,202,
46371,41,1057,16,0, 46551,41,1060,16,0,
4638616,1,1297,1058,16, 4656624,1,1297,1061,16,
46390,616,1,43,1059, 46570,624,1,43,1062,
464016,0,616,1,44, 465816,0,624,1,44,
46411060,16,0,205,1, 46591063,16,0,202,1,
46421803,909,1,1804,1061, 46601803,912,1,1804,1064,
464316,0,616,1,299, 466116,0,624,1,299,
46441062,16,0,616,1, 46621065,16,0,624,1,
464547,1063,16,0,201, 466347,1066,16,0,198,
46461,52,1064,16,0, 46641,52,1067,16,0,
4647616,1,2318,1065,16, 4665624,1,2318,1068,16,
46480,616,1,63,1066, 46660,624,1,63,1069,
464916,0,227,1,66, 466716,0,224,1,66,
46501067,16,0,225,1, 46681070,16,0,222,1,
46512075,1068,16,0,616, 46692075,1071,16,0,624,
46521,1574,921,1,71, 46701,1574,924,1,71,
46531069,16,0,616,1, 46711072,16,0,624,1,
465476,1070,16,0,616, 467276,1073,16,0,624,
46551,1834,1071,16,0, 46731,1834,1074,16,0,
4656616,1,2337,1072,16, 4674624,1,2337,1075,16,
46570,616,1,79,1073, 46750,624,1,79,1076,
465816,0,616,1,1335, 467616,0,624,1,1335,
46591074,16,0,616,1, 46771077,16,0,624,1,
4660322,1075,16,0,616, 4678322,1078,16,0,624,
46611,85,1076,16,0, 46791,85,1079,16,0,
4662616,1,89,1077,16, 4680624,1,89,1080,16,
46630,616,1,346,1078, 46810,624,1,346,1081,
466416,0,616,1,97, 468216,0,624,1,97,
46651079,16,0,616,1, 46831082,16,0,624,1,
46662106,1080,16,0,616, 46842106,1083,16,0,624,
46671,102,1081,16,0, 46851,102,1084,16,0,
4668616,1,1860,943,1, 4686624,1,1860,946,1,
46692364,949,1,2782,1082, 46872364,952,1,1114,1085,
467016,0,616,1,1114,
46711083,16,0,201,1,
4672112,1084,16,0,616,
46731,1117,1085,16,0,
4674616,1,1873,958,1,
46751876,1086,16,0,616,
46761,124,1087,16,0,
4677616,1,2136,965,1,
4678381,1088,16,0,616,
46791,525,1089,16,0,
4680616,1,137,1090,16,
46810,616,1,1901,1091,
468216,0,616,1,1153,
46831092,16,0,616,1,
4684151,1093,16,0,616,
46851,1407,1094,16,0,
4686616,1,1659,1095,16,
46870,616,1,2413,1096,
468816,0,616,1,406,
46891097,16,0,616,1,
46901371,1098,16,0,616,
46911,2105,936,1,166,
46921099,16,0,616,1,
46931622,1100,16,0,616,
46941,1931,983,1,1933,
46951101,16,0,616,1,
4696431,1102,16,0,616,
46971,1585,1103,16,0,
4698616,1,182,1104,16,
46990,616,1,1189,1105,
470016,0,616,1,1443,
47011106,16,0,616,1,
47021695,1107,16,0,616,
47031,2198,1108,16,0,
4704616,1,447,1109,16,
47050,616,1,2458,998,
47061,2459,1004,1,1958,
47071110,16,0,616,1,
47082462,1011,1,1657,1016,
47091,2464,1021,1,199,
47101111,16,0,616,1,
4711459,1112,16,0,616,
47121,462,1113,16,0,
4713616,1,217,1114,16,
47140,616,1,2227,1030,
47151,1225,1115,16,0,
4716616,1,1479,1116,16,
47170,616,1,1731,1117,
471816,0,616,1,1989,
47191038,1,1990,1118,16,
47200,616,1,236,1119,
472116,0,616,1,1756,
47221120,16,0,616,1,
47235,1121,19,200,1,
47245,1122,5,100,1,
4725256,1123,16,0,612,
47261,1261,1124,16,0,
4727612,1,509,1125,16,
47280,612,1,1515,1126,
472916,0,612,1,2021,
4730840,1,1775,1127,16,
47310,612,1,2029,847,
47321,2030,853,1,2031,
4733858,1,2032,863,1,
47342033,868,1,277,1128,
473516,0,612,1,2035,
4736874,1,2037,879,1,
47372039,884,1,32,1129,
473816,0,612,1,2041,
4739890,1,2293,1130,16,
47400,612,1,2043,896,
47411,2045,901,1,40,
47421131,16,0,204,1,
474341,1132,16,0,612,
47441,1297,1133,16,0,
4745612,1,43,1134,16,
47460,612,1,44,1135,
474716,0,204,1,1803,
4748909,1,1804,1136,16,
47490,612,1,299,1137,
475016,0,612,1,47,
47511138,16,0,198,1,
475252,1139,16,0,612,
47531,2318,1140,16,0,
4754612,1,63,1141,16,
47550,226,1,66,1142,
475616,0,224,1,2075,
47571143,16,0,612,1,
47581574,921,1,71,1144,
475916,0,612,1,76,
47601145,16,0,612,1,
47611834,1146,16,0,612,
47621,2337,1147,16,0,
4763612,1,79,1148,16,
47640,612,1,1335,1149,
476516,0,612,1,322,
47661150,16,0,612,1,
476785,1151,16,0,612,
47681,89,1152,16,0,
4769612,1,346,1153,16,
47700,612,1,97,1154,
477116,0,612,1,2106,
47721155,16,0,612,1,
4773102,1156,16,0,612,
47741,1860,943,1,2364,
4775949,1,2782,1157,16,
47760,612,1,1114,1158,
477716,0,198,1,112, 468816,0,198,1,112,
47781159,16,0,612,1, 46891086,16,0,624,1,
47791117,1160,16,0,612, 46901117,1087,16,0,624,
47801,1873,958,1,1876, 46911,2786,1088,16,0,
47811161,16,0,612,1, 4692624,1,1873,961,1,
4782124,1162,16,0,612, 46931876,1089,16,0,624,
47831,2136,965,1,381, 46941,124,1090,16,0,
47841163,16,0,612,1, 4695624,1,2136,968,1,
4785525,1164,16,0,612, 4696381,1091,16,0,624,
47861,137,1165,16,0, 46971,525,1092,16,0,
4787612,1,1901,1166,16, 4698624,1,137,1093,16,
47880,612,1,1153,1167, 46990,624,1,1901,1094,
478916,0,612,1,151, 470016,0,624,1,1153,
47901168,16,0,612,1, 47011095,16,0,624,1,
47911407,1169,16,0,612, 4702151,1096,16,0,624,
47921,1659,1170,16,0, 47031,1407,1097,16,0,
4793612,1,2413,1171,16, 4704624,1,1659,1098,16,
47940,612,1,406,1172, 47050,624,1,2413,1099,
479516,0,612,1,1371, 470616,0,624,1,406,
47961173,16,0,612,1, 47071100,16,0,624,1,
47972105,936,1,166,1174, 47081371,1101,16,0,624,
479816,0,612,1,1622, 47091,2105,939,1,166,
47991175,16,0,612,1, 47101102,16,0,624,1,
48001931,983,1,1933,1176, 47111622,1103,16,0,624,
480116,0,612,1,431, 47121,1931,986,1,1933,
48021177,16,0,612,1, 47131104,16,0,624,1,
48031585,1178,16,0,612, 4714431,1105,16,0,624,
48041,182,1179,16,0, 47151,1585,1106,16,0,
4805612,1,1189,1180,16, 4716624,1,182,1107,16,
48060,612,1,1443,1181, 47170,624,1,1189,1108,
480716,0,612,1,1695, 471816,0,624,1,1443,
48081182,16,0,612,1, 47191109,16,0,624,1,
48092198,1183,16,0,612, 47201695,1110,16,0,624,
48101,447,1184,16,0, 47211,2198,1111,16,0,
4811612,1,2458,998,1, 4722624,1,447,1112,16,
48122459,1004,1,1958,1185, 47230,624,1,2458,1001,
481316,0,612,1,2462, 47241,2459,1007,1,1958,
48141011,1,1657,1016,1, 47251113,16,0,624,1,
48152464,1021,1,199,1186, 47262462,1014,1,1657,1019,
481616,0,612,1,459, 47271,2464,1024,1,199,
48171187,16,0,612,1, 47281114,16,0,624,1,
4818462,1188,16,0,612, 4729459,1115,16,0,624,
48191,217,1189,16,0, 47301,462,1116,16,0,
4820612,1,2227,1030,1, 4731624,1,217,1117,16,
48211225,1190,16,0,612, 47320,624,1,2227,1033,
48221,1479,1191,16,0, 47331,1225,1118,16,0,
4823612,1,1731,1192,16, 4734624,1,1479,1119,16,
48240,612,1,1989,1038, 47350,624,1,1731,1120,
48251,1990,1193,16,0, 473616,0,624,1,1989,
4826612,1,236,1194,16, 47371041,1,1990,1121,16,
48270,612,1,1756,1195, 47380,624,1,236,1122,
482816,0,612,1,6, 473916,0,624,1,1756,
48291196,19,306,1,6, 47401123,16,0,624,1,
48301197,5,2,1,1114, 47415,1124,19,197,1,
48311198,16,0,304,1, 47425,1125,5,100,1,
483240,1199,16,0,601, 4743256,1126,16,0,620,
48331,7,1200,19,270, 47441,1261,1127,16,0,
48341,7,1201,5,2, 4745620,1,509,1128,16,
48351,1114,1202,16,0, 47460,620,1,1515,1129,
4836268,1,40,1203,16, 474716,0,620,1,2021,
48370,531,1,8,1204, 4748843,1,1775,1130,16,
483819,233,1,8,1205, 47490,620,1,2029,850,
48395,2,1,1114,1206, 47501,2030,856,1,2031,
484016,0,231,1,40, 4751861,1,2032,866,1,
48411207,16,0,489,1, 47522033,871,1,277,1131,
48429,1208,19,239,1, 475316,0,620,1,2035,
48439,1209,5,2,1, 4754877,1,2037,882,1,
48441114,1210,16,0,237, 47552039,887,1,32,1132,
48451,40,1211,16,0, 475616,0,620,1,2041,
4846420,1,10,1212,19, 4757893,1,2293,1133,16,
4847183,1,10,1213,5, 47580,620,1,2043,899,
48482,1,1114,1214,16, 47591,2045,904,1,40,
48490,181,1,40,1215, 47601134,16,0,201,1,
485016,0,360,1,11, 476141,1135,16,0,620,
48511216,19,147,1,11, 47621,1297,1136,16,0,
48521217,5,146,1,1260, 4763620,1,43,1137,16,
48531218,17,1219,15,1220, 47640,620,1,44,1138,
476516,0,201,1,1803,
4766912,1,1804,1139,16,
47670,620,1,299,1140,
476816,0,620,1,47,
47691141,16,0,195,1,
477052,1142,16,0,620,
47711,2318,1143,16,0,
4772620,1,63,1144,16,
47730,223,1,66,1145,
477416,0,221,1,2075,
47751146,16,0,620,1,
47761574,924,1,71,1147,
477716,0,620,1,76,
47781148,16,0,620,1,
47791834,1149,16,0,620,
47801,2337,1150,16,0,
4781620,1,79,1151,16,
47820,620,1,1335,1152,
478316,0,620,1,322,
47841153,16,0,620,1,
478585,1154,16,0,620,
47861,89,1155,16,0,
4787620,1,346,1156,16,
47880,620,1,97,1157,
478916,0,620,1,2106,
47901158,16,0,620,1,
4791102,1159,16,0,620,
47921,1860,946,1,2364,
4793952,1,1114,1160,16,
47940,195,1,112,1161,
479516,0,620,1,1117,
47961162,16,0,620,1,
47972786,1163,16,0,620,
47981,1873,961,1,1876,
47991164,16,0,620,1,
4800124,1165,16,0,620,
48011,2136,968,1,381,
48021166,16,0,620,1,
4803525,1167,16,0,620,
48041,137,1168,16,0,
4805620,1,1901,1169,16,
48060,620,1,1153,1170,
480716,0,620,1,151,
48081171,16,0,620,1,
48091407,1172,16,0,620,
48101,1659,1173,16,0,
4811620,1,2413,1174,16,
48120,620,1,406,1175,
481316,0,620,1,1371,
48141176,16,0,620,1,
48152105,939,1,166,1177,
481616,0,620,1,1622,
48171178,16,0,620,1,
48181931,986,1,1933,1179,
481916,0,620,1,431,
48201180,16,0,620,1,
48211585,1181,16,0,620,
48221,182,1182,16,0,
4823620,1,1189,1183,16,
48240,620,1,1443,1184,
482516,0,620,1,1695,
48261185,16,0,620,1,
48272198,1186,16,0,620,
48281,447,1187,16,0,
4829620,1,2458,1001,1,
48302459,1007,1,1958,1188,
483116,0,620,1,2462,
48321014,1,1657,1019,1,
48332464,1024,1,199,1189,
483416,0,620,1,459,
48351190,16,0,620,1,
4836462,1191,16,0,620,
48371,217,1192,16,0,
4838620,1,2227,1033,1,
48391225,1193,16,0,620,
48401,1479,1194,16,0,
4841620,1,1731,1195,16,
48420,620,1,1989,1041,
48431,1990,1196,16,0,
4844620,1,236,1197,16,
48450,620,1,1756,1198,
484616,0,620,1,6,
48471199,19,310,1,6,
48481200,5,2,1,1114,
48491201,16,0,308,1,
485040,1202,16,0,609,
48511,7,1203,19,267,
48521,7,1204,5,2,
48531,1114,1205,16,0,
4854265,1,40,1206,16,
48550,544,1,8,1207,
485619,230,1,8,1208,
48575,2,1,1114,1209,
485816,0,228,1,40,
48591210,16,0,501,1,
48609,1211,19,236,1,
48619,1212,5,2,1,
48621114,1213,16,0,234,
48631,40,1214,16,0,
4864430,1,10,1215,19,
4865180,1,10,1216,5,
48662,1,1114,1217,16,
48670,178,1,40,1218,
486816,0,367,1,11,
48691219,19,151,1,11,
48701220,5,146,1,1260,
48711221,17,1222,15,1223,
48544,34,37,0,83, 48724,34,37,0,83,
48550,105,0,109,0, 48730,105,0,109,0,
4856112,0,108,0,101, 4874112,0,108,0,101,
@@ -4859,7 +4877,7 @@ public yyLSLSyntax
48590,110,0,109,0, 48770,110,0,109,0,
4860101,0,110,0,116, 4878101,0,110,0,116,
48610,1,-1,1,5, 48790,1,-1,1,5,
48621221,20,1222,4,38, 48801224,20,1225,4,38,
486383,0,105,0,109, 488183,0,105,0,109,
48640,112,0,108,0, 48820,112,0,108,0,
4865101,0,65,0,115, 4883101,0,65,0,115,
@@ -4867,11 +4885,11 @@ public yyLSLSyntax
4867103,0,110,0,109, 4885103,0,110,0,109,
48680,101,0,110,0, 48860,101,0,110,0,
4869116,0,95,0,50, 4887116,0,95,0,50,
48700,49,0,1,275, 48880,49,0,1,276,
48711,3,1,6,1, 48891,3,1,6,1,
48725,1223,22,1,111, 48905,1226,22,1,111,
48731,1011,1224,17,1225, 48911,1011,1227,17,1228,
487415,1226,4,44,37, 489215,1229,4,44,37,
48750,80,0,97,0, 48930,80,0,97,0,
4876114,0,101,0,110, 4894114,0,101,0,110,
48770,116,0,104,0, 48950,116,0,104,0,
@@ -4881,7 +4899,7 @@ public yyLSLSyntax
48810,101,0,115,0, 48990,101,0,115,0,
4882115,0,105,0,111, 4900115,0,105,0,111,
48830,110,0,1,-1, 49010,110,0,1,-1,
48841,5,1227,20,1228, 49021,5,1230,20,1231,
48854,46,80,0,97, 49034,46,80,0,97,
48860,114,0,101,0, 49040,114,0,101,0,
4887110,0,116,0,104, 4905110,0,116,0,104,
@@ -4891,12 +4909,12 @@ public yyLSLSyntax
4891114,0,101,0,115, 4909114,0,101,0,115,
48920,115,0,105,0, 49100,115,0,105,0,
4893111,0,110,0,95, 4911111,0,110,0,95,
48940,50,0,1,322, 49120,50,0,1,323,
48951,3,1,4,1, 49131,3,1,4,1,
48963,1229,22,1,158, 49143,1232,22,1,158,
48971,1514,1230,17,1231, 49151,1514,1233,17,1234,
489815,1220,1,-1,1, 491615,1223,1,-1,1,
48995,1232,20,1233,4, 49175,1235,20,1236,4,
490038,83,0,105,0, 491838,83,0,105,0,
4901109,0,112,0,108, 4919109,0,112,0,108,
49020,101,0,65,0, 49200,101,0,65,0,
@@ -4905,26 +4923,26 @@ public yyLSLSyntax
4905109,0,101,0,110, 4923109,0,101,0,110,
49060,116,0,95,0, 49240,116,0,95,0,
490749,0,52,0,1, 492549,0,52,0,1,
4908268,1,3,1,4, 4926269,1,3,1,4,
49091,3,1234,22,1, 49271,3,1237,22,1,
4910104,1,9,1235,17, 4928104,1,9,1238,17,
49111236,15,1237,4,24, 49291239,15,1240,4,24,
491237,0,68,0,101, 493037,0,68,0,101,
49130,99,0,108,0, 49310,99,0,108,0,
491497,0,114,0,97, 493297,0,114,0,97,
49150,116,0,105,0, 49330,116,0,105,0,
4916111,0,110,0,1, 4934111,0,110,0,1,
4917-1,1,5,1238,20, 4935-1,1,5,1241,20,
49181239,4,26,68,0, 49361242,4,26,68,0,
4919101,0,99,0,108, 4937101,0,99,0,108,
49200,97,0,114,0, 49380,97,0,114,0,
492197,0,116,0,105, 493997,0,116,0,105,
49220,111,0,110,0, 49400,111,0,110,0,
492395,0,49,0,1, 494195,0,49,0,1,
4924212,1,3,1,3, 4942213,1,3,1,3,
49251,2,1240,22,1, 49431,2,1243,22,1,
492648,1,262,1241,17, 494448,1,262,1244,17,
49271242,15,1243,4,34, 49451245,15,1246,4,34,
492837,0,66,0,105, 494637,0,66,0,105,
49290,110,0,97,0, 49470,110,0,97,0,
4930114,0,121,0,69, 4948114,0,121,0,69,
@@ -4932,8 +4950,8 @@ public yyLSLSyntax
4932114,0,101,0,115, 4950114,0,101,0,115,
49330,115,0,105,0, 49510,115,0,105,0,
4934111,0,110,0,1, 4952111,0,110,0,1,
4935-1,1,5,1244,20, 4953-1,1,5,1247,20,
49361245,4,36,66,0, 49541248,4,36,66,0,
4937105,0,110,0,97, 4955105,0,110,0,97,
49380,114,0,121,0, 49560,114,0,121,0,
493969,0,120,0,112, 495769,0,120,0,112,
@@ -4941,11 +4959,11 @@ public yyLSLSyntax
4941115,0,115,0,105, 4959115,0,115,0,105,
49420,111,0,110,0, 49600,111,0,110,0,
494395,0,53,0,1, 496195,0,53,0,1,
4944304,1,3,1,4, 4962305,1,3,1,4,
49451,3,1246,22,1, 49631,3,1249,22,1,
4946140,1,1267,1247,17, 4964140,1,1267,1250,17,
49471248,15,1220,1,-1, 49651251,15,1223,1,-1,
49481,5,1249,20,1250, 49661,5,1252,20,1253,
49494,36,83,0,105, 49674,36,83,0,105,
49500,109,0,112,0, 49680,109,0,112,0,
4951108,0,101,0,65, 4969108,0,101,0,65,
@@ -4953,13 +4971,13 @@ public yyLSLSyntax
4953105,0,103,0,110, 4971105,0,103,0,110,
49540,109,0,101,0, 49720,109,0,101,0,
4955110,0,116,0,95, 4973110,0,116,0,95,
49560,56,0,1,262, 49740,56,0,1,263,
49571,3,1,6,1, 49751,3,1,6,1,
49585,1251,22,1,98, 49765,1254,22,1,98,
49591,2021,840,1,1521, 49771,2021,843,1,1521,
49601252,17,1253,15,1220, 49781255,17,1256,15,1223,
49611,-1,1,5,1254, 49791,-1,1,5,1257,
496220,1255,4,36,83, 498020,1258,4,36,83,
49630,105,0,109,0, 49810,105,0,109,0,
4964112,0,108,0,101, 4982112,0,108,0,101,
49650,65,0,115,0, 49830,65,0,115,0,
@@ -4967,26 +4985,26 @@ public yyLSLSyntax
49670,110,0,109,0, 49850,110,0,109,0,
4968101,0,110,0,116, 4986101,0,110,0,116,
49690,95,0,49,0, 49870,95,0,49,0,
49701,255,1,3,1, 49881,256,1,3,1,
49714,1,3,1256,22, 49894,1,3,1259,22,
49721,91,1,2024,1257, 49901,91,1,2024,1260,
497317,1258,15,1259,4, 499117,1261,15,1262,4,
497424,37,0,83,0, 499224,37,0,83,0,
4975116,0,97,0,116, 4993116,0,97,0,116,
49760,101,0,67,0, 49940,101,0,67,0,
4977104,0,97,0,110, 4995104,0,97,0,110,
49780,103,0,101,0, 49960,103,0,101,0,
49791,-1,1,5,1260, 49971,-1,1,5,1263,
498020,1261,4,26,83, 499820,1264,4,26,83,
49810,116,0,97,0, 49990,116,0,97,0,
4982116,0,101,0,67, 5000116,0,101,0,67,
49830,104,0,97,0, 50010,104,0,97,0,
4984110,0,103,0,101, 5002110,0,103,0,101,
49850,95,0,49,0, 50030,95,0,49,0,
49861,237,1,3,1, 50041,238,1,3,1,
49873,1,2,1262,22, 50053,1,2,1265,22,
49881,73,1,1775,1263, 50061,73,1,1775,1266,
498917,1264,15,1265,4, 500717,1267,15,1268,4,
499030,37,0,69,0, 500830,37,0,69,0,
4991109,0,112,0,116, 5009109,0,112,0,116,
49920,121,0,83,0, 50100,121,0,83,0,
@@ -4994,34 +5012,34 @@ public yyLSLSyntax
49940,101,0,109,0, 50120,101,0,109,0,
4995101,0,110,0,116, 5013101,0,110,0,116,
49960,1,-1,1,5, 50140,1,-1,1,5,
49971266,20,1267,4,32, 50151269,20,1270,4,32,
499869,0,109,0,112, 501669,0,109,0,112,
49990,116,0,121,0, 50170,116,0,121,0,
500083,0,116,0,97, 501883,0,116,0,97,
50010,116,0,101,0, 50190,116,0,101,0,
5002109,0,101,0,110, 5020109,0,101,0,110,
50030,116,0,95,0, 50210,116,0,95,0,
500449,0,1,221,1, 502249,0,1,222,1,
50053,1,1,1,0, 50233,1,1,1,0,
50061268,22,1,57,1, 50241271,22,1,57,1,
500719,1269,17,1236,1, 502519,1272,17,1239,1,
50082,1240,1,2028,1270, 50262,1243,1,2028,1273,
500917,1271,15,1272,4, 502717,1274,15,1275,4,
501020,37,0,74,0, 502820,37,0,74,0,
5011117,0,109,0,112, 5029117,0,109,0,112,
50120,76,0,97,0, 50300,76,0,97,0,
501398,0,101,0,108, 503198,0,101,0,108,
50140,1,-1,1,5, 50320,1,-1,1,5,
50151273,20,1274,4,22, 50331276,20,1277,4,22,
501674,0,117,0,109, 503474,0,117,0,109,
50170,112,0,76,0, 50350,112,0,76,0,
501897,0,98,0,101, 503697,0,98,0,101,
50190,108,0,95,0, 50370,108,0,95,0,
502049,0,1,235,1, 503849,0,1,236,1,
50213,1,3,1,2, 50393,1,3,1,2,
50221275,22,1,71,1, 50401278,22,1,71,1,
50232029,847,1,2281,1276, 50412029,850,1,2281,1279,
502417,1277,15,1278,4, 504217,1280,15,1281,4,
502534,37,0,70,0, 504334,37,0,70,0,
5026111,0,114,0,76, 5044111,0,114,0,76,
50270,111,0,111,0, 50450,111,0,111,0,
@@ -5029,8 +5047,8 @@ public yyLSLSyntax
50290,97,0,116,0, 50470,97,0,116,0,
5030101,0,109,0,101, 5048101,0,109,0,101,
50310,110,0,116,0, 50490,110,0,116,0,
50321,-1,1,5,1279, 50501,-1,1,5,1282,
503320,1280,4,36,70, 505120,1283,4,36,70,
50340,111,0,114,0, 50520,111,0,114,0,
503576,0,111,0,111, 505376,0,111,0,111,
50360,112,0,83,0, 50540,112,0,83,0,
@@ -5038,125 +5056,95 @@ public yyLSLSyntax
50380,101,0,109,0, 50560,101,0,109,0,
5039101,0,110,0,116, 5057101,0,110,0,116,
50400,95,0,50,0, 50580,95,0,50,0,
50411,250,1,3,1, 50591,251,1,3,1,
50422,1,1,1281,22, 50602,1,1,1284,22,
50431,86,1,2031,858, 50611,86,1,2031,861,
50441,2032,863,1,2033, 50621,2785,1285,16,0,
5045868,1,2034,1282,16, 5063519,1,2033,871,1,
50460,676,1,2788,1283, 50642034,1286,16,0,691,
504716,0,145,1,2036, 50651,2035,877,1,2036,
50481284,16,0,602,1, 50661287,16,0,610,1,
50492037,879,1,2038,1285, 50672037,882,1,2038,1288,
505016,0,606,1,2039, 506816,0,614,1,2792,
5051884,1,32,1286,17, 50691289,16,0,149,1,
50521264,1,0,1268,1, 507032,1290,17,1267,1,
50532041,890,1,2042,1287, 50710,1271,1,2032,866,
505416,0,749,1,2043, 50721,2042,1291,16,0,
5055896,1,2044,1288,16, 5073757,1,2043,899,1,
50560,689,1,2045,901, 50742044,1292,16,0,704,
50571,2299,1289,16,0, 50751,2045,904,1,2299,
5058255,1,1296,1290,17, 50761293,16,0,252,1,
50591291,15,1220,1,-1, 50771296,1294,17,1295,15,
50601,5,1292,20,1293, 50781223,1,-1,1,5,
50614,38,83,0,105, 50791296,20,1297,4,38,
50620,109,0,112,0, 508083,0,105,0,109,
5063108,0,101,0,65, 50810,112,0,108,0,
50640,115,0,115,0, 5082101,0,65,0,115,
5065105,0,103,0,110, 50830,115,0,105,0,
50660,109,0,101,0, 5084103,0,110,0,109,
5067110,0,116,0,95,
50680,50,0,48,0,
50691,274,1,3,1,
50706,1,5,1294,22,
50711,110,1,283,1295,
507217,1296,15,1243,1,
5073-1,1,5,1297,20,
50741298,4,36,66,0,
5075105,0,110,0,97,
50760,114,0,121,0,
507769,0,120,0,112,
50780,114,0,101,0,
5079115,0,115,0,105,
50800,111,0,110,0,
508195,0,52,0,1,
5082303,1,3,1,4,
50831,3,1299,22,1,
5084139,1,40,1300,17,
50851301,15,1302,4,32,
508637,0,73,0,100,
50870,101,0,110,0, 50850,101,0,110,0,
5088116,0,69,0,120, 5086116,0,95,0,50,
50890,112,0,114,0, 50870,48,0,1,275,
5090101,0,115,0,115, 50881,3,1,6,1,
50910,105,0,111,0, 50895,1298,22,1,110,
5092110,0,1,-1,1, 50901,283,1299,17,1300,
50935,1303,20,1304,4, 509115,1246,1,-1,1,
509434,73,0,100,0, 50925,1301,20,1302,4,
5095101,0,110,0,116, 509336,66,0,105,0,
50960,69,0,120,0, 5094110,0,97,0,114,
5097112,0,114,0,101, 50950,121,0,69,0,
50980,115,0,115,0, 5096120,0,112,0,114,
5099105,0,111,0,110, 50970,101,0,115,0,
51000,95,0,49,0, 5098115,0,105,0,111,
51011,289,1,3,1, 50990,110,0,95,0,
51022,1,1,1305,22, 510052,0,1,304,1,
51031,125,1,44,1306, 51013,1,4,1,3,
510417,1301,1,1,1305, 51021303,22,1,139,1,
51051,1803,909,1,47, 510340,1304,17,1305,15,
51061307,17,1308,15,1309, 51041306,4,32,37,0,
51074,38,37,0,73, 510573,0,100,0,101,
51080,100,0,101,0, 51060,110,0,116,0,
5109110,0,116,0,68,
51100,111,0,116,0,
511169,0,120,0,112, 510769,0,120,0,112,
51120,114,0,101,0, 51080,114,0,101,0,
5113115,0,115,0,105, 5109115,0,115,0,105,
51140,111,0,110,0, 51100,111,0,110,0,
51151,-1,1,5,1310, 51111,-1,1,5,1307,
511620,1311,4,40,73, 511220,1308,4,34,73,
51170,100,0,101,0, 51130,100,0,101,0,
5118110,0,116,0,68, 5114110,0,116,0,69,
51190,111,0,116,0, 51150,120,0,112,0,
512069,0,120,0,112, 5116114,0,101,0,115,
51210,114,0,101,0, 51170,115,0,105,0,
5122115,0,115,0,105, 5118111,0,110,0,95,
51230,111,0,110,0, 51190,49,0,1,290,
512495,0,49,0,1, 51201,3,1,2,1,
5125290,1,3,1,4, 51211,1309,22,1,125,
51261,3,1312,22,1, 51221,44,1310,17,1305,
5127126,1,48,1313,17, 51231,1,1309,1,1803,
51281314,15,1315,4,58, 5124912,1,47,1311,17,
512937,0,73,0,110, 51251312,15,1313,4,38,
51300,99,0,114,0, 512637,0,73,0,100,
5131101,0,109,0,101, 51270,101,0,110,0,
51320,110,0,116,0, 5128116,0,68,0,111,
513368,0,101,0,99,
51340,114,0,101,0,
5135109,0,101,0,110,
51360,116,0,69,0, 51290,116,0,69,0,
5137120,0,112,0,114, 5130120,0,112,0,114,
51380,101,0,115,0, 51310,101,0,115,0,
5139115,0,105,0,111, 5132115,0,105,0,111,
51400,110,0,1,-1, 51330,110,0,1,-1,
51411,5,1316,20,1317, 51341,5,1314,20,1315,
51424,60,73,0,110, 51354,40,73,0,100,
51430,99,0,114,0, 51360,101,0,110,0,
5144101,0,109,0,101, 5137116,0,68,0,111,
51450,110,0,116,0,
514668,0,101,0,99,
51470,114,0,101,0,
5148109,0,101,0,110,
51490,116,0,69,0, 51380,116,0,69,0,
5150120,0,112,0,114, 5139120,0,112,0,114,
51510,101,0,115,0, 51400,101,0,115,0,
5152115,0,105,0,111, 5141115,0,105,0,111,
51530,110,0,95,0, 51420,110,0,95,0,
515452,0,1,294,1, 514349,0,1,291,1,
51553,1,5,1,4, 51443,1,4,1,3,
51561318,22,1,130,1, 51451316,22,1,126,1,
515749,1319,17,1320,15, 514648,1317,17,1318,15,
51581315,1,-1,1,5, 51471319,4,58,37,0,
51591321,20,1322,4,60,
516073,0,110,0,99, 514873,0,110,0,99,
51610,114,0,101,0, 51490,114,0,101,0,
5162109,0,101,0,110, 5150109,0,101,0,110,
@@ -5168,13 +5156,26 @@ public yyLSLSyntax
5168112,0,114,0,101, 5156112,0,114,0,101,
51690,115,0,115,0, 51570,115,0,115,0,
5170105,0,111,0,110, 5158105,0,111,0,110,
51710,95,0,51,0, 51590,1,-1,1,5,
51721,293,1,3,1, 51601320,20,1321,4,60,
51735,1,4,1323,22, 516173,0,110,0,99,
51741,129,1,50,1324, 51620,114,0,101,0,
517517,1325,15,1315,1, 5163109,0,101,0,110,
5176-1,1,5,1326,20, 51640,116,0,68,0,
51771327,4,60,73,0, 5165101,0,99,0,114,
51660,101,0,109,0,
5167101,0,110,0,116,
51680,69,0,120,0,
5169112,0,114,0,101,
51700,115,0,115,0,
5171105,0,111,0,110,
51720,95,0,52,0,
51731,295,1,3,1,
51745,1,4,1322,22,
51751,130,1,49,1323,
517617,1324,15,1319,1,
5177-1,1,5,1325,20,
51781326,4,60,73,0,
5178110,0,99,0,114, 5179110,0,99,0,114,
51790,101,0,109,0, 51800,101,0,109,0,
5180101,0,110,0,116, 5181101,0,110,0,116,
@@ -5186,12 +5187,12 @@ public yyLSLSyntax
5186114,0,101,0,115, 5187114,0,101,0,115,
51870,115,0,105,0, 51880,115,0,105,0,
5188111,0,110,0,95, 5189111,0,110,0,95,
51890,50,0,1,292, 51900,51,0,1,294,
51901,3,1,3,1, 51911,3,1,5,1,
51912,1328,22,1,128, 51924,1327,22,1,129,
51921,51,1329,17,1330, 51931,50,1328,17,1329,
519315,1315,1,-1,1, 519415,1319,1,-1,1,
51945,1331,20,1332,4, 51955,1330,20,1331,4,
519560,73,0,110,0, 519660,73,0,110,0,
519699,0,114,0,101, 519799,0,114,0,101,
51970,109,0,101,0, 51980,109,0,101,0,
@@ -5203,67 +5204,71 @@ public yyLSLSyntax
52030,112,0,114,0, 52040,112,0,114,0,
5204101,0,115,0,115, 5205101,0,115,0,115,
52050,105,0,111,0, 52060,105,0,111,0,
5206110,0,95,0,49, 5207110,0,95,0,50,
52070,1,291,1,3, 52080,1,293,1,3,
52081,3,1,2,1333, 52091,3,1,2,1332,
520922,1,127,1,305, 521022,1,128,1,51,
52101334,17,1335,15,1243, 52111333,17,1334,15,1319,
52111,-1,1,5,1336, 52121,-1,1,5,1335,
521220,1337,4,36,66, 521320,1336,4,60,73,
52130,105,0,110,0, 52140,110,0,99,0,
521497,0,114,0,121, 5215114,0,101,0,109,
52150,69,0,120,0, 52160,101,0,110,0,
5216112,0,114,0,101, 5217116,0,68,0,101,
52170,115,0,115,0, 52180,99,0,114,0,
5218105,0,111,0,110, 5219101,0,109,0,101,
52190,95,0,51,0,
52201,302,1,3,1,
52214,1,3,1338,22,
52221,138,1,525,1339,
522317,1340,15,1341,4,
522434,37,0,82,0,
5225111,0,116,0,97,
52260,116,0,105,0,
5227111,0,110,0,67,
52280,111,0,110,0,
5229115,0,116,0,97,
52300,110,0,116,0, 52200,110,0,116,0,
52311,-1,1,5,1342, 522169,0,120,0,112,
523220,1343,4,36,82, 52220,114,0,101,0,
52330,111,0,116,0, 5223115,0,115,0,105,
523497,0,116,0,105,
52350,111,0,110,0, 52240,111,0,110,0,
523667,0,111,0,110, 522595,0,49,0,1,
52370,115,0,116,0, 5226292,1,3,1,3,
523897,0,110,0,116, 52271,2,1337,22,1,
52390,95,0,49,0, 5228127,1,305,1338,17,
52401,287,1,3,1, 52291339,15,1246,1,-1,
524110,1,9,1344,22, 52301,5,1340,20,1341,
52421,123,1,63,1345, 52314,36,66,0,105,
524317,1346,15,1347,4, 52320,110,0,97,0,
524438,37,0,84,0, 5233114,0,121,0,69,
5245121,0,112,0,101,
52460,99,0,97,0,
5247115,0,116,0,69,
52480,120,0,112,0,
5249114,0,101,0,115,
52500,115,0,105,0,
5251111,0,110,0,1,
5252-1,1,5,1348,20,
52531349,4,40,84,0,
5254121,0,112,0,101,
52550,99,0,97,0,
5256115,0,116,0,69,
52570,120,0,112,0, 52340,120,0,112,0,
5258114,0,101,0,115, 5235114,0,101,0,115,
52590,115,0,105,0, 52360,115,0,105,0,
5260111,0,110,0,95, 5237111,0,110,0,95,
52610,50,0,1,324, 52380,51,0,1,303,
52621,3,1,5,1, 52391,3,1,4,1,
52634,1350,22,1,160, 52403,1342,22,1,138,
52641,66,1351,17,1352, 52411,525,1343,17,1344,
526515,1347,1,-1,1, 524215,1345,4,34,37,
52665,1353,20,1354,4, 52430,82,0,111,0,
5244116,0,97,0,116,
52450,105,0,111,0,
5246110,0,67,0,111,
52470,110,0,115,0,
5248116,0,97,0,110,
52490,116,0,1,-1,
52501,5,1346,20,1347,
52514,36,82,0,111,
52520,116,0,97,0,
5253116,0,105,0,111,
52540,110,0,67,0,
5255111,0,110,0,115,
52560,116,0,97,0,
5257110,0,116,0,95,
52580,49,0,1,288,
52591,3,1,10,1,
52609,1348,22,1,123,
52611,63,1349,17,1350,
526215,1351,4,38,37,
52630,84,0,121,0,
5264112,0,101,0,99,
52650,97,0,115,0,
5266116,0,69,0,120,
52670,112,0,114,0,
5268101,0,115,0,115,
52690,105,0,111,0,
5270110,0,1,-1,1,
52715,1352,20,1353,4,
526740,84,0,121,0, 527240,84,0,121,0,
5268112,0,101,0,99, 5273112,0,101,0,99,
52690,97,0,115,0, 52740,97,0,115,0,
@@ -5271,13 +5276,13 @@ public yyLSLSyntax
52710,112,0,114,0, 52760,112,0,114,0,
5272101,0,115,0,115, 5277101,0,115,0,115,
52730,105,0,111,0, 52780,105,0,111,0,
5274110,0,95,0,51, 5279110,0,95,0,50,
52750,1,325,1,3, 52800,1,325,1,3,
52761,7,1,6,1355, 52811,5,1,4,1354,
527722,1,161,1,67, 528222,1,160,1,66,
52781356,17,1357,15,1347, 52831355,17,1356,15,1351,
52791,-1,1,5,1358, 52841,-1,1,5,1357,
528020,1359,4,40,84, 528520,1358,4,40,84,
52810,121,0,112,0, 52860,121,0,112,0,
5282101,0,99,0,97, 5287101,0,99,0,97,
52830,115,0,116,0, 52880,115,0,116,0,
@@ -5285,12 +5290,12 @@ public yyLSLSyntax
52850,114,0,101,0, 52900,114,0,101,0,
5286115,0,115,0,105, 5291115,0,115,0,105,
52870,111,0,110,0, 52920,111,0,110,0,
528895,0,55,0,1, 529395,0,51,0,1,
5289329,1,3,1,8, 5294326,1,3,1,7,
52901,7,1360,22,1, 52951,6,1359,22,1,
5291165,1,68,1361,17, 5296161,1,67,1360,17,
52921362,15,1347,1,-1, 52971361,15,1351,1,-1,
52931,5,1363,20,1364, 52981,5,1362,20,1363,
52944,40,84,0,121, 52994,40,84,0,121,
52950,112,0,101,0, 53000,112,0,101,0,
529699,0,97,0,115, 530199,0,97,0,115,
@@ -5299,12 +5304,12 @@ public yyLSLSyntax
52990,101,0,115,0, 53040,101,0,115,0,
5300115,0,105,0,111, 5305115,0,105,0,111,
53010,110,0,95,0, 53060,110,0,95,0,
530253,0,1,327,1, 530755,0,1,330,1,
53033,1,8,1,7, 53083,1,8,1,7,
53041365,22,1,163,1, 53091364,22,1,165,1,
530569,1366,17,1367,15, 531068,1365,17,1366,15,
53061347,1,-1,1,5, 53111351,1,-1,1,5,
53071368,20,1369,4,40, 53121367,20,1368,4,40,
530884,0,121,0,112, 531384,0,121,0,112,
53090,101,0,99,0, 53140,101,0,99,0,
531097,0,115,0,116, 531597,0,115,0,116,
@@ -5312,13 +5317,13 @@ public yyLSLSyntax
5312112,0,114,0,101, 5317112,0,114,0,101,
53130,115,0,115,0, 53180,115,0,115,0,
5314105,0,111,0,110, 5319105,0,111,0,110,
53150,95,0,54,0, 53200,95,0,53,0,
53161,328,1,3,1, 53211,328,1,3,1,
53176,1,5,1370,22, 53228,1,7,1369,22,
53181,164,1,70,1371, 53231,163,1,69,1370,
531917,1372,15,1347,1, 532417,1371,15,1351,1,
5320-1,1,5,1373,20, 5325-1,1,5,1372,20,
53211374,4,40,84,0, 53261373,4,40,84,0,
5322121,0,112,0,101, 5327121,0,112,0,101,
53230,99,0,97,0, 53280,99,0,97,0,
5324115,0,116,0,69, 5329115,0,116,0,69,
@@ -5326,12 +5331,12 @@ public yyLSLSyntax
5326114,0,101,0,115, 5331114,0,101,0,115,
53270,115,0,105,0, 53320,115,0,105,0,
5328111,0,110,0,95, 5333111,0,110,0,95,
53290,52,0,1,326, 53340,54,0,1,329,
53301,3,1,6,1, 53351,3,1,6,1,
53315,1375,22,1,162, 53365,1374,22,1,164,
53321,74,1376,17,1377, 53371,70,1375,17,1376,
533315,1347,1,-1,1, 533815,1351,1,-1,1,
53345,1378,20,1379,4, 53395,1377,20,1378,4,
533540,84,0,121,0, 534040,84,0,121,0,
5336112,0,101,0,99, 5341112,0,101,0,99,
53370,97,0,115,0, 53420,97,0,115,0,
@@ -5339,191 +5344,251 @@ public yyLSLSyntax
53390,112,0,114,0, 53440,112,0,114,0,
5340101,0,115,0,115, 5345101,0,115,0,115,
53410,105,0,111,0, 53460,105,0,111,0,
5342110,0,95,0,57, 5347110,0,95,0,52,
53430,1,331,1,3, 53480,1,327,1,3,
53441,7,1,6,1380, 53491,6,1,5,1379,
534522,1,167,1,1013, 535022,1,162,1,74,
53461381,17,1382,15,1226, 53511380,17,1381,15,1351,
53471,-1,1,5,1383, 53521,-1,1,5,1382,
534820,1384,4,46,80, 535320,1383,4,40,84,
53490,97,0,114,0, 53540,121,0,112,0,
5350101,0,110,0,116, 5355101,0,99,0,97,
53510,104,0,101,0, 53560,115,0,116,0,
5352115,0,105,0,115,
53530,69,0,120,0,
5354112,0,114,0,101,
53550,115,0,115,0,
5356105,0,111,0,110,
53570,95,0,49,0,
53581,321,1,3,1,
53594,1,3,1385,22,
53601,157,1,1332,1386,
536117,1387,15,1220,1,
5362-1,1,5,1388,20,
53631389,4,38,83,0,
5364105,0,109,0,112,
53650,108,0,101,0,
536665,0,115,0,115,
53670,105,0,103,0,
5368110,0,109,0,101,
53690,110,0,116,0,
537095,0,49,0,57,
53710,1,273,1,3,
53721,6,1,5,1390,
537322,1,109,1,2337,
53741391,17,1264,1,0,
53751268,1,1585,1392,17,
53761393,15,1394,4,32,
537737,0,82,0,101,
53780,116,0,117,0,
5379114,0,110,0,83,
53800,116,0,97,0,
5381116,0,101,0,109,
53820,101,0,110,0,
5383116,0,1,-1,1,
53845,1395,20,1396,4,
538534,82,0,101,0,
5386116,0,117,0,114,
53870,110,0,83,0,
5388116,0,97,0,116,
53890,101,0,109,0,
5390101,0,110,0,116,
53910,95,0,50,0,
53921,280,1,3,1,
53932,1,1,1397,22,
53941,116,1,2023,1398,
539517,1399,15,1259,1,
5396-1,1,5,1400,20,
53971401,4,26,83,0,
5398116,0,97,0,116,
53990,101,0,67,0,
5400104,0,97,0,110,
54010,103,0,101,0,
540295,0,50,0,1,
5403238,1,3,1,3,
54041,2,1402,22,1,
540574,1,2136,965,1,
540682,1403,17,1404,15,
54071405,4,32,37,0,
540885,0,110,0,97,
54090,114,0,121,0,
541069,0,120,0,112, 535769,0,120,0,112,
54110,114,0,101,0, 53580,114,0,101,0,
5412115,0,115,0,105, 5359115,0,115,0,105,
54130,111,0,110,0, 53600,111,0,110,0,
54141,-1,1,5,1406, 536195,0,57,0,1,
541520,1407,4,34,85, 5362332,1,3,1,7,
54160,110,0,97,0, 53631,6,1384,22,1,
5417114,0,121,0,69, 5364167,1,1013,1385,17,
53651386,15,1229,1,-1,
53661,5,1387,20,1388,
53674,46,80,0,97,
53680,114,0,101,0,
5369110,0,116,0,104,
53700,101,0,115,0,
5371105,0,115,0,69,
54180,120,0,112,0, 53720,120,0,112,0,
5419114,0,101,0,115, 5373114,0,101,0,115,
54200,115,0,105,0, 53740,115,0,105,0,
5421111,0,110,0,95, 5375111,0,110,0,95,
54220,51,0,1,320, 53760,49,0,1,322,
54231,3,1,3,1, 53771,3,1,4,1,
54242,1408,22,1,156, 53783,1389,22,1,157,
54251,2026,1409,17,1410, 53791,1332,1390,17,1391,
542615,1411,4,28,37, 538015,1223,1,-1,1,
54270,74,0,117,0, 53815,1392,20,1393,4,
5428109,0,112,0,83, 538238,83,0,105,0,
54290,116,0,97,0,
5430116,0,101,0,109,
54310,101,0,110,0,
5432116,0,1,-1,1,
54335,1412,20,1413,4,
543430,74,0,117,0,
5435109,0,112,0,83,
54360,116,0,97,0,
5437116,0,101,0,109,
54380,101,0,110,0,
5439116,0,95,0,49,
54400,1,236,1,3,
54411,3,1,2,1414,
544222,1,72,1,1591,
54431415,17,1416,15,1394,
54441,-1,1,5,1417,
544520,1418,4,34,82,
54460,101,0,116,0,
5447117,0,114,0,110,
54480,83,0,116,0,
544997,0,116,0,101,
54500,109,0,101,0,
5451110,0,116,0,95,
54520,49,0,1,279,
54531,3,1,3,1,
54542,1419,22,1,115,
54551,1341,1420,17,1421,
545615,1220,1,-1,1,
54575,1422,20,1423,4,
545836,83,0,105,0,
5459109,0,112,0,108, 5383109,0,112,0,108,
54600,101,0,65,0, 53840,101,0,65,0,
5461115,0,115,0,105, 5385115,0,115,0,105,
54620,103,0,110,0, 53860,103,0,110,0,
5463109,0,101,0,110, 5387109,0,101,0,110,
54640,116,0,95,0, 53880,116,0,95,0,
546554,0,1,260,1, 538949,0,57,0,1,
54663,1,4,1,3, 5390274,1,3,1,6,
54671424,22,1,96,1, 53911,5,1394,22,1,
54682030,853,1,328,1425, 5392109,1,2337,1395,17,
546917,1426,15,1243,1, 53931267,1,0,1271,1,
5470-1,1,5,1427,20, 53941585,1396,17,1397,15,
54711428,4,36,66,0, 53951398,4,32,37,0,
5472105,0,110,0,97, 539682,0,101,0,116,
54730,114,0,121,0, 53970,117,0,114,0,
547469,0,120,0,112, 5398110,0,83,0,116,
54750,114,0,101,0, 53990,97,0,116,0,
5476115,0,115,0,105, 5400101,0,109,0,101,
54770,111,0,110,0, 54010,110,0,116,0,
547895,0,50,0,1, 54021,-1,1,5,1399,
5479301,1,3,1,4, 540320,1400,4,34,82,
54801,3,1429,22,1, 54040,101,0,116,0,
5481137,1,1303,1430,17, 5405117,0,114,0,110,
54821431,15,1220,1,-1, 54060,83,0,116,0,
54831,5,1432,20,1433, 540797,0,116,0,101,
54844,36,83,0,105,
54850,109,0,112,0,
5486108,0,101,0,65,
54870,115,0,115,0,
5488105,0,103,0,110,
54890,109,0,101,0, 54080,109,0,101,0,
5490110,0,116,0,95, 5409110,0,116,0,95,
54910,55,0,1,261, 54100,50,0,1,281,
54921,3,1,6,1, 54111,3,1,2,1,
54935,1434,22,1,97, 54121,1401,22,1,116,
54941,2035,874,1,93, 54131,2023,1402,17,1403,
54951435,17,1436,15,1405, 541415,1262,1,-1,1,
54961,-1,1,5,1437, 54155,1404,20,1405,4,
549720,1438,4,34,85, 541626,83,0,116,0,
54980,110,0,97,0, 541797,0,116,0,101,
5499114,0,121,0,69, 54180,67,0,104,0,
55000,120,0,112,0, 541997,0,110,0,103,
5501114,0,101,0,115, 54200,101,0,95,0,
542150,0,1,239,1,
54223,1,3,1,2,
54231406,22,1,74,1,
54242136,968,1,82,1407,
542517,1408,15,1409,4,
542632,37,0,85,0,
5427110,0,97,0,114,
54280,121,0,69,0,
5429120,0,112,0,114,
54300,101,0,115,0,
5431115,0,105,0,111,
54320,110,0,1,-1,
54331,5,1410,20,1411,
54344,34,85,0,110,
54350,97,0,114,0,
5436121,0,69,0,120,
54370,112,0,114,0,
5438101,0,115,0,115,
54390,105,0,111,0,
5440110,0,95,0,51,
54410,1,321,1,3,
54421,3,1,2,1412,
544322,1,156,1,2026,
54441413,17,1414,15,1415,
54454,28,37,0,74,
54460,117,0,109,0,
5447112,0,83,0,116,
54480,97,0,116,0,
5449101,0,109,0,101,
54500,110,0,116,0,
54511,-1,1,5,1416,
545220,1417,4,30,74,
54530,117,0,109,0,
5454112,0,83,0,116,
54550,97,0,116,0,
5456101,0,109,0,101,
54570,110,0,116,0,
545895,0,49,0,1,
5459237,1,3,1,3,
54601,2,1418,22,1,
546172,1,1591,1419,17,
54621420,15,1398,1,-1,
54631,5,1421,20,1422,
54644,34,82,0,101,
54650,116,0,117,0,
5466114,0,110,0,83,
54670,116,0,97,0,
5468116,0,101,0,109,
54690,101,0,110,0,
5470116,0,95,0,49,
54710,1,280,1,3,
54721,3,1,2,1423,
547322,1,115,1,1341,
54741424,17,1425,15,1223,
54751,-1,1,5,1426,
547620,1427,4,36,83,
54770,105,0,109,0,
5478112,0,108,0,101,
54790,65,0,115,0,
5480115,0,105,0,103,
54810,110,0,109,0,
5482101,0,110,0,116,
54830,95,0,54,0,
54841,261,1,3,1,
54854,1,3,1428,22,
54861,96,1,2030,856,
54871,328,1429,17,1430,
548815,1246,1,-1,1,
54895,1431,20,1432,4,
549036,66,0,105,0,
5491110,0,97,0,114,
54920,121,0,69,0,
5493120,0,112,0,114,
54940,101,0,115,0,
5495115,0,105,0,111,
54960,110,0,95,0,
549750,0,1,302,1,
54983,1,4,1,3,
54991433,22,1,137,1,
55001303,1434,17,1435,15,
55011223,1,-1,1,5,
55021436,20,1437,4,36,
550383,0,105,0,109,
55040,112,0,108,0,
5505101,0,65,0,115,
55020,115,0,105,0, 55060,115,0,105,0,
5503111,0,110,0,95, 5507103,0,110,0,109,
55040,50,0,1,319, 55080,101,0,110,0,
55051,3,1,3,1, 5509116,0,95,0,55,
55062,1439,22,1,155, 55100,1,262,1,3,
55071,1550,1440,17,1441, 55111,6,1,5,1438,
550815,1220,1,-1,1, 551222,1,97,1,1096,
55095,1442,20,1443,4, 55131439,17,1440,15,1441,
551038,83,0,105,0, 55144,26,37,0,70,
5511109,0,112,0,108, 55150,117,0,110,0,
55120,101,0,65,0, 551699,0,116,0,105,
5513115,0,115,0,105, 55170,111,0,110,0,
55140,103,0,110,0, 551867,0,97,0,108,
5515109,0,101,0,110, 55190,108,0,1,-1,
55160,116,0,95,0, 55201,5,1442,20,1443,
551749,0,51,0,1, 55214,28,70,0,117,
5518267,1,3,1,4, 55220,110,0,99,0,
55191,3,1444,22,1, 5523116,0,105,0,111,
5520103,1,2040,1445,16, 55240,110,0,67,0,
55210,610,1,2106,1446, 552597,0,108,0,108,
552217,1264,1,0,1268, 55260,95,0,49,0,
55231,1555,1447,16,0, 55271,333,1,3,1,
5524707,1,827,1448,17, 55285,1,4,1444,22,
55251449,15,1243,1,-1, 55291,168,1,93,1445,
55261,5,1450,20,1451, 553017,1446,15,1409,1,
5531-1,1,5,1447,20,
55321448,4,34,85,0,
5533110,0,97,0,114,
55340,121,0,69,0,
5535120,0,112,0,114,
55360,101,0,115,0,
5537115,0,105,0,111,
55380,110,0,95,0,
553950,0,1,320,1,
55403,1,3,1,2,
55411449,22,1,155,1,
55421550,1450,17,1451,15,
55431223,1,-1,1,5,
55441452,20,1453,4,38,
554583,0,105,0,109,
55460,112,0,108,0,
5547101,0,65,0,115,
55480,115,0,105,0,
5549103,0,110,0,109,
55500,101,0,110,0,
5551116,0,95,0,49,
55520,51,0,1,268,
55531,3,1,4,1,
55543,1454,22,1,103,
55551,2039,887,1,2040,
55561455,16,0,618,1,
55572041,893,1,1555,1456,
555816,0,722,1,827,
55591457,17,1458,15,1246,
55601,-1,1,5,1459,
556120,1460,4,38,66,
55620,105,0,110,0,
556397,0,114,0,121,
55640,69,0,120,0,
5565112,0,114,0,101,
55660,115,0,115,0,
5567105,0,111,0,110,
55680,95,0,49,0,
556953,0,1,315,1,
55703,1,4,1,3,
55711461,22,1,150,1,
55721859,1462,16,0,344,
55731,1860,946,1,1804,
55741463,17,1267,1,0,
55751271,1,107,1464,17,
55761465,15,1409,1,-1,
55771,5,1466,20,1467,
55784,34,85,0,110,
55790,97,0,114,0,
5580121,0,69,0,120,
55810,112,0,114,0,
5582101,0,115,0,115,
55830,105,0,111,0,
5584110,0,95,0,49,
55850,1,319,1,3,
55861,3,1,2,1468,
558722,1,154,1,1114,
55881469,17,1312,1,3,
55891316,1,1048,1470,17,
55901471,15,1246,1,-1,
55911,5,1472,20,1473,
55274,38,66,0,105, 55924,38,66,0,105,
55280,110,0,97,0, 55930,110,0,97,0,
5529114,0,121,0,69, 5594114,0,121,0,69,
@@ -5531,31 +5596,27 @@ public yyLSLSyntax
5531114,0,101,0,115, 5596114,0,101,0,115,
55320,115,0,105,0, 55970,115,0,105,0,
5533111,0,110,0,95, 5598111,0,110,0,95,
55340,49,0,53,0, 55990,49,0,56,0,
55351,314,1,3,1, 56001,318,1,3,1,
55364,1,3,1452,22, 56014,1,3,1474,22,
55371,150,1,1859,1453, 56021,153,1,352,1475,
553816,0,339,1,1860, 560317,1476,15,1246,1,
5539943,1,1804,1454,17, 5604-1,1,5,1477,20,
55401264,1,0,1268,1, 56051478,4,36,66,0,
5541107,1455,17,1456,15, 5606105,0,110,0,97,
55421405,1,-1,1,5,
55431457,20,1458,4,34,
554485,0,110,0,97,
55450,114,0,121,0, 56070,114,0,121,0,
554669,0,120,0,112, 560869,0,120,0,112,
55470,114,0,101,0, 56090,114,0,101,0,
5548115,0,115,0,105, 5610115,0,115,0,105,
55490,111,0,110,0, 56110,111,0,110,0,
555095,0,49,0,1, 561295,0,49,0,1,
5551318,1,3,1,3, 5613301,1,3,1,4,
55521,2,1459,22,1, 56141,3,1479,22,1,
5553154,1,2781,1460,16, 5615136,1,1872,1480,16,
55540,278,1,1114,1461, 56160,354,1,1873,961,
555517,1308,1,3,1312, 56171,118,1481,17,1482,
55561,1048,1462,17,1463, 561815,1246,1,-1,1,
555715,1243,1,-1,1, 56195,1483,20,1484,4,
55585,1464,20,1465,4,
555938,66,0,105,0, 562038,66,0,105,0,
5560110,0,97,0,114, 5621110,0,97,0,114,
55610,121,0,69,0, 56220,121,0,69,0,
@@ -5563,126 +5624,63 @@ public yyLSLSyntax
55630,101,0,115,0, 56240,101,0,115,0,
5564115,0,105,0,111, 5625115,0,105,0,111,
55650,110,0,95,0, 56260,110,0,95,0,
556649,0,56,0,1, 562749,0,52,0,1,
5567317,1,3,1,4, 5628314,1,3,1,4,
55681,3,1466,22,1, 56291,3,1485,22,1,
5569153,1,352,1467,17, 5630149,1,1123,1486,17,
55701468,15,1243,1,-1, 56311487,15,1223,1,-1,
55711,5,1469,20,1470, 56321,5,1488,20,1489,
55724,36,66,0,105, 56334,38,83,0,105,
55730,110,0,97,0, 56340,109,0,112,0,
5574114,0,121,0,69, 5635108,0,101,0,65,
55750,120,0,112,0, 56360,115,0,115,0,
5576114,0,101,0,115, 5637105,0,103,0,110,
55770,115,0,105,0, 56380,109,0,101,0,
5578111,0,110,0,95, 5639110,0,116,0,95,
55790,49,0,1,300, 56400,49,0,50,0,
55801,3,1,4,1, 56411,267,1,3,1,
55813,1471,22,1,136, 56426,1,5,1490,22,
55821,1872,1472,16,0, 56431,102,1,371,1491,
5583349,1,1873,958,1, 564417,1492,15,1493,4,
5584118,1473,17,1474,15, 564546,37,0,70,0,
55851243,1,-1,1,5, 5646117,0,110,0,99,
55861475,20,1476,4,38, 56470,116,0,105,0,
558766,0,105,0,110, 5648111,0,110,0,67,
55880,97,0,114,0, 56490,97,0,108,0,
5589121,0,69,0,120, 5650108,0,69,0,120,
55900,112,0,114,0, 56510,112,0,114,0,
5591101,0,115,0,115, 5652101,0,115,0,115,
55920,105,0,111,0, 56530,105,0,111,0,
5593110,0,95,0,49, 5654110,0,1,-1,1,
55940,52,0,1,313, 56555,1494,20,1495,4,
55951,3,1,4,1, 565648,70,0,117,0,
55963,1477,22,1,149, 5657110,0,99,0,116,
55971,1123,1478,17,1479, 56580,105,0,111,0,
559815,1220,1,-1,1, 5659110,0,67,0,97,
55995,1480,20,1481,4, 56600,108,0,108,0,
560038,83,0,105,0, 566169,0,120,0,112,
5601109,0,112,0,108,
56020,101,0,65,0,
5603115,0,115,0,105,
56040,103,0,110,0,
5605109,0,101,0,110,
56060,116,0,95,0,
560749,0,50,0,1,
5608266,1,3,1,6,
56091,5,1482,22,1,
5610102,1,371,1483,17,
56111484,15,1485,4,46,
561237,0,70,0,117,
56130,110,0,99,0,
5614116,0,105,0,111,
56150,110,0,67,0,
561697,0,108,0,108,
56170,69,0,120,0,
5618112,0,114,0,101,
56190,115,0,115,0,
5620105,0,111,0,110,
56210,1,-1,1,5,
56221486,20,1487,4,48,
562370,0,117,0,110,
56240,99,0,116,0,
5625105,0,111,0,110,
56260,67,0,97,0,
5627108,0,108,0,69,
56280,120,0,112,0,
5629114,0,101,0,115,
56300,115,0,105,0,
5631111,0,110,0,95,
56320,49,0,1,299,
56331,3,1,2,1,
56341,1488,22,1,135,
56351,1377,1489,17,1490,
563615,1220,1,-1,1,
56375,1491,20,1492,4,
563836,83,0,105,0,
5639109,0,112,0,108,
56400,101,0,65,0,
5641115,0,115,0,105,
56420,103,0,110,0,
5643109,0,101,0,110,
56440,116,0,95,0,
564553,0,1,259,1,
56463,1,4,1,3,
56471493,22,1,95,1,
5648375,1494,17,1495,15,
56491315,1,-1,1,5,
56501496,20,1497,4,60,
565173,0,110,0,99,
56520,114,0,101,0, 56620,114,0,101,0,
5653109,0,101,0,110, 5663115,0,115,0,105,
56540,116,0,68,0, 56640,111,0,110,0,
5655101,0,99,0,114, 566595,0,49,0,1,
56560,101,0,109,0, 5666300,1,3,1,2,
5657101,0,110,0,116, 56671,1,1496,22,1,
56580,69,0,120,0, 5668135,1,1377,1497,17,
5659112,0,114,0,101, 56691498,15,1223,1,-1,
56701,5,1499,20,1500,
56714,36,83,0,105,
56720,109,0,112,0,
5673108,0,101,0,65,
56600,115,0,115,0, 56740,115,0,115,0,
5661105,0,111,0,110, 5675105,0,103,0,110,
56620,95,0,56,0,
56631,298,1,3,1,
56645,1,4,1498,22,
56651,134,1,377,1499,
566617,1500,15,1315,1,
5667-1,1,5,1501,20,
56681502,4,60,73,0,
5669110,0,99,0,114,
56700,101,0,109,0,
5671101,0,110,0,116,
56720,68,0,101,0,
567399,0,114,0,101,
56740,109,0,101,0, 56760,109,0,101,0,
5675110,0,116,0,69, 5677110,0,116,0,95,
56760,120,0,112,0, 56780,53,0,1,260,
5677114,0,101,0,115, 56791,3,1,4,1,
56780,115,0,105,0, 56803,1501,22,1,95,
5679111,0,110,0,95, 56811,375,1502,17,1503,
56800,53,0,1,295, 568215,1319,1,-1,1,
56811,3,1,3,1, 56835,1504,20,1505,4,
56822,1503,22,1,131,
56831,379,1504,17,1505,
568415,1315,1,-1,1,
56855,1506,20,1507,4,
568660,73,0,110,0, 568460,73,0,110,0,
568799,0,114,0,101, 568599,0,114,0,101,
56880,109,0,101,0, 56860,109,0,101,0,
@@ -5694,64 +5692,30 @@ public yyLSLSyntax
56940,112,0,114,0, 56920,112,0,114,0,
5695101,0,115,0,115, 5693101,0,115,0,115,
56960,105,0,111,0, 56940,105,0,111,0,
5697110,0,95,0,55, 5695110,0,95,0,56,
56980,1,297,1,3, 56960,1,299,1,3,
56991,5,1,4,1508, 56971,5,1,4,1506,
570022,1,133,1,380, 569822,1,134,1,377,
57011509,17,1510,15,1511, 56991507,17,1508,15,1319,
57024,38,37,0,67, 57001,-1,1,5,1509,
57030,111,0,110,0, 570120,1510,4,60,73,
5704115,0,116,0,97, 57020,110,0,99,0,
57050,110,0,116,0, 5703114,0,101,0,109,
570669,0,120,0,112, 57040,101,0,110,0,
57070,114,0,101,0, 5705116,0,68,0,101,
5708115,0,115,0,105, 57060,99,0,114,0,
57090,111,0,110,0, 5707101,0,109,0,101,
57101,-1,1,5,1512,
571120,1513,4,40,67,
57120,111,0,110,0,
5713115,0,116,0,97,
57140,110,0,116,0, 57080,110,0,116,0,
571569,0,120,0,112, 570969,0,120,0,112,
57160,114,0,101,0, 57100,114,0,101,0,
5717115,0,115,0,105, 5711115,0,115,0,105,
57180,111,0,110,0, 57120,111,0,110,0,
571995,0,49,0,1, 571395,0,53,0,1,
5720288,1,3,1,2, 5714296,1,3,1,3,
57211,1,1514,22,1, 57151,2,1511,22,1,
5722124,1,883,1515,17, 5716131,1,379,1512,17,
57231516,15,1243,1,-1, 57171513,15,1319,1,-1,
57241,5,1517,20,1518, 57181,5,1514,20,1515,
57254,38,66,0,105,
57260,110,0,97,0,
5727114,0,121,0,69,
57280,120,0,112,0,
5729114,0,101,0,115,
57300,115,0,105,0,
5731111,0,110,0,95,
57320,49,0,54,0,
57331,315,1,3,1,
57344,1,3,1519,22,
57351,151,1,1628,1520,
573617,1521,15,1522,4,
573722,37,0,65,0,
5738115,0,115,0,105,
57390,103,0,110,0,
5740109,0,101,0,110,
57410,116,0,1,-1,
57421,5,1523,20,1524,
57434,24,65,0,115,
57440,115,0,105,0,
5745103,0,110,0,109,
57460,101,0,110,0,
5747116,0,95,0,49,
57480,1,253,1,3,
57491,4,1,3,1525,
575022,1,89,1,2075,
57511526,17,1264,1,0,
57521268,1,373,1527,17,
57531528,15,1315,1,-1,
57541,5,1529,20,1530,
57554,60,73,0,110, 57194,60,73,0,110,
57560,99,0,114,0, 57200,99,0,114,0,
5757101,0,109,0,101, 5721101,0,109,0,101,
@@ -5764,25 +5728,81 @@ public yyLSLSyntax
57640,101,0,115,0, 57280,101,0,115,0,
5765115,0,105,0,111, 5729115,0,105,0,111,
57660,110,0,95,0, 57300,110,0,95,0,
576754,0,1,296,1, 573155,0,1,298,1,
57683,1,3,1,2, 57323,1,5,1,4,
57691531,22,1,132,1, 57331516,22,1,133,1,
5770130,1532,17,1533,15, 5734380,1517,17,1518,15,
57711243,1,-1,1,5, 57351519,4,38,37,0,
57721534,20,1535,4,38, 573667,0,111,0,110,
577366,0,105,0,110, 57370,115,0,116,0,
57740,97,0,114,0, 573897,0,110,0,116,
5775121,0,69,0,120, 57390,69,0,120,0,
57760,112,0,114,0, 5740112,0,114,0,101,
5777101,0,115,0,115, 57410,115,0,115,0,
57780,105,0,111,0, 5742105,0,111,0,110,
5779110,0,95,0,49, 57430,1,-1,1,5,
57800,51,0,1,312, 57441520,20,1521,4,40,
57811,3,1,4,1, 574567,0,111,0,110,
57823,1536,22,1,148, 57460,115,0,116,0,
57831,143,1537,17,1538, 574797,0,110,0,116,
578415,1243,1,-1,1, 57480,69,0,120,0,
57855,1539,20,1540,4, 5749112,0,114,0,101,
57500,115,0,115,0,
5751105,0,111,0,110,
57520,95,0,49,0,
57531,289,1,3,1,
57542,1,1,1522,22,
57551,124,1,883,1523,
575617,1524,15,1246,1,
5757-1,1,5,1525,20,
57581526,4,38,66,0,
5759105,0,110,0,97,
57600,114,0,121,0,
576169,0,120,0,112,
57620,114,0,101,0,
5763115,0,115,0,105,
57640,111,0,110,0,
576595,0,49,0,54,
57660,1,316,1,3,
57671,4,1,3,1527,
576822,1,151,1,1628,
57691528,17,1529,15,1530,
57704,22,37,0,65,
57710,115,0,115,0,
5772105,0,103,0,110,
57730,109,0,101,0,
5774110,0,116,0,1,
5775-1,1,5,1531,20,
57761532,4,24,65,0,
5777115,0,115,0,105,
57780,103,0,110,0,
5779109,0,101,0,110,
57800,116,0,95,0,
578149,0,1,254,1,
57823,1,4,1,3,
57831533,22,1,89,1,
57842075,1534,17,1267,1,
57850,1271,1,373,1535,
578617,1536,15,1319,1,
5787-1,1,5,1537,20,
57881538,4,60,73,0,
5789110,0,99,0,114,
57900,101,0,109,0,
5791101,0,110,0,116,
57920,68,0,101,0,
579399,0,114,0,101,
57940,109,0,101,0,
5795110,0,116,0,69,
57960,120,0,112,0,
5797114,0,101,0,115,
57980,115,0,105,0,
5799111,0,110,0,95,
58000,54,0,1,297,
58011,3,1,3,1,
58022,1539,22,1,132,
58031,130,1540,17,1541,
580415,1246,1,-1,1,
58055,1542,20,1543,4,
578638,66,0,105,0, 580638,66,0,105,0,
5787110,0,97,0,114, 5807110,0,97,0,114,
57880,121,0,69,0, 58080,121,0,69,0,
@@ -5790,43 +5810,27 @@ public yyLSLSyntax
57900,101,0,115,0, 58100,101,0,115,0,
5791115,0,105,0,111, 5811115,0,105,0,111,
57920,110,0,95,0, 58120,110,0,95,0,
579349,0,50,0,1, 581349,0,51,0,1,
5794311,1,3,1,4, 5814313,1,3,1,4,
57951,3,1541,22,1, 58151,3,1544,22,1,
5796147,1,1901,1542,17, 5816148,1,143,1545,17,
57971264,1,0,1268,1, 58171546,15,1246,1,-1,
57981152,1543,17,1544,15, 58181,5,1547,20,1548,
57991220,1,-1,1,5, 58194,38,66,0,105,
58001545,20,1546,4,38, 58200,110,0,97,0,
580183,0,105,0,109, 5821114,0,121,0,69,
58020,112,0,108,0, 58220,120,0,112,0,
5803101,0,65,0,115, 5823114,0,101,0,115,
58040,115,0,105,0, 58240,115,0,105,0,
5805103,0,110,0,109, 5825111,0,110,0,95,
58060,101,0,110,0, 58260,49,0,50,0,
5807116,0,95,0,50, 58271,312,1,3,1,
58080,52,0,1,278, 58284,1,3,1549,22,
58091,3,1,6,1, 58291,147,1,1901,1550,
58105,1547,22,1,114, 583017,1267,1,0,1271,
58111,1406,1548,17,1549, 58311,1152,1551,17,1552,
581215,1220,1,-1,1, 583215,1223,1,-1,1,
58135,1550,20,1551,4, 58335,1553,20,1554,4,
581438,83,0,105,0,
5815109,0,112,0,108,
58160,101,0,65,0,
5817115,0,115,0,105,
58180,103,0,110,0,
5819109,0,101,0,110,
58200,116,0,95,0,
582149,0,55,0,1,
5822271,1,3,1,4,
58231,3,1552,22,1,
5824107,1,1659,1553,16,
58250,297,1,2413,1554,
582617,1264,1,0,1268,
58271,1159,1555,17,1556,
582815,1220,1,-1,1,
58295,1557,20,1558,4,
583038,83,0,105,0, 583438,83,0,105,0,
5831109,0,112,0,108, 5835109,0,112,0,108,
58320,101,0,65,0, 58360,101,0,65,0,
@@ -5834,38 +5838,12 @@ public yyLSLSyntax
58340,103,0,110,0, 58380,103,0,110,0,
5835109,0,101,0,110, 5839109,0,101,0,110,
58360,116,0,95,0, 58400,116,0,95,0,
583749,0,49,0,1, 584150,0,52,0,1,
5838265,1,3,1,6, 5842279,1,3,1,6,
58391,5,1559,22,1, 58431,5,1555,22,1,
5840101,1,157,1560,17, 5844114,1,1406,1556,17,
58411561,15,1243,1,-1, 58451557,15,1223,1,-1,
58421,5,1562,20,1563, 58461,5,1558,20,1559,
58434,38,66,0,105,
58440,110,0,97,0,
5845114,0,121,0,69,
58460,120,0,112,0,
5847114,0,101,0,115,
58480,115,0,105,0,
5849111,0,110,0,95,
58500,49,0,49,0,
58511,310,1,3,1,
58524,1,3,1564,22,
58531,146,1,1413,1565,
585417,1566,15,1220,1,
5855-1,1,5,1567,20,
58561568,4,36,83,0,
5857105,0,109,0,112,
58580,108,0,101,0,
585965,0,115,0,115,
58600,105,0,103,0,
5861110,0,109,0,101,
58620,110,0,116,0,
586395,0,52,0,1,
5864258,1,3,1,4,
58651,3,1569,22,1,
586694,1,1370,1570,17,
58671571,15,1220,1,-1,
58681,5,1572,20,1573,
58694,38,83,0,105, 58474,38,83,0,105,
58700,109,0,112,0, 58480,109,0,112,0,
5871108,0,101,0,65, 5849108,0,101,0,65,
@@ -5873,79 +5851,165 @@ public yyLSLSyntax
5873105,0,103,0,110, 5851105,0,103,0,110,
58740,109,0,101,0, 58520,109,0,101,0,
5875110,0,116,0,95, 5853110,0,116,0,95,
58760,49,0,56,0, 58540,49,0,55,0,
58771,272,1,3,1, 58551,272,1,3,1,
58784,1,3,1574,22, 58564,1,3,1560,22,
58791,108,1,1478,1575, 58571,107,1,1659,1561,
588017,1576,15,1220,1, 585816,0,298,1,2413,
5881-1,1,5,1577,20, 58591562,17,1267,1,0,
58821578,4,38,83,0, 58601271,1,1159,1563,17,
58611564,15,1223,1,-1,
58621,5,1565,20,1566,
58634,38,83,0,105,
58640,109,0,112,0,
5865108,0,101,0,65,
58660,115,0,115,0,
5867105,0,103,0,110,
58680,109,0,101,0,
5869110,0,116,0,95,
58700,49,0,49,0,
58711,266,1,3,1,
58726,1,5,1567,22,
58731,101,1,157,1568,
587417,1569,15,1246,1,
5875-1,1,5,1570,20,
58761571,4,38,66,0,
5877105,0,110,0,97,
58780,114,0,121,0,
587969,0,120,0,112,
58800,114,0,101,0,
5881115,0,115,0,105,
58820,111,0,110,0,
588395,0,49,0,49,
58840,1,311,1,3,
58851,4,1,3,1572,
588622,1,146,1,1413,
58871573,17,1574,15,1223,
58881,-1,1,5,1575,
588920,1576,4,36,83,
58900,105,0,109,0,
5891112,0,108,0,101,
58920,65,0,115,0,
5893115,0,105,0,103,
58940,110,0,109,0,
5895101,0,110,0,116,
58960,95,0,52,0,
58971,259,1,3,1,
58984,1,3,1577,22,
58991,94,1,1370,1578,
590017,1579,15,1223,1,
5901-1,1,5,1580,20,
59021581,4,38,83,0,
5883105,0,109,0,112, 5903105,0,109,0,112,
58840,108,0,101,0, 59040,108,0,101,0,
588565,0,115,0,115, 590565,0,115,0,115,
58860,105,0,103,0, 59060,105,0,103,0,
5887110,0,109,0,101, 5907110,0,109,0,101,
58880,110,0,116,0, 59080,110,0,116,0,
588995,0,49,0,53, 590995,0,49,0,56,
58900,1,269,1,3, 59100,1,273,1,3,
58911,4,1,3,1579, 59111,4,1,3,1582,
589222,1,105,1,1620, 591222,1,108,1,1478,
58931580,17,1581,15,1522, 59131583,17,1584,15,1223,
58941,-1,1,5,1582, 59141,-1,1,5,1585,
589520,1583,4,24,65, 591520,1586,4,38,83,
58960,115,0,115,0, 59160,105,0,109,0,
5897105,0,103,0,110, 5917112,0,108,0,101,
58980,109,0,101,0, 59180,65,0,115,0,
5899110,0,116,0,95, 5919115,0,105,0,103,
59000,50,0,1,254, 59200,110,0,109,0,
59011,3,1,2,1,
59021,1584,22,1,90,
59031,1621,1585,16,0,
5904786,1,1574,921,1,
5905172,1586,17,1587,15,
59061243,1,-1,1,5,
59071588,20,1589,4,38,
590866,0,105,0,110,
59090,97,0,114,0,
5910121,0,69,0,120,
59110,112,0,114,0,
5912101,0,115,0,115,
59130,105,0,111,0,
5914110,0,95,0,49,
59150,48,0,1,309,
59161,3,1,4,1,
59173,1590,22,1,145,
59181,1931,983,1,1665,
59191591,17,1592,15,1278,
59201,-1,1,5,1593,
592120,1594,4,36,70,
59220,111,0,114,0,
592376,0,111,0,111,
59240,112,0,83,0,
5925116,0,97,0,116,
59260,101,0,109,0,
5927101,0,110,0,116, 5921101,0,110,0,116,
59280,95,0,49,0, 59220,95,0,49,0,
59291,249,1,3,1, 592353,0,1,270,1,
59302,1,1,1595,22, 59243,1,4,1,3,
59311,85,1,2364,949, 59251587,22,1,105,1,
59321,2105,936,1,1188, 59262106,1588,17,1267,1,
59331596,17,1597,15,1220, 59270,1271,1,1620,1589,
59341,-1,1,5,1598, 592817,1590,15,1530,1,
593520,1599,4,38,83, 5929-1,1,5,1591,20,
59301592,4,24,65,0,
5931115,0,115,0,105,
59320,103,0,110,0,
5933109,0,101,0,110,
59340,116,0,95,0,
593550,0,1,255,1,
59363,1,2,1,1,
59371593,22,1,90,1,
59381621,1594,16,0,791,
59391,1574,924,1,172,
59401595,17,1596,15,1246,
59411,-1,1,5,1597,
594220,1598,4,38,66,
59430,105,0,110,0,
594497,0,114,0,121,
59450,69,0,120,0,
5946112,0,114,0,101,
59470,115,0,115,0,
5948105,0,111,0,110,
59490,95,0,49,0,
595048,0,1,310,1,
59513,1,4,1,3,
59521599,22,1,145,1,
59531931,986,1,1665,1600,
595417,1601,15,1281,1,
5955-1,1,5,1602,20,
59561603,4,36,70,0,
5957111,0,114,0,76,
59580,111,0,111,0,
5959112,0,83,0,116,
59600,97,0,116,0,
5961101,0,109,0,101,
59620,110,0,116,0,
596395,0,49,0,1,
5964250,1,3,1,2,
59651,1,1604,22,1,
596685,1,2364,952,1,
59672105,939,1,1188,1605,
596817,1606,15,1223,1,
5969-1,1,5,1607,20,
59701608,4,38,83,0,
5971105,0,109,0,112,
59720,108,0,101,0,
597365,0,115,0,115,
59740,105,0,103,0,
5975110,0,109,0,101,
59760,110,0,116,0,
597795,0,50,0,51,
59780,1,278,1,3,
59791,6,1,5,1609,
598022,1,113,1,1442,
59811610,17,1611,15,1223,
59821,-1,1,5,1612,
598320,1613,4,38,83,
59360,105,0,109,0, 59840,105,0,109,0,
5937112,0,108,0,101, 5985112,0,108,0,101,
59380,65,0,115,0, 59860,65,0,115,0,
5939115,0,105,0,103, 5987115,0,105,0,103,
59400,110,0,109,0, 59880,110,0,109,0,
5941101,0,110,0,116, 5989101,0,110,0,116,
59420,95,0,50,0, 59900,95,0,49,0,
594351,0,1,277,1, 599154,0,1,271,1,
59443,1,6,1,5, 59923,1,4,1,3,
59451600,22,1,113,1, 59931614,22,1,106,1,
59461442,1601,17,1602,15, 59941694,1615,16,0,215,
59471220,1,-1,1,5, 59951,942,1616,17,1617,
59481603,20,1604,4,38, 599615,1246,1,-1,1,
59975,1618,20,1619,4,
599838,66,0,105,0,
5999110,0,97,0,114,
60000,121,0,69,0,
6001120,0,112,0,114,
60020,101,0,115,0,
6003115,0,105,0,111,
60040,110,0,95,0,
600549,0,55,0,1,
6006317,1,3,1,4,
60071,3,1620,22,1,
6008152,1,2198,1621,17,
60091267,1,0,1271,1,
60101195,1622,17,1623,15,
60111223,1,-1,1,5,
60121624,20,1625,4,38,
594983,0,105,0,109, 601383,0,105,0,109,
59500,112,0,108,0, 60140,112,0,108,0,
5951101,0,65,0,115, 6015101,0,65,0,115,
@@ -5953,88 +6017,100 @@ public yyLSLSyntax
5953103,0,110,0,109, 6017103,0,110,0,109,
59540,101,0,110,0, 60180,101,0,110,0,
5955116,0,95,0,49, 6019116,0,95,0,49,
59560,54,0,1,270, 60200,48,0,1,265,
59571,3,1,4,1, 60211,3,1,6,1,
59583,1605,22,1,106, 60225,1626,22,1,100,
59591,1694,1606,16,0, 60231,1449,1627,17,1628,
5960218,1,942,1607,17, 602415,1223,1,-1,1,
59611608,15,1243,1,-1, 60255,1629,20,1630,4,
59621,5,1609,20,1610, 602636,83,0,105,0,
59634,38,66,0,105,
59640,110,0,97,0,
5965114,0,121,0,69,
59660,120,0,112,0,
5967114,0,101,0,115,
59680,115,0,105,0,
5969111,0,110,0,95,
59700,49,0,55,0,
59711,316,1,3,1,
59724,1,3,1611,22,
59731,152,1,2198,1612,
597417,1264,1,0,1268,
59751,1195,1613,17,1614,
597615,1220,1,-1,1,
59775,1615,20,1616,4,
597838,83,0,105,0,
5979109,0,112,0,108, 6027109,0,112,0,108,
59800,101,0,65,0, 60280,101,0,65,0,
5981115,0,115,0,105, 6029115,0,115,0,105,
59820,103,0,110,0, 60300,103,0,110,0,
5983109,0,101,0,110, 6031109,0,101,0,110,
59840,116,0,95,0, 60320,116,0,95,0,
598549,0,48,0,1, 603351,0,1,258,1,
5986264,1,3,1,6,
59871,5,1617,22,1,
5988100,1,1449,1618,17,
59891619,15,1220,1,-1,
59901,5,1620,20,1621,
59914,36,83,0,105,
59920,109,0,112,0,
5993108,0,101,0,65,
59940,115,0,115,0,
5995105,0,103,0,110,
59960,109,0,101,0,
5997110,0,116,0,95,
59980,51,0,1,257,
59991,3,1,4,1,
60003,1622,22,1,93,
60011,1701,1623,17,1624,
600215,1278,1,-1,1,
60035,1625,20,1626,4,
600436,70,0,111,0,
6005114,0,76,0,111,
60060,111,0,112,0,
600783,0,116,0,97,
60080,116,0,101,0,
6009109,0,101,0,110,
60100,116,0,95,0,
601151,0,1,251,1,
60123,1,4,1,3, 60343,1,4,1,3,
60131627,22,1,87,1, 60351631,22,1,93,1,
6014447,1628,17,1629,15, 60361701,1632,17,1633,15,
60151630,4,30,37,0, 60371281,1,-1,1,5,
601686,0,101,0,99, 60381634,20,1635,4,36,
60170,116,0,111,0, 603970,0,111,0,114,
6018114,0,67,0,111, 60400,76,0,111,0,
60190,110,0,115,0, 6041111,0,112,0,83,
6020116,0,97,0,110, 60420,116,0,97,0,
60210,116,0,1,-1, 6043116,0,101,0,109,
60221,5,1631,20,1632, 60440,101,0,110,0,
60234,32,86,0,101, 6045116,0,95,0,51,
60240,99,0,116,0, 60460,1,252,1,3,
6025111,0,114,0,67, 60471,4,1,3,1636,
604822,1,87,1,447,
60491637,17,1638,15,1639,
60504,30,37,0,86,
60510,101,0,99,0,
6052116,0,111,0,114,
60530,67,0,111,0,
6054110,0,115,0,116,
60550,97,0,110,0,
6056116,0,1,-1,1,
60575,1640,20,1641,4,
605832,86,0,101,0,
605999,0,116,0,111,
60600,114,0,67,0,
6061111,0,110,0,115,
60620,116,0,97,0,
6063110,0,116,0,95,
60640,49,0,1,287,
60651,3,1,8,1,
60667,1642,22,1,122,
60671,2458,1001,1,2459,
60681007,1,1958,1643,17,
60691267,1,0,1271,1,
6070188,1644,17,1645,15,
60711246,1,-1,1,5,
60721646,20,1647,4,36,
607366,0,105,0,110,
60740,97,0,114,0,
6075121,0,69,0,120,
60760,112,0,114,0,
6077101,0,115,0,115,
60780,105,0,111,0,
6079110,0,95,0,57,
60800,1,309,1,3,
60811,4,1,3,1648,
608222,1,144,1,2462,
60831014,1,1657,1019,1,
60842464,1024,1,205,1649,
608517,1650,15,1246,1,
6086-1,1,5,1651,20,
60871652,4,36,66,0,
6088105,0,110,0,97,
60890,114,0,121,0,
609069,0,120,0,112,
60910,114,0,101,0,
6092115,0,115,0,105,
60260,111,0,110,0, 60930,111,0,110,0,
6027115,0,116,0,97, 609495,0,56,0,1,
60280,110,0,116,0, 6095308,1,3,1,4,
602995,0,49,0,1, 60961,3,1653,22,1,
6030286,1,3,1,8, 6097143,1,2227,1033,1,
60311,7,1633,22,1, 60981224,1654,17,1655,15,
6032122,1,2458,998,1, 60991223,1,-1,1,5,
60332459,1004,1,1958,1634, 61001656,20,1657,4,38,
603417,1264,1,0,1268, 610183,0,105,0,109,
60351,188,1635,17,1636, 61020,112,0,108,0,
603615,1243,1,-1,1, 6103101,0,65,0,115,
60375,1637,20,1638,4, 61040,115,0,105,0,
6105103,0,110,0,109,
61060,101,0,110,0,
6107116,0,95,0,50,
61080,50,0,1,277,
61091,3,1,6,1,
61105,1658,22,1,112,
61111,223,1659,17,1660,
611215,1246,1,-1,1,
61135,1661,20,1662,4,
603836,66,0,105,0, 611436,66,0,105,0,
6039110,0,97,0,114, 6115110,0,97,0,114,
60400,121,0,69,0, 61160,121,0,69,0,
@@ -6042,89 +6118,87 @@ public yyLSLSyntax
60420,101,0,115,0, 61180,101,0,115,0,
6043115,0,105,0,111, 6119115,0,105,0,111,
60440,110,0,95,0, 61200,110,0,95,0,
604557,0,1,308,1, 612155,0,1,307,1,
60463,1,4,1,3, 61223,1,4,1,3,
60471639,22,1,144,1, 61231663,22,1,142,1,
60482462,1011,1,1657,1016, 61241730,1664,17,1665,15,
60491,2464,1021,1,205, 61251281,1,-1,1,5,
60501640,17,1641,15,1243, 61261666,20,1667,4,36,
60511,-1,1,5,1642, 612770,0,111,0,114,
605220,1643,4,36,66, 61280,76,0,111,0,
60530,105,0,110,0, 6129111,0,112,0,83,
605497,0,114,0,121, 61300,116,0,97,0,
60550,69,0,120,0, 6131116,0,101,0,109,
6056112,0,114,0,101, 61320,101,0,110,0,
60570,115,0,115,0, 6133116,0,95,0,52,
6058105,0,111,0,110, 61340,1,253,1,3,
60590,95,0,56,0, 61351,4,1,3,1668,
60601,307,1,3,1, 613622,1,88,1,476,
60614,1,3,1644,22, 61371669,17,1670,15,1671,
60621,143,1,2227,1030, 61384,18,37,0,67,
60631,1224,1645,17,1646, 61390,111,0,110,0,
606415,1220,1,-1,1, 6140115,0,116,0,97,
60655,1647,20,1648,4, 61410,110,0,116,0,
606638,83,0,105,0, 61421,-1,1,5,1672,
6067109,0,112,0,108, 614320,1673,4,20,67,
60680,101,0,65,0, 61440,111,0,110,0,
6069115,0,115,0,105, 6145115,0,116,0,97,
60700,103,0,110,0, 61460,110,0,116,0,
6071109,0,101,0,110, 614795,0,52,0,1,
6148285,1,3,1,2,
61491,1,1674,22,1,
6150120,1,477,1675,17,
61511676,15,1671,1,-1,
61521,5,1677,20,1678,
61534,20,67,0,111,
61540,110,0,115,0,
6155116,0,97,0,110,
60720,116,0,95,0, 61560,116,0,95,0,
607350,0,50,0,1, 615751,0,1,284,1,
6074276,1,3,1,6, 61583,1,2,1,1,
60751,5,1649,22,1, 61591679,22,1,119,1,
6076112,1,223,1650,17, 61601231,1680,17,1681,15,
60771651,15,1243,1,-1, 61611223,1,-1,1,5,
60781,5,1652,20,1653, 61621682,20,1683,4,36,
60794,36,66,0,105, 616383,0,105,0,109,
60800,110,0,97,0, 61640,112,0,108,0,
6081114,0,121,0,69, 6165101,0,65,0,115,
60820,120,0,112,0,
6083114,0,101,0,115,
60840,115,0,105,0, 61660,115,0,105,0,
6085111,0,110,0,95, 6167103,0,110,0,109,
60860,55,0,1,306, 61680,101,0,110,0,
60871,3,1,4,1, 6169116,0,95,0,57,
60883,1654,22,1,142, 61700,1,264,1,3,
60891,1730,1655,17,1656, 61711,6,1,5,1684,
609015,1278,1,-1,1, 617222,1,99,1,479,
60915,1657,20,1658,4, 61731685,17,1686,15,1671,
609236,70,0,111,0, 61741,-1,1,5,1687,
6093114,0,76,0,111, 617520,1688,4,20,67,
60940,111,0,112,0, 61760,111,0,110,0,
609583,0,116,0,97, 6177115,0,116,0,97,
60960,116,0,101,0, 61780,110,0,116,0,
6097109,0,101,0,110, 617995,0,49,0,1,
60980,116,0,95,0, 6180282,1,3,1,2,
609952,0,1,252,1, 61811,1,1689,22,1,
61003,1,4,1,3, 6182117,1,480,1690,17,
61011659,22,1,88,1, 61831691,15,1692,4,26,
6102476,1660,17,1661,15, 618437,0,76,0,105,
61031662,4,18,37,0,
610467,0,111,0,110,
61050,115,0,116,0, 61850,115,0,116,0,
610697,0,110,0,116,
61070,1,-1,1,5,
61081663,20,1664,4,20,
610967,0,111,0,110, 618667,0,111,0,110,
61100,115,0,116,0, 61870,115,0,116,0,
611197,0,110,0,116, 618897,0,110,0,116,
61120,95,0,52,0, 61890,1,-1,1,5,
61131,284,1,3,1, 61901693,20,1694,4,28,
61142,1,1,1665,22, 619176,0,105,0,115,
61151,120,1,477,1666, 61920,116,0,67,0,
611617,1667,15,1662,1,
6117-1,1,5,1668,20,
61181669,4,20,67,0,
6119111,0,110,0,115, 6193111,0,110,0,115,
61200,116,0,97,0, 61940,116,0,97,0,
6121110,0,116,0,95, 6195110,0,116,0,95,
61220,51,0,1,283, 61960,49,0,1,286,
61231,3,1,2,1, 61971,3,1,4,1,
61241,1670,22,1,119, 61983,1695,22,1,121,
61251,1231,1671,17,1672, 61991,1485,1696,17,1697,
612615,1220,1,-1,1, 620015,1223,1,-1,1,
61275,1673,20,1674,4, 62015,1698,20,1699,4,
612836,83,0,105,0, 620236,83,0,105,0,
6129109,0,112,0,108, 6203109,0,112,0,108,
61300,101,0,65,0, 62040,101,0,65,0,
@@ -6132,71 +6206,15 @@ public yyLSLSyntax
61320,103,0,110,0, 62060,103,0,110,0,
6133109,0,101,0,110, 6207109,0,101,0,110,
61340,116,0,95,0, 62080,116,0,95,0,
613557,0,1,263,1, 620950,0,1,257,1,
61363,1,6,1,5, 62103,1,4,1,3,
61371675,22,1,99,1, 62111700,22,1,92,1,
6138479,1676,17,1677,15, 62121737,1701,16,0,303,
61391662,1,-1,1,5, 62131,1989,1041,1,1990,
61401678,20,1679,4,20, 62141702,17,1267,1,0,
614167,0,111,0,110, 62151271,1,242,1703,17,
61420,115,0,116,0, 62161704,15,1246,1,-1,
614397,0,110,0,116, 62171,5,1705,20,1706,
61440,95,0,49,0,
61451,281,1,3,1,
61462,1,1,1680,22,
61471,117,1,480,1681,
614817,1682,15,1683,4,
614926,37,0,76,0,
6150105,0,115,0,116,
61510,67,0,111,0,
6152110,0,115,0,116,
61530,97,0,110,0,
6154116,0,1,-1,1,
61555,1684,20,1685,4,
615628,76,0,105,0,
6157115,0,116,0,67,
61580,111,0,110,0,
6159115,0,116,0,97,
61600,110,0,116,0,
616195,0,49,0,1,
6162285,1,3,1,4,
61631,3,1686,22,1,
6164121,1,1485,1687,17,
61651688,15,1220,1,-1,
61661,5,1689,20,1690,
61674,36,83,0,105,
61680,109,0,112,0,
6169108,0,101,0,65,
61700,115,0,115,0,
6171105,0,103,0,110,
61720,109,0,101,0,
6173110,0,116,0,95,
61740,50,0,1,256,
61751,3,1,4,1,
61763,1691,22,1,92,
61771,1737,1692,16,0,
6178299,1,1989,1038,1,
61791990,1693,17,1264,1,
61800,1268,1,1096,1694,
618117,1695,15,1696,4,
618226,37,0,70,0,
6183117,0,110,0,99,
61840,116,0,105,0,
6185111,0,110,0,67,
61860,97,0,108,0,
6187108,0,1,-1,1,
61885,1697,20,1698,4,
618928,70,0,117,0,
6190110,0,99,0,116,
61910,105,0,111,0,
6192110,0,67,0,97,
61930,108,0,108,0,
619495,0,49,0,1,
6195332,1,3,1,5,
61961,4,1699,22,1,
6197168,1,242,1700,17,
61981701,15,1243,1,-1,
61991,5,1702,20,1703,
62004,36,66,0,105, 62184,36,66,0,105,
62010,110,0,97,0, 62190,110,0,97,0,
6202114,0,121,0,69, 6220114,0,121,0,69,
@@ -6204,22 +6222,22 @@ public yyLSLSyntax
6204114,0,101,0,115, 6222114,0,101,0,115,
62050,115,0,105,0, 62230,115,0,105,0,
6206111,0,110,0,95, 6224111,0,110,0,95,
62070,54,0,1,305, 62250,54,0,1,306,
62081,3,1,4,1, 62261,3,1,4,1,
62093,1704,22,1,141, 62273,1707,22,1,141,
62101,478,1705,17,1706, 62281,478,1708,17,1709,
621115,1662,1,-1,1, 622915,1671,1,-1,1,
62125,1707,20,1708,4, 62305,1710,20,1711,4,
621320,67,0,111,0, 623120,67,0,111,0,
6214110,0,115,0,116, 6232110,0,115,0,116,
62150,97,0,110,0, 62330,97,0,110,0,
6216116,0,95,0,50, 6234116,0,95,0,50,
62170,1,282,1,3, 62350,1,283,1,3,
62181,2,1,1,1709, 62361,2,1,1,1712,
621922,1,118,1,1001, 623722,1,118,1,1001,
62201710,17,1711,15,1347, 62381713,17,1714,15,1351,
62211,-1,1,5,1712, 62391,-1,1,5,1715,
622220,1713,4,40,84, 624020,1716,4,40,84,
62230,121,0,112,0, 62410,121,0,112,0,
6224101,0,99,0,97, 6242101,0,99,0,97,
62250,115,0,116,0, 62430,115,0,116,0,
@@ -6228,11 +6246,11 @@ public yyLSLSyntax
6228115,0,115,0,105, 6246115,0,115,0,105,
62290,111,0,110,0, 62470,111,0,110,0,
623095,0,56,0,1, 624895,0,56,0,1,
6231330,1,3,1,5, 6249331,1,3,1,5,
62321,4,1714,22,1, 62501,4,1717,22,1,
6233166,1,1002,1715,17, 6251166,1,1002,1718,17,
62341716,15,1347,1,-1, 62521719,15,1351,1,-1,
62351,5,1717,20,1718, 62531,5,1720,20,1721,
62364,40,84,0,121, 62544,40,84,0,121,
62370,112,0,101,0, 62550,112,0,101,0,
623899,0,97,0,115, 625699,0,97,0,115,
@@ -6241,153 +6259,58 @@ public yyLSLSyntax
62410,101,0,115,0, 62590,101,0,115,0,
6242115,0,105,0,111, 6260115,0,105,0,111,
62430,110,0,95,0, 62610,110,0,95,0,
624449,0,1,323,1, 626249,0,1,324,1,
62453,1,5,1,4, 62633,1,5,1,4,
62461719,22,1,159,1, 62641722,22,1,159,1,
624712,1720,19,166,1, 626512,1723,19,166,1,
624812,1721,5,50,1, 626612,1724,5,50,1,
62491901,1722,16,0,164, 62671901,1725,16,0,164,
62501,2075,1723,16,0, 62681,2075,1726,16,0,
6251164,1,1860,943,1, 6269164,1,1860,946,1,
62521803,909,1,1804,1724, 62701803,912,1,1804,1727,
625316,0,164,1,2518, 627116,0,164,1,2519,
62541725,16,0,164,1, 62721728,16,0,164,1,
62552413,1726,16,0,164, 62732549,1729,16,0,164,
62561,2198,1727,16,0, 62741,2413,1730,16,0,
6257164,1,1873,958,1, 6275164,1,2198,1731,16,
62581657,1016,1,2136,965, 62760,164,1,1873,961,
62591,2032,863,1,1989, 62771,1657,1019,1,2534,
62601038,1,1990,1728,16, 62781732,16,0,164,1,
62610,164,1,31,1729, 62791990,1733,16,0,164,
626216,0,164,1,32, 62801,31,1734,16,0,
62631730,16,0,164,1, 6281164,1,32,1735,16,
62642105,936,1,2106,1731, 62820,164,1,2105,939,
626516,0,164,1,2656, 62831,2106,1736,16,0,
62661732,16,0,282,1, 6284164,1,2573,1737,16,
62672548,1733,16,0,164, 62850,164,1,2658,1738,
62681,2227,1030,1,2337, 628616,0,284,1,2578,
62691734,16,0,164,1, 62871739,16,0,164,1,
62702556,1735,16,0,164, 62882227,1033,1,2337,1740,
62711,2777,1736,16,0, 628916,0,164,1,2557,
6272164,1,2564,1737,16, 62901741,16,0,164,1,
62730,164,1,2021,840, 62912781,1742,16,0,164,
62741,2458,998,1,2459, 62921,2565,1743,16,0,
62751004,1,2462,1011,1, 6293164,1,2021,843,1,
62762572,1738,16,0,164, 62942458,1001,1,2459,1007,
62771,2464,1021,1,2029, 62951,2462,1014,1,2136,
6278847,1,2030,853,1, 6296968,1,2464,1024,1,
62792031,858,1,2577,1739, 62972029,850,1,2030,856,
628016,0,164,1,2469, 62981,2031,861,1,2032,
62811740,16,0,520,1, 6299866,1,2469,1744,16,
62822035,874,1,2364,949, 63000,536,1,2035,877,
62831,2039,884,1,1931, 63011,2364,952,1,2039,
6284983,1,2041,890,1, 6302887,1,1931,986,1,
62852043,896,1,2045,901, 63032041,893,1,2043,899,
62861,2592,1741,16,0, 63041,2045,904,1,2593,
6287164,1,1775,1742,16, 63051745,16,0,164,1,
62880,164,1,2033,868, 63061775,1746,16,0,164,
62891,2037,879,1,1574, 63071,1989,1041,1,2033,
6290921,1,1958,1743,16, 6308871,1,2037,882,1,
62910,164,1,2533,1744, 63091574,924,1,1958,1747,
629216,0,164,1,13, 631016,0,164,1,13,
62931745,19,508,1,13, 63111748,19,213,1,13,
62941746,5,55,1,2643, 63121749,5,55,1,2536,
62951747,17,1748,15,1749, 63131750,17,1751,15,1752,
62964,20,37,0,83,
62970,116,0,97,0,
6298116,0,101,0,66,
62990,111,0,100,0,
6300121,0,1,-1,1,
63015,1750,20,1751,4,
630222,83,0,116,0,
630397,0,116,0,101,
63040,66,0,111,0,
6305100,0,121,0,95,
63060,56,0,1,187,
63071,3,1,3,1,
63082,1752,22,1,22,
63091,2644,1753,17,1754,
631015,1749,1,-1,1,
63115,1755,20,1756,4,
631222,83,0,116,0,
631397,0,116,0,101,
63140,66,0,111,0,
6315100,0,121,0,95,
63160,54,0,1,185,
63171,3,1,3,1,
63182,1757,22,1,20,
63191,1860,943,1,1803,
6320909,1,2520,1758,17,
63211759,15,1760,4,46,
632237,0,75,0,101,
63230,121,0,73,0,
6324110,0,116,0,73,
63250,110,0,116,0,
632665,0,114,0,103,
63270,83,0,116,0,
632897,0,116,0,101,
63290,69,0,118,0,
6330101,0,110,0,116,
63310,1,-1,1,5,
63321761,20,1762,4,48,
633375,0,101,0,121,
63340,73,0,110,0,
6335116,0,73,0,110,
63360,116,0,65,0,
6337114,0,103,0,83,
63380,116,0,97,0,
6339116,0,101,0,69,
63400,118,0,101,0,
6341110,0,116,0,95,
63420,49,0,1,203,
63431,3,1,6,1,
63445,1763,22,1,38,
63451,2413,1764,16,0,
6346506,1,1873,958,1,
63471657,1016,1,2639,1765,
634817,1766,15,1749,1,
6349-1,1,5,1767,20,
63501768,4,24,83,0,
6351116,0,97,0,116,
63520,101,0,66,0,
6353111,0,100,0,121,
63540,95,0,49,0,
635554,0,1,195,1,
63563,1,3,1,2,
63571769,22,1,30,1,
63582640,1770,17,1771,15,
63591749,1,-1,1,5,
63601772,20,1773,4,24,
636183,0,116,0,97,
63620,116,0,101,0,
636366,0,111,0,100,
63640,121,0,95,0,
636549,0,52,0,1,
6366193,1,3,1,3,
63671,2,1774,22,1,
636828,1,2641,1775,17,
63691776,15,1749,1,-1,
63701,5,1777,20,1778,
63714,24,83,0,116,
63720,97,0,116,0,
6373101,0,66,0,111,
63740,100,0,121,0,
637595,0,49,0,50,
63760,1,191,1,3,
63771,3,1,2,1779,
637822,1,26,1,2642,
63791780,17,1781,15,1749,
63801,-1,1,5,1782,
638120,1783,4,24,83,
63820,116,0,97,0,
6383116,0,101,0,66,
63840,111,0,100,0,
6385121,0,95,0,49,
63860,48,0,1,189,
63871,3,1,3,1,
63882,1784,22,1,24,
63891,1989,1038,1,2535,
63901785,17,1786,15,1787,
63914,46,37,0,73, 63144,46,37,0,73,
63920,110,0,116,0, 63150,110,0,116,0,
639386,0,101,0,99, 631686,0,101,0,99,
@@ -6398,7 +6321,7 @@ public yyLSLSyntax
63980,101,0,69,0, 63210,101,0,69,0,
6399118,0,101,0,110, 6322118,0,101,0,110,
64000,116,0,1,-1, 63230,116,0,1,-1,
64011,5,1788,20,1789, 63241,5,1753,20,1754,
64024,48,73,0,110, 63254,48,73,0,110,
64030,116,0,86,0, 63260,116,0,86,0,
6404101,0,99,0,86, 6327101,0,99,0,86,
@@ -6409,181 +6332,228 @@ public yyLSLSyntax
64090,69,0,118,0, 63320,69,0,118,0,
6410101,0,110,0,116, 6333101,0,110,0,116,
64110,95,0,49,0, 63340,95,0,49,0,
64121,202,1,3,1, 63351,203,1,3,1,
64136,1,5,1790,22, 63366,1,5,1755,22,
64141,37,1,2645,1791, 63371,37,1,2643,1756,
641517,1792,15,1749,1, 633817,1757,15,1758,4,
6416-1,1,5,1793,20, 633920,37,0,83,0,
64171794,4,22,83,0,
6418116,0,97,0,116, 6340116,0,97,0,116,
64190,101,0,66,0, 63410,101,0,66,0,
6420111,0,100,0,121, 6342111,0,100,0,121,
64210,95,0,52,0, 63430,1,-1,1,5,
64221,183,1,3,1, 63441759,20,1760,4,24,
64233,1,2,1795,22, 634583,0,116,0,97,
64241,18,1,2646,1796, 63460,116,0,101,0,
642517,1797,15,1749,1, 634766,0,111,0,100,
6426-1,1,5,1798,20, 63480,121,0,95,0,
64271799,4,22,83,0, 634949,0,50,0,1,
6350192,1,3,1,3,
63511,2,1761,22,1,
635226,1,2647,1762,17,
63531763,15,1758,1,-1,
63541,5,1764,20,1765,
63554,22,83,0,116,
63560,97,0,116,0,
6357101,0,66,0,111,
63580,100,0,121,0,
635995,0,52,0,1,
6360184,1,3,1,3,
63611,2,1766,22,1,
636218,1,1860,946,1,
63631803,912,1,2521,1767,
636417,1768,15,1769,4,
636546,37,0,75,0,
6366101,0,121,0,73,
63670,110,0,116,0,
636873,0,110,0,116,
63690,65,0,114,0,
6370103,0,83,0,116,
63710,97,0,116,0,
6372101,0,69,0,118,
63730,101,0,110,0,
6374116,0,1,-1,1,
63755,1770,20,1771,4,
637648,75,0,101,0,
6377121,0,73,0,110,
63780,116,0,73,0,
6379110,0,116,0,65,
63800,114,0,103,0,
638183,0,116,0,97,
63820,116,0,101,0,
638369,0,118,0,101,
63840,110,0,116,0,
638595,0,49,0,1,
6386204,1,3,1,6,
63871,5,1772,22,1,
638838,1,2413,1773,16,
63890,521,1,2657,1774,
639017,1775,15,1758,1,
6391-1,1,5,1776,20,
63921777,4,22,83,0,
6428116,0,97,0,116, 6393116,0,97,0,116,
64290,101,0,66,0, 63940,101,0,66,0,
6430111,0,100,0,121, 6395111,0,100,0,121,
64310,95,0,50,0, 63960,95,0,49,0,
64321,181,1,3,1, 63971,181,1,3,1,
64333,1,2,1800,22, 63982,1,1,1778,22,
64341,16,1,2037,879, 63991,15,1,1873,961,
64351,32,1801,16,0, 64001,1657,1019,1,2641,
6436513,1,2649,1802,17, 64011779,17,1780,15,1758,
64371803,15,1749,1,-1, 64021,-1,1,5,1781,
64381,5,1804,20,1805, 640320,1782,4,24,83,
64394,24,83,0,116,
64400,97,0,116,0,
6441101,0,66,0,111,
64420,100,0,121,0,
644395,0,49,0,51,
64440,1,192,1,3,
64451,2,1,1,1806,
644622,1,27,1,2650,
64471807,17,1808,15,1749,
64481,-1,1,5,1809,
644920,1810,4,24,83,
64500,116,0,97,0, 64040,116,0,97,0,
6451116,0,101,0,66, 6405116,0,101,0,66,
64520,111,0,100,0, 64060,111,0,100,0,
6453121,0,95,0,49, 6407121,0,95,0,49,
64540,49,0,1,190, 64080,54,0,1,196,
64551,3,1,2,1, 64091,3,1,3,1,
64561,1811,22,1,25, 64102,1783,22,1,30,
64571,2651,1812,17,1813, 64111,2642,1784,17,1785,
645815,1749,1,-1,1, 641215,1758,1,-1,1,
64595,1814,20,1815,4, 64135,1786,20,1787,4,
646022,83,0,116,0, 641424,83,0,116,0,
646197,0,116,0,101,
64620,66,0,111,0,
6463100,0,121,0,95,
64640,57,0,1,188,
64651,3,1,2,1,
64661,1816,22,1,23,
64671,2652,1817,17,1818,
646815,1749,1,-1,1,
64695,1819,20,1820,4,
647022,83,0,116,0,
647197,0,116,0,101,
64720,66,0,111,0,
6473100,0,121,0,95,
64740,55,0,1,186,
64751,3,1,2,1,
64761,1821,22,1,21,
64771,2653,1822,17,1823,
647815,1749,1,-1,1,
64795,1824,20,1825,4,
648022,83,0,116,0,
648197,0,116,0,101,
64820,66,0,111,0,
6483100,0,121,0,95,
64840,53,0,1,184,
64851,3,1,2,1,
64861,1826,22,1,19,
64871,2654,1827,17,1828,
648815,1749,1,-1,1,
64895,1829,20,1830,4,
649022,83,0,116,0,
649197,0,116,0,101, 641597,0,116,0,101,
64920,66,0,111,0, 64160,66,0,111,0,
6493100,0,121,0,95, 6417100,0,121,0,95,
64940,51,0,1,182, 64180,49,0,52,0,
64951,3,1,2,1, 64191,194,1,3,1,
64961,1831,22,1,17, 64203,1,2,1788,22,
64971,2655,1832,17,1833, 64211,28,1,1989,1041,
649815,1749,1,-1,1, 64221,2644,1789,17,1790,
64995,1834,20,1835,4, 642315,1758,1,-1,1,
650022,83,0,116,0, 64245,1791,20,1792,4,
642524,83,0,116,0,
650197,0,116,0,101, 642697,0,116,0,101,
65020,66,0,111,0, 64270,66,0,111,0,
6503100,0,121,0,95, 6428100,0,121,0,95,
65040,49,0,1,180, 64290,49,0,48,0,
65051,3,1,2,1, 64301,190,1,3,1,
65061,1836,22,1,15, 64313,1,2,1793,22,
65071,2574,1837,17,1838, 64321,24,1,2645,1794,
650815,1839,4,34,37, 643317,1795,15,1758,1,
65090,75,0,101,0, 6434-1,1,5,1796,20,
6510121,0,65,0,114, 64351797,4,22,83,0,
65110,103,0,83,0,
6512116,0,97,0,116, 6436116,0,97,0,116,
65130,101,0,69,0, 64370,101,0,66,0,
6514118,0,101,0,110, 6438111,0,100,0,121,
65150,116,0,1,-1, 64390,95,0,56,0,
65161,5,1840,20,1841, 64401,188,1,3,1,
65174,36,75,0,101, 64413,1,2,1798,22,
65180,121,0,65,0, 64421,22,1,2646,1799,
644317,1800,15,1758,1,
6444-1,1,5,1801,20,
64451802,4,22,83,0,
6446116,0,97,0,116,
64470,101,0,66,0,
6448111,0,100,0,121,
64490,95,0,54,0,
64501,186,1,3,1,
64513,1,2,1803,22,
64521,20,1,2037,882,
64531,32,1804,16,0,
6454526,1,2567,1805,17,
64551806,15,1807,4,34,
645637,0,73,0,110,
64570,116,0,65,0,
6519114,0,103,0,83, 6458114,0,103,0,83,
65200,116,0,97,0, 64590,116,0,97,0,
6521116,0,101,0,69, 6460116,0,101,0,69,
65220,118,0,101,0, 64610,118,0,101,0,
6523110,0,116,0,95, 6462110,0,116,0,1,
65240,49,0,1,198, 6463-1,1,5,1808,20,
65251,3,1,6,1, 64641809,4,36,73,0,
65265,1842,22,1,33, 6465110,0,116,0,65,
65271,2550,1843,17,1844,
652815,1845,4,46,37,
65290,73,0,110,0,
6530116,0,82,0,111,
65310,116,0,82,0,
6532111,0,116,0,65,
65330,114,0,103,0, 64660,114,0,103,0,
653483,0,116,0,97, 646783,0,116,0,97,
65350,116,0,101,0, 64680,116,0,101,0,
653669,0,118,0,101, 646969,0,118,0,101,
65370,110,0,116,0, 64700,110,0,116,0,
65381,-1,1,5,1846, 647195,0,49,0,1,
653920,1847,4,48,73, 6472200,1,3,1,6,
65400,110,0,116,0, 64731,5,1810,22,1,
654182,0,111,0,116, 647434,1,2650,1811,17,
65420,82,0,111,0, 64751812,15,1758,1,-1,
6543116,0,65,0,114, 64761,5,1813,20,1814,
65440,103,0,83,0, 64774,24,83,0,116,
6545116,0,97,0,116, 64780,97,0,116,0,
65460,101,0,69,0, 6479101,0,66,0,111,
6547118,0,101,0,110, 64800,100,0,121,0,
65480,116,0,95,0, 648195,0,49,0,53,
654949,0,1,201,1, 64820,1,195,1,3,
65503,1,6,1,5, 64831,2,1,1,1815,
65511848,22,1,36,1, 648422,1,29,1,2651,
65522227,1030,1,1574,921, 64851816,17,1817,15,1758,
65531,2558,1849,17,1850, 64861,-1,1,5,1818,
655415,1851,4,40,37, 648720,1819,4,24,83,
65550,86,0,101,0,
655699,0,116,0,111,
65570,114,0,65,0,
6558114,0,103,0,83,
65590,116,0,97,0, 64880,116,0,97,0,
6560116,0,101,0,69, 6489116,0,101,0,66,
65610,118,0,101,0, 64900,111,0,100,0,
6562110,0,116,0,1, 6491121,0,95,0,49,
6563-1,1,5,1852,20, 64920,51,0,1,193,
65641853,4,42,86,0, 64931,3,1,2,1,
6565101,0,99,0,116, 64941,1820,22,1,27,
65660,111,0,114,0, 64951,2652,1821,17,1822,
656765,0,114,0,103, 649615,1758,1,-1,1,
65680,83,0,116,0, 64975,1823,20,1824,4,
649824,83,0,116,0,
656997,0,116,0,101, 649997,0,116,0,101,
65700,69,0,118,0, 65000,66,0,111,0,
6571101,0,110,0,116, 6501100,0,121,0,95,
65720,95,0,49,0, 65020,49,0,49,0,
65731,200,1,3,1, 65031,191,1,3,1,
65746,1,5,1854,22, 65042,1,1,1825,22,
65751,35,1,2566,1855, 65051,25,1,2653,1826,
657617,1856,15,1857,4, 650617,1827,15,1758,1,
657734,37,0,73,0, 6507-1,1,5,1828,20,
6578110,0,116,0,65, 65081829,4,22,83,0,
6509116,0,97,0,116,
65100,101,0,66,0,
6511111,0,100,0,121,
65120,95,0,57,0,
65131,189,1,3,1,
65142,1,1,1830,22,
65151,23,1,2654,1831,
651617,1832,15,1758,1,
6517-1,1,5,1833,20,
65181834,4,22,83,0,
6519116,0,97,0,116,
65200,101,0,66,0,
6521111,0,100,0,121,
65220,95,0,55,0,
65231,187,1,3,1,
65242,1,1,1835,22,
65251,21,1,2655,1836,
652617,1837,15,1758,1,
6527-1,1,5,1838,20,
65281839,4,22,83,0,
6529116,0,97,0,116,
65300,101,0,66,0,
6531111,0,100,0,121,
65320,95,0,53,0,
65331,185,1,3,1,
65342,1,1,1840,22,
65351,19,1,2656,1841,
653617,1842,15,1758,1,
6537-1,1,5,1843,20,
65381844,4,22,83,0,
6539116,0,97,0,116,
65400,101,0,66,0,
6541111,0,100,0,121,
65420,95,0,51,0,
65431,183,1,3,1,
65442,1,1,1845,22,
65451,17,1,2575,1846,
654617,1847,15,1848,4,
654734,37,0,75,0,
6548101,0,121,0,65,
65790,114,0,103,0, 65490,114,0,103,0,
658083,0,116,0,97, 655083,0,116,0,97,
65810,116,0,101,0, 65510,116,0,101,0,
658269,0,118,0,101, 655269,0,118,0,101,
65830,110,0,116,0, 65530,110,0,116,0,
65841,-1,1,5,1858, 65541,-1,1,5,1849,
658520,1859,4,36,73, 655520,1850,4,36,75,
65860,110,0,116,0, 65560,101,0,121,0,
658765,0,114,0,103, 655765,0,114,0,103,
65880,83,0,116,0, 65580,83,0,116,0,
658997,0,116,0,101, 655997,0,116,0,101,
@@ -6591,137 +6561,166 @@ public yyLSLSyntax
6591101,0,110,0,116, 6561101,0,110,0,116,
65920,95,0,49,0, 65620,95,0,49,0,
65931,199,1,3,1, 65631,199,1,3,1,
65946,1,5,1860,22, 65646,1,5,1851,22,
65951,34,1,2458,998, 65651,33,1,2551,1852,
65961,2459,1004,1,2462, 656617,1853,15,1854,4,
65971011,1,2136,965,1, 656746,37,0,73,0,
65982464,1021,1,2029,847, 6568110,0,116,0,82,
65991,2030,853,1,2031, 65690,111,0,116,0,
6600858,1,2032,863,1, 657082,0,111,0,116,
66012033,868,1,2579,1861,
660217,1862,15,1863,4,
660336,37,0,86,0,
6604111,0,105,0,100,
66050,65,0,114,0, 65710,65,0,114,0,
6606103,0,83,0,116, 6572103,0,83,0,116,
66070,97,0,116,0, 65730,97,0,116,0,
6608101,0,69,0,118, 6574101,0,69,0,118,
66090,101,0,110,0, 65750,101,0,110,0,
6610116,0,1,-1,1, 6576116,0,1,-1,1,
66115,1864,20,1865,4, 65775,1855,20,1856,4,
661238,86,0,111,0, 657848,73,0,110,0,
6613105,0,100,0,65, 6579116,0,82,0,111,
65800,116,0,82,0,
6581111,0,116,0,65,
66140,114,0,103,0, 65820,114,0,103,0,
661583,0,116,0,97, 658383,0,116,0,97,
66160,116,0,101,0, 65840,116,0,101,0,
661769,0,118,0,101, 658569,0,118,0,101,
66180,110,0,116,0, 65860,110,0,116,0,
661995,0,49,0,1, 658795,0,49,0,1,
6620197,1,3,1,5, 6588202,1,3,1,6,
66211,4,1866,22,1, 65891,5,1857,22,1,
662232,1,2035,874,1, 659036,1,2580,1858,17,
66232364,949,1,2039,884, 65911859,15,1860,4,36,
66241,1931,983,1,2041, 659237,0,86,0,111,
6625890,1,2021,840,1, 65930,105,0,100,0,
66262043,896,1,2045,901, 659465,0,114,0,103,
66271,2700,1867,16,0, 65950,83,0,116,0,
6628769,1,2594,1868,17,
66291869,15,1870,4,22,
663037,0,83,0,116,
66310,97,0,116,0,
6632101,0,69,0,118,
66330,101,0,110,0,
6634116,0,1,-1,1,
66355,1871,20,1872,4,
663624,83,0,116,0,
663797,0,116,0,101, 659697,0,116,0,101,
66380,69,0,118,0, 65970,69,0,118,0,
6639101,0,110,0,116, 6598101,0,110,0,116,
66400,95,0,49,0, 65990,1,-1,1,5,
66411,196,1,3,1, 66001861,20,1862,4,38,
66426,1,5,1873,22, 660186,0,111,0,105,
66431,31,1,2596,1874, 66020,100,0,65,0,
664416,0,662,1,2648, 6603114,0,103,0,83,
66451875,17,1876,15,1749,
66461,-1,1,5,1877,
664720,1878,4,24,83,
66480,116,0,97,0, 66040,116,0,97,0,
6649116,0,101,0,66, 6605116,0,101,0,69,
66500,111,0,100,0, 66060,118,0,101,0,
6651121,0,95,0,49, 6607110,0,116,0,95,
66520,53,0,1,194, 66080,49,0,1,198,
66531,3,1,2,1, 66091,3,1,5,1,
66541,1879,22,1,29, 66104,1863,22,1,32,
66551,2105,936,1,14, 66111,2227,1033,1,1574,
66561880,19,144,1,14, 6612924,1,2559,1864,17,
66571881,5,115,1,2512, 66131865,15,1866,4,40,
66581882,17,1883,15,1884, 661437,0,86,0,101,
66594,30,37,0,73, 66150,99,0,116,0,
66600,110,0,116,0, 6616111,0,114,0,65,
666168,0,101,0,99,
66620,108,0,97,0,
6663114,0,97,0,116,
66640,105,0,111,0,
6665110,0,1,-1,1,
66665,1885,20,1886,4,
666732,73,0,110,0,
6668116,0,68,0,101,
66690,99,0,108,0,
667097,0,114,0,97,
66710,116,0,105,0,
6672111,0,110,0,95,
66730,49,0,1,214,
66741,3,1,3,1,
66752,1887,22,1,50,
66761,2513,1888,16,0,
6677481,1,1260,1218,1,
66781011,1224,1,1514,1230,
66791,9,1235,1,10,
66801889,17,1890,15,1891,
66814,48,37,0,65,
66820,114,0,103,0, 66170,114,0,103,0,
6683117,0,109,0,101, 661883,0,116,0,97,
66190,116,0,101,0,
662069,0,118,0,101,
66840,110,0,116,0, 66210,110,0,116,0,
668568,0,101,0,99, 66221,-1,1,5,1867,
66860,108,0,97,0, 662320,1868,4,42,86,
6687114,0,97,0,116, 66240,101,0,99,0,
66880,105,0,111,0, 6625116,0,111,0,114,
6689110,0,76,0,105, 66260,65,0,114,0,
66900,115,0,116,0, 6627103,0,83,0,116,
66911,-1,1,5,140, 66280,97,0,116,0,
66921,0,1,0,1892, 6629101,0,69,0,118,
669322,1,39,1,262, 66300,101,0,110,0,
66941241,1,1267,1247,1, 6631116,0,95,0,49,
66952524,1893,16,0,492, 66320,1,201,1,3,
66961,1521,1252,1,1773, 66331,6,1,5,1869,
66971894,16,0,151,1, 663422,1,35,1,2021,
66982527,1895,17,1896,15, 6635843,1,2458,1001,1,
66991897,4,30,37,0, 66362459,1007,1,2462,1014,
670086,0,101,0,99, 66371,2136,968,1,2464,
66381024,1,2029,850,1,
66392030,856,1,2031,861,
66401,2032,866,1,2033,
6641871,1,2035,877,1,
66422364,952,1,2039,887,
66431,1931,986,1,2041,
6644893,1,2043,899,1,
66452045,904,1,2703,1870,
664616,0,211,1,2595,
66471871,17,1872,15,1873,
66484,22,37,0,83,
66490,116,0,97,0,
6650116,0,101,0,69,
66510,118,0,101,0,
6652110,0,116,0,1,
6653-1,1,5,1874,20,
66541875,4,24,83,0,
6655116,0,97,0,116,
66560,101,0,69,0,
6657118,0,101,0,110,
66580,116,0,95,0,
665949,0,1,197,1,
66603,1,6,1,5,
66611876,22,1,31,1,
66622597,1877,16,0,761,
66631,2648,1878,17,1879,
666415,1758,1,-1,1,
66655,1880,20,1881,4,
666622,83,0,116,0,
666797,0,116,0,101,
66680,66,0,111,0,
6669100,0,121,0,95,
66700,50,0,1,182,
66711,3,1,3,1,
66722,1882,22,1,16,
66731,2105,939,1,14,
66741883,19,144,1,14,
66751884,5,115,1,2510,
66761885,16,0,706,1,
66772513,1886,17,1887,15,
66781888,4,30,37,0,
667973,0,110,0,116,
67010,68,0,101,0, 66800,68,0,101,0,
670299,0,108,0,97, 668199,0,108,0,97,
67030,114,0,97,0, 66820,114,0,97,0,
6704116,0,105,0,111, 6683116,0,105,0,111,
67050,110,0,1,-1, 66840,110,0,1,-1,
67061,5,1898,20,1899, 66851,5,1889,20,1890,
67074,32,86,0,101, 66864,32,73,0,110,
67080,99,0,68,0, 66870,116,0,68,0,
6709101,0,99,0,108, 6688101,0,99,0,108,
67100,97,0,114,0, 66890,97,0,114,0,
671197,0,116,0,105, 669097,0,116,0,105,
67120,111,0,110,0, 66910,111,0,110,0,
671395,0,49,0,1, 669295,0,49,0,1,
6714215,1,3,1,3, 6693215,1,3,1,3,
67151,2,1900,22,1, 66941,2,1891,22,1,
671651,1,2528,1901,16, 669550,1,2514,1892,16,
67170,498,1,19,1269, 66960,360,1,1260,1221,
67181,20,1902,16,0, 66971,1011,1227,1,1514,
6719142,1,2281,1276,1, 66981233,1,9,1238,1,
6720525,1339,1,2539,1903, 669910,1893,17,1894,15,
672116,0,510,1,30, 67001895,4,48,37,0,
67221904,17,1905,15,1891, 670165,0,114,0,103,
67231,-1,1,5,1906, 67020,117,0,109,0,
672420,1907,4,50,65, 6703101,0,110,0,116,
67040,68,0,101,0,
670599,0,108,0,97,
67060,114,0,97,0,
6707116,0,105,0,111,
67080,110,0,76,0,
6709105,0,115,0,116,
67100,1,-1,1,5,
6711140,1,0,1,0,
67121896,22,1,39,1,
6713262,1244,1,1267,1250,
67141,2525,1897,16,0,
6715507,1,1773,1898,16,
67160,148,1,2779,1899,
671716,0,142,1,19,
67181272,1,20,1900,16,
67190,142,1,2281,1279,
67201,525,1343,1,30,
67211901,17,1902,15,1895,
67221,-1,1,5,1903,
672320,1904,4,50,65,
67250,114,0,103,0, 67240,114,0,103,0,
6726117,0,109,0,101, 6725117,0,109,0,101,
67270,110,0,116,0, 67260,110,0,116,0,
@@ -6732,18 +6731,18 @@ public yyLSLSyntax
6732110,0,76,0,105, 6731110,0,76,0,105,
67330,115,0,116,0, 67320,115,0,116,0,
673495,0,50,0,1, 673395,0,50,0,1,
6735205,1,3,1,4, 6734206,1,3,1,4,
67361,3,1908,22,1, 67351,3,1905,22,1,
673741,1,1002,1715,1, 673641,1,283,1299,1,
67382542,1909,17,1910,15, 67372543,1906,17,1907,15,
67391911,4,30,37,0, 67381908,4,30,37,0,
674082,0,111,0,116, 673982,0,111,0,116,
67410,68,0,101,0, 67400,68,0,101,0,
674299,0,108,0,97, 674199,0,108,0,97,
67430,114,0,97,0, 67420,114,0,97,0,
6744116,0,105,0,111, 6743116,0,105,0,111,
67450,110,0,1,-1, 67440,110,0,1,-1,
67461,5,1912,20,1913, 67451,5,1909,20,1910,
67474,32,82,0,111, 67464,32,82,0,111,
67480,116,0,68,0, 67470,116,0,68,0,
6749101,0,99,0,108, 6748101,0,99,0,108,
@@ -6751,21 +6750,21 @@ public yyLSLSyntax
675197,0,116,0,105, 675097,0,116,0,105,
67520,111,0,110,0, 67510,111,0,110,0,
675395,0,49,0,1, 675295,0,49,0,1,
6754216,1,3,1,3, 6753217,1,3,1,3,
67551,2,1914,22,1, 67541,2,1911,22,1,
675652,1,2543,1915,16, 675552,1,2544,1912,16,
67570,514,1,40,1300, 67560,528,1,40,1304,
67581,41,1916,17,1917, 67571,41,1913,17,1914,
675915,1918,4,26,37, 675815,1915,4,26,37,
67600,65,0,114,0, 67590,65,0,114,0,
6761103,0,117,0,109, 6760103,0,117,0,109,
67620,101,0,110,0, 67610,101,0,110,0,
6763116,0,76,0,105, 6762116,0,76,0,105,
67640,115,0,116,0, 67630,115,0,116,0,
67651,-1,1,5,709, 67641,-1,1,5,724,
67661,0,1,0,1919, 67651,0,1,0,1916,
676722,1,169,1,42, 676622,1,169,1,42,
67681920,17,1921,15,1922, 67671917,17,1918,15,1919,
67694,38,37,0,69, 67684,38,37,0,69,
67700,120,0,112,0, 67690,120,0,112,0,
6771114,0,101,0,115, 6770114,0,101,0,115,
@@ -6774,8 +6773,8 @@ public yyLSLSyntax
67740,114,0,103,0, 67730,114,0,103,0,
6775117,0,109,0,101, 6774117,0,109,0,101,
67760,110,0,116,0, 67750,110,0,116,0,
67771,-1,1,5,1923, 67761,-1,1,5,1920,
677820,1924,4,40,69, 677720,1921,4,40,69,
67790,120,0,112,0, 67780,120,0,112,0,
6780114,0,101,0,115, 6779114,0,101,0,115,
67810,115,0,105,0, 67800,115,0,105,0,
@@ -6784,317 +6783,336 @@ public yyLSLSyntax
6784117,0,109,0,101, 6783117,0,109,0,101,
67850,110,0,116,0, 67840,110,0,116,0,
678695,0,49,0,1, 678595,0,49,0,1,
6787335,1,3,1,2, 6786336,1,3,1,2,
67881,1,1925,22,1, 67871,1,1922,22,1,
6789172,1,44,1306,1, 6788172,1,44,1310,1,
679047,1307,1,48,1313, 678947,1311,1,48,1317,
67911,49,1319,1,50, 67901,49,1323,1,50,
67921324,1,51,1329,1, 67911328,1,51,1333,1,
6793283,1295,1,305,1334, 6792305,1338,1,63,1349,
67941,63,1345,1,66, 67931,1521,1255,1,66,
67951351,1,67,1356,1, 67941355,1,67,1360,1,
67961478,1575,1,69,1366, 67951478,1583,1,69,1370,
67971,70,1371,1,2581, 67961,70,1375,1,68,
67981926,17,1927,15,1891, 67971365,1,74,1380,1,
67991,-1,1,5,140, 67981013,1385,1,2335,1923,
68001,0,1,0,1892, 679916,0,148,1,1332,
68011,68,1361,1,74, 68001390,1,1048,1470,1,
68021376,1,1013,1381,1, 68012591,1924,16,0,142,
68032335,1928,16,0,151, 68021,82,1407,1,1296,
68041,1332,1386,1,1048, 68031294,1,1341,1424,1,
68051462,1,2590,1929,16, 6804328,1429,1,1303,1434,
68060,142,1,82,1403, 68051,1096,1439,1,93,
68071,1296,1290,1,1341, 68061445,1,1550,1450,1,
68081420,1,328,1425,1, 68072770,1925,17,1926,15,
68091303,1430,1,1096,1694, 68081895,1,-1,1,5,
68101,93,1435,1,1550, 6809140,1,0,1,0,
68111440,1,352,1467,1, 68101896,1,2528,1927,17,
68122775,1930,16,0,142, 68111928,15,1929,4,30,
68131,107,1455,1,1114, 681237,0,86,0,101,
68141461,1,1370,1570,1, 68130,99,0,68,0,
6815118,1473,1,1123,1478, 6814101,0,99,0,108,
68161,371,1483,1,1377, 68150,97,0,114,0,
68171489,1,375,1494,1, 681697,0,116,0,105,
6818377,1499,1,827,1448, 68170,111,0,110,0,
68191,380,1509,1,883, 68181,-1,1,5,1930,
68201515,1,373,1527,1, 681920,1931,4,32,86,
6821130,1532,1,379,1504, 68200,101,0,99,0,
68221,143,1537,1,1152,
68231543,1,387,1931,16,
68240,643,1,1406,1548,
68251,1159,1555,1,157,
68261560,1,1413,1565,1,
68271665,1591,1,412,1932,
682816,0,680,1,1094,
68291933,16,0,711,1,
6830172,1586,1,2766,1934,
683117,1935,15,1891,1,
6832-1,1,5,140,1,
68330,1,0,1892,1,
68341188,1596,1,437,1936,
683516,0,755,1,1442,
68361601,1,1694,1937,16,
68370,151,1,942,1607,
68381,1195,1613,1,1449,
68391618,1,1701,1623,1,
6840447,1628,1,188,1635,
68411,205,1640,1,2467,
68421938,17,1939,15,1891,
68431,-1,1,5,1940,
684420,1941,4,50,65,
68450,114,0,103,0,
6846117,0,109,0,101,
68470,110,0,116,0,
684868,0,101,0,99, 682168,0,101,0,99,
68490,108,0,97,0, 68220,108,0,97,0,
6850114,0,97,0,116, 6823114,0,97,0,116,
68510,105,0,111,0, 68240,105,0,111,0,
6852110,0,76,0,105, 6825110,0,95,0,49,
68530,115,0,116,0, 68260,1,216,1,3,
685495,0,49,0,1, 68271,3,1,2,1932,
6855204,1,3,1,2, 682822,1,51,1,2529,
68561,1,1942,22,1, 68291933,16,0,515,1,
685740,1,461,1943,16, 6830352,1475,1,107,1464,
68580,711,1,464,1944, 68311,1114,1469,1,2540,
685917,1945,15,1918,1, 68321934,16,0,524,1,
6860-1,1,5,1946,20, 68331370,1578,1,118,1481,
68611947,4,28,65,0, 68341,1123,1486,1,371,
6862114,0,103,0,117, 68351491,1,1377,1497,1,
68630,109,0,101,0, 6836375,1502,1,377,1507,
6864110,0,116,0,76, 68371,827,1457,1,380,
68650,105,0,115,0, 68381517,1,883,1523,1,
6866116,0,95,0,50, 6839373,1535,1,130,1540,
68670,1,334,1,3, 68401,379,1512,1,143,
68681,4,1,3,1948, 68411545,1,1152,1551,1,
686922,1,171,1,1224, 6842387,1935,16,0,656,
68701645,1,223,1650,1, 68431,1406,1556,1,2582,
68711730,1655,1,476,1660, 68441936,17,1937,15,1895,
68721,477,1666,1,1231, 68451,-1,1,5,140,
68731671,1,479,1676,1, 68461,0,1,0,1896,
6874480,1681,1,1485,1687, 68471,1159,1563,1,157,
68751,459,1949,17,1950, 68481568,1,1413,1573,1,
687615,1918,1,-1,1, 68491665,1600,1,412,1938,
68775,709,1,0,1, 685016,0,695,1,1094,
68780,1919,1,242,1700, 68511939,16,0,726,1,
68791,478,1705,1,481, 6852172,1595,1,1188,1605,
68801951,17,1952,15,1918, 68531,437,1940,16,0,
68811,-1,1,5,1953, 6854765,1,1442,1610,1,
688220,1954,4,28,65, 68551694,1941,16,0,148,
68830,114,0,103,0, 68561,942,1616,1,1195,
6884117,0,109,0,101, 68571622,1,1449,1627,1,
68850,110,0,116,0, 68581701,1632,1,447,1637,
68591,188,1644,1,205,
68601649,1,2467,1942,17,
68611943,15,1895,1,-1,
68621,5,1944,20,1945,
68634,50,65,0,114,
68640,103,0,117,0,
6865109,0,101,0,110,
68660,116,0,68,0,
6867101,0,99,0,108,
68680,97,0,114,0,
686997,0,116,0,105,
68700,111,0,110,0,
688676,0,105,0,115, 687176,0,105,0,115,
68870,116,0,95,0, 68720,116,0,95,0,
688849,0,1,333,1, 687349,0,1,205,1,
68893,1,2,1,1, 68743,1,2,1,1,
68901955,22,1,170,1, 68751946,22,1,40,1,
68911001,1710,1,2508,1956, 6876461,1947,16,0,726,
689217,1957,15,1958,4, 68771,464,1948,17,1949,
689330,37,0,75,0, 687815,1915,1,-1,1,
6894101,0,121,0,68, 68795,1950,20,1951,4,
68950,101,0,99,0, 688028,65,0,114,0,
6896108,0,97,0,114, 6881103,0,117,0,109,
68970,97,0,116,0, 68820,101,0,110,0,
6898105,0,111,0,110, 6883116,0,76,0,105,
68990,1,-1,1,5, 68840,115,0,116,0,
69001959,20,1960,4,32, 688595,0,50,0,1,
690175,0,101,0,121, 6886335,1,3,1,4,
69020,68,0,101,0, 68871,3,1952,22,1,
690399,0,108,0,97, 6888171,1,1224,1654,1,
69040,114,0,97,0, 6889223,1659,1,1730,1664,
6905116,0,105,0,111, 68901,476,1669,1,477,
69060,110,0,95,0, 68911675,1,1231,1680,1,
690749,0,1,213,1, 6892479,1685,1,480,1690,
69083,1,3,1,2, 68931,1485,1696,1,459,
69091961,22,1,49,1, 68941953,17,1954,15,1915,
69102509,1962,16,0,475, 68951,-1,1,5,724,
69111,15,1963,19,334, 68961,0,1,0,1916,
69121,15,1964,5,6, 68971,242,1703,1,478,
69131,1114,1965,16,0, 68981708,1,481,1955,17,
6914332,1,1621,1966,16, 68991956,15,1915,1,-1,
69150,754,1,2781,1967, 69001,5,1957,20,1958,
691616,0,795,1,40, 69014,28,65,0,114,
69171968,16,0,639,1, 69020,103,0,117,0,
691819,1269,1,9,1235, 6903109,0,101,0,110,
69191,16,1969,19,136, 69040,116,0,76,0,
69201,16,1970,5,146, 6905105,0,115,0,116,
69211,2765,1971,16,0, 69060,95,0,49,0,
6922784,1,256,1972,16, 69071,334,1,3,1,
69230,206,1,1261,1973, 69082,1,1,1959,22,
692416,0,206,1,509, 69091,170,1,1001,1713,
69251974,16,0,206,1, 69101,1002,1718,1,2509,
69269,1975,16,0,134, 69111960,17,1961,15,1962,
69271,2521,1976,16,0, 69124,30,37,0,75,
6928490,1,2021,840,1, 69130,101,0,121,0,
69291775,1977,16,0,206, 691468,0,101,0,99,
69301,2029,847,1,2030, 69150,108,0,97,0,
6931853,1,2031,858,1, 6916114,0,97,0,116,
69322032,863,1,2033,868, 69170,105,0,111,0,
69331,277,1978,16,0, 6918110,0,1,-1,1,
6934206,1,2035,874,1, 69195,1963,20,1964,4,
69352037,879,1,2039,884, 692032,75,0,101,0,
69361,32,1979,16,0, 6921121,0,68,0,101,
6937206,1,2041,890,1, 69220,99,0,108,0,
69382293,1980,16,0,206, 692397,0,114,0,97,
69391,2043,896,1,2045, 69240,116,0,105,0,
6940901,1,40,1981,16, 6925111,0,110,0,95,
69410,185,1,41,1982, 69260,49,0,1,214,
694216,0,206,1,1297, 69271,3,1,3,1,
69431983,16,0,206,1, 69282,1965,22,1,49,
694443,1984,16,0,206, 69291,15,1966,19,336,
69451,44,1985,16,0, 69301,15,1967,5,6,
6946185,1,1803,909,1, 69311,2785,1968,16,0,
69471804,1986,16,0,206, 6932334,1,1114,1969,16,
69481,299,1987,16,0, 69330,339,1,1621,1970,
6949206,1,2480,1988,17, 693416,0,764,1,40,
69501989,15,1990,4,24, 69351971,16,0,649,1,
695137,0,73,0,110, 693619,1272,1,9,1238,
69520,116,0,65,0, 69371,16,1972,19,136,
6953114,0,103,0,69, 69381,16,1973,5,147,
69540,118,0,101,0, 69391,256,1974,16,0,
6955110,0,116,0,1, 6940203,1,1261,1975,16,
6956-1,1,5,1991,20, 69410,203,1,509,1976,
69571992,4,26,73,0, 694216,0,203,1,2769,
69431977,16,0,790,1,
69449,1978,16,0,134,
69451,2522,1979,16,0,
6946505,1,2021,843,1,
69471775,1980,16,0,203,
69481,2029,850,1,2030,
6949856,1,2031,861,1,
69502032,866,1,2786,1981,
695116,0,203,1,277,
69521982,16,0,203,1,
69532537,1983,16,0,522,
69541,2037,882,1,2039,
6955887,1,32,1984,16,
69560,203,1,2041,893,
69571,2293,1985,16,0,
6958203,1,2043,899,1,
69592045,904,1,40,1986,
696016,0,182,1,41,
69611987,16,0,203,1,
69621297,1988,16,0,203,
69631,43,1989,16,0,
6964203,1,44,1990,16,
69650,182,1,1803,912,
69661,1804,1991,16,0,
6967203,1,299,1992,16,
69680,203,1,2480,1993,
696917,1994,15,1995,4,
697024,37,0,73,0,
6958110,0,116,0,65, 6971110,0,116,0,65,
69590,114,0,103,0, 69720,114,0,103,0,
696069,0,118,0,101, 697369,0,118,0,101,
69610,110,0,116,0, 69740,110,0,116,0,
696295,0,55,0,1, 69751,-1,1,5,1996,
6963367,1,3,1,2, 697620,1997,4,26,73,
69641,1,1993,22,1,
6965204,1,52,1994,16,
69660,206,1,2484,1995,
696717,1996,15,1990,1,
6968-1,1,5,1997,20,
69691998,4,26,73,0,
6970110,0,116,0,65,
69710,114,0,103,0,
697269,0,118,0,101,
69730,110,0,116,0, 69770,110,0,116,0,
697495,0,51,0,1, 697865,0,114,0,103,
6975363,1,3,1,2, 69790,69,0,118,0,
69761,1,1999,22,1, 6980101,0,110,0,116,
6977200,1,2567,2000,16, 69810,95,0,55,0,
69780,750,1,1515,2001, 69821,369,1,3,1,
697916,0,206,1,2318, 69832,1,1,1998,22,
69802002,16,0,206,1, 69841,205,1,2560,1999,
69812491,2003,17,2004,15, 698516,0,549,1,52,
69822005,4,26,37,0, 69862000,16,0,203,1,
698386,0,111,0,105, 69872484,2001,17,2002,15,
69840,100,0,65,0, 69881995,1,-1,1,5,
6985114,0,103,0,69, 69892003,20,2004,4,26,
69860,118,0,101,0, 699073,0,110,0,116,
6987110,0,116,0,1,
6988-1,1,5,2006,20,
69892007,4,28,86,0,
6990111,0,105,0,100,
69910,65,0,114,0, 69910,65,0,114,0,
6992103,0,69,0,118, 6992103,0,69,0,118,
69930,101,0,110,0, 69930,101,0,110,0,
6994116,0,95,0,54, 6994116,0,95,0,51,
69950,1,356,1,3, 69950,1,365,1,3,
69961,2,1,1,2008, 69961,2,1,1,2005,
699722,1,193,1,62, 699722,1,201,1,1515,
69982009,16,0,228,1, 69982006,16,0,203,1,
699963,2010,16,0,185, 69992318,2007,16,0,203,
70001,2495,2011,17,2012, 70001,2491,2008,17,2009,
700115,2005,1,-1,1, 700115,2010,4,26,37,
70025,2013,20,2014,4, 70020,86,0,111,0,
700328,86,0,111,0,
7004105,0,100,0,65, 7003105,0,100,0,65,
70050,114,0,103,0, 70040,114,0,103,0,
700669,0,118,0,101, 700569,0,118,0,101,
70070,110,0,116,0, 70060,110,0,116,0,
700895,0,50,0,1, 70071,-1,1,5,2011,
7009352,1,3,1,2, 700820,2012,4,28,86,
70101,1,2015,22,1, 70090,111,0,105,0,
7011189,1,2575,2016,16, 7010100,0,65,0,114,
70120,759,1,2075,2017, 70110,103,0,69,0,
701316,0,206,1,1574, 7012118,0,101,0,110,
7014921,1,1479,2018,16, 70130,116,0,95,0,
70150,206,1,2580,2019, 701454,0,1,358,1,
701616,0,352,1,71, 70153,1,2,1,1,
70172020,16,0,206,1, 70162013,22,1,194,1,
70181658,2021,16,0,790, 701762,2014,16,0,225,
70191,1833,2022,16,0, 70181,63,2015,16,0,
7020321,1,1834,2023,16, 7019182,1,2495,2016,17,
70210,206,1,2337,2024, 70202017,15,2010,1,-1,
702216,0,206,1,79, 70211,5,2018,20,2019,
70232025,16,0,206,1, 70224,28,86,0,111,
70241335,2026,16,0,206, 70230,105,0,100,0,
70251,322,2027,16,0, 702465,0,114,0,103,
7026206,1,76,2028,16, 70250,69,0,118,0,
70270,206,1,85,2029, 7026101,0,110,0,116,
702816,0,206,1,89, 70270,95,0,50,0,
70292030,16,0,206,1, 70281,354,1,3,1,
7030346,2031,16,0,206, 70292,1,1,2020,22,
70311,97,2032,16,0, 70301,190,1,2576,2021,
7032206,1,2106,2033,16, 703116,0,579,1,2075,
70330,206,1,102,2034, 70322022,16,0,203,1,
703416,0,206,1,1860, 70331574,924,1,1479,2023,
7035943,1,2458,998,1, 703416,0,203,1,71,
70362364,949,1,2536,2035, 70352024,16,0,203,1,
703716,0,633,1,2782, 70361658,2025,16,0,795,
70382036,16,0,206,1, 70371,1833,2026,16,0,
70391990,2037,16,0,206, 7038326,1,1834,2027,16,
70401,112,2038,16,0, 70390,203,1,2337,2028,
7041206,1,1117,2039,16, 704016,0,203,1,79,
70420,206,1,1873,958, 70412029,16,0,203,1,
70431,1875,2040,16,0, 70421335,2030,16,0,203,
7044436,1,1876,2041,16, 70431,322,2031,16,0,
70450,206,1,2551,2042, 7044203,1,76,2032,16,
704616,0,642,1,124, 70450,203,1,85,2033,
70472043,16,0,206,1, 704616,0,203,1,89,
70482478,2044,17,2045,15, 70472034,16,0,203,1,
70491990,1,-1,1,5, 70482033,871,1,2035,877,
70502046,20,2047,4,26, 70491,346,2035,16,0,
705173,0,110,0,116, 7050203,1,97,2036,16,
70520,65,0,114,0, 70510,203,1,2106,2037,
7053103,0,69,0,118, 705216,0,203,1,102,
70540,101,0,110,0, 70532038,16,0,203,1,
7055116,0,95,0,57, 70541860,946,1,2458,1001,
70560,1,369,1,3, 70551,2364,952,1,1990,
70571,2,1,1,2048, 70562039,16,0,203,1,
705822,1,206,1,2136, 7057112,2040,16,0,203,
7059965,1,2559,2049,16, 70581,1117,2041,16,0,
70600,536,1,525,2050, 7059203,1,1873,961,1,
706116,0,206,1,137, 70601875,2042,16,0,446,
70622051,16,0,206,1, 70611,1876,2043,16,0,
7063381,2052,16,0,206, 7062203,1,2552,2044,16,
70641,1901,2053,16,0, 70630,540,1,124,2045,
7065206,1,1153,2054,16, 706416,0,203,1,2478,
70660,206,1,151,2055, 70652046,17,2047,15,1995,
706716,0,206,1,1407, 70661,-1,1,5,2048,
70682056,16,0,206,1, 706720,2049,4,26,73,
70691659,2057,16,0,206, 70680,110,0,116,0,
70701,2413,2058,16,0, 706965,0,114,0,103,
7071206,1,406,2059,16, 70700,69,0,118,0,
70720,206,1,1371,2060, 7071101,0,110,0,116,
707316,0,206,1,2105, 70720,95,0,57,0,
7074936,1,166,2061,16, 70731,371,1,3,1,
70750,206,1,1622,2062, 70742,1,1,2050,22,
707616,0,206,1,1931, 70751,207,1,2136,968,
7077983,1,1932,2063,16, 70761,381,2051,16,0,
70780,525,1,1933,2064, 7077203,1,525,2052,16,
707916,0,206,1,431, 70780,203,1,137,2053,
70802065,16,0,206,1, 707916,0,203,1,2568,
70811585,2066,16,0,206, 70802054,16,0,683,1,
70821,182,2067,16,0, 70811901,2055,16,0,203,
7083206,1,1189,2068,16, 70821,1153,2056,16,0,
70840,206,1,1443,2069, 7083203,1,151,2057,16,
708516,0,206,1,1695, 70840,203,1,1407,2058,
70862070,16,0,206,1, 708516,0,203,1,2581,
70872198,2071,16,0,206, 70862059,16,0,779,1,
70881,447,2072,16,0, 70872413,2060,16,0,203,
7089206,1,199,2073,16, 70881,406,2061,16,0,
70900,206,1,2459,1004, 7089203,1,1371,2062,16,
70911,1958,2074,16,0, 70900,203,1,2105,939,
7092206,1,2462,1011,1, 70911,166,2063,16,0,
70931657,1016,1,2464,1021, 7092203,1,1622,2064,16,
70941,459,2075,16,0, 70930,203,1,1931,986,
7095206,1,462,2076,16, 70941,1932,2065,16,0,
70960,206,1,2471,2077, 7095539,1,1933,2066,16,
709717,2078,15,2079,4, 70960,203,1,431,2067,
709716,0,203,1,1585,
70982068,16,0,203,1,
7099182,2069,16,0,203,
71001,1189,2070,16,0,
7101203,1,1443,2071,16,
71020,203,1,1695,2072,
710316,0,203,1,2198,
71042073,16,0,203,1,
7105447,2074,16,0,203,
71061,199,2075,16,0,
7107203,1,2459,1007,1,
71081958,2076,16,0,203,
71091,2462,1014,1,1657,
71101019,1,2464,1024,1,
71111659,2077,16,0,203,
71121,459,2078,16,0,
7113203,1,462,2079,16,
71140,203,1,2471,2080,
711517,2081,15,2082,4,
709836,37,0,75,0, 711636,37,0,75,0,
7099101,0,121,0,73, 7117101,0,121,0,73,
71000,110,0,116,0, 71180,110,0,116,0,
@@ -7103,7 +7121,7 @@ public yyLSLSyntax
7103103,0,69,0,118, 7121103,0,69,0,118,
71040,101,0,110,0, 71220,101,0,110,0,
7105116,0,1,-1,1, 7123116,0,1,-1,1,
71065,2080,20,2081,4, 71245,2083,20,2084,4,
710738,75,0,101,0, 712538,75,0,101,0,
7108121,0,73,0,110, 7126121,0,73,0,110,
71090,116,0,73,0, 71270,116,0,73,0,
@@ -7112,10 +7130,10 @@ public yyLSLSyntax
711269,0,118,0,101, 713069,0,118,0,101,
71130,110,0,116,0, 71310,110,0,116,0,
711495,0,49,0,1, 713295,0,49,0,1,
7115376,1,3,1,2, 7133378,1,3,1,2,
71161,1,2082,22,1, 71341,1,2085,22,1,
7117213,1,2472,2083,17, 7135214,1,2472,2086,17,
71182084,15,2085,4,36, 71362087,15,2088,4,36,
711937,0,73,0,110, 713737,0,73,0,110,
71200,116,0,86,0, 71380,116,0,86,0,
7121101,0,99,0,86, 7139101,0,99,0,86,
@@ -7124,7 +7142,7 @@ public yyLSLSyntax
71240,69,0,118,0, 71420,69,0,118,0,
7125101,0,110,0,116, 7143101,0,110,0,116,
71260,1,-1,1,5, 71440,1,-1,1,5,
71272086,20,2087,4,38, 71452089,20,2090,4,38,
712873,0,110,0,116, 714673,0,110,0,116,
71290,86,0,101,0, 71470,86,0,101,0,
713099,0,86,0,101, 714899,0,86,0,101,
@@ -7132,11 +7150,11 @@ public yyLSLSyntax
7132114,0,103,0,69, 7150114,0,103,0,69,
71330,118,0,101,0, 71510,118,0,101,0,
7134110,0,116,0,95, 7152110,0,116,0,95,
71350,49,0,1,375, 71530,49,0,1,377,
71361,3,1,2,1, 71541,3,1,2,1,
71371,2088,22,1,212, 71551,2091,22,1,213,
71381,2473,2089,17,2090, 71561,2473,2092,17,2093,
713915,2091,4,36,37, 715715,2094,4,36,37,
71400,73,0,110,0, 71580,73,0,110,0,
7141116,0,82,0,111, 7159116,0,82,0,111,
71420,116,0,82,0, 71600,116,0,82,0,
@@ -7144,8 +7162,8 @@ public yyLSLSyntax
71440,114,0,103,0, 71620,114,0,103,0,
714569,0,118,0,101, 716369,0,118,0,101,
71460,110,0,116,0, 71640,110,0,116,0,
71471,-1,1,5,2092, 71651,-1,1,5,2095,
714820,2093,4,38,73, 716620,2096,4,38,73,
71490,110,0,116,0, 71670,110,0,116,0,
715082,0,111,0,116, 716882,0,111,0,116,
71510,82,0,111,0, 71690,82,0,111,0,
@@ -7153,18 +7171,18 @@ public yyLSLSyntax
71530,103,0,69,0, 71710,103,0,69,0,
7154118,0,101,0,110, 7172118,0,101,0,110,
71550,116,0,95,0, 71730,116,0,95,0,
715649,0,1,374,1, 717449,0,1,376,1,
71573,1,2,1,1, 71753,1,2,1,1,
71582094,22,1,211,1, 71762097,22,1,212,1,
71592474,2095,17,2096,15, 71772474,2098,17,2099,15,
71602097,4,30,37,0, 71782100,4,30,37,0,
716186,0,101,0,99, 717986,0,101,0,99,
71620,116,0,111,0, 71800,116,0,111,0,
7163114,0,65,0,114, 7181114,0,65,0,114,
71640,103,0,69,0, 71820,103,0,69,0,
7165118,0,101,0,110, 7183118,0,101,0,110,
71660,116,0,1,-1, 71840,116,0,1,-1,
71671,5,2098,20,2099, 71851,5,2101,20,2102,
71684,32,86,0,101, 71864,32,86,0,101,
71690,99,0,116,0, 71870,99,0,116,0,
7170111,0,114,0,65, 7188111,0,114,0,65,
@@ -7172,11 +7190,11 @@ public yyLSLSyntax
717269,0,118,0,101, 719069,0,118,0,101,
71730,110,0,116,0, 71910,110,0,116,0,
717495,0,51,0,1, 719295,0,51,0,1,
7175373,1,3,1,2, 7193375,1,3,1,2,
71761,1,2100,22,1, 71941,1,2103,22,1,
7177210,1,2475,2101,17, 7195211,1,2475,2104,17,
71782102,15,2097,1,-1, 71962105,15,2100,1,-1,
71791,5,2103,20,2104, 71971,5,2106,20,2107,
71804,32,86,0,101, 71984,32,86,0,101,
71810,99,0,116,0, 71990,99,0,116,0,
7182111,0,114,0,65, 7200111,0,114,0,65,
@@ -7184,11 +7202,11 @@ public yyLSLSyntax
718469,0,118,0,101, 720269,0,118,0,101,
71850,110,0,116,0, 72030,110,0,116,0,
718695,0,50,0,1, 720495,0,50,0,1,
7187372,1,3,1,2, 7205374,1,3,1,2,
71881,1,2105,22,1, 72061,1,2108,22,1,
7189209,1,2476,2106,17, 7207210,1,2476,2109,17,
71902107,15,2097,1,-1, 72082110,15,2100,1,-1,
71911,5,2108,20,2109, 72091,5,2111,20,2112,
71924,32,86,0,101, 72104,32,86,0,101,
71930,99,0,116,0, 72110,99,0,116,0,
7194111,0,114,0,65, 7212111,0,114,0,65,
@@ -7196,380 +7214,352 @@ public yyLSLSyntax
719669,0,118,0,101, 721469,0,118,0,101,
71970,110,0,116,0, 72150,110,0,116,0,
719895,0,49,0,1, 721695,0,49,0,1,
7199371,1,3,1,2, 7217373,1,3,1,2,
72001,1,2110,22,1, 72181,1,2113,22,1,
7201208,1,2477,2111,17, 7219209,1,2477,2114,17,
72022112,15,1990,1,-1, 72202115,15,1995,1,-1,
72031,5,2113,20,2114, 72211,5,2116,20,2117,
72044,28,73,0,110, 72224,28,73,0,110,
72050,116,0,65,0, 72230,116,0,65,0,
7206114,0,103,0,69, 7224114,0,103,0,69,
72070,118,0,101,0, 72250,118,0,101,0,
7208110,0,116,0,95, 7226110,0,116,0,95,
72090,49,0,48,0, 72270,49,0,48,0,
72101,370,1,3,1, 72281,372,1,3,1,
72112,1,1,2115,22, 72292,1,1,2118,22,
72121,207,1,2227,1030, 72301,208,1,2227,1033,
72131,2479,2116,17,2117, 72311,2479,2119,17,2120,
721415,1990,1,-1,1, 723215,1995,1,-1,1,
72155,2118,20,2119,4, 72335,2121,20,2122,4,
721626,73,0,110,0, 723426,73,0,110,0,
7217116,0,65,0,114, 7235116,0,65,0,114,
72180,103,0,69,0, 72360,103,0,69,0,
7219118,0,101,0,110, 7237118,0,101,0,110,
72200,116,0,95,0, 72380,116,0,95,0,
722156,0,1,368,1, 723956,0,1,370,1,
72223,1,2,1,1, 72403,1,2,1,1,
72232120,22,1,205,1, 72412123,22,1,206,1,
72241225,2121,16,0,206, 72421225,2124,16,0,203,
72251,2481,2122,17,2123, 72431,2481,2125,17,2126,
722615,1990,1,-1,1, 724415,1995,1,-1,1,
72275,2124,20,2125,4, 72455,2127,20,2128,4,
722826,73,0,110,0, 724626,73,0,110,0,
7229116,0,65,0,114, 7247116,0,65,0,114,
72300,103,0,69,0, 72480,103,0,69,0,
7231118,0,101,0,110, 7249118,0,101,0,110,
72320,116,0,95,0, 72500,116,0,95,0,
723354,0,1,366,1, 725154,0,1,368,1,
72343,1,2,1,1, 72523,1,2,1,1,
72352126,22,1,203,1, 72532129,22,1,204,1,
72362482,2127,17,2128,15, 72542482,2130,17,2131,15,
72371990,1,-1,1,5, 72551995,1,-1,1,5,
72382129,20,2130,4,26, 72562132,20,2133,4,26,
723973,0,110,0,116, 725773,0,110,0,116,
72400,65,0,114,0, 72580,65,0,114,0,
7241103,0,69,0,118, 7259103,0,69,0,118,
72420,101,0,110,0, 72600,101,0,110,0,
7243116,0,95,0,53, 7261116,0,95,0,53,
72440,1,365,1,3, 72620,1,367,1,3,
72451,2,1,1,2131, 72631,2,1,1,2134,
724622,1,202,1,2483, 726422,1,203,1,2483,
72472132,17,2133,15,1990, 72652135,17,2136,15,1995,
72481,-1,1,5,2134, 72661,-1,1,5,2137,
724920,2135,4,26,73, 726720,2138,4,26,73,
72500,110,0,116,0, 72680,110,0,116,0,
725165,0,114,0,103, 726965,0,114,0,103,
72520,69,0,118,0, 72700,69,0,118,0,
7253101,0,110,0,116, 7271101,0,110,0,116,
72540,95,0,52,0, 72720,95,0,52,0,
72551,364,1,3,1, 72731,366,1,3,1,
72562,1,1,2136,22, 72742,1,1,2139,22,
72571,201,1,1731,2137, 72751,202,1,1731,2140,
725816,0,206,1,2485, 727616,0,203,1,2485,
72592138,17,2139,15,1990, 72772141,17,2142,15,1995,
72601,-1,1,5,2140, 72781,-1,1,5,2143,
726120,2141,4,26,73, 727920,2144,4,26,73,
72620,110,0,116,0, 72800,110,0,116,0,
726365,0,114,0,103, 728165,0,114,0,103,
72640,69,0,118,0, 72820,69,0,118,0,
7265101,0,110,0,116, 7283101,0,110,0,116,
72660,95,0,50,0, 72840,95,0,50,0,
72671,362,1,3,1, 72851,364,1,3,1,
72682,1,1,2142,22, 72862,1,1,2145,22,
72691,199,1,2486,2143, 72871,200,1,2486,2146,
727017,2144,15,1990,1, 728817,2147,15,1995,1,
7271-1,1,5,2145,20, 7289-1,1,5,2148,20,
72722146,4,26,73,0, 72902149,4,26,73,0,
7273110,0,116,0,65, 7291110,0,116,0,65,
72740,114,0,103,0, 72920,114,0,103,0,
727569,0,118,0,101, 729369,0,118,0,101,
72760,110,0,116,0, 72940,110,0,116,0,
727795,0,49,0,1, 729595,0,49,0,1,
7278361,1,3,1,2, 7296363,1,3,1,2,
72791,1,2147,22,1, 72971,1,2150,22,1,
7280198,1,2487,2148,17, 7298199,1,2487,2151,17,
72812149,15,2150,4,24, 72992152,15,2153,4,24,
728237,0,75,0,101, 730037,0,75,0,101,
72830,121,0,65,0, 73010,121,0,65,0,
7284114,0,103,0,69, 7302114,0,103,0,69,
72850,118,0,101,0, 73030,118,0,101,0,
7286110,0,116,0,1, 7304110,0,116,0,1,
7287-1,1,5,2151,20, 7305-1,1,5,2154,20,
72882152,4,26,75,0, 73062155,4,26,75,0,
7289101,0,121,0,65, 7307101,0,121,0,65,
72900,114,0,103,0, 73080,114,0,103,0,
729169,0,118,0,101, 730969,0,118,0,101,
72920,110,0,116,0, 73100,110,0,116,0,
729395,0,50,0,1, 731195,0,50,0,1,
7294360,1,3,1,2, 7312362,1,3,1,2,
72951,1,2153,22,1, 73131,1,2156,22,1,
7296197,1,2488,2154,17, 7314198,1,2488,2157,17,
72972155,15,2150,1,-1, 73152158,15,2153,1,-1,
72981,5,2156,20,2157, 73161,5,2159,20,2160,
72994,26,75,0,101, 73174,26,75,0,101,
73000,121,0,65,0, 73180,121,0,65,0,
7301114,0,103,0,69, 7319114,0,103,0,69,
73020,118,0,101,0, 73200,118,0,101,0,
7303110,0,116,0,95, 7321110,0,116,0,95,
73040,49,0,1,359, 73220,49,0,1,361,
73051,3,1,2,1, 73231,3,1,2,1,
73061,2158,22,1,196, 73241,2161,22,1,197,
73071,2489,2159,17,2160, 73251,2489,2162,17,2163,
730815,2005,1,-1,1, 732615,2010,1,-1,1,
73095,2161,20,2162,4, 73275,2164,20,2165,4,
731028,86,0,111,0, 732828,86,0,111,0,
7311105,0,100,0,65, 7329105,0,100,0,65,
73120,114,0,103,0, 73300,114,0,103,0,
731369,0,118,0,101, 733169,0,118,0,101,
73140,110,0,116,0, 73320,110,0,116,0,
731595,0,56,0,1, 733395,0,56,0,1,
7316358,1,3,1,2, 7334360,1,3,1,2,
73171,1,2163,22,1, 73351,1,2166,22,1,
7318195,1,2490,2164,17, 7336196,1,2490,2167,17,
73192165,15,2005,1,-1, 73372168,15,2010,1,-1,
73201,5,2166,20,2167, 73381,5,2169,20,2170,
73214,28,86,0,111, 73394,28,86,0,111,
73220,105,0,100,0, 73400,105,0,100,0,
732365,0,114,0,103, 734165,0,114,0,103,
73240,69,0,118,0, 73420,69,0,118,0,
7325101,0,110,0,116, 7343101,0,110,0,116,
73260,95,0,55,0, 73440,95,0,55,0,
73271,357,1,3,1, 73451,359,1,3,1,
73282,1,1,2168,22, 73462,1,1,2171,22,
73291,194,1,1989,1038, 73471,195,1,1989,1041,
73301,2492,2169,17,2170, 73481,2492,2172,17,2173,
733115,2005,1,-1,1, 734915,2010,1,-1,1,
73325,2171,20,2172,4, 73505,2174,20,2175,4,
733328,86,0,111,0, 735128,86,0,111,0,
7334105,0,100,0,65, 7352105,0,100,0,65,
73350,114,0,103,0, 73530,114,0,103,0,
733669,0,118,0,101, 735469,0,118,0,101,
73370,110,0,116,0, 73550,110,0,116,0,
733895,0,53,0,1, 735695,0,53,0,1,
7339355,1,3,1,2, 7357357,1,3,1,2,
73401,1,2173,22,1, 73581,1,2176,22,1,
7341192,1,2493,2174,17, 7359193,1,2493,2177,17,
73422175,15,2005,1,-1, 73602178,15,2010,1,-1,
73431,5,2176,20,2177, 73611,5,2179,20,2180,
73444,28,86,0,111, 73624,28,86,0,111,
73450,105,0,100,0, 73630,105,0,100,0,
734665,0,114,0,103, 736465,0,114,0,103,
73470,69,0,118,0, 73650,69,0,118,0,
7348101,0,110,0,116, 7366101,0,110,0,116,
73490,95,0,52,0, 73670,95,0,52,0,
73501,354,1,3,1, 73681,356,1,3,1,
73512,1,1,2178,22, 73692,1,1,2181,22,
73521,191,1,2494,2179, 73701,192,1,2494,2182,
735317,2180,15,2005,1, 737117,2183,15,2010,1,
7354-1,1,5,2181,20, 7372-1,1,5,2184,20,
73552182,4,28,86,0, 73732185,4,28,86,0,
7356111,0,105,0,100, 7374111,0,105,0,100,
73570,65,0,114,0, 73750,65,0,114,0,
7358103,0,69,0,118, 7376103,0,69,0,118,
73590,101,0,110,0, 73770,101,0,110,0,
7360116,0,95,0,51, 7378116,0,95,0,51,
73610,1,353,1,3, 73790,1,355,1,3,
73621,2,1,1,2183, 73801,2,1,1,2186,
736322,1,190,1,236, 738122,1,191,1,236,
73642184,16,0,206,1, 73822187,16,0,203,1,
73652496,2185,17,2186,15, 73832496,2188,17,2189,15,
73662005,1,-1,1,5, 73842010,1,-1,1,5,
73672187,20,2188,4,28, 73852190,20,2191,4,28,
736886,0,111,0,105, 738686,0,111,0,105,
73690,100,0,65,0, 73870,100,0,65,0,
7370114,0,103,0,69, 7388114,0,103,0,69,
73710,118,0,101,0, 73890,118,0,101,0,
7372110,0,116,0,95, 7390110,0,116,0,95,
73730,49,0,1,351, 73910,49,0,1,353,
73741,3,1,2,1, 73921,3,1,2,1,
73751,2189,22,1,188, 73931,2192,22,1,189,
73761,2497,2190,17,2191, 73941,2497,2193,17,2194,
737715,2192,4,12,37, 739515,2195,4,12,37,
73780,69,0,118,0, 73960,69,0,118,0,
7379101,0,110,0,116, 7397101,0,110,0,116,
73800,1,-1,1,5, 73980,1,-1,1,5,
73812193,20,2194,4,14, 73992196,20,2197,4,14,
738269,0,118,0,101, 740069,0,118,0,101,
73830,110,0,116,0, 74010,110,0,116,0,
738495,0,56,0,1, 740295,0,57,0,1,
7385350,1,3,1,2, 7403352,1,3,1,2,
73861,1,2195,22,1, 74041,1,2198,22,1,
7387187,1,2498,2196,17, 7405188,1,2498,2199,17,
73882197,15,2192,1,-1, 74062200,15,2195,1,-1,
73891,5,2198,20,2199, 74071,5,2201,20,2202,
73904,14,69,0,118, 74084,14,69,0,118,
73910,101,0,110,0, 74090,101,0,110,0,
7392116,0,95,0,55, 7410116,0,95,0,56,
73930,1,349,1,3, 74110,1,351,1,3,
73941,2,1,1,2200, 74121,2,1,1,2203,
739522,1,186,1,2499, 741322,1,187,1,2499,
73962201,17,2202,15,2192, 74142204,17,2205,15,2195,
73971,-1,1,5,2203, 74151,-1,1,5,2206,
739820,2204,4,14,69, 741620,2207,4,14,69,
73990,118,0,101,0, 74170,118,0,101,0,
7400110,0,116,0,95, 7418110,0,116,0,95,
74010,54,0,1,348, 74190,55,0,1,350,
74021,3,1,2,1, 74201,3,1,2,1,
74031,2205,22,1,185, 74211,2208,22,1,186,
74041,2500,2206,17,2207, 74221,2500,2209,17,2210,
740515,2192,1,-1,1, 742315,2195,1,-1,1,
74065,2208,20,2209,4, 74245,2211,20,2212,4,
740714,69,0,118,0, 742514,69,0,118,0,
7408101,0,110,0,116, 7426101,0,110,0,116,
74090,95,0,53,0, 74270,95,0,54,0,
74101,347,1,3,1, 74281,349,1,3,1,
74112,1,1,2210,22, 74292,1,1,2213,22,
74121,184,1,2501,2211, 74301,185,1,2501,2214,
741317,2212,15,2192,1, 743117,2215,15,2195,1,
7414-1,1,5,2213,20, 7432-1,1,5,2216,20,
74152214,4,14,69,0, 74332217,4,14,69,0,
7416118,0,101,0,110, 7434118,0,101,0,110,
74170,116,0,95,0, 74350,116,0,95,0,
741852,0,1,346,1, 743653,0,1,348,1,
74193,1,2,1,1, 74373,1,2,1,1,
74202215,22,1,183,1, 74382218,22,1,184,1,
74212502,2216,17,2217,15, 74392502,2219,17,2220,15,
74222192,1,-1,1,5, 74402195,1,-1,1,5,
74232218,20,2219,4,14, 74412221,20,2222,4,14,
742469,0,118,0,101, 744269,0,118,0,101,
74250,110,0,116,0, 74430,110,0,116,0,
742695,0,51,0,1, 744495,0,52,0,1,
7427345,1,3,1,2, 7445347,1,3,1,2,
74281,1,2220,22,1, 74461,1,2223,22,1,
7429182,1,2503,2221,17, 7447183,1,2503,2224,17,
74302222,15,2192,1,-1, 74482225,15,2195,1,-1,
74311,5,2223,20,2224, 74491,5,2226,20,2227,
74324,14,69,0,118, 74504,14,69,0,118,
74330,101,0,110,0, 74510,101,0,110,0,
7434116,0,95,0,50, 7452116,0,95,0,51,
74350,1,344,1,3, 74530,1,346,1,3,
74361,2,1,1,2225, 74541,2,1,1,2228,
743722,1,181,1,2504, 745522,1,182,1,2504,
74382226,17,2227,15,2192, 74562229,17,2230,15,2195,
74391,-1,1,5,2228, 74571,-1,1,5,2231,
744020,2229,4,14,69, 745820,2232,4,14,69,
74410,118,0,101,0, 74590,118,0,101,0,
7442110,0,116,0,95, 7460110,0,116,0,95,
74430,49,0,1,343, 74610,50,0,1,345,
74441,3,1,2,1, 74621,3,1,2,1,
74451,2230,22,1,180, 74631,2233,22,1,181,
74461,2505,2231,16,0, 74641,2505,2234,17,2235,
7447469,1,217,2232,16, 746515,2195,1,-1,1,
74480,206,1,1756,2233, 74665,2236,20,2237,4,
744916,0,206,1,17, 746714,69,0,118,0,
74502234,19,163,1,17, 7468101,0,110,0,116,
74512235,5,134,1,1, 74690,95,0,49,0,
74522236,17,2237,15,2238, 74701,344,1,3,1,
74534,18,37,0,84, 74712,1,1,2238,22,
74540,121,0,112,0, 74721,180,1,2506,2239,
7455101,0,110,0,97, 747316,0,482,1,217,
74560,109,0,101,0, 74742240,16,0,203,1,
74571,-1,1,5,2239, 74751756,2241,16,0,203,
745820,2240,4,20,84, 74761,17,2242,19,163,
74771,17,2243,5,134,
74781,1,2244,17,2245,
747915,2246,4,18,37,
74800,84,0,121,0,
7481112,0,101,0,110,
74820,97,0,109,0,
7483101,0,1,-1,1,
74845,2247,20,2248,4,
748520,84,0,121,0,
7486112,0,101,0,110,
74870,97,0,109,0,
7488101,0,95,0,55,
74890,1,343,1,3,
74901,2,1,1,2249,
749122,1,179,1,2,
74922250,17,2251,15,2246,
74931,-1,1,5,2252,
749420,2253,4,20,84,
74590,121,0,112,0, 74950,121,0,112,0,
7460101,0,110,0,97, 7496101,0,110,0,97,
74610,109,0,101,0, 74970,109,0,101,0,
746295,0,55,0,1, 749895,0,54,0,1,
7463342,1,3,1,2, 7499342,1,3,1,2,
74641,1,2241,22,1, 75001,1,2254,22,1,
7465179,1,2,2242,17, 7501178,1,3,2255,17,
74662243,15,2238,1,-1, 75022256,15,2246,1,-1,
74671,5,2244,20,2245, 75031,5,2257,20,2258,
74684,20,84,0,121, 75044,20,84,0,121,
74690,112,0,101,0, 75050,112,0,101,0,
7470110,0,97,0,109, 7506110,0,97,0,109,
74710,101,0,95,0, 75070,101,0,95,0,
747254,0,1,341,1, 750853,0,1,341,1,
74733,1,2,1,1, 75093,1,2,1,1,
74742246,22,1,178,1, 75102259,22,1,177,1,
74753,2247,17,2248,15, 75114,2260,17,2261,15,
74762238,1,-1,1,5, 75122246,1,-1,1,5,
74772249,20,2250,4,20, 75132262,20,2263,4,20,
747884,0,121,0,112, 751484,0,121,0,112,
74790,101,0,110,0, 75150,101,0,110,0,
748097,0,109,0,101, 751697,0,109,0,101,
74810,95,0,53,0, 75170,95,0,52,0,
74821,340,1,3,1, 75181,340,1,3,1,
74832,1,1,2251,22, 75192,1,1,2264,22,
74841,177,1,4,2252, 75201,176,1,5,2265,
748517,2253,15,2238,1, 752117,2266,15,2246,1,
7486-1,1,5,2254,20, 7522-1,1,5,2267,20,
74872255,4,20,84,0, 75232268,4,20,84,0,
7488121,0,112,0,101, 7524121,0,112,0,101,
74890,110,0,97,0, 75250,110,0,97,0,
7490109,0,101,0,95, 7526109,0,101,0,95,
74910,52,0,1,339, 75270,51,0,1,339,
74921,3,1,2,1, 75281,3,1,2,1,
74931,2256,22,1,176, 75291,2269,22,1,175,
74941,5,2257,17,2258, 75301,6,2270,17,2271,
749515,2238,1,-1,1, 753115,2246,1,-1,1,
74965,2259,20,2260,4, 75325,2272,20,2273,4,
749720,84,0,121,0, 753320,84,0,121,0,
7498112,0,101,0,110, 7534112,0,101,0,110,
74990,97,0,109,0, 75350,97,0,109,0,
7500101,0,95,0,51, 7536101,0,95,0,50,
75010,1,338,1,3, 75370,1,338,1,3,
75021,2,1,1,2261, 75381,2,1,1,2274,
750322,1,175,1,6, 753922,1,174,1,7,
75042262,17,2263,15,2238, 75402275,17,2276,15,2246,
75051,-1,1,5,2264, 75411,-1,1,5,2277,
750620,2265,4,20,84, 754220,2278,4,20,84,
75070,121,0,112,0, 75430,121,0,112,0,
7508101,0,110,0,97, 7544101,0,110,0,97,
75090,109,0,101,0, 75450,109,0,101,0,
751095,0,50,0,1, 754695,0,49,0,1,
7511337,1,3,1,2, 7547337,1,3,1,2,
75121,1,2266,22,1, 75481,1,2279,22,1,
7513174,1,7,2267,17, 7549173,1,2518,2280,16,
75142268,15,2238,1,-1, 75500,499,1,9,1238,
75151,5,2269,20,2270, 75511,10,1893,1,262,
75164,20,84,0,121, 75521244,1,1267,1250,1,
75170,112,0,101,0, 75531521,1255,1,1773,2281,
7518110,0,97,0,109, 755416,0,261,1,2528,
75190,101,0,95,0, 75551927,1,19,1272,1,
752049,0,1,336,1, 755620,2282,16,0,161,
75213,1,2,1,1, 75571,2532,2283,17,2284,
75222271,22,1,173,1, 755815,2285,4,66,37,
75231514,1230,1,9,1235,
75241,10,1889,1,262,
75251241,1,1267,1247,1,
75262775,2272,16,0,792,
75271,1521,1252,1,1773,
75282273,16,0,264,1,
75292527,1895,1,19,1269,
75301,20,2274,16,0,
7531161,1,2531,2275,17,
75322276,15,2277,4,66,
753337,0,73,0,110,
75340,116,0,86,0,
7535101,0,99,0,86,
75360,101,0,99,0,
753765,0,114,0,103,
75380,117,0,109,0,
7539101,0,110,0,116,
75400,68,0,101,0,
754199,0,108,0,97,
75420,114,0,97,0,
7543116,0,105,0,111,
75440,110,0,76,0,
7545105,0,115,0,116,
75460,1,-1,1,5,
75472278,20,2279,4,68,
754873,0,110,0,116,
75490,86,0,101,0,
755099,0,86,0,101,
75510,99,0,65,0,
7552114,0,103,0,117,
75530,109,0,101,0,
7554110,0,116,0,68,
75550,101,0,99,0,
7556108,0,97,0,114,
75570,97,0,116,0,
7558105,0,111,0,110,
75590,76,0,105,0,
7560115,0,116,0,95,
75610,49,0,1,210,
75621,3,1,6,1,
75635,2280,22,1,46,
75641,2281,1276,1,525,
75651339,1,30,1904,1,
75661002,1715,1,283,1295,
75671,2546,2281,17,2282,
756815,2283,4,66,37,
75690,73,0,110,0, 75590,73,0,110,0,
7570116,0,82,0,111, 7560116,0,86,0,101,
75710,116,0,82,0, 75610,99,0,86,0,
7572111,0,116,0,65, 7562101,0,99,0,65,
75730,114,0,103,0, 75630,114,0,103,0,
7574117,0,109,0,101, 7564117,0,109,0,101,
75750,110,0,116,0, 75650,110,0,116,0,
@@ -7579,12 +7569,12 @@ public yyLSLSyntax
75790,105,0,111,0, 75690,105,0,111,0,
7580110,0,76,0,105, 7570110,0,76,0,105,
75810,115,0,116,0, 75710,115,0,116,0,
75821,-1,1,5,2284, 75721,-1,1,5,2286,
758320,2285,4,68,73, 757320,2287,4,68,73,
75840,110,0,116,0, 75740,110,0,116,0,
758582,0,111,0,116, 757586,0,101,0,99,
75860,82,0,111,0, 75760,86,0,101,0,
7587116,0,65,0,114, 757799,0,65,0,114,
75880,103,0,117,0, 75780,103,0,117,0,
7589109,0,101,0,110, 7579109,0,101,0,110,
75900,116,0,68,0, 75800,116,0,68,0,
@@ -7594,34 +7584,54 @@ public yyLSLSyntax
75940,111,0,110,0, 75840,111,0,110,0,
759576,0,105,0,115, 758576,0,105,0,115,
75960,116,0,95,0, 75860,116,0,95,0,
759749,0,1,209,1, 758749,0,1,211,1,
75983,1,6,1,5, 75883,1,6,1,5,
75992286,22,1,45,1, 75892288,22,1,46,1,
76002547,2287,16,0,519, 75902533,2289,16,0,518,
76011,1010,2288,16,0, 75911,30,1901,1,283,
7602701,1,40,1300,1, 75921299,1,2543,1906,1,
760341,1916,1,42,1920, 75932547,2290,17,2291,15,
76041,44,1306,1,2555, 75942292,4,66,37,0,
76052289,16,0,645,1, 759573,0,110,0,116,
76061260,1218,1,47,1307, 75960,82,0,111,0,
76071,48,1313,1,49, 7597116,0,82,0,111,
76081319,1,50,1324,1, 75980,116,0,65,0,
760951,1329,1,2562,2290, 7599114,0,103,0,117,
761017,2291,15,2292,4, 76000,109,0,101,0,
761154,37,0,73,0, 7601110,0,116,0,68,
7612110,0,116,0,65, 76020,101,0,99,0,
76130,114,0,103,0, 7603108,0,97,0,114,
7614117,0,109,0,101, 76040,97,0,116,0,
76150,110,0,116,0, 7605105,0,111,0,110,
761668,0,101,0,99, 76060,76,0,105,0,
76170,108,0,97,0, 7607115,0,116,0,1,
7618114,0,97,0,116, 7608-1,1,5,2293,20,
76190,105,0,111,0, 76092294,4,68,73,0,
7620110,0,76,0,105, 7610110,0,116,0,82,
76210,115,0,116,0, 76110,111,0,116,0,
76221,-1,1,5,2293, 761282,0,111,0,116,
762320,2294,4,56,73, 76130,65,0,114,0,
76240,110,0,116,0, 7614103,0,117,0,109,
76150,101,0,110,0,
7616116,0,68,0,101,
76170,99,0,108,0,
761897,0,114,0,97,
76190,116,0,105,0,
7620111,0,110,0,76,
76210,105,0,115,0,
7622116,0,95,0,49,
76230,1,210,1,3,
76241,6,1,5,2295,
762522,1,45,1,2548,
76262296,16,0,650,1,
76271010,2297,16,0,716,
76281,40,1304,1,41,
76291913,1,42,1917,1,
763044,1310,1,2555,2298,
763117,2299,15,2300,4,
763260,37,0,86,0,
7633101,0,99,0,116,
76340,111,0,114,0,
762565,0,114,0,103, 763565,0,114,0,103,
76260,117,0,109,0, 76360,117,0,109,0,
7627101,0,110,0,116, 7637101,0,110,0,116,
@@ -7631,16 +7641,30 @@ public yyLSLSyntax
7631116,0,105,0,111, 7641116,0,105,0,111,
76320,110,0,76,0, 76420,110,0,76,0,
7633105,0,115,0,116, 7643105,0,115,0,116,
76340,95,0,49,0, 76440,1,-1,1,5,
76351,207,1,3,1, 76452301,20,2302,4,62,
76362,1,1,2295,22, 764686,0,101,0,99,
76371,43,1,2563,2296, 76470,116,0,111,0,
763816,0,661,1,305, 7648114,0,65,0,114,
76391334,1,2576,2297,16, 76490,103,0,117,0,
76400,571,1,2570,2298, 7650109,0,101,0,110,
764117,2299,15,2300,4, 76510,116,0,68,0,
764254,37,0,75,0, 7652101,0,99,0,108,
7643101,0,121,0,65, 76530,97,0,114,0,
765497,0,116,0,105,
76550,111,0,110,0,
765676,0,105,0,115,
76570,116,0,95,0,
765849,0,1,209,1,
76593,1,2,1,1,
76602303,22,1,44,1,
76611260,1221,1,47,1311,
76621,48,1317,1,49,
76631323,1,50,1328,1,
766451,1333,1,2563,2304,
766517,2305,15,2306,4,
766654,37,0,73,0,
7667110,0,116,0,65,
76440,114,0,103,0, 76680,114,0,103,0,
7645117,0,109,0,101, 7669117,0,109,0,101,
76460,110,0,116,0, 76700,110,0,116,0,
@@ -7650,9 +7674,9 @@ public yyLSLSyntax
76500,105,0,111,0, 76740,105,0,111,0,
7651110,0,76,0,105, 7675110,0,76,0,105,
76520,115,0,116,0, 76760,115,0,116,0,
76531,-1,1,5,2301, 76771,-1,1,5,2307,
765420,2302,4,56,75, 767820,2308,4,56,73,
76550,101,0,121,0, 76790,110,0,116,0,
765665,0,114,0,103, 768065,0,114,0,103,
76570,117,0,109,0, 76810,117,0,109,0,
7658101,0,110,0,116, 7682101,0,110,0,116,
@@ -7663,23 +7687,26 @@ public yyLSLSyntax
76630,110,0,76,0, 76870,110,0,76,0,
7664105,0,115,0,116, 7688105,0,115,0,116,
76650,95,0,49,0, 76890,95,0,49,0,
76661,206,1,3,1, 76901,208,1,3,1,
76672,1,1,2303,22, 76912,1,1,2309,22,
76681,42,1,61,2304, 76921,43,1,305,1338,
766916,0,220,1,63, 76931,1514,1233,1,525,
76701345,1,66,1351,1, 76941343,1,61,2310,16,
767167,1356,1,68,1361, 76950,217,1,2572,2311,
76721,69,1366,1,70, 769616,0,689,1,63,
76731371,1,2581,1926,1, 76971349,1,66,1355,1,
767473,2305,16,0,230, 769867,1360,1,68,1365,
76751,74,1376,1,1013, 76991,69,1370,1,70,
76761381,1,2335,2306,16, 77001375,1,2582,1936,1,
76770,266,1,1332,1386, 770173,2312,16,0,227,
76781,1048,1462,1,2590, 77021,827,1457,1,1013,
76792307,16,0,774,1, 77031385,1,2335,2313,16,
768082,1403,1,1840,2308, 77040,263,1,1332,1390,
768116,0,338,1,2516, 77051,74,1380,1,2591,
76822309,17,2310,15,2311, 77062314,16,0,710,1,
770782,1407,1,2513,1886,
77081,1341,1424,1,2517,
77092315,17,2316,15,2317,
76834,66,37,0,75, 77104,66,37,0,75,
76840,101,0,121,0, 77110,101,0,121,0,
768573,0,110,0,116, 771273,0,110,0,116,
@@ -7694,7 +7721,7 @@ public yyLSLSyntax
76940,111,0,110,0, 77210,111,0,110,0,
769576,0,105,0,115, 772276,0,105,0,115,
76960,116,0,1,-1, 77230,116,0,1,-1,
76971,5,2312,20,2313, 77241,5,2318,20,2319,
76984,68,75,0,101, 77254,68,75,0,101,
76990,121,0,73,0, 77260,121,0,73,0,
7700110,0,116,0,73, 7727110,0,116,0,73,
@@ -7709,63 +7736,55 @@ public yyLSLSyntax
77090,110,0,76,0, 77360,110,0,76,0,
7710105,0,115,0,116, 7737105,0,115,0,116,
77110,95,0,49,0, 77380,95,0,49,0,
77121,211,1,3,1, 77391,212,1,3,1,
77136,1,5,2314,22, 77406,1,5,2320,22,
77141,47,1,2517,2315, 77411,47,1,328,1429,
771516,0,487,1,328, 77421,1303,1434,1,1096,
77161425,1,1303,1430,1, 77431439,1,93,1445,1,
77171096,1694,1,93,1435, 77441550,1450,1,2281,1279,
77181,1550,1440,1,827, 77451,2770,1925,1,352,
77191448,1,2532,2316,16, 77461475,1,2779,2321,16,
77200,628,1,1011,1224, 77470,797,1,107,1464,
77211,107,1455,1,1114, 77481,1114,1469,1,1048,
77221461,1,2542,1909,1, 77491470,1,1871,2322,16,
77231871,2317,16,0,348, 77500,353,1,1370,1578,
77241,1370,1570,1,1478, 77511,1478,1583,1,118,
77251575,1,118,1473,1, 77521481,1,1123,1486,1,
77261123,1478,1,371,1483, 7753371,1491,1,1377,1497,
77271,1377,1489,1,375, 77541,375,1502,1,1882,
77281494,1,1882,2318,16, 77552323,16,0,373,1,
77290,363,1,377,1499, 7756377,1507,1,2556,2324,
77301,352,1467,1,379, 775716,0,661,1,379,
77311504,1,1341,1420,1, 77581512,1,380,1517,1,
7732130,1532,1,2074,2319, 7759130,1540,1,2074,2325,
773316,0,641,1,373, 776016,0,652,1,373,
77341527,1,1012,2320,16, 77611535,1,2564,2326,16,
77350,703,1,380,1509, 77620,554,1,1011,1227,
77361,143,1537,1,1152, 77631,1012,2327,16,0,
77371543,1,1406,1548,1, 7764718,1,1840,2328,16,
77381159,1555,1,157,1560, 77650,343,1,143,1545,
77391,1413,1565,1,883, 77661,1152,1551,1,2577,
77401515,1,2512,1882,1, 77672329,16,0,696,1,
77411296,1290,1,172,1586, 77681406,1556,1,1159,1563,
77421,1665,1591,1,2766, 77691,157,1568,1,1413,
77431934,1,1939,2321,16, 77701573,1,883,1523,1,
77440,482,1,1188,1596, 77711094,2330,16,0,787,
77451,1442,1601,1,188, 77721,1296,1294,1,172,
77461635,1,942,1607,1, 77731595,1,1665,1600,1,
77471195,1613,1,1449,1618, 77741939,2331,16,0,494,
77481,1701,1623,1,447, 77751,1188,1605,1,1442,
77491628,1,1094,2322,16, 77761610,1,188,1644,1,
77500,785,1,205,1640, 7777942,1616,1,1195,1622,
77511,2554,2323,17,2324, 77781,1449,1627,1,1701,
775215,2325,4,60,37, 77791632,1,447,1637,1,
77530,86,0,101,0, 7780205,1649,1,2467,1942,
775499,0,116,0,111, 77811,464,1948,1,2197,
77550,114,0,65,0, 77822332,16,0,782,1,
7756114,0,103,0,117, 77831224,1654,1,223,1659,
77570,109,0,101,0, 77841,1730,1664,1,2571,
7758110,0,116,0,68, 77852333,17,2334,15,2335,
77590,101,0,99,0, 77864,54,37,0,75,
7760108,0,97,0,114, 77870,101,0,121,0,
77610,97,0,116,0,
7762105,0,111,0,110,
77630,76,0,105,0,
7764115,0,116,0,1,
7765-1,1,5,2326,20,
77662327,4,62,86,0,
7767101,0,99,0,116,
77680,111,0,114,0,
776965,0,114,0,103, 778865,0,114,0,103,
77700,117,0,109,0, 77890,117,0,109,0,
7771101,0,110,0,116, 7790101,0,110,0,116,
@@ -7775,2175 +7794,2120 @@ public yyLSLSyntax
7775116,0,105,0,111, 7794116,0,105,0,111,
77760,110,0,76,0, 77950,110,0,76,0,
7777105,0,115,0,116, 7796105,0,115,0,116,
77780,95,0,49,0, 77970,1,-1,1,5,
77791,208,1,3,1, 77982336,20,2337,4,56,
77802,1,1,2328,22, 779975,0,101,0,121,
77811,44,1,2467,1938, 78000,65,0,114,0,
77821,464,1944,1,2197, 7801103,0,117,0,109,
77832329,16,0,772,1, 78020,101,0,110,0,
77841224,1645,1,223,1650, 7803116,0,68,0,101,
77851,1730,1655,1,2571, 78040,99,0,108,0,
77862330,16,0,673,1, 780597,0,114,0,97,
7787477,1666,1,1231,1671, 78060,116,0,105,0,
77881,479,1676,1,480, 7807111,0,110,0,76,
77891681,1,1485,1687,1, 78080,105,0,115,0,
7790459,1949,1,476,1660, 7809116,0,95,0,49,
77911,242,1700,1,478, 78100,1,207,1,3,
77921705,1,481,1951,1, 78111,2,1,1,2338,
77931001,1710,1,2508,1956, 781222,1,42,1,477,
77941,18,2331,19,564, 78131675,1,1231,1680,1,
77951,18,2332,5,84, 7814479,1685,1,480,1690,
77961,1011,1224,1,1012, 78151,1485,1696,1,459,
77972333,16,0,562,1, 78161953,1,476,1669,1,
77981013,1381,1,262,1241, 7817242,1703,1,478,1708,
77991,1267,2334,16,0, 78181,481,1955,1,1001,
7800562,1,515,2335,16, 78191713,1,1002,1718,1,
78010,562,1,1521,2336, 78202509,1960,1,18,2339,
780216,0,562,1,525, 782119,574,1,18,2340,
78031339,1,2788,2337,16, 78225,84,1,1011,1227,
78040,562,1,283,1295, 78231,1012,2341,16,0,
78051,2299,2338,16,0, 7824572,1,1013,1385,1,
7806562,1,42,2339,16, 7825262,1244,1,1267,2342,
78070,562,1,40,1300, 782616,0,572,1,515,
78081,44,1306,1,47, 78272343,16,0,572,1,
78091307,1,1303,2340,16, 78281521,2344,16,0,572,
78100,562,1,1555,2341, 78291,525,1343,1,2792,
781116,0,562,1,50, 78302345,16,0,572,1,
78121324,1,48,1313,1, 7831283,1299,1,2299,2346,
781349,1319,1,51,1329, 783216,0,572,1,42,
78141,63,1345,1,305, 78332347,16,0,572,1,
78151334,1,66,1351,1, 783440,1304,1,44,1310,
781667,1356,1,68,1361, 78351,47,1311,1,1303,
78171,69,1366,1,70, 78362348,16,0,572,1,
78181371,1,73,2342,16, 78371555,2349,16,0,572,
78190,562,1,74,1376, 78381,50,1328,1,48,
78201,328,1425,1,1048, 78391317,1,49,1323,1,
78212343,16,0,562,1, 784051,1333,1,63,1349,
782282,2344,16,0,562, 78411,305,1338,1,66,
78231,1840,2345,16,0, 78421355,1,67,1360,1,
7824562,1,1591,2346,16, 784368,1365,1,69,1370,
78250,562,1,1341,2347, 78441,70,1375,1,73,
782616,0,562,1,1096, 78452350,16,0,572,1,
78271694,1,93,1435,1, 784674,1380,1,328,1429,
7828352,1467,1,107,2348, 78471,1048,2351,16,0,
782916,0,562,1,1114, 7848572,1,82,2352,16,
78301461,1,118,2349,16, 78490,572,1,1840,2353,
78310,562,1,1123,2350, 785016,0,572,1,1591,
783216,0,562,1,371, 78512354,16,0,572,1,
78331483,1,1628,2351,16, 78521341,2355,16,0,572,
78340,562,1,375,1494, 78531,1096,1439,1,93,
78351,1882,2352,16,0, 78541445,1,352,1475,1,
7836562,1,377,1499,1, 7855107,2356,16,0,572,
7837379,1504,1,380,1509, 78561,1114,1469,1,118,
78381,883,2353,16,0, 78572357,16,0,572,1,
7839562,1,373,1527,1, 78581123,2358,16,0,572,
7840130,2354,16,0,562, 78591,371,1491,1,1628,
78411,143,2355,16,0, 78602359,16,0,572,1,
7842562,1,387,2356,16, 7861375,1502,1,1882,2360,
78430,562,1,1159,2357, 786216,0,572,1,377,
784416,0,562,1,157, 78631507,1,379,1512,1,
78452358,16,0,562,1, 7864380,1517,1,883,2361,
78461413,2359,16,0,562, 786516,0,572,1,373,
78471,1665,2360,16,0, 78661535,1,130,2362,16,
7848562,1,412,2361,16, 78670,572,1,143,2363,
78490,562,1,1377,2362, 786816,0,572,1,387,
785016,0,562,1,172, 78692364,16,0,572,1,
78512363,16,0,562,1, 78701159,2365,16,0,572,
78521939,2364,16,0,562, 78711,157,2366,16,0,
78531,437,2365,16,0, 7872572,1,1413,2367,16,
7854562,1,188,2366,16, 78730,572,1,1665,2368,
78550,562,1,942,2367, 787416,0,572,1,412,
785616,0,562,1,1195, 78752369,16,0,572,1,
78572368,16,0,562,1, 78761377,2370,16,0,572,
78581449,2369,16,0,562, 78771,172,2371,16,0,
78591,1701,2370,16,0, 7878572,1,1939,2372,16,
7860562,1,447,1628,1, 78790,572,1,437,2373,
7861205,2371,16,0,562, 788016,0,572,1,188,
78621,827,2372,16,0, 78812374,16,0,572,1,
7863562,1,223,2373,16, 7882942,2375,16,0,572,
78640,562,1,476,1660, 78831,1195,2376,16,0,
78651,477,1666,1,1231, 7884572,1,1449,2377,16,
78662374,16,0,562,1, 78850,572,1,1701,2378,
7867479,1676,1,480,1681, 788616,0,572,1,447,
78681,1485,2375,16,0, 78871637,1,205,2379,16,
7869562,1,1737,2376,16, 78880,572,1,827,2380,
78700,562,1,242,2377, 788916,0,572,1,223,
787116,0,562,1,478, 78902381,16,0,572,1,
78721705,1,1001,1710,1, 7891476,1669,1,477,1675,
78731002,1715,1,19,2378, 78921,1231,2382,16,0,
787419,254,1,19,2379, 7893572,1,479,1685,1,
78755,176,1,256,2380, 7894480,1690,1,1485,2383,
787616,0,252,1,1261, 789516,0,572,1,1737,
78772381,16,0,252,1, 78962384,16,0,572,1,
78781011,1224,1,1012,2382, 7897242,2385,16,0,572,
787916,0,521,1,2458, 78981,478,1708,1,1001,
7880998,1,262,1241,1, 78991713,1,1002,1718,1,
78811267,2383,16,0,521, 790019,2386,19,251,1,
78821,2021,840,1,1521, 790119,2387,5,176,1,
78832384,16,0,521,1, 7902942,2388,16,0,537,
78841775,2385,16,0,252, 79031,256,2389,16,0,
78851,2029,847,1,2030, 7904249,1,1261,2390,16,
7886853,1,2031,858,1, 79050,249,1,1011,1227,
78872032,863,1,2033,868, 79061,1012,2391,16,0,
78881,277,2386,16,0, 7907537,1,2458,1001,1,
7889252,1,2788,2387,16, 7908262,1244,1,1267,2392,
78900,521,1,2037,879, 790916,0,537,1,2021,
78911,2039,884,1,32, 7910843,1,1521,2393,16,
78922388,16,0,252,1, 79110,537,1,1775,2394,
78932464,1021,1,2293,2389, 791216,0,249,1,2029,
789416,0,252,1,2043, 7913850,1,2030,856,1,
7895896,1,2045,901,1, 79142031,861,1,2032,866,
78962299,2390,16,0,521, 79151,2786,2395,16,0,
78971,41,2391,16,0, 7916249,1,277,2396,16,
7898252,1,42,2392,16, 79170,249,1,2035,877,
78990,521,1,40,1300, 79181,2037,882,1,2792,
79001,44,1306,1,43, 79192397,16,0,537,1,
79012393,16,0,252,1, 792032,2398,16,0,249,
79021804,2394,16,0,252, 79211,2464,1024,1,2293,
79031,48,1313,1,49, 79222399,16,0,249,1,
79041319,1,47,1307,1, 79232043,899,1,2045,904,
790551,1329,1,52,2395, 79241,2299,2400,16,0,
790616,0,252,1,50, 7925537,1,41,2401,16,
79071324,1,305,1334,1, 79260,249,1,42,2402,
79081096,1694,1,1515,2396, 792716,0,537,1,40,
790916,0,252,1,2318, 79281304,1,44,1310,1,
79102397,16,0,252,1, 792943,2403,16,0,249,
7911283,1295,1,63,1345, 79301,1804,2404,16,0,
79121,66,1351,1,67, 7931249,1,48,1317,1,
79131356,1,68,1361,1, 793249,1323,1,47,1311,
791469,1366,1,70,1371, 79331,51,1333,1,52,
79151,71,2398,16,0, 79342405,16,0,249,1,
7916252,1,73,2399,16, 793550,1328,1,305,1338,
79170,521,1,74,1376, 79361,1096,1439,1,1515,
79181,1013,1381,1,76, 79372406,16,0,249,1,
79192400,16,0,252,1, 79382318,2407,16,0,249,
79201834,2401,16,0,252, 79391,283,1299,1,63,
79211,2337,2402,16,0, 79401349,1,66,1355,1,
7922252,1,79,2403,16, 794167,1360,1,68,1365,
79230,252,1,1335,2404, 79421,69,1370,1,70,
792416,0,252,1,299, 79431375,1,71,2408,16,
79252405,16,0,252,1, 79440,249,1,73,2409,
792682,2406,16,0,521, 794516,0,537,1,74,
79271,1840,2407,16,0, 79461380,1,1013,1385,1,
7928521,1,1297,2408,16, 794776,2410,16,0,249,
79290,252,1,85,2409, 79481,1834,2411,16,0,
793016,0,252,1,1341, 7949249,1,2337,2412,16,
79312410,16,0,521,1, 79500,249,1,79,2413,
793289,2411,16,0,252, 795116,0,249,1,1335,
79331,1303,2412,16,0, 79522414,16,0,249,1,
7934521,1,2035,874,1, 7953299,2415,16,0,249,
793593,1435,1,322,2413, 79541,82,2416,16,0,
793616,0,252,1,97, 7955537,1,1840,2417,16,
79372414,16,0,252,1, 79560,537,1,1297,2418,
79382041,890,1,1555,2415, 795716,0,249,1,85,
793916,0,521,1,827, 79582419,16,0,249,1,
79402416,16,0,521,1, 79591341,2420,16,0,537,
7941102,2417,16,0,252, 79601,89,2421,16,0,
79421,1860,943,1,1803, 7961249,1,1303,2422,16,
7943909,1,2364,949,1, 79620,537,1,509,2423,
7944107,2418,16,0,521, 796316,0,249,1,93,
79451,509,2419,16,0, 79641445,1,322,2424,16,
7946252,1,1114,1461,1, 79650,249,1,2039,887,
7947112,2420,16,0,252, 79661,97,2425,16,0,
79481,1117,2421,16,0, 7967249,1,2041,893,1,
7949252,1,352,1467,1, 79681555,2426,16,0,537,
79501873,958,1,118,2422, 79691,827,2427,16,0,
795116,0,521,1,1123, 7970537,1,102,2428,16,
79522423,16,0,521,1, 79710,249,1,1860,946,
7953371,1483,1,515,2424, 79721,1803,912,1,2364,
795416,0,521,1,1377, 7973952,1,107,2429,16,
79552425,16,0,521,1, 79740,537,1,1114,1469,
7956124,2426,16,0,252, 79751,112,2430,16,0,
79571,1882,2427,16,0, 7976249,1,1117,2431,16,
7958521,1,377,1499,1, 79770,249,1,352,1475,
7959379,1504,1,380,1509, 79781,1873,961,1,118,
79601,130,2428,16,0, 79792432,16,0,537,1,
7961521,1,346,2429,16, 79801123,2433,16,0,537,
79620,252,1,2075,2430, 79811,371,1491,1,515,
796316,0,252,1,373, 79822434,16,0,537,1,
79641527,1,387,2431,16, 79831377,2435,16,0,537,
79650,521,1,137,2432, 79841,124,2436,16,0,
796616,0,252,1,143, 7985249,1,1882,2437,16,
79672433,16,0,521,1, 79860,537,1,377,1507,
79681901,2434,16,0,252, 79871,379,1512,1,380,
79691,1048,2435,16,0, 79881517,1,130,2438,16,
7970521,1,1153,2436,16, 79890,537,1,346,2439,
79710,252,1,375,1494, 799016,0,249,1,2075,
79721,151,2437,16,0, 79912440,16,0,249,1,
7973252,1,1407,2438,16, 7992373,1535,1,387,2441,
79740,252,1,1659,2439, 799316,0,537,1,137,
797516,0,252,1,2413, 79942442,16,0,249,1,
79762440,16,0,252,1, 7995143,2443,16,0,537,
79771159,2441,16,0,521, 79961,1901,2444,16,0,
79781,381,2442,16,0, 7997249,1,1048,2445,16,
7979252,1,157,2443,16, 79980,537,1,1153,2446,
79800,521,1,1413,2444, 799916,0,249,1,375,
798116,0,521,1,883, 80001502,1,151,2447,16,
79822445,16,0,521,1, 80010,249,1,1407,2448,
79831371,2446,16,0,252, 800216,0,249,1,1659,
79841,328,1425,1,2105, 80032449,16,0,249,1,
7985936,1,2106,2447,16, 80042413,2450,16,0,249,
79860,252,1,166,2448, 80051,1159,2451,16,0,
798716,0,252,1,525, 8006537,1,381,2452,16,
79882449,16,0,252,1, 80070,249,1,157,2453,
79891622,2450,16,0,252, 800816,0,537,1,1413,
79901,406,2451,16,0, 80092454,16,0,537,1,
7991252,1,1574,921,1, 8010883,2455,16,0,537,
7992172,2452,16,0,521, 80111,1371,2456,16,0,
79931,1931,983,1,412, 8012249,1,328,1429,1,
79942453,16,0,521,1, 80132105,939,1,2106,2457,
79951933,2454,16,0,252, 801416,0,249,1,166,
79961,1876,2455,16,0, 80152458,16,0,249,1,
7997252,1,431,2456,16, 8016525,2459,16,0,249,
79980,252,1,1585,2457, 80171,1622,2460,16,0,
799916,0,252,1,182, 8018249,1,406,2461,16,
80002458,16,0,252,1, 80190,249,1,1574,924,
80011628,2459,16,0,521, 80201,172,2462,16,0,
80021,1189,2460,16,0, 8021537,1,1931,986,1,
8003252,1,437,2461,16, 8022412,2463,16,0,537,
80040,521,1,1591,2462, 80231,1933,2464,16,0,
800516,0,521,1,188, 8024249,1,1876,2465,16,
80062463,16,0,521,1, 80250,249,1,431,2466,
80071695,2464,16,0,252, 802616,0,249,1,1585,
80081,2198,2465,16,0, 80272467,16,0,249,1,
8009252,1,1195,2466,16, 8028182,2468,16,0,249,
80100,521,1,1449,2467, 80291,1628,2469,16,0,
801116,0,521,1,1701, 8030537,1,1189,2470,16,
80122468,16,0,521,1, 80310,249,1,437,2471,
8013447,2469,16,0,252, 803216,0,537,1,1591,
80141,2782,2470,16,0, 80332472,16,0,537,1,
8015252,1,199,2471,16, 8034188,2473,16,0,537,
80160,252,1,2459,1004, 80351,1695,2474,16,0,
80171,1958,2472,16,0, 8036249,1,2198,2475,16,
8018252,1,2462,1011,1, 80370,249,1,1195,2476,
80191657,1016,1,205,2473, 803816,0,537,1,1449,
802016,0,521,1,459, 80392477,16,0,537,1,
80212474,16,0,252,1, 80401701,2478,16,0,537,
8022462,2475,16,0,252, 80411,447,2479,16,0,
80231,1665,2476,16,0, 8042249,1,199,2480,16,
8024521,1,217,2477,16, 80430,249,1,2459,1007,
80250,252,1,2227,1030, 80441,1958,2481,16,0,
80261,942,2478,16,0, 8045249,1,2462,1014,1,
8027521,1,1225,2479,16, 80461657,1019,1,205,2482,
80280,252,1,223,2480, 804716,0,537,1,459,
802916,0,521,1,1479, 80482483,16,0,249,1,
80302481,16,0,252,1, 8049462,2484,16,0,249,
80311731,2482,16,0,252, 80501,1665,2485,16,0,
80321,477,1666,1,1231, 8051537,1,217,2486,16,
80332483,16,0,521,1, 80520,249,1,2227,1033,
8034479,1676,1,480,1681, 80531,2033,871,1,1225,
80351,1485,2484,16,0, 80542487,16,0,249,1,
8036521,1,1737,2485,16, 8055223,2488,16,0,537,
80370,521,1,1989,1038, 80561,1479,2489,16,0,
80381,1990,2486,16,0, 8057249,1,1731,2490,16,
8039252,1,1443,2487,16, 80580,249,1,477,1675,
80400,252,1,236,2488, 80591,1231,2491,16,0,
804116,0,252,1,2136, 8060537,1,479,1685,1,
8042965,1,476,1660,1, 8061480,1690,1,1485,2492,
8043242,2489,16,0,521, 806216,0,537,1,1737,
80441,478,1705,1,1939, 80632493,16,0,537,1,
80452490,16,0,521,1, 80641989,1041,1,1990,2494,
80461001,1710,1,1002,1715, 806516,0,249,1,1443,
80471,1756,2491,16,0, 80662495,16,0,249,1,
8048252,1,20,2492,19, 8067236,2496,16,0,249,
8049496,1,20,2493,5, 80681,2136,968,1,476,
805084,1,1011,1224,1, 80691669,1,242,2497,16,
80511012,2494,16,0,494, 80700,537,1,478,1708,
80521,1013,1381,1,262, 80711,1939,2498,16,0,
80531241,1,1267,2495,16, 8072537,1,1001,1713,1,
80540,494,1,515,2496, 80731002,1718,1,1756,2499,
805516,0,494,1,1521, 807416,0,249,1,20,
80562497,16,0,494,1, 80752500,19,510,1,20,
8057525,1339,1,2788,2498, 80762501,5,84,1,1011,
805816,0,494,1,283, 80771227,1,1012,2502,16,
80591295,1,2299,2499,16, 80780,508,1,1013,1385,
80600,494,1,42,2500, 80791,262,1244,1,1267,
806116,0,494,1,40, 80802503,16,0,508,1,
80621300,1,44,1306,1, 8081515,2504,16,0,508,
806347,1307,1,1303,2501, 80821,1521,2505,16,0,
806416,0,494,1,1555, 8083508,1,525,1343,1,
80652502,16,0,494,1, 80842792,2506,16,0,508,
806650,1324,1,48,1313, 80851,283,1299,1,2299,
80671,49,1319,1,51, 80862507,16,0,508,1,
80681329,1,63,1345,1, 808742,2508,16,0,508,
8069305,1334,1,66,1351, 80881,40,1304,1,44,
80701,67,1356,1,68, 80891310,1,47,1311,1,
80711361,1,69,1366,1, 80901303,2509,16,0,508,
807270,1371,1,73,2503, 80911,1555,2510,16,0,
807316,0,494,1,74, 8092508,1,50,1328,1,
80741376,1,328,2504,16, 809348,1317,1,49,1323,
80750,494,1,1048,2505, 80941,51,1333,1,63,
807616,0,494,1,82, 80951349,1,305,1338,1,
80772506,16,0,494,1, 809666,1355,1,67,1360,
80781840,2507,16,0,494, 80971,68,1365,1,69,
80791,1591,2508,16,0, 80981370,1,70,1375,1,
8080494,1,1341,2509,16, 809973,2511,16,0,508,
80810,494,1,1096,1694, 81001,74,1380,1,328,
80821,93,1435,1,352, 81012512,16,0,508,1,
80832510,16,0,494,1, 81021048,2513,16,0,508,
8084107,2511,16,0,494, 81031,82,2514,16,0,
80851,1114,1461,1,118, 8104508,1,1840,2515,16,
80862512,16,0,494,1, 81050,508,1,1591,2516,
80871123,2513,16,0,494, 810616,0,508,1,1341,
80881,371,1483,1,1628, 81072517,16,0,508,1,
80892514,16,0,494,1, 81081096,1439,1,93,1445,
8090375,1494,1,1882,2515, 81091,352,2518,16,0,
809116,0,494,1,377, 8110508,1,107,2519,16,
80921499,1,379,1504,1, 81110,508,1,1114,1469,
8093380,1509,1,883,2516, 81121,118,2520,16,0,
809416,0,494,1,373, 8113508,1,1123,2521,16,
80951527,1,130,2517,16, 81140,508,1,371,1491,
80960,494,1,143,2518, 81151,1628,2522,16,0,
809716,0,494,1,387, 8116508,1,375,1502,1,
80982519,16,0,494,1, 81171882,2523,16,0,508,
80991159,2520,16,0,494, 81181,377,1507,1,379,
81001,157,2521,16,0, 81191512,1,380,1517,1,
8101494,1,1413,2522,16, 8120883,2524,16,0,508,
81020,494,1,1665,2523, 81211,373,1535,1,130,
810316,0,494,1,412, 81222525,16,0,508,1,
81042524,16,0,494,1, 8123143,2526,16,0,508,
81051377,2525,16,0,494, 81241,387,2527,16,0,
81061,172,2526,16,0, 8125508,1,1159,2528,16,
8107494,1,1939,2527,16, 81260,508,1,157,2529,
81080,494,1,437,2528, 812716,0,508,1,1413,
810916,0,494,1,188, 81282530,16,0,508,1,
81102529,16,0,494,1, 81291665,2531,16,0,508,
8111942,2530,16,0,494, 81301,412,2532,16,0,
81121,1195,2531,16,0, 8131508,1,1377,2533,16,
8113494,1,1449,2532,16, 81320,508,1,172,2534,
81140,494,1,1701,2533, 813316,0,508,1,1939,
811516,0,494,1,447, 81342535,16,0,508,1,
81161628,1,205,2534,16, 8135437,2536,16,0,508,
81170,494,1,827,2535, 81361,188,2537,16,0,
811816,0,494,1,223, 8137508,1,942,2538,16,
81192536,16,0,494,1, 81380,508,1,1195,2539,
8120476,1660,1,477,1666, 813916,0,508,1,1449,
81211,1231,2537,16,0, 81402540,16,0,508,1,
8122494,1,479,1676,1, 81411701,2541,16,0,508,
8123480,1681,1,1485,2538, 81421,447,1637,1,205,
812416,0,494,1,1737, 81432542,16,0,508,1,
81252539,16,0,494,1, 8144827,2543,16,0,508,
8126242,2540,16,0,494, 81451,223,2544,16,0,
81271,478,1705,1,1001, 8146508,1,476,1669,1,
81281710,1,1002,1715,1, 8147477,1675,1,1231,2545,
812921,2541,19,468,1, 814816,0,508,1,479,
813021,2542,5,84,1, 81491685,1,480,1690,1,
81311011,1224,1,1012,2543, 81501485,2546,16,0,508,
813216,0,466,1,1013, 81511,1737,2547,16,0,
81331381,1,262,1241,1, 8152508,1,242,2548,16,
81341267,2544,16,0,466, 81530,508,1,478,1708,
81351,515,2545,16,0, 81541,1001,1713,1,1002,
8136466,1,1521,2546,16, 81551718,1,21,2549,19,
81370,466,1,525,1339, 8156478,1,21,2550,5,
81381,2788,2547,16,0, 815784,1,1011,1227,1,
8139466,1,283,1295,1, 81581012,2551,16,0,476,
81402299,2548,16,0,466, 81591,1013,1385,1,262,
81411,42,2549,16,0, 81601244,1,1267,2552,16,
8142466,1,40,1300,1, 81610,476,1,515,2553,
814344,1306,1,47,1307, 816216,0,476,1,1521,
81441,1303,2550,16,0, 81632554,16,0,476,1,
8145466,1,1555,2551,16, 8164525,1343,1,2792,2555,
81460,466,1,50,1324, 816516,0,476,1,283,
81471,48,1313,1,49, 81661299,1,2299,2556,16,
81481319,1,51,1329,1, 81670,476,1,42,2557,
814963,1345,1,305,1334, 816816,0,476,1,40,
81501,66,1351,1,67, 81691304,1,44,1310,1,
81511356,1,68,1361,1, 817047,1311,1,1303,2558,
815269,1366,1,70,1371, 817116,0,476,1,1555,
81531,73,2552,16,0, 81722559,16,0,476,1,
8154466,1,74,1376,1, 817350,1328,1,48,1317,
8155328,2553,16,0,466, 81741,49,1323,1,51,
81561,1048,2554,16,0, 81751333,1,63,1349,1,
8157466,1,82,2555,16, 8176305,1338,1,66,1355,
81580,466,1,1840,2556, 81771,67,1360,1,68,
815916,0,466,1,1591, 81781365,1,69,1370,1,
81602557,16,0,466,1, 817970,1375,1,73,2560,
81611341,2558,16,0,466, 818016,0,476,1,74,
81621,1096,1694,1,93, 81811380,1,328,2561,16,
81631435,1,352,2559,16, 81820,476,1,1048,2562,
81640,466,1,107,2560, 818316,0,476,1,82,
816516,0,466,1,1114, 81842563,16,0,476,1,
81661461,1,118,2561,16, 81851840,2564,16,0,476,
81670,466,1,1123,2562, 81861,1591,2565,16,0,
816816,0,466,1,371, 8187476,1,1341,2566,16,
81691483,1,1628,2563,16, 81880,476,1,1096,1439,
81700,466,1,375,1494, 81891,93,1445,1,352,
81711,1882,2564,16,0, 81902567,16,0,476,1,
8172466,1,377,1499,1, 8191107,2568,16,0,476,
8173379,1504,1,380,1509, 81921,1114,1469,1,118,
81741,883,2565,16,0, 81932569,16,0,476,1,
8175466,1,373,1527,1, 81941123,2570,16,0,476,
8176130,2566,16,0,466, 81951,371,1491,1,1628,
81771,143,2567,16,0, 81962571,16,0,476,1,
8178466,1,387,2568,16, 8197375,1502,1,1882,2572,
81790,466,1,1159,2569, 819816,0,476,1,377,
818016,0,466,1,157, 81991507,1,379,1512,1,
81812570,16,0,466,1, 8200380,1517,1,883,2573,
81821413,2571,16,0,466, 820116,0,476,1,373,
81831,1665,2572,16,0, 82021535,1,130,2574,16,
8184466,1,412,2573,16, 82030,476,1,143,2575,
81850,466,1,1377,2574, 820416,0,476,1,387,
818616,0,466,1,172, 82052576,16,0,476,1,
81872575,16,0,466,1, 82061159,2577,16,0,476,
81881939,2576,16,0,466, 82071,157,2578,16,0,
81891,437,2577,16,0, 8208476,1,1413,2579,16,
8190466,1,188,2578,16, 82090,476,1,1665,2580,
81910,466,1,942,2579, 821016,0,476,1,412,
819216,0,466,1,1195, 82112581,16,0,476,1,
81932580,16,0,466,1, 82121377,2582,16,0,476,
81941449,2581,16,0,466, 82131,172,2583,16,0,
81951,1701,2582,16,0, 8214476,1,1939,2584,16,
8196466,1,447,1628,1, 82150,476,1,437,2585,
8197205,2583,16,0,466, 821616,0,476,1,188,
81981,827,2584,16,0, 82172586,16,0,476,1,
8199466,1,223,2585,16, 8218942,2587,16,0,476,
82000,466,1,476,1660, 82191,1195,2588,16,0,
82011,477,1666,1,1231, 8220476,1,1449,2589,16,
82022586,16,0,466,1, 82210,476,1,1701,2590,
8203479,1676,1,480,1681, 822216,0,476,1,447,
82041,1485,2587,16,0, 82231637,1,205,2591,16,
8205466,1,1737,2588,16, 82240,476,1,827,2592,
82060,466,1,242,2589, 822516,0,476,1,223,
820716,0,466,1,478, 82262593,16,0,476,1,
82081705,1,1001,1710,1, 8227476,1669,1,477,1675,
82091002,1715,1,22,2590, 82281,1231,2594,16,0,
821019,419,1,22,2591, 8229476,1,479,1685,1,
82115,84,1,1011,1224, 8230480,1690,1,1485,2595,
82121,1012,2592,16,0, 823116,0,476,1,1737,
8213417,1,1013,1381,1, 82322596,16,0,476,1,
8214262,1241,1,1267,2593, 8233242,2597,16,0,476,
821516,0,417,1,515, 82341,478,1708,1,1001,
82162594,16,0,417,1, 82351713,1,1002,1718,1,
82171521,2595,16,0,417, 823622,2598,19,429,1,
82181,525,1339,1,2788, 823722,2599,5,84,1,
82192596,16,0,417,1, 82381011,1227,1,1012,2600,
8220283,1295,1,2299,2597, 823916,0,427,1,1013,
822116,0,417,1,42, 82401385,1,262,1244,1,
82222598,16,0,417,1, 82411267,2601,16,0,427,
822340,1300,1,44,1306, 82421,515,2602,16,0,
82241,47,1307,1,1303, 8243427,1,1521,2603,16,
82252599,16,0,417,1, 82440,427,1,525,1343,
82261555,2600,16,0,417, 82451,2792,2604,16,0,
82271,50,1324,1,48, 8246427,1,283,1299,1,
82281313,1,49,1319,1, 82472299,2605,16,0,427,
822951,1329,1,63,1345, 82481,42,2606,16,0,
82301,305,1334,1,66, 8249427,1,40,1304,1,
82311351,1,67,1356,1, 825044,1310,1,47,1311,
823268,1361,1,69,1366, 82511,1303,2607,16,0,
82331,70,1371,1,73, 8252427,1,1555,2608,16,
82342601,16,0,417,1, 82530,427,1,50,1328,
823574,1376,1,328,2602, 82541,48,1317,1,49,
823616,0,417,1,1048, 82551323,1,51,1333,1,
82372603,16,0,417,1, 825663,1349,1,305,1338,
823882,2604,16,0,417, 82571,66,1355,1,67,
82391,1840,2605,16,0, 82581360,1,68,1365,1,
8240417,1,1591,2606,16, 825969,1370,1,70,1375,
82410,417,1,1341,2607, 82601,73,2609,16,0,
824216,0,417,1,1096, 8261427,1,74,1380,1,
82431694,1,93,1435,1, 8262328,2610,16,0,427,
8244352,2608,16,0,417, 82631,1048,2611,16,0,
82451,107,2609,16,0, 8264427,1,82,2612,16,
8246417,1,1114,1461,1, 82650,427,1,1840,2613,
8247118,2610,16,0,417, 826616,0,427,1,1591,
82481,1123,2611,16,0, 82672614,16,0,427,1,
8249417,1,371,1483,1, 82681341,2615,16,0,427,
82501628,2612,16,0,417, 82691,1096,1439,1,93,
82511,375,1494,1,1882, 82701445,1,352,2616,16,
82522613,16,0,417,1, 82710,427,1,107,2617,
8253377,1499,1,379,1504, 827216,0,427,1,1114,
82541,380,1509,1,883, 82731469,1,118,2618,16,
82552614,16,0,417,1, 82740,427,1,1123,2619,
8256373,1527,1,130,2615, 827516,0,427,1,371,
825716,0,417,1,143, 82761491,1,1628,2620,16,
82582616,16,0,417,1, 82770,427,1,375,1502,
8259387,2617,16,0,417, 82781,1882,2621,16,0,
82601,1159,2618,16,0, 8279427,1,377,1507,1,
8261417,1,157,2619,16, 8280379,1512,1,380,1517,
82620,417,1,1413,2620, 82811,883,2622,16,0,
826316,0,417,1,1665, 8282427,1,373,1535,1,
82642621,16,0,417,1, 8283130,2623,16,0,427,
8265412,2622,16,0,417, 82841,143,2624,16,0,
82661,1377,2623,16,0, 8285427,1,387,2625,16,
8267417,1,172,2624,16, 82860,427,1,1159,2626,
82680,417,1,1939,2625, 828716,0,427,1,157,
826916,0,417,1,437, 82882627,16,0,427,1,
82702626,16,0,417,1, 82891413,2628,16,0,427,
8271188,2627,16,0,417, 82901,1665,2629,16,0,
82721,942,2628,16,0, 8291427,1,412,2630,16,
8273417,1,1195,2629,16, 82920,427,1,1377,2631,
82740,417,1,1449,2630, 829316,0,427,1,172,
827516,0,417,1,1701, 82942632,16,0,427,1,
82762631,16,0,417,1, 82951939,2633,16,0,427,
8277447,1628,1,205,2632, 82961,437,2634,16,0,
827816,0,417,1,827, 8297427,1,188,2635,16,
82792633,16,0,417,1, 82980,427,1,942,2636,
8280223,2634,16,0,417, 829916,0,427,1,1195,
82811,476,1660,1,477, 83002637,16,0,427,1,
82821666,1,1231,2635,16, 83011449,2638,16,0,427,
82830,417,1,479,1676, 83021,1701,2639,16,0,
82841,480,1681,1,1485, 8303427,1,447,1637,1,
82852636,16,0,417,1, 8304205,2640,16,0,427,
82861737,2637,16,0,417, 83051,827,2641,16,0,
82871,242,2638,16,0, 8306427,1,223,2642,16,
8288417,1,478,1705,1, 83070,427,1,476,1669,
82891001,1710,1,1002,1715, 83081,477,1675,1,1231,
82901,23,2639,19,582, 83092643,16,0,427,1,
82911,23,2640,5,38, 8310479,1685,1,480,1690,
82921,1901,2641,16,0, 83111,1485,2644,16,0,
8293580,1,2075,2642,16, 8312427,1,1737,2645,16,
82940,580,1,1860,943, 83130,427,1,242,2646,
82951,1803,909,1,1804, 831416,0,427,1,478,
82962643,16,0,580,1, 83151708,1,1001,1713,1,
82972413,2644,16,0,580, 83161002,1718,1,23,2647,
82981,2198,2645,16,0, 831719,590,1,23,2648,
8299580,1,1873,958,1, 83185,38,1,1901,2649,
83001657,1016,1,1989,1038, 831916,0,588,1,2075,
83011,1990,2646,16,0, 83202650,16,0,588,1,
8302580,1,1775,2647,16, 83211860,946,1,1803,912,
83030,580,1,32,2648, 83221,1804,2651,16,0,
830416,0,580,1,2105, 8323588,1,2413,2652,16,
8305936,1,2106,2649,16, 83240,588,1,2198,2653,
83060,580,1,2364,949, 832516,0,588,1,1873,
83071,2227,1030,1,2337, 8326961,1,1657,1019,1,
83082650,16,0,580,1, 83271989,1041,1,1990,2654,
83092021,840,1,2458,998, 832816,0,588,1,1775,
83101,2459,1004,1,2462, 83292655,16,0,588,1,
83111011,1,2136,965,1, 833032,2656,16,0,588,
83122464,1021,1,2029,847, 83311,2105,939,1,2106,
83131,2030,853,1,2031, 83322657,16,0,588,1,
8314858,1,2032,863,1, 83332364,952,1,2227,1033,
83152033,868,1,2035,874, 83341,2337,2658,16,0,
83161,2037,879,1,2039, 8335588,1,2021,843,1,
8317884,1,1931,983,1, 83362458,1001,1,2459,1007,
83182041,890,1,2043,896, 83371,2462,1014,1,2136,
83191,2045,901,1,1574, 8338968,1,2464,1024,1,
8320921,1,1958,2651,16, 83392029,850,1,2030,856,
83210,580,1,24,2652, 83401,2031,861,1,2032,
832219,196,1,24,2653, 8341866,1,2033,871,1,
83235,5,1,44,2654, 83422035,877,1,2037,882,
832416,0,194,1,377, 83431,2039,887,1,1931,
83252655,16,0,618,1, 8344986,1,2041,893,1,
832640,2656,16,0,796, 83452043,899,1,2045,904,
83271,63,2657,16,0, 83461,1574,924,1,1958,
8328222,1,373,2658,16, 83472659,16,0,588,1,
83290,614,1,25,2659, 834824,2660,19,193,1,
833019,324,1,25,2660, 834924,2661,5,5,1,
83315,177,1,256,2661, 835044,2662,16,0,191,
833216,0,623,1,1261, 83511,377,2663,16,0,
83332662,16,0,623,1, 8352626,1,40,2664,16,
83341011,1224,1,1012,2663, 83530,799,1,63,2665,
833516,0,322,1,2458, 835416,0,219,1,373,
8336998,1,262,1241,1, 83552666,16,0,622,1,
83371267,2664,16,0,322, 835625,2667,19,329,1,
83381,2021,840,1,1521, 835725,2668,5,177,1,
83392665,16,0,322,1, 8358942,1616,1,256,2669,
83401775,2666,16,0,623, 835916,0,631,1,1261,
83411,2029,847,1,2030, 83602670,16,0,631,1,
8342853,1,2031,858,1, 83611011,1227,1,1012,2671,
83432032,863,1,2033,868, 836216,0,327,1,2458,
83441,277,2667,16,0, 83631001,1,262,1244,1,
8345623,1,2788,2668,16, 83641267,2672,16,0,327,
83460,322,1,2037,879, 83651,2021,843,1,1521,
83471,2039,884,1,32, 83662673,16,0,327,1,
83482669,16,0,623,1, 83671775,2674,16,0,631,
83492464,1021,1,2293,2670, 83681,2029,850,1,2030,
835016,0,623,1,2043, 8369856,1,2031,861,1,
8351896,1,2045,901,1, 83702032,866,1,2786,2675,
83522299,2671,16,0,322, 837116,0,631,1,277,
83531,41,2672,16,0, 83722676,16,0,631,1,
8354623,1,42,2673,16, 83732035,877,1,2037,882,
83550,322,1,40,1300, 83741,2792,2677,16,0,
83561,44,1306,1,43, 8375327,1,32,2678,16,
83572674,16,0,623,1, 83760,631,1,2464,1024,
83581804,2675,16,0,623, 83771,2293,2679,16,0,
83591,48,1313,1,49, 8378631,1,2043,899,1,
83601319,1,47,1307,1, 83792045,904,1,2299,2680,
836151,1329,1,52,2676, 838016,0,327,1,41,
836216,0,623,1,50, 83812681,16,0,631,1,
83631324,1,305,1334,1, 838242,2682,16,0,327,
83641096,1694,1,1515,2677, 83831,40,1304,1,44,
836516,0,623,1,2318, 83841310,1,43,2683,16,
83662678,16,0,623,1, 83850,631,1,1804,2684,
836762,2679,16,0,623, 838616,0,631,1,48,
83681,63,1345,1,66, 83871317,1,49,1323,1,
83691351,1,67,1356,1, 838847,1311,1,51,1333,
837068,1361,1,69,1366, 83891,52,2685,16,0,
83711,70,1371,1,71, 8390631,1,50,1328,1,
83722680,16,0,623,1, 8391305,1338,1,1096,1439,
8373283,1295,1,73,2681, 83921,1515,2686,16,0,
837416,0,322,1,74, 8393631,1,2318,2687,16,
83751376,1,1013,1381,1, 83940,631,1,62,2688,
837676,2682,16,0,623, 839516,0,631,1,63,
83771,1834,2683,16,0, 83961349,1,66,1355,1,
8378623,1,2337,2684,16, 839767,1360,1,68,1365,
83790,623,1,79,2685, 83981,69,1370,1,70,
838016,0,623,1,1335, 83991375,1,71,2689,16,
83812686,16,0,623,1, 84000,631,1,283,1299,
8382299,2687,16,0,623, 84011,73,2690,16,0,
83831,82,2688,16,0, 8402327,1,74,1380,1,
8384322,1,1840,2689,16, 84031013,1385,1,76,2691,
83850,322,1,1297,2690, 840416,0,631,1,1834,
838616,0,623,1,85, 84052692,16,0,631,1,
83872691,16,0,623,1, 84062337,2693,16,0,631,
83881341,2692,16,0,322, 84071,79,2694,16,0,
83891,89,2693,16,0, 8408631,1,1335,2695,16,
8390623,1,1303,2694,16, 84090,631,1,299,2696,
83910,322,1,2035,874, 841016,0,631,1,82,
83921,93,1435,1,322, 84112697,16,0,327,1,
83932695,16,0,623,1, 84121840,2698,16,0,327,
839497,2696,16,0,623, 84131,1297,2699,16,0,
83951,2041,890,1,1555, 8414631,1,85,2700,16,
83962697,16,0,322,1, 84150,631,1,1341,2701,
8397827,2698,16,0,322, 841616,0,327,1,89,
83981,102,2699,16,0, 84172702,16,0,631,1,
8399623,1,1860,943,1, 84181303,2703,16,0,327,
84001803,909,1,2364,949, 84191,509,2704,16,0,
84011,107,2700,16,0, 8420631,1,93,1445,1,
8402322,1,509,2701,16, 8421322,2705,16,0,631,
84030,623,1,1114,1461, 84221,2039,887,1,97,
84041,112,2702,16,0, 84232706,16,0,631,1,
8405623,1,1117,2703,16, 84242041,893,1,1555,2707,
84060,623,1,352,1467, 842516,0,327,1,827,
84071,1873,958,1,118, 84262708,16,0,327,1,
84081473,1,1123,2704,16, 8427102,2709,16,0,631,
84090,322,1,371,1483, 84281,1860,946,1,1803,
84101,515,2705,16,0, 8429912,1,2364,952,1,
8411322,1,1377,2706,16, 8430107,2710,16,0,327,
84120,322,1,124,2707, 84311,1114,1469,1,112,
841316,0,623,1,1882, 84322711,16,0,631,1,
84142708,16,0,322,1, 84331117,2712,16,0,631,
8415377,1499,1,379,1504, 84341,352,1475,1,1873,
84161,380,1509,1,130, 8435961,1,118,1481,1,
84171532,1,346,2709,16, 84361123,2713,16,0,327,
84180,623,1,2075,2710, 84371,371,1491,1,515,
841916,0,623,1,373, 84382714,16,0,327,1,
84201527,1,387,2711,16, 84391377,2715,16,0,327,
84210,322,1,137,2712, 84401,124,2716,16,0,
842216,0,623,1,143, 8441631,1,1882,2717,16,
84232713,16,0,322,1, 84420,327,1,377,1507,
84241901,2714,16,0,623, 84431,379,1512,1,380,
84251,1048,1462,1,1153, 84441517,1,130,1540,1,
84262715,16,0,623,1, 8445346,2718,16,0,631,
8427375,1494,1,151,2716, 84461,2075,2719,16,0,
842816,0,623,1,1407, 8447631,1,373,1535,1,
84292717,16,0,623,1, 8448387,2720,16,0,327,
84301659,2718,16,0,623, 84491,137,2721,16,0,
84311,2413,2719,16,0, 8450631,1,143,2722,16,
8432623,1,1159,2720,16, 84510,327,1,1901,2723,
84330,322,1,381,2721, 845216,0,631,1,1048,
843416,0,623,1,157, 84531470,1,1153,2724,16,
84352722,16,0,322,1, 84540,631,1,375,1502,
84361413,2723,16,0,322, 84551,151,2725,16,0,
84371,883,2724,16,0, 8456631,1,1407,2726,16,
8438322,1,1371,2725,16, 84570,631,1,1659,2727,
84390,623,1,328,1425, 845816,0,631,1,2413,
84401,2105,936,1,2106, 84592728,16,0,631,1,
84412726,16,0,623,1, 84601159,2729,16,0,327,
8442166,2727,16,0,623, 84611,381,2730,16,0,
84431,525,2728,16,0, 8462631,1,157,2731,16,
8444623,1,1622,2729,16, 84630,327,1,1413,2732,
84450,623,1,406,2730, 846416,0,327,1,883,
844616,0,623,1,1574, 84652733,16,0,327,1,
8447921,1,172,1586,1, 84661371,2734,16,0,631,
84481931,983,1,412,2731, 84671,328,1429,1,2105,
844916,0,322,1,1933, 8468939,1,2106,2735,16,
84502732,16,0,623,1, 84690,631,1,166,2736,
84511876,2733,16,0,623, 847016,0,631,1,525,
84521,431,2734,16,0, 84712737,16,0,631,1,
8453623,1,1585,2735,16, 84721622,2738,16,0,631,
84540,623,1,182,2736, 84731,406,2739,16,0,
845516,0,623,1,1628, 8474631,1,1574,924,1,
84562737,16,0,322,1, 8475172,1595,1,1931,986,
84571189,2738,16,0,623, 84761,412,2740,16,0,
84581,437,2739,16,0, 8477327,1,1933,2741,16,
8459322,1,1591,2740,16, 84780,631,1,1876,2742,
84600,322,1,188,1635, 847916,0,631,1,431,
84611,1695,2741,16,0, 84802743,16,0,631,1,
8462623,1,2198,2742,16, 84811585,2744,16,0,631,
84630,623,1,1195,2743, 84821,182,2745,16,0,
846416,0,322,1,1449, 8483631,1,1628,2746,16,
84652744,16,0,322,1, 84840,327,1,1189,2747,
84661701,2745,16,0,322, 848516,0,631,1,437,
84671,447,2746,16,0, 84862748,16,0,327,1,
8468623,1,2782,2747,16, 84871591,2749,16,0,327,
84690,623,1,199,2748, 84881,188,1644,1,1695,
847016,0,623,1,2459, 84892750,16,0,631,1,
84711004,1,1958,2749,16, 84902198,2751,16,0,631,
84720,623,1,2462,1011, 84911,1195,2752,16,0,
84731,1657,1016,1,205, 8492327,1,1449,2753,16,
84742750,16,0,322,1, 84930,327,1,1701,2754,
8475459,2751,16,0,623, 849416,0,327,1,447,
84761,462,2752,16,0, 84952755,16,0,631,1,
8477623,1,1665,2753,16, 8496199,2756,16,0,631,
84780,322,1,217,2754, 84971,2459,1007,1,1958,
847916,0,623,1,2227, 84982757,16,0,631,1,
84801030,1,942,1607,1, 84992462,1014,1,1657,1019,
84811225,2755,16,0,623, 85001,205,2758,16,0,
84821,223,2756,16,0, 8501327,1,459,2759,16,
8483322,1,1479,2757,16, 85020,631,1,462,2760,
84840,623,1,1731,2758, 850316,0,631,1,1665,
848516,0,623,1,477, 85042761,16,0,327,1,
84861666,1,1231,2759,16, 8505217,2762,16,0,631,
84870,322,1,479,1676, 85061,2227,1033,1,2033,
84881,480,1681,1,1485, 8507871,1,1225,2763,16,
84892760,16,0,322,1, 85080,631,1,223,2764,
84901737,2761,16,0,322, 850916,0,327,1,1479,
84911,1989,1038,1,1990, 85102765,16,0,631,1,
84922762,16,0,623,1, 85111731,2766,16,0,631,
84931443,2763,16,0,623, 85121,477,1675,1,1231,
84941,236,2764,16,0, 85132767,16,0,327,1,
8495623,1,2136,965,1, 8514479,1685,1,480,1690,
8496476,1660,1,242,2765, 85151,1485,2768,16,0,
849716,0,322,1,478, 8516327,1,1737,2769,16,
84981705,1,1939,2766,16, 85170,327,1,1989,1041,
84990,322,1,1001,1710, 85181,1990,2770,16,0,
85001,1002,1715,1,1756, 8519631,1,1443,2771,16,
85012767,16,0,623,1, 85200,631,1,236,2772,
850226,2768,19,343,1, 852116,0,631,1,2136,
850326,2769,5,84,1, 8522968,1,476,1669,1,
85041011,1224,1,1012,2770, 8523242,2773,16,0,327,
850516,0,341,1,1013, 85241,478,1708,1,1939,
85061381,1,262,1241,1, 85252774,16,0,327,1,
85071267,2771,16,0,341, 85261001,1713,1,1002,1718,
85081,515,2772,16,0, 85271,1756,2775,16,0,
8509770,1,1521,2773,16, 8528631,1,26,2776,19,
85100,341,1,525,1339, 8529348,1,26,2777,5,
85111,2788,2774,16,0, 853084,1,1011,1227,1,
8512341,1,283,1295,1, 85311012,2778,16,0,346,
85132299,2775,16,0,341, 85321,1013,1385,1,262,
85141,42,2776,16,0, 85331244,1,1267,2779,16,
8515341,1,40,1300,1, 85340,346,1,515,2780,
851644,1306,1,47,1307, 853516,0,780,1,1521,
85171,1303,2777,16,0, 85362781,16,0,346,1,
8518341,1,1555,2778,16, 8537525,1343,1,2792,2782,
85190,341,1,50,1324, 853816,0,346,1,283,
85201,48,1313,1,49, 85391299,1,2299,2783,16,
85211319,1,51,1329,1, 85400,346,1,42,2784,
852263,1345,1,305,1334, 854116,0,346,1,40,
85231,66,1351,1,67, 85421304,1,44,1310,1,
85241356,1,68,1361,1, 854347,1311,1,1303,2785,
852569,1366,1,70,1371, 854416,0,346,1,1555,
85261,73,2779,16,0, 85452786,16,0,346,1,
8527341,1,74,1376,1, 854650,1328,1,48,1317,
8528328,1425,1,1048,1462, 85471,49,1323,1,51,
85291,82,2780,16,0, 85481333,1,63,1349,1,
8530341,1,1840,2781,16, 8549305,1338,1,66,1355,
85310,341,1,1591,2782, 85501,67,1360,1,68,
853216,0,341,1,1341, 85511365,1,69,1370,1,
85332783,16,0,341,1, 855270,1375,1,73,2787,
85341096,1694,1,93,1435, 855316,0,346,1,74,
85351,352,1467,1,107, 85541380,1,328,1429,1,
85362784,16,0,341,1, 85551048,1470,1,82,2788,
85371114,1461,1,118,1473, 855616,0,346,1,1840,
85381,1123,2785,16,0, 85572789,16,0,346,1,
8539341,1,371,1483,1, 85581591,2790,16,0,346,
85401628,2786,16,0,341, 85591,1341,2791,16,0,
85411,375,1494,1,1882, 8560346,1,1096,1439,1,
85422787,16,0,341,1, 856193,1445,1,352,1475,
8543377,1499,1,379,1504, 85621,107,2792,16,0,
85441,380,1509,1,883, 8563346,1,1114,1469,1,
85452788,16,0,341,1, 8564118,1481,1,1123,2793,
8546373,1527,1,130,1532, 856516,0,346,1,371,
85471,143,2789,16,0, 85661491,1,1628,2794,16,
8548341,1,387,2790,16, 85670,346,1,375,1502,
85490,341,1,1159,2791, 85681,1882,2795,16,0,
855016,0,341,1,157, 8569346,1,377,1507,1,
85512792,16,0,341,1, 8570379,1512,1,380,1517,
85521413,2793,16,0,341, 85711,883,2796,16,0,
85531,1665,2794,16,0, 8572346,1,373,1535,1,
8554341,1,412,2795,16, 8573130,1540,1,143,2797,
85550,341,1,1377,2796, 857416,0,346,1,387,
855616,0,341,1,172, 85752798,16,0,346,1,
85571586,1,1939,2797,16, 85761159,2799,16,0,346,
85580,341,1,437,2798, 85771,157,2800,16,0,
855916,0,694,1,188, 8578346,1,1413,2801,16,
85601635,1,942,1607,1, 85790,346,1,1665,2802,
85611195,2799,16,0,341, 858016,0,346,1,412,
85621,1449,2800,16,0, 85812803,16,0,346,1,
8563341,1,1701,2801,16, 85821377,2804,16,0,346,
85640,341,1,447,1628, 85831,172,1595,1,1939,
85651,205,2802,16,0, 85842805,16,0,346,1,
8566341,1,827,2803,16, 8585437,2806,16,0,709,
85670,341,1,223,2804, 85861,188,1644,1,942,
856816,0,341,1,476, 85871616,1,1195,2807,16,
85691660,1,477,1666,1, 85880,346,1,1449,2808,
85701231,2805,16,0,341, 858916,0,346,1,1701,
85711,479,1676,1,480, 85902809,16,0,346,1,
85721681,1,1485,2806,16, 8591447,1637,1,205,2810,
85730,341,1,1737,2807, 859216,0,346,1,827,
857416,0,341,1,242, 85932811,16,0,346,1,
85752808,16,0,341,1, 8594223,2812,16,0,346,
8576478,1705,1,1001,1710, 85951,476,1669,1,477,
85771,1002,1715,1,27, 85961675,1,1231,2813,16,
85782809,19,706,1,27, 85970,346,1,479,1685,
85792810,5,95,1,256, 85981,480,1690,1,1485,
85802811,16,0,704,1, 85992814,16,0,346,1,
85811261,2812,16,0,704, 86001737,2815,16,0,346,
85821,509,2813,16,0, 86011,242,2816,16,0,
8583704,1,1515,2814,16, 8602346,1,478,1708,1,
85840,704,1,2021,840, 86031001,1713,1,1002,1718,
85851,1775,2815,16,0, 86041,27,2817,19,721,
8586704,1,2029,847,1, 86051,27,2818,5,95,
85872030,853,1,2031,858, 86061,256,2819,16,0,
85881,2032,863,1,2033, 8607719,1,1261,2820,16,
8589868,1,277,2816,16, 86080,719,1,509,2821,
85900,704,1,2035,874, 860916,0,719,1,1515,
85911,2037,879,1,2039, 86102822,16,0,719,1,
8592884,1,32,2817,16, 86112021,843,1,1775,2823,
85930,704,1,2041,890, 861216,0,719,1,2029,
85941,2293,2818,16,0, 8613850,1,2030,856,1,
8595704,1,2043,896,1, 86142031,861,1,2032,866,
85962045,901,1,41,2819, 86151,2033,871,1,277,
859716,0,704,1,1297, 86162824,16,0,719,1,
85982820,16,0,704,1, 86172035,877,1,2037,882,
859943,2821,16,0,704, 86181,2039,887,1,32,
86001,1803,909,1,1804, 86192825,16,0,719,1,
86012822,16,0,704,1, 86202041,893,1,2293,2826,
8602299,2823,16,0,704, 862116,0,719,1,2043,
86031,52,2824,16,0, 8622899,1,2045,904,1,
8604704,1,2318,2825,16, 862341,2827,16,0,719,
86050,704,1,62,2826, 86241,1297,2828,16,0,
860616,0,704,1,2075, 8625719,1,43,2829,16,
86072827,16,0,704,1, 86260,719,1,1803,912,
86081574,921,1,71,2828, 86271,1804,2830,16,0,
860916,0,704,1,76, 8628719,1,299,2831,16,
86102829,16,0,704,1, 86290,719,1,52,2832,
86111834,2830,16,0,704, 863016,0,719,1,2318,
86121,2337,2831,16,0, 86312833,16,0,719,1,
8613704,1,79,2832,16, 863262,2834,16,0,719,
86140,704,1,1335,2833, 86331,2075,2835,16,0,
861516,0,704,1,322, 8634719,1,1574,924,1,
86162834,16,0,704,1, 863571,2836,16,0,719,
861785,2835,16,0,704, 86361,76,2837,16,0,
86181,89,2836,16,0, 8637719,1,1834,2838,16,
8619704,1,346,2837,16, 86380,719,1,2337,2839,
86200,704,1,2105,936, 863916,0,719,1,79,
86211,2106,2838,16,0, 86402840,16,0,719,1,
8622704,1,97,2839,16, 86411335,2841,16,0,719,
86230,704,1,1860,943, 86421,322,2842,16,0,
86241,2364,949,1,102, 8643719,1,85,2843,16,
86252840,16,0,704,1, 86440,719,1,89,2844,
86262782,2841,16,0,704, 864516,0,719,1,346,
86271,112,2842,16,0, 86462845,16,0,719,1,
8628704,1,1117,2843,16, 86472105,939,1,2106,2846,
86290,704,1,1873,958, 864816,0,719,1,97,
86301,1876,2844,16,0, 86492847,16,0,719,1,
8631704,1,124,2845,16, 86501860,946,1,2364,952,
86320,704,1,2136,965, 86511,102,2848,16,0,
86331,381,2846,16,0, 8652719,1,112,2849,16,
8634704,1,525,2847,16, 86530,719,1,1117,2850,
86350,704,1,137,2848, 865416,0,719,1,2786,
863616,0,704,1,1901, 86552851,16,0,719,1,
86372849,16,0,704,1, 86561873,961,1,1876,2852,
86381153,2850,16,0,704, 865716,0,719,1,124,
86391,151,2851,16,0, 86582853,16,0,719,1,
8640704,1,1407,2852,16, 86592136,968,1,381,2854,
86410,704,1,1659,2853, 866016,0,719,1,525,
864216,0,704,1,2413, 86612855,16,0,719,1,
86432854,16,0,704,1, 8662137,2856,16,0,719,
8644406,2855,16,0,704, 86631,1901,2857,16,0,
86451,1371,2856,16,0, 8664719,1,1153,2858,16,
8646704,1,166,2857,16, 86650,719,1,151,2859,
86470,704,1,1622,2858, 866616,0,719,1,1407,
864816,0,704,1,1931, 86672860,16,0,719,1,
8649983,1,1933,2859,16, 86681659,2861,16,0,719,
86500,704,1,431,2860, 86691,2413,2862,16,0,
865116,0,704,1,1585, 8670719,1,406,2863,16,
86522861,16,0,704,1, 86710,719,1,1371,2864,
8653182,2862,16,0,704, 867216,0,719,1,166,
86541,1189,2863,16,0, 86732865,16,0,719,1,
8655704,1,1443,2864,16, 86741622,2866,16,0,719,
86560,704,1,1695,2865, 86751,1931,986,1,1933,
865716,0,704,1,2198, 86762867,16,0,719,1,
86582866,16,0,704,1, 8677431,2868,16,0,719,
8659447,2867,16,0,704, 86781,1585,2869,16,0,
86601,2458,998,1,2459, 8679719,1,182,2870,16,
86611004,1,1958,2868,16, 86800,719,1,1189,2871,
86620,704,1,2462,1011, 868116,0,719,1,1443,
86631,1657,1016,1,2464, 86822872,16,0,719,1,
86641021,1,199,2869,16, 86831695,2873,16,0,719,
86650,704,1,459,2870, 86841,2198,2874,16,0,
866616,0,704,1,462, 8685719,1,447,2875,16,
86672871,16,0,704,1, 86860,719,1,2458,1001,
8668217,2872,16,0,704, 86871,2459,1007,1,1958,
86691,2227,1030,1,1225, 86882876,16,0,719,1,
86702873,16,0,704,1, 86892462,1014,1,1657,1019,
86711479,2874,16,0,704, 86901,2464,1024,1,199,
86721,1731,2875,16,0, 86912877,16,0,719,1,
8673704,1,1989,1038,1, 8692459,2878,16,0,719,
86741990,2876,16,0,704, 86931,462,2879,16,0,
86751,236,2877,16,0, 8694719,1,217,2880,16,
8676704,1,1756,2878,16, 86950,719,1,2227,1033,
86770,704,1,28,2879, 86961,1225,2881,16,0,
867819,734,1,28,2880, 8697719,1,1479,2882,16,
86795,60,1,328,1425, 86980,719,1,1731,2883,
86801,223,1650,1,1096, 869916,0,719,1,1989,
86811694,1,118,1473,1, 87001041,1,1990,2884,16,
8682883,1515,1,525,1339, 87010,719,1,236,2885,
86831,1001,1710,1,130, 870216,0,719,1,1756,
86841532,1,459,1949,1, 87032886,16,0,719,1,
86851114,1461,1,352,1467, 870428,2887,19,749,1,
86861,447,1628,1,464, 870528,2888,5,60,1,
86871944,1,1011,1224,1, 8706328,1429,1,223,1659,
86881013,1381,1,242,1700, 87071,1096,1439,1,118,
86891,143,1537,1,40, 87081481,1,883,1523,1,
86901300,1,41,1916,1, 8709525,1343,1,1001,1713,
869142,1920,1,479,1676, 87101,130,1540,1,459,
86921,44,1306,1,481, 87111953,1,1114,1469,1,
86931951,1,373,1527,1, 8712352,1475,1,447,1637,
869447,1307,1,157,1560, 87131,464,1948,1,1011,
86951,49,1319,1,50, 87141227,1,1013,1385,1,
86961324,1,48,1313,1, 8715242,1703,1,143,1545,
8697379,1504,1,380,1509, 87161,40,1304,1,41,
86981,51,1329,1,476, 87171913,1,42,1917,1,
86991660,1,371,1483,1, 8718479,1685,1,44,1310,
8700478,1705,1,1048,1462, 87191,481,1955,1,373,
87011,375,1494,1,172, 87201535,1,47,1311,1,
87021586,1,262,1241,1, 8721157,1568,1,49,1323,
8703283,1295,1,63,1345, 87221,50,1328,1,48,
87041,67,1356,1,68, 87231317,1,379,1512,1,
87051361,1,69,1366,1, 8724380,1517,1,51,1333,
870666,1351,1,461,2881, 87251,476,1669,1,371,
870716,0,732,1,74, 87261491,1,478,1708,1,
87081376,1,377,1499,1, 87271048,1470,1,375,1502,
87091002,1715,1,70,1371, 87281,172,1595,1,262,
87101,188,1635,1,82, 87291244,1,283,1299,1,
87111403,1,305,1334,1, 873063,1349,1,67,1360,
8712477,1666,1,827,1448, 87311,68,1365,1,69,
87131,93,1435,1,480, 87321370,1,66,1355,1,
87141681,1,205,1640,1, 8733461,2889,16,0,747,
8715942,1607,1,107,1455, 87341,74,1380,1,377,
87161,29,2882,19,312, 87351507,1,1002,1718,1,
87171,29,2883,5,84, 873670,1375,1,188,1644,
87181,1011,1224,1,1012, 87371,82,1407,1,305,
87192884,16,0,310,1, 87381338,1,477,1675,1,
87201013,1381,1,262,1241, 8739827,1457,1,93,1445,
87211,1267,2885,16,0, 87401,480,1690,1,205,
8722310,1,515,2886,16, 87411649,1,942,1616,1,
87230,310,1,1521,2887, 8742107,1464,1,29,2890,
872416,0,310,1,525, 874319,315,1,29,2891,
87251339,1,2788,2888,16, 87445,84,1,1011,1227,
87260,310,1,283,1295, 87451,1012,2892,16,0,
87271,2299,2889,16,0, 8746313,1,1013,1385,1,
8728310,1,42,2890,16, 8747262,1244,1,1267,2893,
87290,310,1,40,1300, 874816,0,313,1,515,
87301,44,1306,1,47, 87492894,16,0,313,1,
87311307,1,1303,2891,16, 87501521,2895,16,0,313,
87320,310,1,1555,2892, 87511,525,1343,1,2792,
873316,0,310,1,50, 87522896,16,0,313,1,
87341324,1,48,1313,1, 8753283,1299,1,2299,2897,
873549,1319,1,51,1329, 875416,0,313,1,42,
87361,63,1345,1,305, 87552898,16,0,313,1,
87371334,1,66,1351,1, 875640,1304,1,44,1310,
873867,1356,1,68,1361, 87571,47,1311,1,1303,
87391,69,1366,1,70, 87582899,16,0,313,1,
87401371,1,73,2893,16, 87591555,2900,16,0,313,
87410,310,1,74,1376, 87601,50,1328,1,48,
87421,328,1425,1,1048, 87611317,1,49,1323,1,
87431462,1,82,2894,16, 876251,1333,1,63,1349,
87440,310,1,1840,2895, 87631,305,1338,1,66,
874516,0,310,1,1591, 87641355,1,67,1360,1,
87462896,16,0,310,1, 876568,1365,1,69,1370,
87471341,2897,16,0,310, 87661,70,1375,1,73,
87481,1096,1694,1,93, 87672901,16,0,313,1,
87491435,1,352,1467,1, 876874,1380,1,328,1429,
8750107,2898,16,0,310, 87691,1048,1470,1,82,
87511,1114,1461,1,118, 87702902,16,0,313,1,
87521473,1,1123,2899,16, 87711840,2903,16,0,313,
87530,310,1,371,1483, 87721,1591,2904,16,0,
87541,1628,2900,16,0, 8773313,1,1341,2905,16,
8755310,1,375,1494,1, 87740,313,1,1096,1439,
87561882,2901,16,0,310, 87751,93,1445,1,352,
87571,377,1499,1,379, 87761475,1,107,2906,16,
87581504,1,380,1509,1, 87770,313,1,1114,1469,
8759883,2902,16,0,310, 87781,118,1481,1,1123,
87601,373,1527,1,130, 87792907,16,0,313,1,
87611532,1,143,1537,1, 8780371,1491,1,1628,2908,
8762387,2903,16,0,310, 878116,0,313,1,375,
87631,1159,2904,16,0, 87821502,1,1882,2909,16,
8764310,1,157,1560,1, 87830,313,1,377,1507,
87651413,2905,16,0,310, 87841,379,1512,1,380,
87661,1665,2906,16,0, 87851517,1,883,2910,16,
8767310,1,412,2907,16, 87860,313,1,373,1535,
87680,310,1,1377,2908, 87871,130,1540,1,143,
876916,0,310,1,172, 87881545,1,387,2911,16,
87701586,1,1939,2909,16, 87890,313,1,1159,2912,
87710,310,1,437,2910, 879016,0,313,1,157,
877216,0,310,1,188, 87911568,1,1413,2913,16,
87731635,1,942,1607,1, 87920,313,1,1665,2914,
87741195,2911,16,0,310, 879316,0,313,1,412,
87751,1449,2912,16,0, 87942915,16,0,313,1,
8776310,1,1701,2913,16, 87951377,2916,16,0,313,
87770,310,1,447,1628, 87961,172,1595,1,1939,
87781,205,2914,16,0, 87972917,16,0,313,1,
8779310,1,827,2915,16, 8798437,2918,16,0,313,
87800,310,1,223,2916, 87991,188,1644,1,942,
878116,0,310,1,476, 88001616,1,1195,2919,16,
87821660,1,477,1666,1, 88010,313,1,1449,2920,
87831231,2917,16,0,310, 880216,0,313,1,1701,
87841,479,1676,1,480, 88032921,16,0,313,1,
87851681,1,1485,2918,16, 8804447,1637,1,205,2922,
87860,310,1,1737,2919, 880516,0,313,1,827,
878716,0,310,1,242, 88062923,16,0,313,1,
87882920,16,0,310,1, 8807223,2924,16,0,313,
8789478,1705,1,1001,1710, 88081,476,1669,1,477,
87901,1002,1715,1,30, 88091675,1,1231,2925,16,
87912921,19,296,1,30, 88100,313,1,479,1685,
87922922,5,84,1,1011, 88111,480,1690,1,1485,
87931224,1,1012,2923,16, 88122926,16,0,313,1,
87940,294,1,1013,1381, 88131737,2927,16,0,313,
87951,262,1241,1,1267, 88141,242,2928,16,0,
87962924,16,0,294,1, 8815313,1,478,1708,1,
8797515,2925,16,0,294, 88161001,1713,1,1002,1718,
87981,1521,2926,16,0, 88171,30,2929,19,297,
8799294,1,525,1339,1, 88181,30,2930,5,84,
88002788,2927,16,0,294, 88191,1011,1227,1,1012,
88011,283,1295,1,2299, 88202931,16,0,295,1,
88022928,16,0,294,1, 88211013,1385,1,262,1244,
880342,2929,16,0,294, 88221,1267,2932,16,0,
88041,40,1300,1,44, 8823295,1,515,2933,16,
88051306,1,47,1307,1, 88240,295,1,1521,2934,
88061303,2930,16,0,294, 882516,0,295,1,525,
88071,1555,2931,16,0, 88261343,1,2792,2935,16,
8808294,1,50,1324,1, 88270,295,1,283,1299,
880948,1313,1,49,1319, 88281,2299,2936,16,0,
88101,51,1329,1,63, 8829295,1,42,2937,16,
88111345,1,305,1334,1, 88300,295,1,40,1304,
881266,1351,1,67,1356, 88311,44,1310,1,47,
88131,68,1361,1,69, 88321311,1,1303,2938,16,
88141366,1,70,1371,1, 88330,295,1,1555,2939,
881573,2932,16,0,294, 883416,0,295,1,50,
88161,74,1376,1,328, 88351328,1,48,1317,1,
88171425,1,1048,1462,1, 883649,1323,1,51,1333,
881882,2933,16,0,294, 88371,63,1349,1,305,
88191,1840,2934,16,0, 88381338,1,66,1355,1,
8820294,1,1591,2935,16, 883967,1360,1,68,1365,
88210,294,1,1341,2936, 88401,69,1370,1,70,
882216,0,294,1,1096, 88411375,1,73,2940,16,
88231694,1,93,1435,1, 88420,295,1,74,1380,
8824352,1467,1,107,2937, 88431,328,1429,1,1048,
882516,0,294,1,1114, 88441470,1,82,2941,16,
88261461,1,118,1473,1, 88450,295,1,1840,2942,
88271123,2938,16,0,294, 884616,0,295,1,1591,
88281,371,1483,1,1628, 88472943,16,0,295,1,
88292939,16,0,294,1, 88481341,2944,16,0,295,
8830375,1494,1,1882,2940, 88491,1096,1439,1,93,
883116,0,294,1,377, 88501445,1,352,1475,1,
88321499,1,379,1504,1, 8851107,2945,16,0,295,
8833380,1509,1,883,2941, 88521,1114,1469,1,118,
883416,0,294,1,373, 88531481,1,1123,2946,16,
88351527,1,130,1532,1, 88540,295,1,371,1491,
8836143,1537,1,387,2942, 88551,1628,2947,16,0,
883716,0,294,1,1159, 8856295,1,375,1502,1,
88382943,16,0,294,1, 88571882,2948,16,0,295,
8839157,1560,1,1413,2944, 88581,377,1507,1,379,
884016,0,294,1,1665, 88591512,1,380,1517,1,
88412945,16,0,294,1, 8860883,2949,16,0,295,
8842412,2946,16,0,294, 88611,373,1535,1,130,
88431,1377,2947,16,0, 88621540,1,143,1545,1,
8844294,1,172,1586,1, 8863387,2950,16,0,295,
88451939,2948,16,0,294, 88641,1159,2951,16,0,
88461,437,2949,16,0, 8865295,1,157,1568,1,
8847294,1,188,1635,1, 88661413,2952,16,0,295,
8848942,1607,1,1195,2950, 88671,1665,2953,16,0,
884916,0,294,1,1449, 8868295,1,412,2954,16,
88502951,16,0,294,1, 88690,295,1,1377,2955,
88511701,2952,16,0,294, 887016,0,295,1,172,
88521,447,1628,1,205, 88711595,1,1939,2956,16,
88532953,16,0,294,1, 88720,295,1,437,2957,
8854827,2954,16,0,294, 887316,0,295,1,188,
88551,223,2955,16,0, 88741644,1,942,1616,1,
8856294,1,476,1660,1, 88751195,2958,16,0,295,
8857477,1666,1,1231,2956, 88761,1449,2959,16,0,
885816,0,294,1,479, 8877295,1,1701,2960,16,
88591676,1,480,1681,1, 88780,295,1,447,1637,
88601485,2957,16,0,294, 88791,205,2961,16,0,
88611,1737,2958,16,0, 8880295,1,827,2962,16,
8862294,1,242,2959,16, 88810,295,1,223,2963,
88630,294,1,478,1705, 888216,0,295,1,476,
88641,1001,1710,1,1002, 88831669,1,477,1675,1,
88651715,1,31,2960,19, 88841231,2964,16,0,295,
8866281,1,31,2961,5, 88851,479,1685,1,480,
886784,1,1011,1224,1, 88861690,1,1485,2965,16,
88681012,2962,16,0,279, 88870,295,1,1737,2966,
88691,1013,1381,1,262, 888816,0,295,1,242,
88701241,1,1267,2963,16, 88892967,16,0,295,1,
88710,279,1,515,2964, 8890478,1708,1,1001,1713,
887216,0,279,1,1521, 88911,1002,1718,1,31,
88732965,16,0,279,1, 88922968,19,277,1,31,
8874525,1339,1,2788,2966, 88932969,5,84,1,1011,
887516,0,279,1,283, 88941227,1,1012,2970,16,
88761295,1,2299,2967,16, 88950,275,1,1013,1385,
88770,279,1,42,2968, 88961,262,1244,1,1267,
887816,0,279,1,40, 88972971,16,0,275,1,
88791300,1,44,1306,1, 8898515,2972,16,0,275,
888047,1307,1,1303,2969, 88991,1521,2973,16,0,
888116,0,279,1,1555, 8900275,1,525,1343,1,
88822970,16,0,279,1, 89012792,2974,16,0,275,
888350,1324,1,48,1313, 89021,283,1299,1,2299,
88841,49,1319,1,51, 89032975,16,0,275,1,
88851329,1,63,1345,1, 890442,2976,16,0,275,
8886305,1334,1,66,1351, 89051,40,1304,1,44,
88871,67,1356,1,68, 89061310,1,47,1311,1,
88881361,1,69,1366,1, 89071303,2977,16,0,275,
888970,1371,1,73,2971, 89081,1555,2978,16,0,
889016,0,279,1,74, 8909275,1,50,1328,1,
88911376,1,328,1425,1, 891048,1317,1,49,1323,
88921048,1462,1,82,2972, 89111,51,1333,1,63,
889316,0,279,1,1840, 89121349,1,305,1338,1,
88942973,16,0,279,1, 891366,1355,1,67,1360,
88951591,2974,16,0,279, 89141,68,1365,1,69,
88961,1341,2975,16,0, 89151370,1,70,1375,1,
8897279,1,1096,1694,1, 891673,2979,16,0,275,
889893,1435,1,352,1467, 89171,74,1380,1,328,
88991,107,2976,16,0, 89181429,1,1048,1470,1,
8900279,1,1114,1461,1, 891982,2980,16,0,275,
8901118,1473,1,1123,2977, 89201,1840,2981,16,0,
890216,0,279,1,371, 8921275,1,1591,2982,16,
89031483,1,1628,2978,16, 89220,275,1,1341,2983,
89040,279,1,375,1494, 892316,0,275,1,1096,
89051,1882,2979,16,0, 89241439,1,93,1445,1,
8906279,1,377,1499,1, 8925352,1475,1,107,2984,
8907379,1504,1,380,1509, 892616,0,275,1,1114,
89081,883,2980,16,0, 89271469,1,118,1481,1,
8909279,1,373,1527,1, 89281123,2985,16,0,275,
8910130,1532,1,143,2981, 89291,371,1491,1,1628,
891116,0,279,1,387, 89302986,16,0,275,1,
89122982,16,0,279,1, 8931375,1502,1,1882,2987,
89131159,2983,16,0,279, 893216,0,275,1,377,
89141,157,2984,16,0, 89331507,1,379,1512,1,
8915279,1,1413,2985,16, 8934380,1517,1,883,2988,
89160,279,1,1665,2986, 893516,0,275,1,373,
891716,0,279,1,412, 89361535,1,130,1540,1,
89182987,16,0,279,1, 8937143,2989,16,0,275,
89191377,2988,16,0,279, 89381,387,2990,16,0,
89201,172,1586,1,1939, 8939275,1,1159,2991,16,
89212989,16,0,279,1, 89400,275,1,157,2992,
8922437,2990,16,0,279, 894116,0,275,1,1413,
89231,188,1635,1,942, 89422993,16,0,275,1,
89241607,1,1195,2991,16, 89431665,2994,16,0,275,
89250,279,1,1449,2992, 89441,412,2995,16,0,
892616,0,279,1,1701, 8945275,1,1377,2996,16,
89272993,16,0,279,1, 89460,275,1,172,1595,
8928447,1628,1,205,2994, 89471,1939,2997,16,0,
892916,0,279,1,827, 8948275,1,437,2998,16,
89302995,16,0,279,1, 89490,275,1,188,1644,
8931223,2996,16,0,279, 89501,942,1616,1,1195,
89321,476,1660,1,477, 89512999,16,0,275,1,
89331666,1,1231,2997,16, 89521449,3000,16,0,275,
89340,279,1,479,1676, 89531,1701,3001,16,0,
89351,480,1681,1,1485, 8954275,1,447,1637,1,
89362998,16,0,279,1, 8955205,3002,16,0,275,
89371737,2999,16,0,279, 89561,827,3003,16,0,
89381,242,3000,16,0, 8957275,1,223,3004,16,
8939279,1,478,1705,1, 89580,275,1,476,1669,
89401001,1710,1,1002,1715, 89591,477,1675,1,1231,
89411,32,3001,19,273, 89603005,16,0,275,1,
89421,32,3002,5,84, 8961479,1685,1,480,1690,
89431,1011,1224,1,1012, 89621,1485,3006,16,0,
89443003,16,0,271,1, 8963275,1,1737,3007,16,
89451013,1381,1,262,1241, 89640,275,1,242,3008,
89461,1267,3004,16,0, 896516,0,275,1,478,
8947271,1,515,3005,16, 89661708,1,1001,1713,1,
89480,271,1,1521,3006, 89671002,1718,1,32,3009,
894916,0,271,1,525, 896819,270,1,32,3010,
89501339,1,2788,3007,16, 89695,84,1,1011,1227,
89510,271,1,283,1295, 89701,1012,3011,16,0,
89521,2299,3008,16,0, 8971268,1,1013,1385,1,
8953271,1,42,3009,16, 8972262,1244,1,1267,3012,
89540,271,1,40,1300, 897316,0,268,1,515,
89551,44,1306,1,47, 89743013,16,0,268,1,
89561307,1,1303,3010,16, 89751521,3014,16,0,268,
89570,271,1,1555,3011, 89761,525,1343,1,2792,
895816,0,271,1,50, 89773015,16,0,268,1,
89591324,1,48,1313,1, 8978283,1299,1,2299,3016,
896049,1319,1,51,1329, 897916,0,268,1,42,
89611,63,1345,1,305, 89803017,16,0,268,1,
89621334,1,66,1351,1, 898140,1304,1,44,1310,
896367,1356,1,68,1361, 89821,47,1311,1,1303,
89641,69,1366,1,70, 89833018,16,0,268,1,
89651371,1,73,3012,16, 89841555,3019,16,0,268,
89660,271,1,74,1376, 89851,50,1328,1,48,
89671,328,1425,1,1048, 89861317,1,49,1323,1,
89681462,1,82,3013,16, 898751,1333,1,63,1349,
89690,271,1,1840,3014, 89881,305,1338,1,66,
897016,0,271,1,1591, 89891355,1,67,1360,1,
89713015,16,0,271,1, 899068,1365,1,69,1370,
89721341,3016,16,0,271, 89911,70,1375,1,73,
89731,1096,1694,1,93, 89923020,16,0,268,1,
89741435,1,352,1467,1, 899374,1380,1,328,1429,
8975107,3017,16,0,271, 89941,1048,1470,1,82,
89761,1114,1461,1,118, 89953021,16,0,268,1,
89771473,1,1123,3018,16, 89961840,3022,16,0,268,
89780,271,1,371,1483, 89971,1591,3023,16,0,
89791,1628,3019,16,0, 8998268,1,1341,3024,16,
8980271,1,375,1494,1, 89990,268,1,1096,1439,
89811882,3020,16,0,271, 90001,93,1445,1,352,
89821,377,1499,1,379, 90011475,1,107,3025,16,
89831504,1,380,1509,1, 90020,268,1,1114,1469,
8984883,3021,16,0,271, 90031,118,1481,1,1123,
89851,373,1527,1,130, 90043026,16,0,268,1,
89861532,1,143,3022,16, 9005371,1491,1,1628,3027,
89870,271,1,387,3023, 900616,0,268,1,375,
898816,0,271,1,1159, 90071502,1,1882,3028,16,
89893024,16,0,271,1, 90080,268,1,377,1507,
8990157,3025,16,0,271, 90091,379,1512,1,380,
89911,1413,3026,16,0, 90101517,1,883,3029,16,
8992271,1,1665,3027,16, 90110,268,1,373,1535,
89930,271,1,412,3028, 90121,130,1540,1,143,
899416,0,271,1,1377, 90133030,16,0,268,1,
89953029,16,0,271,1, 9014387,3031,16,0,268,
8996172,1586,1,1939,3030, 90151,1159,3032,16,0,
899716,0,271,1,437, 9016268,1,157,3033,16,
89983031,16,0,271,1, 90170,268,1,1413,3034,
8999188,1635,1,942,1607, 901816,0,268,1,1665,
90001,1195,3032,16,0, 90193035,16,0,268,1,
9001271,1,1449,3033,16, 9020412,3036,16,0,268,
90020,271,1,1701,3034, 90211,1377,3037,16,0,
900316,0,271,1,447, 9022268,1,172,1595,1,
90041628,1,205,3035,16, 90231939,3038,16,0,268,
90050,271,1,827,3036, 90241,437,3039,16,0,
900616,0,271,1,223, 9025268,1,188,1644,1,
90073037,16,0,271,1, 9026942,1616,1,1195,3040,
9008476,1660,1,477,1666, 902716,0,268,1,1449,
90091,1231,3038,16,0, 90283041,16,0,268,1,
9010271,1,479,1676,1, 90291701,3042,16,0,268,
9011480,1681,1,1485,3039, 90301,447,1637,1,205,
901216,0,271,1,1737, 90313043,16,0,268,1,
90133040,16,0,271,1, 9032827,3044,16,0,268,
9014242,3041,16,0,271, 90331,223,3045,16,0,
90151,478,1705,1,1001, 9034268,1,476,1669,1,
90161710,1,1002,1715,1, 9035477,1675,1,1231,3046,
901733,3042,19,370,1, 903616,0,268,1,479,
901833,3043,5,84,1, 90371685,1,480,1690,1,
90191011,1224,1,1012,3044, 90381485,3047,16,0,268,
902016,0,368,1,1013, 90391,1737,3048,16,0,
90211381,1,262,1241,1, 9040268,1,242,3049,16,
90221267,3045,16,0,368, 90410,268,1,478,1708,
90231,515,3046,16,0, 90421,1001,1713,1,1002,
9024368,1,1521,3047,16, 90431718,1,33,3050,19,
90250,368,1,525,1339, 9044378,1,33,3051,5,
90261,2788,3048,16,0, 904584,1,1011,1227,1,
9027368,1,283,1295,1, 90461012,3052,16,0,376,
90282299,3049,16,0,368, 90471,1013,1385,1,262,
90291,42,3050,16,0, 90481244,1,1267,3053,16,
9030368,1,40,1300,1, 90490,376,1,515,3054,
903144,1306,1,47,1307, 905016,0,376,1,1521,
90321,1303,3051,16,0, 90513055,16,0,376,1,
9033368,1,1555,3052,16, 9052525,1343,1,2792,3056,
90340,368,1,50,1324, 905316,0,376,1,283,
90351,48,1313,1,49, 90541299,1,2299,3057,16,
90361319,1,51,1329,1, 90550,376,1,42,3058,
903763,1345,1,305,1334, 905616,0,376,1,40,
90381,66,1351,1,67, 90571304,1,44,1310,1,
90391356,1,68,1361,1, 905847,1311,1,1303,3059,
904069,1366,1,70,1371, 905916,0,376,1,1555,
90411,73,3053,16,0, 90603060,16,0,376,1,
9042368,1,74,1376,1, 906150,1328,1,48,1317,
9043328,1425,1,1048,1462, 90621,49,1323,1,51,
90441,82,3054,16,0, 90631333,1,63,1349,1,
9045368,1,1840,3055,16, 9064305,1338,1,66,1355,
90460,368,1,1591,3056, 90651,67,1360,1,68,
904716,0,368,1,1341, 90661365,1,69,1370,1,
90483057,16,0,368,1, 906770,1375,1,73,3061,
90491096,1694,1,93,1435, 906816,0,376,1,74,
90501,352,1467,1,107, 90691380,1,328,1429,1,
90513058,16,0,368,1, 90701048,1470,1,82,3062,
90521114,1461,1,118,1473, 907116,0,376,1,1840,
90531,1123,3059,16,0, 90723063,16,0,376,1,
9054368,1,371,1483,1, 90731591,3064,16,0,376,
90551628,3060,16,0,368, 90741,1341,3065,16,0,
90561,375,1494,1,1882, 9075376,1,1096,1439,1,
90573061,16,0,368,1, 907693,1445,1,352,1475,
9058377,1499,1,379,1504, 90771,107,3066,16,0,
90591,380,1509,1,883, 9078376,1,1114,1469,1,
90603062,16,0,368,1, 9079118,1481,1,1123,3067,
9061373,1527,1,130,1532, 908016,0,376,1,371,
90621,143,1537,1,387, 90811491,1,1628,3068,16,
90633063,16,0,368,1, 90820,376,1,375,1502,
90641159,3064,16,0,368, 90831,1882,3069,16,0,
90651,157,1560,1,1413, 9084376,1,377,1507,1,
90663065,16,0,368,1, 9085379,1512,1,380,1517,
90671665,3066,16,0,368, 90861,883,3070,16,0,
90681,412,3067,16,0, 9087376,1,373,1535,1,
9069368,1,1377,3068,16, 9088130,1540,1,143,1545,
90700,368,1,172,1586, 90891,387,3071,16,0,
90711,1939,3069,16,0, 9090376,1,1159,3072,16,
9072368,1,437,3070,16, 90910,376,1,157,1568,
90730,368,1,188,1635, 90921,1413,3073,16,0,
90741,942,1607,1,1195, 9093376,1,1665,3074,16,
90753071,16,0,368,1, 90940,376,1,412,3075,
90761449,3072,16,0,368, 909516,0,376,1,1377,
90771,1701,3073,16,0, 90963076,16,0,376,1,
9078368,1,447,1628,1, 9097172,1595,1,1939,3077,
9079205,3074,16,0,368, 909816,0,376,1,437,
90801,827,3075,16,0, 90993078,16,0,376,1,
9081368,1,223,3076,16, 9100188,1644,1,942,1616,
90820,368,1,476,1660, 91011,1195,3079,16,0,
90831,477,1666,1,1231, 9102376,1,1449,3080,16,
90843077,16,0,368,1, 91030,376,1,1701,3081,
9085479,1676,1,480,1681, 910416,0,376,1,447,
90861,1485,3078,16,0, 91051637,1,205,3082,16,
9087368,1,1737,3079,16, 91060,376,1,827,3083,
90880,368,1,242,1700, 910716,0,376,1,223,
90891,478,1705,1,1001, 91083084,16,0,376,1,
90901710,1,1002,1715,1, 9109476,1669,1,477,1675,
909134,3080,19,358,1, 91101,1231,3085,16,0,
909234,3081,5,84,1, 9111376,1,479,1685,1,
90931011,1224,1,1012,3082, 9112480,1690,1,1485,3086,
909416,0,356,1,1013, 911316,0,376,1,1737,
90951381,1,262,1241,1, 91143087,16,0,376,1,
90961267,3083,16,0,356, 9115242,1703,1,478,1708,
90971,515,3084,16,0, 91161,1001,1713,1,1002,
9098356,1,1521,3085,16, 91171718,1,34,3088,19,
90990,356,1,525,1339, 9118365,1,34,3089,5,
91001,2788,3086,16,0, 911984,1,1011,1227,1,
9101356,1,283,1295,1, 91201012,3090,16,0,363,
91022299,3087,16,0,356, 91211,1013,1385,1,262,
91031,42,3088,16,0, 91221244,1,1267,3091,16,
9104356,1,40,1300,1, 91230,363,1,515,3092,
910544,1306,1,47,1307, 912416,0,363,1,1521,
91061,1303,3089,16,0, 91253093,16,0,363,1,
9107356,1,1555,3090,16, 9126525,1343,1,2792,3094,
91080,356,1,50,1324, 912716,0,363,1,283,
91091,48,1313,1,49, 91281299,1,2299,3095,16,
91101319,1,51,1329,1, 91290,363,1,42,3096,
911163,1345,1,305,1334, 913016,0,363,1,40,
91121,66,1351,1,67, 91311304,1,44,1310,1,
91131356,1,68,1361,1, 913247,1311,1,1303,3097,
911469,1366,1,70,1371, 913316,0,363,1,1555,
91151,73,3091,16,0, 91343098,16,0,363,1,
9116356,1,74,1376,1, 913550,1328,1,48,1317,
9117328,1425,1,1048,1462, 91361,49,1323,1,51,
91181,82,3092,16,0, 91371333,1,63,1349,1,
9119356,1,1840,3093,16, 9138305,1338,1,66,1355,
91200,356,1,1591,3094, 91391,67,1360,1,68,
912116,0,356,1,1341, 91401365,1,69,1370,1,
91223095,16,0,356,1, 914170,1375,1,73,3099,
91231096,1694,1,93,1435, 914216,0,363,1,74,
91241,352,1467,1,107, 91431380,1,328,1429,1,
91253096,16,0,356,1, 91441048,1470,1,82,3100,
91261114,1461,1,118,1473, 914516,0,363,1,1840,
91271,1123,3097,16,0, 91463101,16,0,363,1,
9128356,1,371,1483,1, 91471591,3102,16,0,363,
91291628,3098,16,0,356, 91481,1341,3103,16,0,
91301,375,1494,1,1882, 9149363,1,1096,1439,1,
91313099,16,0,356,1, 915093,1445,1,352,1475,
9132377,1499,1,379,1504, 91511,107,3104,16,0,
91331,380,1509,1,883, 9152363,1,1114,1469,1,
91343100,16,0,356,1, 9153118,1481,1,1123,3105,
9135373,1527,1,130,1532, 915416,0,363,1,371,
91361,143,1537,1,387, 91551491,1,1628,3106,16,
91373101,16,0,356,1, 91560,363,1,375,1502,
91381159,3102,16,0,356, 91571,1882,3107,16,0,
91391,157,1560,1,1413, 9158363,1,377,1507,1,
91403103,16,0,356,1, 9159379,1512,1,380,1517,
91411665,3104,16,0,356, 91601,883,3108,16,0,
91421,412,3105,16,0, 9161363,1,373,1535,1,
9143356,1,1377,3106,16, 9162130,1540,1,143,1545,
91440,356,1,172,1586, 91631,387,3109,16,0,
91451,1939,3107,16,0, 9164363,1,1159,3110,16,
9146356,1,437,3108,16, 91650,363,1,157,1568,
91470,356,1,188,1635, 91661,1413,3111,16,0,
91481,942,1607,1,1195, 9167363,1,1665,3112,16,
91493109,16,0,356,1, 91680,363,1,412,3113,
91501449,3110,16,0,356, 916916,0,363,1,1377,
91511,1701,3111,16,0, 91703114,16,0,363,1,
9152356,1,447,1628,1, 9171172,1595,1,1939,3115,
9153205,1640,1,827,3112, 917216,0,363,1,437,
915416,0,356,1,223, 91733116,16,0,363,1,
91551650,1,476,1660,1, 9174188,1644,1,942,1616,
9156477,1666,1,1231,3113, 91751,1195,3117,16,0,
915716,0,356,1,479, 9176363,1,1449,3118,16,
91581676,1,480,1681,1, 91770,363,1,1701,3119,
91591485,3114,16,0,356, 917816,0,363,1,447,
91601,1737,3115,16,0, 91791637,1,205,1649,1,
9161356,1,242,1700,1, 9180827,3120,16,0,363,
9162478,1705,1,1001,1710, 91811,223,1659,1,476,
91631,1002,1715,1,35, 91821669,1,477,1675,1,
91643116,19,346,1,35, 91831231,3121,16,0,363,
91653117,5,84,1,1011, 91841,479,1685,1,480,
91661224,1,1012,3118,16, 91851690,1,1485,3122,16,
91670,344,1,1013,1381, 91860,363,1,1737,3123,
91681,262,1241,1,1267, 918716,0,363,1,242,
91693119,16,0,344,1, 91881703,1,478,1708,1,
9170515,3120,16,0,344, 91891001,1713,1,1002,1718,
91711,1521,3121,16,0, 91901,35,3124,19,351,
9172344,1,525,1339,1, 91911,35,3125,5,84,
91732788,3122,16,0,344, 91921,1011,1227,1,1012,
91741,283,1295,1,2299, 91933126,16,0,349,1,
91753123,16,0,344,1, 91941013,1385,1,262,1244,
917642,3124,16,0,344, 91951,1267,3127,16,0,
91771,40,1300,1,44, 9196349,1,515,3128,16,
91781306,1,47,1307,1, 91970,349,1,1521,3129,
91791303,3125,16,0,344, 919816,0,349,1,525,
91801,1555,3126,16,0, 91991343,1,2792,3130,16,
9181344,1,50,1324,1, 92000,349,1,283,1299,
918248,1313,1,49,1319, 92011,2299,3131,16,0,
91831,51,1329,1,63, 9202349,1,42,3132,16,
91841345,1,305,1334,1, 92030,349,1,40,1304,
918566,1351,1,67,1356, 92041,44,1310,1,47,
91861,68,1361,1,69, 92051311,1,1303,3133,16,
91871366,1,70,1371,1, 92060,349,1,1555,3134,
918873,3127,16,0,344, 920716,0,349,1,50,
91891,74,1376,1,328, 92081328,1,48,1317,1,
91901425,1,1048,1462,1, 920949,1323,1,51,1333,
919182,3128,16,0,344, 92101,63,1349,1,305,
91921,1840,3129,16,0, 92111338,1,66,1355,1,
9193344,1,1591,3130,16, 921267,1360,1,68,1365,
91940,344,1,1341,3131, 92131,69,1370,1,70,
919516,0,344,1,1096, 92141375,1,73,3135,16,
91961694,1,93,1435,1, 92150,349,1,74,1380,
9197352,1467,1,107,3132, 92161,328,1429,1,1048,
919816,0,344,1,1114, 92171470,1,82,3136,16,
91991461,1,118,1473,1, 92180,349,1,1840,3137,
92001123,3133,16,0,344, 921916,0,349,1,1591,
92011,371,1483,1,1628, 92203138,16,0,349,1,
92023134,16,0,344,1, 92211341,3139,16,0,349,
9203375,1494,1,1882,3135, 92221,1096,1439,1,93,
920416,0,344,1,377, 92231445,1,352,1475,1,
92051499,1,379,1504,1, 9224107,3140,16,0,349,
9206380,1509,1,883,3136, 92251,1114,1469,1,118,
920716,0,344,1,373, 92261481,1,1123,3141,16,
92081527,1,130,1532,1, 92270,349,1,371,1491,
9209143,1537,1,387,3137, 92281,1628,3142,16,0,
921016,0,344,1,1159, 9229349,1,375,1502,1,
92113138,16,0,344,1, 92301882,3143,16,0,349,
9212157,1560,1,1413,3139, 92311,377,1507,1,379,
921316,0,344,1,1665, 92321512,1,380,1517,1,
92143140,16,0,344,1, 9233883,3144,16,0,349,
9215412,3141,16,0,344, 92341,373,1535,1,130,
92161,1377,3142,16,0, 92351540,1,143,1545,1,
9217344,1,172,1586,1, 9236387,3145,16,0,349,
92181939,3143,16,0,344, 92371,1159,3146,16,0,
92191,437,3144,16,0, 9238349,1,157,1568,1,
9220344,1,188,1635,1, 92391413,3147,16,0,349,
9221942,1607,1,1195,3145, 92401,1665,3148,16,0,
922216,0,344,1,1449, 9241349,1,412,3149,16,
92233146,16,0,344,1, 92420,349,1,1377,3150,
92241701,3147,16,0,344, 924316,0,349,1,172,
92251,447,1628,1,205, 92441595,1,1939,3151,16,
92261640,1,827,3148,16, 92450,349,1,437,3152,
92270,344,1,223,3149, 924616,0,349,1,188,
922816,0,344,1,476, 92471644,1,942,1616,1,
92291660,1,477,1666,1, 92481195,3153,16,0,349,
92301231,3150,16,0,344, 92491,1449,3154,16,0,
92311,479,1676,1,480, 9250349,1,1701,3155,16,
92321681,1,1485,3151,16, 92510,349,1,447,1637,
92330,344,1,1737,3152, 92521,205,1649,1,827,
923416,0,344,1,242, 92533156,16,0,349,1,
92351700,1,478,1705,1, 9254223,3157,16,0,349,
92361001,1710,1,1002,1715, 92551,476,1669,1,477,
92371,36,3153,19,242, 92561675,1,1231,3158,16,
92381,36,3154,5,94, 92570,349,1,479,1685,
92391,256,3155,16,0, 92581,480,1690,1,1485,
9240240,1,1261,3156,16, 92593159,16,0,349,1,
92410,240,1,509,3157, 92601737,3160,16,0,349,
924216,0,240,1,1515, 92611,242,1703,1,478,
92433158,16,0,240,1, 92621708,1,1001,1713,1,
92442021,840,1,1775,3159, 92631002,1718,1,36,3161,
924516,0,240,1,2029, 926419,239,1,36,3162,
9246847,1,2030,853,1, 92655,94,1,256,3163,
92472031,858,1,2032,863, 926616,0,237,1,1261,
92481,2033,868,1,277, 92673164,16,0,237,1,
92493160,16,0,240,1, 9268509,3165,16,0,237,
92502035,874,1,2037,879, 92691,1515,3166,16,0,
92511,2039,884,1,32, 9270237,1,2021,843,1,
92523161,16,0,240,1, 92711775,3167,16,0,237,
92532041,890,1,2293,3162, 92721,2029,850,1,2030,
925416,0,240,1,2043, 9273856,1,2031,861,1,
9255896,1,2045,901,1, 92742032,866,1,2033,871,
925641,3163,16,0,240, 92751,277,3168,16,0,
92571,1297,3164,16,0, 9276237,1,2035,877,1,
9258240,1,43,3165,16, 92772037,882,1,2039,887,
92590,240,1,1803,909, 92781,32,3169,16,0,
92601,1804,3166,16,0, 9279237,1,2041,893,1,
9261240,1,299,3167,16, 92802293,3170,16,0,237,
92620,240,1,52,3168, 92811,2043,899,1,2045,
926316,0,240,1,2318, 9282904,1,41,3171,16,
92643169,16,0,240,1, 92830,237,1,1297,3172,
92652075,3170,16,0,240, 928416,0,237,1,43,
92661,1574,921,1,71, 92853173,16,0,237,1,
92673171,16,0,240,1, 92861803,912,1,1804,3174,
926876,3172,16,0,240, 928716,0,237,1,299,
92691,1834,3173,16,0, 92883175,16,0,237,1,
9270240,1,2337,3174,16, 928952,3176,16,0,237,
92710,240,1,79,3175, 92901,2318,3177,16,0,
927216,0,240,1,1335, 9291237,1,2075,3178,16,
92733176,16,0,240,1, 92920,237,1,1574,924,
9274322,3177,16,0,240, 92931,71,3179,16,0,
92751,85,3178,16,0, 9294237,1,76,3180,16,
9276240,1,89,3179,16, 92950,237,1,1834,3181,
92770,240,1,346,3180, 929616,0,237,1,2337,
927816,0,240,1,2105, 92973182,16,0,237,1,
9279936,1,2106,3181,16, 929879,3183,16,0,237,
92800,240,1,97,3182, 92991,1335,3184,16,0,
928116,0,240,1,1860, 9300237,1,322,3185,16,
9282943,1,2364,949,1, 93010,237,1,85,3186,
9283102,3183,16,0,240, 930216,0,237,1,89,
92841,2782,3184,16,0, 93033187,16,0,237,1,
9285240,1,112,3185,16, 9304346,3188,16,0,237,
92860,240,1,1117,3186, 93051,2105,939,1,2106,
928716,0,240,1,1873, 93063189,16,0,237,1,
9288958,1,1876,3187,16, 930797,3190,16,0,237,
92890,240,1,124,3188, 93081,1860,946,1,2364,
929016,0,240,1,2136, 9309952,1,102,3191,16,
9291965,1,381,3189,16, 93100,237,1,112,3192,
92920,240,1,525,3190, 931116,0,237,1,1117,
929316,0,240,1,137, 93123193,16,0,237,1,
92943191,16,0,240,1, 93132786,3194,16,0,237,
92951901,3192,16,0,240, 93141,1873,961,1,1876,
92961,1153,3193,16,0, 93153195,16,0,237,1,
9297240,1,151,3194,16, 9316124,3196,16,0,237,
92980,240,1,1407,3195, 93171,2136,968,1,381,
929916,0,240,1,1659, 93183197,16,0,237,1,
93003196,16,0,240,1, 9319525,3198,16,0,237,
93012413,3197,16,0,240, 93201,137,3199,16,0,
93021,406,3198,16,0, 9321237,1,1901,3200,16,
9303240,1,1371,3199,16, 93220,237,1,1153,3201,
93040,240,1,166,3200, 932316,0,237,1,151,
930516,0,240,1,1622, 93243202,16,0,237,1,
93063201,16,0,240,1, 93251407,3203,16,0,237,
93071931,983,1,1933,3202, 93261,1659,3204,16,0,
930816,0,240,1,431, 9327237,1,2413,3205,16,
93093203,16,0,240,1, 93280,237,1,406,3206,
93101585,3204,16,0,240, 932916,0,237,1,1371,
93111,182,3205,16,0, 93303207,16,0,237,1,
9312240,1,1189,3206,16, 9331166,3208,16,0,237,
93130,240,1,1443,3207, 93321,1622,3209,16,0,
931416,0,240,1,1695, 9333237,1,1931,986,1,
93153208,16,0,240,1, 93341933,3210,16,0,237,
93162198,3209,16,0,240, 93351,431,3211,16,0,
93171,447,3210,16,0, 9336237,1,1585,3212,16,
9318240,1,2458,998,1, 93370,237,1,182,3213,
93192459,1004,1,1958,3211, 933816,0,237,1,1189,
932016,0,240,1,2462, 93393214,16,0,237,1,
93211011,1,1657,1016,1, 93401443,3215,16,0,237,
93222464,1021,1,199,3212, 93411,1695,3216,16,0,
932316,0,240,1,459, 9342237,1,2198,3217,16,
93243213,16,0,240,1, 93430,237,1,447,3218,
9325462,3214,16,0,240, 934416,0,237,1,2458,
93261,217,3215,16,0, 93451001,1,2459,1007,1,
9327240,1,2227,1030,1, 93461958,3219,16,0,237,
93281225,3216,16,0,240, 93471,2462,1014,1,1657,
93291,1479,3217,16,0, 93481019,1,2464,1024,1,
9330240,1,1731,3218,16, 9349199,3220,16,0,237,
93310,240,1,1989,1038, 93501,459,3221,16,0,
93321,1990,3219,16,0, 9351237,1,462,3222,16,
9333240,1,236,3220,16, 93520,237,1,217,3223,
93340,240,1,1756,3221, 935316,0,237,1,2227,
933516,0,240,1,37, 93541033,1,1225,3224,16,
93363222,19,263,1,37, 93550,237,1,1479,3225,
93373223,5,94,1,256, 935616,0,237,1,1731,
93383224,16,0,261,1, 93573226,16,0,237,1,
93391261,3225,16,0,261, 93581989,1041,1,1990,3227,
93401,509,3226,16,0, 935916,0,237,1,236,
9341261,1,1515,3227,16, 93603228,16,0,237,1,
93420,261,1,2021,840, 93611756,3229,16,0,237,
93431,1775,3228,16,0, 93621,37,3230,19,260,
9344261,1,2029,847,1, 93631,37,3231,5,94,
93452030,853,1,2031,858, 93641,256,3232,16,0,
93461,2032,863,1,2033, 9365258,1,1261,3233,16,
9347868,1,277,3229,16, 93660,258,1,509,3234,
93480,261,1,2035,874, 936716,0,258,1,1515,
93491,2037,879,1,2039, 93683235,16,0,258,1,
9350884,1,32,3230,16, 93692021,843,1,1775,3236,
93510,261,1,2041,890, 937016,0,258,1,2029,
93521,2293,3231,16,0, 9371850,1,2030,856,1,
9353261,1,2043,896,1, 93722031,861,1,2032,866,
93542045,901,1,41,3232, 93731,2033,871,1,277,
935516,0,261,1,1297, 93743237,16,0,258,1,
93563233,16,0,261,1, 93752035,877,1,2037,882,
935743,3234,16,0,261, 93761,2039,887,1,32,
93581,1803,909,1,1804, 93773238,16,0,258,1,
93593235,16,0,261,1, 93782041,893,1,2293,3239,
9360299,3236,16,0,261, 937916,0,258,1,2043,
93611,52,3237,16,0, 9380899,1,2045,904,1,
9362261,1,2318,3238,16, 938141,3240,16,0,258,
93630,261,1,2075,3239, 93821,1297,3241,16,0,
936416,0,261,1,1574, 9383258,1,43,3242,16,
9365921,1,71,3240,16, 93840,258,1,1803,912,
93660,261,1,76,3241, 93851,1804,3243,16,0,
936716,0,261,1,1834, 9386258,1,299,3244,16,
93683242,16,0,261,1, 93870,258,1,52,3245,
93692337,3243,16,0,261, 938816,0,258,1,2318,
93701,79,3244,16,0, 93893246,16,0,258,1,
9371261,1,1335,3245,16, 93902075,3247,16,0,258,
93720,261,1,322,3246, 93911,1574,924,1,71,
937316,0,261,1,85, 93923248,16,0,258,1,
93743247,16,0,261,1, 939376,3249,16,0,258,
937589,3248,16,0,261, 93941,1834,3250,16,0,
93761,346,3249,16,0, 9395258,1,2337,3251,16,
9377261,1,2105,936,1, 93960,258,1,79,3252,
93782106,3250,16,0,261, 939716,0,258,1,1335,
93791,97,3251,16,0, 93983253,16,0,258,1,
9380261,1,1860,943,1, 9399322,3254,16,0,258,
93812364,949,1,102,3252, 94001,85,3255,16,0,
938216,0,261,1,2782, 9401258,1,89,3256,16,
93833253,16,0,261,1, 94020,258,1,346,3257,
9384112,3254,16,0,261, 940316,0,258,1,2105,
93851,1117,3255,16,0, 9404939,1,2106,3258,16,
9386261,1,1873,958,1, 94050,258,1,97,3259,
93871876,3256,16,0,261, 940616,0,258,1,1860,
93881,124,3257,16,0, 9407946,1,2364,952,1,
9389261,1,2136,965,1, 9408102,3260,16,0,258,
9390381,3258,16,0,261, 94091,112,3261,16,0,
93911,525,3259,16,0, 9410258,1,1117,3262,16,
9392261,1,137,3260,16, 94110,258,1,2786,3263,
93930,261,1,1901,3261, 941216,0,258,1,1873,
939416,0,261,1,1153, 9413961,1,1876,3264,16,
93953262,16,0,261,1, 94140,258,1,124,3265,
9396151,3263,16,0,261, 941516,0,258,1,2136,
93971,1407,3264,16,0, 9416968,1,381,3266,16,
9398261,1,1659,3265,16, 94170,258,1,525,3267,
93990,261,1,2413,3266, 941816,0,258,1,137,
940016,0,261,1,406, 94193268,16,0,258,1,
94013267,16,0,261,1, 94201901,3269,16,0,258,
94021371,3268,16,0,261, 94211,1153,3270,16,0,
94031,166,3269,16,0, 9422258,1,151,3271,16,
9404261,1,1622,3270,16, 94230,258,1,1407,3272,
94050,261,1,1931,983, 942416,0,258,1,1659,
94061,1933,3271,16,0, 94253273,16,0,258,1,
9407261,1,431,3272,16, 94262413,3274,16,0,258,
94080,261,1,1585,3273, 94271,406,3275,16,0,
940916,0,261,1,182, 9428258,1,1371,3276,16,
94103274,16,0,261,1, 94290,258,1,166,3277,
94111189,3275,16,0,261, 943016,0,258,1,1622,
94121,1443,3276,16,0, 94313278,16,0,258,1,
9413261,1,1695,3277,16, 94321931,986,1,1933,3279,
94140,261,1,2198,3278, 943316,0,258,1,431,
941516,0,261,1,447, 94343280,16,0,258,1,
94163279,16,0,261,1, 94351585,3281,16,0,258,
94172458,998,1,2459,1004, 94361,182,3282,16,0,
94181,1958,3280,16,0, 9437258,1,1189,3283,16,
9419261,1,2462,1011,1, 94380,258,1,1443,3284,
94201657,1016,1,2464,1021, 943916,0,258,1,1695,
94211,199,3281,16,0, 94403285,16,0,258,1,
9422261,1,459,3282,16, 94412198,3286,16,0,258,
94230,261,1,462,3283, 94421,447,3287,16,0,
942416,0,261,1,217, 9443258,1,2458,1001,1,
94253284,16,0,261,1, 94442459,1007,1,1958,3288,
94262227,1030,1,1225,3285, 944516,0,258,1,2462,
942716,0,261,1,1479, 94461014,1,1657,1019,1,
94283286,16,0,261,1, 94472464,1024,1,199,3289,
94291731,3287,16,0,261, 944816,0,258,1,459,
94301,1989,1038,1,1990, 94493290,16,0,258,1,
94313288,16,0,261,1, 9450462,3291,16,0,258,
9432236,3289,16,0,261, 94511,217,3292,16,0,
94331,1756,3290,16,0, 9452258,1,2227,1033,1,
9434261,1,38,3291,19, 94531225,3293,16,0,258,
9435260,1,38,3292,5, 94541,1479,3294,16,0,
943684,1,1011,1224,1, 9455258,1,1731,3295,16,
94371012,3293,16,0,258, 94560,258,1,1989,1041,
94381,1013,1381,1,262, 94571,1990,3296,16,0,
94391241,1,1267,3294,16, 9458258,1,236,3297,16,
94400,258,1,515,3295, 94590,258,1,1756,3298,
944116,0,258,1,1521, 946016,0,258,1,38,
94423296,16,0,258,1, 94613299,19,257,1,38,
9443525,1339,1,2788,3297, 94623300,5,84,1,1011,
944416,0,258,1,283, 94631227,1,1012,3301,16,
94451295,1,2299,3298,16, 94640,255,1,1013,1385,
94460,258,1,42,3299, 94651,262,1244,1,1267,
944716,0,258,1,40, 94663302,16,0,255,1,
94481300,1,44,1306,1, 9467515,3303,16,0,255,
944947,1307,1,1303,3300, 94681,1521,3304,16,0,
945016,0,258,1,1555, 9469255,1,525,1343,1,
94513301,16,0,258,1, 94702792,3305,16,0,255,
945250,1324,1,48,1313, 94711,283,1299,1,2299,
94531,49,1319,1,51, 94723306,16,0,255,1,
94541329,1,63,1345,1, 947342,3307,16,0,255,
9455305,1334,1,66,1351, 94741,40,1304,1,44,
94561,67,1356,1,68, 94751310,1,47,1311,1,
94571361,1,69,1366,1, 94761303,3308,16,0,255,
945870,1371,1,73,3302, 94771,1555,3309,16,0,
945916,0,258,1,74, 9478255,1,50,1328,1,
94601376,1,328,1425,1, 947948,1317,1,49,1323,
94611048,1462,1,82,3303, 94801,51,1333,1,63,
946216,0,258,1,1840, 94811349,1,305,1338,1,
94633304,16,0,258,1, 948266,1355,1,67,1360,
94641591,3305,16,0,258, 94831,68,1365,1,69,
94651,1341,3306,16,0, 94841370,1,70,1375,1,
9466258,1,1096,1694,1, 948573,3310,16,0,255,
946793,1435,1,352,1467, 94861,74,1380,1,328,
94681,107,3307,16,0, 94871429,1,1048,1470,1,
9469258,1,1114,1461,1, 948882,3311,16,0,255,
9470118,1473,1,1123,3308, 94891,1840,3312,16,0,
947116,0,258,1,371, 9490255,1,1591,3313,16,
94721483,1,1628,3309,16, 94910,255,1,1341,3314,
94730,258,1,375,1494, 949216,0,255,1,1096,
94741,1882,3310,16,0, 94931439,1,93,1445,1,
9475258,1,377,1499,1, 9494352,1475,1,107,3315,
9476379,1504,1,380,1509, 949516,0,255,1,1114,
94771,883,1515,1,373, 94961469,1,118,1481,1,
94781527,1,130,1532,1, 94971123,3316,16,0,255,
9479143,1537,1,387,3311, 94981,371,1491,1,1628,
948016,0,258,1,1159, 94993317,16,0,255,1,
94813312,16,0,258,1, 9500375,1502,1,1882,3318,
9482157,1560,1,1413,3313, 950116,0,255,1,377,
948316,0,258,1,1665, 95021507,1,379,1512,1,
94843314,16,0,258,1, 9503380,1517,1,883,1523,
9485412,3315,16,0,258, 95041,373,1535,1,130,
94861,1377,3316,16,0, 95051540,1,143,1545,1,
9487258,1,172,1586,1, 9506387,3319,16,0,255,
94881939,3317,16,0,258, 95071,1159,3320,16,0,
94891,437,3318,16,0, 9508255,1,157,1568,1,
9490258,1,188,1635,1, 95091413,3321,16,0,255,
9491942,1607,1,1195,3319, 95101,1665,3322,16,0,
949216,0,258,1,1449, 9511255,1,412,3323,16,
94933320,16,0,258,1, 95120,255,1,1377,3324,
94941701,3321,16,0,258, 951316,0,255,1,172,
94951,447,1628,1,205, 95141595,1,1939,3325,16,
94961640,1,827,1448,1, 95150,255,1,437,3326,
9497223,1650,1,476,1660, 951616,0,255,1,188,
94981,477,1666,1,1231, 95171644,1,942,1616,1,
94993322,16,0,258,1, 95181195,3327,16,0,255,
9500479,1676,1,480,1681, 95191,1449,3328,16,0,
95011,1485,3323,16,0, 9520255,1,1701,3329,16,
9502258,1,1737,3324,16, 95210,255,1,447,1637,
95030,258,1,242,1700, 95221,205,1649,1,827,
95041,478,1705,1,1001, 95231457,1,223,1659,1,
95051710,1,1002,1715,1, 9524476,1669,1,477,1675,
950639,3325,19,248,1, 95251,1231,3330,16,0,
950739,3326,5,84,1, 9526255,1,479,1685,1,
95081011,1224,1,1012,3327, 9527480,1690,1,1485,3331,
950916,0,246,1,1013, 952816,0,255,1,1737,
95101381,1,262,1241,1, 95293332,16,0,255,1,
95111267,3328,16,0,246, 9530242,1703,1,478,1708,
95121,515,3329,16,0, 95311,1001,1713,1,1002,
9513246,1,1521,3330,16, 95321718,1,39,3333,19,
95140,246,1,525,1339, 9533245,1,39,3334,5,
95151,2788,3331,16,0, 953484,1,1011,1227,1,
9516246,1,283,1295,1, 95351012,3335,16,0,243,
95172299,3332,16,0,246, 95361,1013,1385,1,262,
95181,42,3333,16,0, 95371244,1,1267,3336,16,
9519246,1,40,1300,1, 95380,243,1,515,3337,
952044,1306,1,47,1307, 953916,0,243,1,1521,
95211,1303,3334,16,0, 95403338,16,0,243,1,
9522246,1,1555,3335,16, 9541525,1343,1,2792,3339,
95230,246,1,50,1324, 954216,0,243,1,283,
95241,48,1313,1,49, 95431299,1,2299,3340,16,
95251319,1,51,1329,1, 95440,243,1,42,3341,
952663,1345,1,305,1334, 954516,0,243,1,40,
95271,66,1351,1,67, 95461304,1,44,1310,1,
95281356,1,68,1361,1, 954747,1311,1,1303,3342,
952969,1366,1,70,1371, 954816,0,243,1,1555,
95301,73,3336,16,0, 95493343,16,0,243,1,
9531246,1,74,1376,1, 955050,1328,1,48,1317,
9532328,1425,1,1048,1462, 95511,49,1323,1,51,
95331,82,3337,16,0, 95521333,1,63,1349,1,
9534246,1,1840,3338,16, 9553305,1338,1,66,1355,
95350,246,1,1591,3339, 95541,67,1360,1,68,
953616,0,246,1,1341, 95551365,1,69,1370,1,
95373340,16,0,246,1, 955670,1375,1,73,3344,
95381096,1694,1,93,1435, 955716,0,243,1,74,
95391,352,1467,1,107, 95581380,1,328,1429,1,
95403341,16,0,246,1, 95591048,1470,1,82,3345,
95411114,1461,1,118,1473, 956016,0,243,1,1840,
95421,1123,3342,16,0, 95613346,16,0,243,1,
9543246,1,371,1483,1, 95621591,3347,16,0,243,
95441628,3343,16,0,246, 95631,1341,3348,16,0,
95451,375,1494,1,1882, 9564243,1,1096,1439,1,
95463344,16,0,246,1, 956593,1445,1,352,1475,
9547377,1499,1,379,1504, 95661,107,3349,16,0,
95481,380,1509,1,883, 9567243,1,1114,1469,1,
95491515,1,373,1527,1, 9568118,1481,1,1123,3350,
9550130,1532,1,143,1537, 956916,0,243,1,371,
95511,387,3345,16,0, 95701491,1,1628,3351,16,
9552246,1,1159,3346,16, 95710,243,1,375,1502,
95530,246,1,157,1560, 95721,1882,3352,16,0,
95541,1413,3347,16,0, 9573243,1,377,1507,1,
9555246,1,1665,3348,16, 9574379,1512,1,380,1517,
95560,246,1,412,3349, 95751,883,1523,1,373,
955716,0,246,1,1377, 95761535,1,130,1540,1,
95583350,16,0,246,1, 9577143,1545,1,387,3353,
9559172,1586,1,1939,3351, 957816,0,243,1,1159,
956016,0,246,1,437, 95793354,16,0,243,1,
95613352,16,0,246,1, 9580157,1568,1,1413,3355,
9562188,1635,1,942,1607, 958116,0,243,1,1665,
95631,1195,3353,16,0, 95823356,16,0,243,1,
9564246,1,1449,3354,16, 9583412,3357,16,0,243,
95650,246,1,1701,3355, 95841,1377,3358,16,0,
956616,0,246,1,447, 9585243,1,172,1595,1,
95671628,1,205,1640,1, 95861939,3359,16,0,243,
9568827,1448,1,223,1650, 95871,437,3360,16,0,
95691,476,1660,1,477, 9588243,1,188,1644,1,
95701666,1,1231,3356,16, 9589942,1616,1,1195,3361,
95710,246,1,479,1676, 959016,0,243,1,1449,
95721,480,1681,1,1485, 95913362,16,0,243,1,
95733357,16,0,246,1, 95921701,3363,16,0,243,
95741737,3358,16,0,246, 95931,447,1637,1,205,
95751,242,1700,1,478, 95941649,1,827,1457,1,
95761705,1,1001,1710,1, 9595223,1659,1,476,1669,
95771002,1715,1,40,3359, 95961,477,1675,1,1231,
957819,236,1,40,3360, 95973364,16,0,243,1,
95795,84,1,1011,1224, 9598479,1685,1,480,1690,
95801,1012,3361,16,0, 95991,1485,3365,16,0,
9581234,1,1013,1381,1, 9600243,1,1737,3366,16,
9582262,1241,1,1267,3362, 96010,243,1,242,1703,
958316,0,234,1,515, 96021,478,1708,1,1001,
95843363,16,0,234,1, 96031713,1,1002,1718,1,
95851521,3364,16,0,234, 960440,3367,19,233,1,
95861,525,1339,1,2788, 960540,3368,5,84,1,
95873365,16,0,234,1, 96061011,1227,1,1012,3369,
9588283,1295,1,2299,3366, 960716,0,231,1,1013,
958916,0,234,1,42, 96081385,1,262,1244,1,
95903367,16,0,234,1, 96091267,3370,16,0,231,
959140,1300,1,44,1306, 96101,515,3371,16,0,
95921,47,1307,1,1303, 9611231,1,1521,3372,16,
95933368,16,0,234,1, 96120,231,1,525,1343,
95941555,3369,16,0,234, 96131,2792,3373,16,0,
95951,50,1324,1,48, 9614231,1,283,1299,1,
95961313,1,49,1319,1, 96152299,3374,16,0,231,
959751,1329,1,63,1345, 96161,42,3375,16,0,
95981,305,1334,1,66, 9617231,1,40,1304,1,
95991351,1,67,1356,1, 961844,1310,1,47,1311,
960068,1361,1,69,1366, 96191,1303,3376,16,0,
96011,70,1371,1,73, 9620231,1,1555,3377,16,
96023370,16,0,234,1, 96210,231,1,50,1328,
960374,1376,1,328,1425, 96221,48,1317,1,49,
96041,1048,1462,1,82, 96231323,1,51,1333,1,
96053371,16,0,234,1, 962463,1349,1,305,1338,
96061840,3372,16,0,234, 96251,66,1355,1,67,
96071,1591,3373,16,0, 96261360,1,68,1365,1,
9608234,1,1341,3374,16, 962769,1370,1,70,1375,
96090,234,1,1096,1694, 96281,73,3378,16,0,
96101,93,1435,1,352, 9629231,1,74,1380,1,
96111467,1,107,3375,16, 9630328,1429,1,1048,1470,
96120,234,1,1114,1461, 96311,82,3379,16,0,
96131,118,3376,16,0, 9632231,1,1840,3380,16,
9614234,1,1123,3377,16, 96330,231,1,1591,3381,
96150,234,1,371,1483, 963416,0,231,1,1341,
96161,1628,3378,16,0, 96353382,16,0,231,1,
9617234,1,375,1494,1, 96361096,1439,1,93,1445,
96181882,3379,16,0,234, 96371,352,1475,1,107,
96191,377,1499,1,379, 96383383,16,0,231,1,
96201504,1,380,1509,1, 96391114,1469,1,118,3384,
9621883,3380,16,0,234, 964016,0,231,1,1123,
96221,373,1527,1,130, 96413385,16,0,231,1,
96233381,16,0,234,1, 9642371,1491,1,1628,3386,
9624143,3382,16,0,234, 964316,0,231,1,375,
96251,387,3383,16,0, 96441502,1,1882,3387,16,
9626234,1,1159,3384,16, 96450,231,1,377,1507,
96270,234,1,157,3385, 96461,379,1512,1,380,
962816,0,234,1,1413, 96471517,1,883,3388,16,
96293386,16,0,234,1, 96480,231,1,373,1535,
96301665,3387,16,0,234, 96491,130,3389,16,0,
96311,412,3388,16,0, 9650231,1,143,3390,16,
9632234,1,1377,3389,16, 96510,231,1,387,3391,
96330,234,1,172,3390, 965216,0,231,1,1159,
963416,0,234,1,1939, 96533392,16,0,231,1,
96353391,16,0,234,1, 9654157,3393,16,0,231,
9636437,3392,16,0,234, 96551,1413,3394,16,0,
96371,188,3393,16,0, 9656231,1,1665,3395,16,
9638234,1,942,1607,1, 96570,231,1,412,3396,
96391195,3394,16,0,234, 965816,0,231,1,1377,
96401,1449,3395,16,0, 96593397,16,0,231,1,
9641234,1,1701,3396,16, 9660172,3398,16,0,231,
96420,234,1,447,1628, 96611,1939,3399,16,0,
96431,205,3397,16,0, 9662231,1,437,3400,16,
9644234,1,827,3398,16, 96630,231,1,188,3401,
96450,234,1,223,3399, 966416,0,231,1,942,
964616,0,234,1,476, 96651616,1,1195,3402,16,
96471660,1,477,1666,1, 96660,231,1,1449,3403,
96481231,3400,16,0,234, 966716,0,231,1,1701,
96491,479,1676,1,480, 96683404,16,0,231,1,
96501681,1,1485,3401,16, 9669447,1637,1,205,3405,
96510,234,1,1737,3402, 967016,0,231,1,827,
965216,0,234,1,242, 96713406,16,0,231,1,
96533403,16,0,234,1, 9672223,3407,16,0,231,
9654478,1705,1,1001,1710, 96731,476,1669,1,477,
96551,1002,1715,1,41, 96741675,1,1231,3408,16,
96563404,19,191,1,41, 96750,231,1,479,1685,
96573405,5,84,1,1011, 96761,480,1690,1,1485,
96581224,1,1012,3406,16, 96773409,16,0,231,1,
96590,189,1,1013,1381, 96781737,3410,16,0,231,
96601,262,1241,1,1267, 96791,242,3411,16,0,
96613407,16,0,189,1, 9680231,1,478,1708,1,
9662515,3408,16,0,189, 96811001,1713,1,1002,1718,
96631,1521,3409,16,0, 96821,41,3412,19,188,
9664189,1,525,1339,1, 96831,41,3413,5,84,
96652788,3410,16,0,189, 96841,1011,1227,1,1012,
96661,283,1295,1,2299, 96853414,16,0,186,1,
96673411,16,0,189,1, 96861013,1385,1,262,1244,
966842,3412,16,0,189, 96871,1267,3415,16,0,
96691,40,1300,1,44, 9688186,1,515,3416,16,
96701306,1,47,1307,1, 96890,186,1,1521,3417,
96711303,3413,16,0,189, 969016,0,186,1,525,
96721,1555,3414,16,0, 96911343,1,2792,3418,16,
9673189,1,50,1324,1, 96920,186,1,283,1299,
967448,1313,1,49,1319, 96931,2299,3419,16,0,
96751,51,1329,1,63, 9694186,1,42,3420,16,
96761345,1,305,1334,1, 96950,186,1,40,1304,
967766,1351,1,67,1356, 96961,44,1310,1,47,
96781,68,1361,1,69, 96971311,1,1303,3421,16,
96791366,1,70,1371,1, 96980,186,1,1555,3422,
968073,3415,16,0,189, 969916,0,186,1,50,
96811,74,1376,1,328, 97001328,1,48,1317,1,
96821425,1,1048,1462,1, 970149,1323,1,51,1333,
968382,3416,16,0,189, 97021,63,1349,1,305,
96841,1840,3417,16,0, 97031338,1,66,1355,1,
9685189,1,1591,3418,16, 970467,1360,1,68,1365,
96860,189,1,1341,3419, 97051,69,1370,1,70,
968716,0,189,1,1096, 97061375,1,73,3423,16,
96881694,1,93,1435,1, 97070,186,1,74,1380,
9689352,1467,1,107,3420, 97081,328,1429,1,1048,
969016,0,189,1,1114, 97091470,1,82,3424,16,
96911461,1,118,3421,16, 97100,186,1,1840,3425,
96920,189,1,1123,3422, 971116,0,186,1,1591,
969316,0,189,1,371, 97123426,16,0,186,1,
96941483,1,1628,3423,16, 97131341,3427,16,0,186,
96950,189,1,375,1494, 97141,1096,1439,1,93,
96961,1882,3424,16,0, 97151445,1,352,1475,1,
9697189,1,377,1499,1, 9716107,3428,16,0,186,
9698379,1504,1,380,1509, 97171,1114,1469,1,118,
96991,883,3425,16,0, 97183429,16,0,186,1,
9700189,1,373,1527,1, 97191123,3430,16,0,186,
9701130,3426,16,0,189, 97201,371,1491,1,1628,
97021,143,3427,16,0, 97213431,16,0,186,1,
9703189,1,387,3428,16, 9722375,1502,1,1882,3432,
97040,189,1,1159,3429, 972316,0,186,1,377,
970516,0,189,1,157, 97241507,1,379,1512,1,
97063430,16,0,189,1, 9725380,1517,1,883,3433,
97071413,3431,16,0,189, 972616,0,186,1,373,
97081,1665,3432,16,0, 97271535,1,130,3434,16,
9709189,1,412,3433,16, 97280,186,1,143,3435,
97100,189,1,1377,3434, 972916,0,186,1,387,
971116,0,189,1,172, 97303436,16,0,186,1,
97123435,16,0,189,1, 97311159,3437,16,0,186,
97131939,3436,16,0,189, 97321,157,3438,16,0,
97141,437,3437,16,0, 9733186,1,1413,3439,16,
9715189,1,188,3438,16, 97340,186,1,1665,3440,
97160,189,1,942,1607, 973516,0,186,1,412,
97171,1195,3439,16,0, 97363441,16,0,186,1,
9718189,1,1449,3440,16, 97371377,3442,16,0,186,
97190,189,1,1701,3441, 97381,172,3443,16,0,
972016,0,189,1,447, 9739186,1,1939,3444,16,
97211628,1,205,3442,16, 97400,186,1,437,3445,
97220,189,1,827,3443, 974116,0,186,1,188,
972316,0,189,1,223, 97423446,16,0,186,1,
97243444,16,0,189,1, 9743942,1616,1,1195,3447,
9725476,1660,1,477,1666, 974416,0,186,1,1449,
97261,1231,3445,16,0, 97453448,16,0,186,1,
9727189,1,479,1676,1, 97461701,3449,16,0,186,
9728480,1681,1,1485,3446, 97471,447,1637,1,205,
972916,0,189,1,1737, 97483450,16,0,186,1,
97303447,16,0,189,1, 9749827,3451,16,0,186,
9731242,3448,16,0,189, 97501,223,3452,16,0,
97321,478,1705,1,1001, 9751186,1,476,1669,1,
97331710,1,1002,1715,1, 9752477,1675,1,1231,3453,
973442,3449,19,430,1, 975316,0,186,1,479,
973542,3450,5,38,1, 97541685,1,480,1690,1,
97361901,3451,16,0,428, 97551485,3454,16,0,186,
97371,2075,3452,16,0, 97561,1737,3455,16,0,
9738428,1,1860,943,1, 9757186,1,242,3456,16,
97391803,909,1,1804,3453, 97580,186,1,478,1708,
974016,0,428,1,2413, 97591,1001,1713,1,1002,
97413454,16,0,428,1, 97601718,1,42,3457,19,
97422198,3455,16,0,428, 9761440,1,42,3458,5,
97431,1873,958,1,1657, 976238,1,1901,3459,16,
97441016,1,1989,1038,1, 97630,438,1,2075,3460,
97451990,3456,16,0,428, 976416,0,438,1,1860,
97461,1775,3457,16,0, 9765946,1,1803,912,1,
9747428,1,32,3458,16, 97661804,3461,16,0,438,
97480,428,1,2105,936, 97671,2413,3462,16,0,
97491,2106,3459,16,0, 9768438,1,2198,3463,16,
9750428,1,2364,949,1, 97690,438,1,1873,961,
97512227,1030,1,2337,3460, 97701,1657,1019,1,1989,
975216,0,428,1,2021, 97711041,1,1990,3464,16,
9753840,1,2458,998,1, 97720,438,1,1775,3465,
97542459,1004,1,2462,1011, 977316,0,438,1,32,
97551,2136,965,1,2464, 97743466,16,0,438,1,
97561021,1,2029,847,1, 97752105,939,1,2106,3467,
97572030,853,1,2031,858, 977616,0,438,1,2364,
97581,2032,863,1,2033, 9777952,1,2227,1033,1,
9759868,1,2035,874,1, 97782337,3468,16,0,438,
97602037,879,1,2039,884, 97791,2021,843,1,2458,
97611,1931,983,1,2041, 97801001,1,2459,1007,1,
9762890,1,2043,896,1, 97812462,1014,1,2136,968,
97632045,901,1,1574,921, 97821,2464,1024,1,2029,
97641,1958,3461,16,0, 9783850,1,2030,856,1,
9765428,1,43,3462,19, 97842031,861,1,2032,866,
9766518,1,43,3463,5, 97851,2033,871,1,2035,
976725,1,2035,874,1, 9786877,1,2037,882,1,
97682037,879,1,2039,884, 97872039,887,1,1931,986,
97691,2041,890,1,2227, 97881,2041,893,1,2043,
97701030,1,2043,896,1, 9789899,1,2045,904,1,
97711657,1016,1,1860,943, 97901574,924,1,1958,3469,
97721,2136,965,1,2021, 979116,0,438,1,43,
9773840,1,2459,1004,1, 97923470,19,532,1,43,
97741574,921,1,2105,3464, 97933471,5,25,1,2035,
977516,0,683,1,1931, 9794877,1,2037,882,1,
9776983,1,1873,958,1, 97952039,887,1,2041,893,
97772031,858,1,1803,909, 97961,2227,1033,1,2043,
97781,1989,3465,16,0, 9797899,1,1657,1019,1,
9779516,1,2464,1021,1, 97981860,946,1,2136,968,
97802029,847,1,2030,853, 97991,2021,843,1,2459,
97811,2364,949,1,2032, 98001007,1,1574,924,1,
9782863,1,2033,868,1, 98012105,3472,16,0,698,
97832045,901,1,44,3466, 98021,1931,986,1,1873,
978419,289,1,44,3467, 9803961,1,2031,861,1,
97855,38,1,1901,3468, 98041803,912,1,1989,3473,
978616,0,287,1,2075, 980516,0,530,1,2464,
97873469,16,0,287,1, 98061024,1,2029,850,1,
97881860,943,1,1803,909, 98072030,856,1,2364,952,
97891,1804,3470,16,0, 98081,2032,866,1,2033,
9790287,1,2413,3471,16, 9809871,1,2045,904,1,
97910,287,1,2198,3472, 981044,3474,19,292,1,
979216,0,287,1,1873, 981144,3475,5,38,1,
9793958,1,1657,1016,1, 98121901,3476,16,0,290,
97941989,1038,1,1990,3473, 98131,2075,3477,16,0,
979516,0,287,1,1775, 9814290,1,1860,946,1,
97963474,16,0,287,1, 98151803,912,1,1804,3478,
979732,3475,16,0,287, 981616,0,290,1,2413,
97981,2105,936,1,2106, 98173479,16,0,290,1,
97993476,16,0,287,1, 98182198,3480,16,0,290,
98002364,949,1,2227,1030, 98191,1873,961,1,1657,
98011,2337,3477,16,0, 98201019,1,1989,1041,1,
9802287,1,2021,840,1, 98211990,3481,16,0,290,
98032458,998,1,2459,1004, 98221,1775,3482,16,0,
98041,2462,1011,1,2136, 9823290,1,32,3483,16,
9805965,1,2464,1021,1, 98240,290,1,2105,939,
98062029,847,1,2030,853, 98251,2106,3484,16,0,
98071,2031,858,1,2032, 9826290,1,2364,952,1,
9808863,1,2033,868,1, 98272227,1033,1,2337,3485,
98092035,874,1,2037,879, 982816,0,290,1,2021,
98101,2039,884,1,1931, 9829843,1,2458,1001,1,
9811983,1,2041,890,1, 98302459,1007,1,2462,1014,
98122043,896,1,2045,901, 98311,2136,968,1,2464,
98131,1574,921,1,1958, 98321024,1,2029,850,1,
98143478,16,0,287,1, 98332030,856,1,2031,861,
981545,3479,19,320,1, 98341,2032,866,1,2033,
981645,3480,5,39,1, 9835871,1,2035,877,1,
98171901,3481,16,0,350, 98362037,882,1,2039,887,
98181,2075,3482,16,0, 98371,1931,986,1,2041,
9819350,1,1860,943,1, 9838893,1,2043,899,1,
98201803,909,1,1804,3483, 98392045,904,1,1574,924,
982116,0,350,1,2413, 98401,1958,3486,16,0,
98223484,16,0,350,1, 9841290,1,45,3487,19,
98232198,3485,16,0,350, 9842325,1,45,3488,5,
98241,1873,958,1,1657, 984339,1,1901,3489,16,
98251016,1,1989,1038,1, 98440,355,1,2075,3490,
98261990,3486,16,0,350, 984516,0,355,1,1860,
98271,1775,3487,16,0, 9846946,1,1803,912,1,
9828350,1,32,3488,16, 98471804,3491,16,0,355,
98290,350,1,2105,936, 98481,2413,3492,16,0,
98301,2106,3489,16,0, 9849355,1,2198,3493,16,
9831350,1,2364,949,1, 98500,355,1,1873,961,
98322227,1030,1,2337,3490, 98511,1657,1019,1,1989,
983316,0,350,1,2021, 98521041,1,1990,3494,16,
9834840,1,2458,998,1, 98530,355,1,1775,3495,
98352459,1004,1,2462,1011, 985416,0,355,1,32,
98361,2136,965,1,2464, 98553496,16,0,355,1,
98371021,1,2029,847,1, 98562105,939,1,2106,3497,
98382030,853,1,2031,858, 985716,0,355,1,2364,
98391,2032,863,1,2033, 9858952,1,2227,1033,1,
9840868,1,2035,874,1, 98592337,3498,16,0,355,
98412037,879,1,2039,884, 98601,2021,843,1,2458,
98421,1931,983,1,2041, 98611001,1,2459,1007,1,
9843890,1,2043,896,1, 98622462,1014,1,2136,968,
98442045,901,1,1832,3491, 98631,2464,1024,1,2029,
984516,0,318,1,1574, 9864850,1,2030,856,1,
9846921,1,1958,3492,16, 98652031,861,1,2032,866,
98470,350,1,46,3493, 98661,2033,871,1,2035,
984819,789,1,46,3494, 9867877,1,2037,882,1,
98495,38,1,1901,3495, 98682039,887,1,1931,986,
985016,0,787,1,2075, 98691,2041,893,1,2043,
98513496,16,0,787,1, 9870899,1,2045,904,1,
98521860,943,1,1803,909, 98711832,3499,16,0,323,
98531,1804,3497,16,0, 98721,1574,924,1,1958,
9854787,1,2413,3498,16, 98733500,16,0,355,1,
98550,787,1,2198,3499, 987446,3501,19,794,1,
985616,0,787,1,1873, 987546,3502,5,38,1,
9857958,1,1657,1016,1, 98761901,3503,16,0,792,
98581989,1038,1,1990,3500, 98771,2075,3504,16,0,
985916,0,787,1,1775, 9878792,1,1860,946,1,
98603501,16,0,787,1, 98791803,912,1,1804,3505,
986132,3502,16,0,787, 988016,0,792,1,2413,
98621,2105,936,1,2106, 98813506,16,0,792,1,
98633503,16,0,787,1, 98822198,3507,16,0,792,
98642364,949,1,2227,1030, 98831,1873,961,1,1657,
98651,2337,3504,16,0, 98841019,1,1989,1041,1,
9866787,1,2021,840,1, 98851990,3508,16,0,792,
98672458,998,1,2459,1004, 98861,1775,3509,16,0,
98681,2462,1011,1,2136, 9887792,1,32,3510,16,
9869965,1,2464,1021,1, 98880,792,1,2105,939,
98702029,847,1,2030,853, 98891,2106,3511,16,0,
98711,2031,858,1,2032, 9890792,1,2364,952,1,
9872863,1,2033,868,1, 98912227,1033,1,2337,3512,
98732035,874,1,2037,879, 989216,0,792,1,2021,
98741,2039,884,1,1931, 9893843,1,2458,1001,1,
9875983,1,2041,890,1, 98942459,1007,1,2462,1014,
98762043,896,1,2045,901, 98951,2136,968,1,2464,
98771,1574,921,1,1958, 98961024,1,2029,850,1,
98783505,16,0,787,1, 98972030,856,1,2031,861,
987947,3506,19,660,1, 98981,2032,866,1,2033,
988047,3507,5,19,1, 9899871,1,2035,877,1,
98810,3508,16,0,760, 99002037,882,1,2039,887,
98821,2760,3509,16,0, 99011,1931,986,1,2041,
9883760,1,2779,3510,17, 9902893,1,2043,899,1,
98843511,15,3512,4,50, 99032045,904,1,1574,924,
988537,0,71,0,108, 99041,1958,3513,16,0,
98860,111,0,98,0, 9905792,1,47,3514,19,
988797,0,108,0,70, 9906283,1,47,3515,5,
98880,117,0,110,0, 990719,1,0,3516,16,
988999,0,116,0,105, 99080,281,1,2783,3517,
98900,111,0,110,0, 990917,3518,15,3519,4,
989168,0,101,0,102, 991050,37,0,71,0,
98920,105,0,110,0,
9893105,0,116,0,105,
98940,111,0,110,0,
98951,-1,1,5,3513,
989620,3514,4,52,71,
98970,108,0,111,0,
989898,0,97,0,108,
98990,70,0,117,0,
9900110,0,99,0,116,
99010,105,0,111,0,
9902110,0,68,0,101,
99030,102,0,105,0,
9904110,0,105,0,116,
99050,105,0,111,0,
9906110,0,95,0,49,
99070,1,174,1,3,
99081,6,1,5,3515,
990922,1,9,1,2764,
9910801,1,2818,3516,17,
99113517,15,3518,4,52,
991237,0,71,0,108,
99130,111,0,98,0,
991497,0,108,0,86,
99150,97,0,114,0,
9916105,0,97,0,98,
99170,108,0,101,0,
991868,0,101,0,99,
99190,108,0,97,0,
9920114,0,97,0,116,
99210,105,0,111,0,
9922110,0,1,-1,1,
99235,3519,20,3520,4,
992454,71,0,108,0,
9925111,0,98,0,97,
99260,108,0,86,0,
992797,0,114,0,105,
99280,97,0,98,0,
9929108,0,101,0,68,
99300,101,0,99,0,
9931108,0,97,0,114,
99320,97,0,116,0,
9933105,0,111,0,110,
99340,95,0,49,0,
99351,172,1,3,1,
99363,1,2,3521,22,
99371,7,1,2819,3522,
993816,0,760,1,2751,
9939807,1,2022,3523,16,
99400,658,1,2459,1004,
99411,2830,3524,16,0,
9942760,1,2647,824,1,
99432464,1021,1,2466,3525,
994417,3526,15,3512,1,
9945-1,1,5,3527,20,
99463528,4,52,71,0,
9947108,0,111,0,98, 9911108,0,111,0,98,
99480,97,0,108,0, 99120,97,0,108,0,
994970,0,117,0,110, 991370,0,117,0,110,
@@ -9953,60 +9917,96 @@ public yyLSLSyntax
9953102,0,105,0,110, 9917102,0,105,0,110,
99540,105,0,116,0, 99180,105,0,116,0,
9955105,0,111,0,110, 9919105,0,111,0,110,
99560,95,0,50,0, 99200,1,-1,1,5,
99571,175,1,3,1, 99213520,20,3521,4,52,
99587,1,6,3529,22, 992271,0,108,0,111,
99591,10,1,2837,3530, 99230,98,0,97,0,
996017,3531,15,3532,4, 9924108,0,70,0,117,
996136,37,0,71,0, 99250,110,0,99,0,
9962108,0,111,0,98, 9926116,0,105,0,111,
99630,97,0,108,0, 99270,110,0,68,0,
996468,0,101,0,102,
99650,105,0,110,0,
9966105,0,116,0,105,
99670,111,0,110,0,
9968115,0,1,-1,1,
99695,3533,20,3534,4,
997038,71,0,108,0,
9971111,0,98,0,97,
99720,108,0,68,0,
9973101,0,102,0,105, 9928101,0,102,0,105,
99740,110,0,105,0, 99290,110,0,105,0,
9975116,0,105,0,111, 9930116,0,105,0,111,
99760,110,0,115,0, 99310,110,0,95,0,
997795,0,52,0,1, 993249,0,1,175,1,
9978171,1,3,1,3, 99333,1,6,1,5,
99791,2,3535,22,1, 99343522,22,1,9,1,
99806,1,2838,3536,17, 99352464,1024,1,2767,822,
99813537,15,3532,1,-1, 99361,2768,810,1,2822,
99821,5,3538,20,3539, 99373523,17,3524,15,3525,
99834,38,71,0,108, 99384,52,37,0,71,
99840,111,0,98,0, 99390,108,0,111,0,
998597,0,108,0,68, 994098,0,97,0,108,
99860,101,0,102,0, 99410,86,0,97,0,
9987105,0,110,0,105, 9942114,0,105,0,97,
99430,98,0,108,0,
9944101,0,68,0,101,
99450,99,0,108,0,
994697,0,114,0,97,
99880,116,0,105,0, 99470,116,0,105,0,
9989111,0,110,0,115, 9948111,0,110,0,1,
99900,95,0,50,0, 9949-1,1,5,3526,20,
99911,169,1,3,1, 99503527,4,54,71,0,
99923,1,2,3540,22, 9951108,0,111,0,98,
99931,4,1,2839,3541, 99520,97,0,108,0,
999417,3542,15,3532,1, 995386,0,97,0,114,
9995-1,1,5,3543,20, 99540,105,0,97,0,
99963544,4,38,71,0, 995598,0,108,0,101,
99560,68,0,101,0,
995799,0,108,0,97,
99580,114,0,97,0,
9959116,0,105,0,111,
99600,110,0,95,0,
996149,0,1,173,1,
99623,1,3,1,2,
99633528,22,1,7,1,
99642823,3529,16,0,281,
99651,2022,3530,16,0,
9966673,1,2755,816,1,
99672834,3531,16,0,281,
99681,2459,1007,1,2466,
99693532,17,3533,15,3519,
99701,-1,1,5,3534,
997120,3535,4,52,71,
99720,108,0,111,0,
997398,0,97,0,108,
99740,70,0,117,0,
9975110,0,99,0,116,
99760,105,0,111,0,
9977110,0,68,0,101,
99780,102,0,105,0,
9979110,0,105,0,116,
99800,105,0,111,0,
9981110,0,95,0,50,
99820,1,176,1,3,
99831,7,1,6,3536,
998422,1,10,1,2764,
99853537,16,0,281,1,
99862841,3538,17,3539,15,
99873540,4,36,37,0,
998871,0,108,0,111,
99890,98,0,97,0,
9990108,0,68,0,101,
99910,102,0,105,0,
9992110,0,105,0,116,
99930,105,0,111,0,
9994110,0,115,0,1,
9995-1,1,5,3541,20,
99963542,4,38,71,0,
9997108,0,111,0,98, 9997108,0,111,0,98,
99980,97,0,108,0, 99980,97,0,108,0,
999968,0,101,0,102, 999968,0,101,0,102,
100000,105,0,110,0, 100000,105,0,110,0,
10001105,0,116,0,105, 10001105,0,116,0,105,
100020,111,0,110,0, 100020,111,0,110,0,
10003115,0,95,0,51, 10003115,0,95,0,52,
100040,1,170,1,3, 100040,1,172,1,3,
100051,2,1,1,3545, 100051,3,1,2,3543,
1000622,1,5,1,2840, 1000622,1,6,1,2842,
100073546,17,3547,15,3532, 100073544,17,3545,15,3540,
100081,-1,1,5,3548, 100081,-1,1,5,3546,
1000920,3549,4,38,71, 1000920,3547,4,38,71,
100100,108,0,111,0, 100100,108,0,111,0,
1001198,0,97,0,108, 1001198,0,97,0,108,
100120,68,0,101,0, 100120,68,0,101,0,
@@ -10014,12 +10014,39 @@ public yyLSLSyntax
100140,105,0,116,0, 100140,105,0,116,0,
10015105,0,111,0,110, 10015105,0,111,0,110,
100160,115,0,95,0, 100160,115,0,95,0,
1001749,0,1,168,1, 1001750,0,1,170,1,
100183,1,2,1,1, 100183,1,3,1,2,
100193550,22,1,3,1, 100193548,22,1,4,1,
100202807,3551,17,3552,15, 100202843,3549,17,3550,15,
100213518,1,-1,1,5, 100213540,1,-1,1,5,
100223553,20,3554,4,54, 100223551,20,3552,4,38,
1002371,0,108,0,111,
100240,98,0,97,0,
10025108,0,68,0,101,
100260,102,0,105,0,
10027110,0,105,0,116,
100280,105,0,111,0,
10029110,0,115,0,95,
100300,51,0,1,171,
100311,3,1,2,1,
100321,3553,22,1,5,
100331,2844,3554,17,3555,
1003415,3540,1,-1,1,
100355,3556,20,3557,4,
1003638,71,0,108,0,
10037111,0,98,0,97,
100380,108,0,68,0,
10039101,0,102,0,105,
100400,110,0,105,0,
10041116,0,105,0,111,
100420,110,0,115,0,
1004395,0,49,0,1,
10044169,1,3,1,2,
100451,1,3558,22,1,
100463,1,2649,832,1,
100472811,3559,17,3560,15,
100483525,1,-1,1,5,
100493561,20,3562,4,54,
1002371,0,108,0,111, 1005071,0,108,0,111,
100240,98,0,97,0, 100510,98,0,97,0,
10025108,0,86,0,97, 10052108,0,86,0,97,
@@ -10031,2846 +10058,2877 @@ public yyLSLSyntax
1003197,0,116,0,105, 1005897,0,116,0,105,
100320,111,0,110,0, 100590,111,0,110,0,
1003395,0,50,0,1, 1006095,0,50,0,1,
10034173,1,3,1,5, 10061174,1,3,1,5,
100351,4,3555,22,1, 100621,4,3563,22,1,
100368,1,2763,813,1, 100638,1,48,3564,19,
1003748,3556,19,375,1, 10064385,1,48,3565,5,
1003848,3557,5,54,1, 1006554,1,0,3566,16,
100390,3558,16,0,373, 100660,383,1,2075,3567,
100401,2837,3530,1,2838, 1006716,0,581,1,1860,
100413536,1,2839,3541,1, 10068946,1,2842,3544,1,
100422840,3546,1,1860,943, 100691804,3568,16,0,581,
100431,1958,3559,16,0, 100701,2844,3554,1,2413,
10044573,1,2760,3560,16, 100713569,16,0,581,1,
100450,373,1,2413,3561, 100722198,3570,16,0,581,
1004616,0,573,1,2198, 100731,1873,961,1,1657,
100473562,16,0,573,1, 100741019,1,2030,856,1,
100481873,958,1,1657,1016, 100751989,1041,1,1990,3571,
100491,2030,853,1,2751, 1007616,0,581,1,2755,
10050807,1,1989,1038,1, 10077816,1,1775,3572,16,
100511990,3563,16,0,573, 100780,581,1,32,3573,
100521,2458,998,1,2459, 1007916,0,581,1,2649,
100531004,1,1775,3564,16, 10080832,1,2105,939,1,
100540,573,1,32,3565, 100812106,3574,16,0,581,
1005516,0,573,1,2105, 100821,2764,3575,16,0,
10056936,1,2106,3566,16, 10083383,1,2841,3538,1,
100570,573,1,2763,813, 100841574,924,1,2767,822,
100581,2764,801,1,2227, 100851,2768,810,1,2227,
100591030,1,2337,3567,16, 100861033,1,2337,3576,16,
100600,573,1,2075,3568, 100870,581,1,2783,3517,
1006116,0,573,1,2779, 100881,1803,912,1,2458,
100623510,1,1803,909,1, 100891001,1,1901,3577,16,
100631804,3569,16,0,573, 100900,581,1,2462,1014,
100641,1901,3570,16,0, 100911,2136,968,1,2464,
10065573,1,2462,1011,1, 100921024,1,2029,850,1,
100662136,965,1,2464,1021, 100932466,3532,1,2031,861,
100671,2029,847,1,2466, 100941,2032,866,1,2033,
100683525,1,2031,858,1, 10095871,1,2035,877,1,
100692032,863,1,2033,868, 100962364,952,1,2039,887,
100701,2035,874,1,2364, 100971,1931,986,1,2041,
10071949,1,2039,884,1, 10098893,1,2021,843,1,
100721931,983,1,2041,890, 100992043,899,1,2045,904,
100731,2021,840,1,2043, 101001,2811,3559,1,2834,
10074896,1,2807,3551,1, 101013578,16,0,383,1,
100752045,901,1,2647,824, 101022037,882,1,2822,3523,
100761,2818,3516,1,2819, 101031,2823,3579,16,0,
100773571,16,0,373,1, 10104383,1,2843,3549,1,
100782037,879,1,1574,921, 101051958,3580,16,0,581,
100791,2830,3572,16,0, 101061,2459,1007,1,49,
10080373,1,49,3573,19, 101073581,19,586,1,49,
10081578,1,49,3574,5, 101083582,5,38,1,1901,
1008238,1,1901,3575,16, 101093583,16,0,584,1,
100830,576,1,2075,3576, 101102075,3584,16,0,584,
1008416,0,576,1,1860, 101111,1860,946,1,1803,
10085943,1,1803,909,1, 10112912,1,1804,3585,16,
100861804,3577,16,0,576, 101130,584,1,2413,3586,
100871,2413,3578,16,0, 1011416,0,584,1,2198,
10088576,1,2198,3579,16, 101153587,16,0,584,1,
100890,576,1,1873,958, 101161873,961,1,1657,1019,
100901,1657,1016,1,1989, 101171,1989,1041,1,1990,
100911038,1,1990,3580,16, 101183588,16,0,584,1,
100920,576,1,1775,3581, 101191775,3589,16,0,584,
1009316,0,576,1,32, 101201,32,3590,16,0,
100943582,16,0,576,1, 10121584,1,2105,939,1,
100952105,936,1,2106,3583, 101222106,3591,16,0,584,
1009616,0,576,1,2364, 101231,2364,952,1,2227,
10097949,1,2227,1030,1, 101241033,1,2337,3592,16,
100982337,3584,16,0,576, 101250,584,1,2021,843,
100991,2021,840,1,2458, 101261,2458,1001,1,2459,
10100998,1,2459,1004,1, 101271007,1,2462,1014,1,
101012462,1011,1,2136,965, 101282136,968,1,2464,1024,
101021,2464,1021,1,2029, 101291,2029,850,1,2030,
10103847,1,2030,853,1, 10130856,1,2031,861,1,
101042031,858,1,2032,863, 101312032,866,1,2033,871,
101051,2033,868,1,2035, 101321,2035,877,1,2037,
10106874,1,2037,879,1, 10133882,1,2039,887,1,
101072039,884,1,1931,983, 101341931,986,1,2041,893,
101081,2041,890,1,2043, 101351,2043,899,1,2045,
10109896,1,2045,901,1, 10136904,1,1574,924,1,
101101574,921,1,1958,3585, 101371958,3593,16,0,584,
1011116,0,576,1,50, 101381,50,3594,19,733,
101123586,19,718,1,50, 101391,50,3595,5,38,
101133587,5,38,1,1901, 101401,1901,3596,16,0,
101143588,16,0,716,1, 10141731,1,2075,3597,16,
101152075,3589,16,0,716, 101420,731,1,1860,946,
101161,1860,943,1,1803, 101431,1803,912,1,1804,
10117909,1,1804,3590,16, 101443598,16,0,731,1,
101180,716,1,2413,3591, 101452413,3599,16,0,731,
1011916,0,716,1,2198, 101461,2198,3600,16,0,
101203592,16,0,716,1, 10147731,1,1873,961,1,
101211873,958,1,1657,1016, 101481657,1019,1,1989,1041,
101221,1989,1038,1,1990, 101491,1990,3601,16,0,
101233593,16,0,716,1, 10150731,1,1775,3602,16,
101241775,3594,16,0,716, 101510,731,1,32,3603,
101251,32,3595,16,0, 1015216,0,731,1,2105,
10126716,1,2105,936,1, 10153939,1,2106,3604,16,
101272106,3596,16,0,716, 101540,731,1,2364,952,
101281,2364,949,1,2227, 101551,2227,1033,1,2337,
101291030,1,2337,3597,16, 101563605,16,0,731,1,
101300,716,1,2021,840, 101572021,843,1,2458,1001,
101311,2458,998,1,2459, 101581,2459,1007,1,2462,
101321004,1,2462,1011,1, 101591014,1,2136,968,1,
101332136,965,1,2464,1021, 101602464,1024,1,2029,850,
101341,2029,847,1,2030, 101611,2030,856,1,2031,
10135853,1,2031,858,1, 10162861,1,2032,866,1,
101362032,863,1,2033,868, 101632033,871,1,2035,877,
101371,2035,874,1,2037, 101641,2037,882,1,2039,
10138879,1,2039,884,1, 10165887,1,1931,986,1,
101391931,983,1,2041,890, 101662041,893,1,2043,899,
101401,2043,896,1,2045, 101671,2045,904,1,1574,
10141901,1,1574,921,1, 10168924,1,1958,3606,16,
101421958,3598,16,0,716, 101690,731,1,51,3607,
101431,51,3599,19,127, 1017019,127,1,51,3608,
101441,51,3600,5,58, 101715,58,1,0,3609,
101451,0,3601,16,0, 1017216,0,125,1,2538,
10146125,1,2537,3602,16, 101733610,16,0,489,1,
101470,691,1,2837,3530, 101742075,3611,16,0,125,
101481,2838,3536,1,2839, 101751,2841,3538,1,2515,
101493541,1,2840,3546,1, 101763612,16,0,489,1,
101501860,943,1,10,3603, 101772843,3549,1,10,3613,
1015116,0,125,1,2413, 1017816,0,125,1,2413,
101523604,16,0,125,1, 101793614,16,0,125,1,
101532198,3605,16,0,125, 101802523,3615,16,0,489,
101541,1873,958,1,21, 101811,2198,3616,16,0,
101553606,16,0,125,1, 10182125,1,1873,961,1,
101561657,1016,1,2030,853, 1018321,3617,16,0,125,
101571,1989,1038,1,1990, 101841,1657,1019,1,2029,
101583607,16,0,125,1, 10185850,1,2030,856,1,
101592458,998,1,2459,1004, 101861989,1041,1,1990,3618,
101601,1775,3608,16,0, 1018716,0,125,1,2458,
10161125,1,32,3609,16, 101881001,1,2459,1007,1,
101620,125,1,2105,936, 101891775,3619,16,0,125,
101631,2106,3610,16,0, 101901,32,3620,16,0,
10164125,1,2045,901,1, 10191125,1,2105,939,1,
101652766,3611,16,0,125, 101922106,3621,16,0,125,
101661,2227,1030,1,2337, 101931,2823,3622,16,0,
101673612,16,0,125,1, 10194125,1,2770,3623,16,
101682075,3613,16,0,125, 101950,125,1,2227,1033,
101691,52,3614,16,0, 101961,2337,3624,16,0,
10170125,1,2560,3615,16, 10197125,1,52,3625,16,
101710,691,1,2779,3510, 101980,125,1,2561,3626,
101721,1803,909,1,1804, 1019916,0,489,1,2783,
101733616,16,0,125,1, 102003517,1,1803,912,1,
101741901,3617,16,0,125, 102011804,3627,16,0,125,
101751,2462,1011,1,2136, 102021,1901,3628,16,0,
10176965,1,2464,1021,1, 10203125,1,2462,1014,1,
101772029,847,1,2466,3525, 102042136,968,1,2464,1024,
101781,2031,858,1,2032, 102051,1860,946,1,2466,
10179863,1,2033,868,1, 102063532,1,2031,861,1,
101802035,874,1,2581,3618, 102072032,866,1,2033,871,
1018116,0,125,1,2364, 102081,2035,877,1,2364,
10182949,1,2039,884,1, 10209952,1,2039,887,1,
101831931,983,1,2041,890, 102101931,986,1,2041,893,
101841,2021,840,1,2043, 102111,2021,843,1,2043,
10185896,1,2807,3551,1, 10212899,1,2045,904,1,
101862510,3619,16,0,691, 102132511,3629,16,0,489,
101871,2514,3620,16,0, 102141,2811,3559,1,2037,
10188691,1,2818,3516,1, 10215882,1,2822,3523,1,
101892819,3621,16,0,125, 102162842,3544,1,1574,924,
101901,2522,3622,16,0, 102171,2844,3554,1,2582,
10191691,1,2037,879,1, 102183630,16,0,125,1,
101921574,921,1,1958,3623, 102191958,3631,16,0,125,
1019316,0,125,1,52, 102201,52,3632,19,124,
101943624,19,124,1,52, 102211,52,3633,5,53,
101953625,5,53,1,0, 102221,0,3634,16,0,
101963626,16,0,122,1, 10223122,1,2075,3635,16,
101972837,3530,1,2838,3536, 102240,122,1,2841,3538,
101981,2839,3541,1,2840, 102251,2842,3544,1,1804,
101993546,1,1860,943,1, 102263636,16,0,122,1,
1020010,3627,16,0,122, 1022710,3637,16,0,122,
102011,2413,3628,16,0, 102281,2413,3638,16,0,
10202122,1,2198,3629,16, 10229122,1,2198,3639,16,
102030,122,1,1873,958, 102300,122,1,1873,961,
102041,21,3630,16,0, 102311,21,3640,16,0,
10205122,1,1657,1016,1, 10232122,1,1657,1019,1,
102062030,853,1,1989,1038, 102332029,850,1,2030,856,
102071,1990,3631,16,0, 102341,1989,1041,1,1990,
10208122,1,2458,998,1, 102353641,16,0,122,1,
102092459,1004,1,1775,3632, 102362459,1007,1,1775,3642,
1021016,0,122,1,32, 1023716,0,122,1,32,
102113633,16,0,122,1, 102383643,16,0,122,1,
102122105,936,1,2106,3634, 102392105,939,1,2106,3644,
1021316,0,122,1,2766, 1024016,0,122,1,1574,
102143635,16,0,122,1, 10241924,1,2770,3645,16,
102152227,1030,1,2337,3636, 102420,122,1,2227,1033,
1021616,0,122,1,2075, 102431,2337,3646,16,0,
102173637,16,0,122,1, 10244122,1,52,3647,16,
1021852,3638,16,0,122, 102450,122,1,2783,3517,
102191,2779,3510,1,1803, 102461,1803,912,1,2458,
10220909,1,1804,3639,16, 102471001,1,1901,3648,16,
102210,122,1,1901,3640, 102480,122,1,2462,1014,
1022216,0,122,1,2462, 102491,2136,968,1,2464,
102231011,1,2136,965,1, 102501024,1,1860,946,1,
102242464,1021,1,2029,847, 102512466,3532,1,2031,861,
102251,2466,3525,1,2031, 102521,2032,866,1,2033,
10226858,1,2032,863,1, 10253871,1,2035,877,1,
102272033,868,1,2035,874, 102542364,952,1,2039,887,
102281,2581,3641,16,0, 102551,1931,986,1,2041,
10229122,1,2364,949,1, 10256893,1,2021,843,1,
102302039,884,1,1931,983, 102572043,899,1,2045,904,
102311,2041,890,1,2021, 102581,2811,3559,1,2037,
10232840,1,2043,896,1, 10259882,1,2822,3523,1,
102332807,3551,1,2045,901, 102602823,3649,16,0,122,
102341,2818,3516,1,2819, 102611,2843,3549,1,2844,
102353642,16,0,122,1, 102623554,1,2582,3650,16,
102362037,879,1,1574,921, 102630,122,1,1958,3651,
102371,1958,3643,16,0, 1026416,0,122,1,53,
10238122,1,53,3644,19, 102653652,19,121,1,53,
10239121,1,53,3645,5, 102663653,5,53,1,0,
1024053,1,0,3646,16, 102673654,16,0,119,1,
102410,119,1,2837,3530, 102682075,3655,16,0,119,
102421,2838,3536,1,2839, 102691,2841,3538,1,2842,
102433541,1,2840,3546,1, 102703544,1,1804,3656,16,
102441860,943,1,10,3647, 102710,119,1,10,3657,
1024516,0,119,1,2413, 1027216,0,119,1,2413,
102463648,16,0,119,1, 102733658,16,0,119,1,
102472198,3649,16,0,119, 102742198,3659,16,0,119,
102481,1873,958,1,21, 102751,1873,961,1,21,
102493650,16,0,119,1, 102763660,16,0,119,1,
102501657,1016,1,2030,853, 102771657,1019,1,2029,850,
102511,1989,1038,1,1990, 102781,2030,856,1,1989,
102523651,16,0,119,1, 102791041,1,1990,3661,16,
102532458,998,1,2459,1004, 102800,119,1,2459,1007,
102541,1775,3652,16,0, 102811,1775,3662,16,0,
10255119,1,32,3653,16, 10282119,1,32,3663,16,
102560,119,1,2105,936, 102830,119,1,2105,939,
102571,2106,3654,16,0, 102841,2106,3664,16,0,
10258119,1,2766,3655,16, 10285119,1,1574,924,1,
102590,119,1,2227,1030, 102862770,3665,16,0,119,
102601,2337,3656,16,0, 102871,2227,1033,1,2337,
10261119,1,2075,3657,16, 102883666,16,0,119,1,
102620,119,1,52,3658, 1028952,3667,16,0,119,
1026316,0,119,1,2779, 102901,2783,3517,1,1803,
102643510,1,1803,909,1, 10291912,1,2458,1001,1,
102651804,3659,16,0,119, 102921901,3668,16,0,119,
102661,1901,3660,16,0, 102931,2462,1014,1,2136,
10267119,1,2462,1011,1, 10294968,1,2464,1024,1,
102682136,965,1,2464,1021, 102951860,946,1,2466,3532,
102691,2029,847,1,2466, 102961,2031,861,1,2032,
102703525,1,2031,858,1, 10297866,1,2033,871,1,
102712032,863,1,2033,868, 102982035,877,1,2364,952,
102721,2035,874,1,2581, 102991,2039,887,1,1931,
102733661,16,0,119,1, 10300986,1,2041,893,1,
102742364,949,1,2039,884, 103012021,843,1,2043,899,
102751,1931,983,1,2041, 103021,2045,904,1,2811,
10276890,1,2021,840,1, 103033559,1,2037,882,1,
102772043,896,1,2807,3551, 103042822,3523,1,2823,3669,
102781,2045,901,1,2818, 1030516,0,119,1,2843,
102793516,1,2819,3662,16, 103063549,1,2844,3554,1,
102800,119,1,2037,879, 103072582,3670,16,0,119,
102811,1574,921,1,1958, 103081,1958,3671,16,0,
102823663,16,0,119,1, 10309119,1,54,3672,19,
1028354,3664,19,118,1, 10310118,1,54,3673,5,
1028454,3665,5,55,1, 1031155,1,0,3674,16,
102850,3666,16,0,116, 103120,116,1,2075,3675,
102861,2837,3530,1,2838, 1031316,0,116,1,2841,
102873536,1,2839,3541,1, 103143538,1,2842,3544,1,
102882840,3546,1,1860,943, 103151804,3676,16,0,116,
102891,10,3667,16,0, 103161,10,3677,16,0,
10290116,1,2413,3668,16, 10317116,1,2413,3678,16,
102910,116,1,2198,3669, 103180,116,1,2198,3679,
1029216,0,116,1,1873, 1031916,0,116,1,1873,
10293958,1,21,3670,16, 10320961,1,21,3680,16,
102940,116,1,1657,1016, 103210,116,1,1657,1019,
102951,2030,853,1,1989, 103221,2029,850,1,2030,
102961038,1,1990,3671,16, 10323856,1,1989,1041,1,
102970,116,1,2458,998, 103241990,3681,16,0,116,
102981,2459,1004,1,1775, 103251,2459,1007,1,1775,
102993672,16,0,116,1, 103263682,16,0,116,1,
1030032,3673,16,0,116, 1032732,3683,16,0,116,
103011,2105,936,1,2106, 103281,2105,939,1,2106,
103023674,16,0,116,1, 103293684,16,0,116,1,
103032766,3675,16,0,116, 103302021,843,1,1574,924,
103041,2227,1030,1,2337, 103311,2770,3685,16,0,
103053676,16,0,116,1, 10332116,1,2227,1033,1,
103062075,3677,16,0,116, 103332337,3686,16,0,116,
103071,52,3678,16,0, 103341,52,3687,16,0,
10308116,1,2779,3510,1, 10335116,1,2783,3517,1,
103091803,909,1,1804,3679, 103361803,912,1,2458,1001,
1031016,0,116,1,1901, 103371,1901,3688,16,0,
103113680,16,0,116,1, 10338116,1,2569,3689,16,
103122462,1011,1,2136,965, 103390,483,1,2462,1014,
103131,2464,1021,1,2029, 103401,2136,968,1,2464,
10314847,1,2466,3525,1, 103411024,1,1860,946,1,
103152031,858,1,2032,863, 103422466,3532,1,2031,861,
103161,2033,868,1,2035, 103431,2032,866,1,2033,
10317874,1,2581,3681,16, 10344871,1,2035,877,1,
103180,116,1,2364,949, 103452364,952,1,2039,887,
103191,2039,884,1,1931, 103461,1931,986,1,2041,
10320983,1,2041,890,1, 10347893,1,2507,3690,16,
103212021,840,1,2043,896, 103480,483,1,2043,899,
103221,2807,3551,1,2045, 103491,2045,904,1,2811,
10323901,1,2568,3682,16, 103503559,1,2037,882,1,
103240,470,1,2818,3516, 103512822,3523,1,2823,3691,
103251,2819,3683,16,0, 1035216,0,116,1,2843,
10326116,1,2037,879,1, 103533549,1,2844,3554,1,
103271574,921,1,1958,3684, 103542582,3692,16,0,116,
1032816,0,116,1,2506, 103551,1958,3693,16,0,
103293685,16,0,470,1, 10356116,1,55,3694,19,
1033055,3686,19,115,1, 10357115,1,55,3695,5,
1033155,3687,5,56,1, 1035856,1,0,3696,16,
103320,3688,16,0,113, 103590,113,1,2075,3697,
103331,2837,3530,1,2838, 1036016,0,113,1,2841,
103343536,1,2839,3541,1, 103613538,1,2842,3544,1,
103352840,3546,1,1860,943, 103622843,3549,1,10,3698,
103361,10,3689,16,0, 1036316,0,113,1,2413,
10337113,1,2413,3690,16, 103643699,16,0,113,1,
103380,113,1,2525,3691, 103652198,3700,16,0,113,
1033916,0,493,1,1657, 103661,2526,3701,16,0,
103401016,1,1873,958,1, 10367304,1,1873,961,1,
1034121,3692,16,0,113, 1036821,3702,16,0,113,
103421,2529,3693,16,0, 103691,1657,1019,1,2530,
10343493,1,2030,853,1, 103703703,16,0,304,1,
103441989,1038,1,1990,3694, 103712030,856,1,1989,1041,
1034516,0,113,1,2458, 103721,1990,3704,16,0,
10346998,1,2459,1004,1, 10373113,1,2458,1001,1,
103471775,3695,16,0,113, 103742459,1007,1,1775,3705,
103481,32,3696,16,0, 1037516,0,113,1,32,
10349113,1,2105,936,1,
103502106,3697,16,0,113,
103511,2766,3698,16,0,
10352113,1,2552,3699,16,
103530,493,1,2227,1030,
103541,2337,3700,16,0,
10355113,1,2075,3701,16,
103560,113,1,52,3702,
1035716,0,113,1,2779,
103583510,1,1803,909,1,
103591804,3703,16,0,113,
103601,1901,3704,16,0,
10361113,1,2462,1011,1,
103622136,965,1,2464,1021,
103631,2029,847,1,2466,
103643525,1,2031,858,1,
103652032,863,1,2033,868,
103661,2035,874,1,2581,
103673705,16,0,113,1,
103682364,949,1,2039,884,
103691,1931,983,1,2041,
10370890,1,2021,840,1,
103712043,896,1,2807,3551,
103721,2045,901,1,2198,
103733706,16,0,113,1, 103763706,16,0,113,1,
103742818,3516,1,2819,3707, 103772105,939,1,2106,3707,
1037516,0,113,1,2037, 1037816,0,113,1,2770,
10376879,1,1574,921,1, 103793708,16,0,113,1,
103771958,3708,16,0,113, 103802553,3709,16,0,304,
103781,56,3709,19,112, 103811,2227,1033,1,2337,
103791,56,3710,5,55, 103823710,16,0,113,1,
103801,0,3711,16,0, 1038352,3711,16,0,113,
10381110,1,2837,3530,1, 103841,2783,3517,1,1803,
103822838,3536,1,2839,3541, 10385912,1,1804,3712,16,
103831,2840,3546,1,1860, 103860,113,1,1901,3713,
10384943,1,10,3712,16, 1038716,0,113,1,2462,
103850,110,1,2413,3713, 103881014,1,2136,968,1,
103892464,1024,1,1860,946,
103901,2466,3532,1,2031,
10391861,1,2032,866,1,
103922033,871,1,2035,877,
103931,2364,952,1,2039,
10394887,1,1931,986,1,
103952041,893,1,2021,843,
103961,2043,899,1,2045,
10397904,1,2811,3559,1,
103982029,850,1,2037,882,
103991,2822,3523,1,2823,
104003714,16,0,113,1,
104011574,924,1,2844,3554,
104021,2582,3715,16,0,
10403113,1,1958,3716,16,
104040,113,1,56,3717,
1040519,112,1,56,3718,
104065,55,1,0,3719,
1040716,0,110,1,2075,
104083720,16,0,110,1,
104092841,3538,1,2842,3544,
104101,1804,3721,16,0,
10411110,1,10,3722,16,
104120,110,1,2413,3723,
1038616,0,110,1,2198, 1041316,0,110,1,2198,
103873714,16,0,110,1, 104143724,16,0,110,1,
103881873,958,1,21,3715, 104151873,961,1,21,3725,
1038916,0,110,1,1657, 1041616,0,110,1,1657,
103901016,1,2030,853,1, 104171019,1,2029,850,1,
103911989,1038,1,1990,3716, 104182030,856,1,1989,1041,
1039216,0,110,1,2458, 104191,1990,3726,16,0,
10393998,1,2459,1004,1, 10420110,1,2459,1007,1,
103941775,3717,16,0,110, 104211775,3727,16,0,110,
103951,32,3718,16,0, 104221,32,3728,16,0,
10396110,1,2540,3719,16, 10423110,1,2541,3729,16,
103970,511,1,2105,936, 104240,525,1,2106,3730,
103981,2106,3720,16,0, 1042516,0,110,1,2545,
10399110,1,2544,3721,16, 104263731,16,0,525,1,
104000,511,1,2766,3722, 104271574,924,1,2770,3732,
1040116,0,110,1,2227, 1042816,0,110,1,2227,
104021030,1,2337,3723,16, 104291033,1,2337,3733,16,
104030,110,1,2075,3724, 104300,110,1,52,3734,
1040416,0,110,1,52, 1043116,0,110,1,2783,
104053725,16,0,110,1, 104323517,1,1803,912,1,
104062779,3510,1,1803,909, 104332458,1001,1,1901,3735,
104071,1804,3726,16,0, 1043416,0,110,1,2462,
10408110,1,1901,3727,16, 104351014,1,2136,968,1,
104090,110,1,2462,1011, 104362464,1024,1,1860,946,
104101,2136,965,1,2464, 104371,2466,3532,1,2031,
104111021,1,2029,847,1, 10438861,1,2032,866,1,
104122466,3525,1,2031,858, 104392033,871,1,2035,877,
104131,2032,863,1,2033, 104401,2364,952,1,2039,
10414868,1,2035,874,1, 10441887,1,1931,986,1,
104152581,3728,16,0,110, 104422041,893,1,2021,843,
104161,2364,949,1,2039, 104431,2043,899,1,2045,
10417884,1,1931,983,1, 10444904,1,2811,3559,1,
104182041,890,1,2021,840, 104452037,882,1,2822,3523,
104191,2043,896,1,2807, 104461,2823,3736,16,0,
104203551,1,2045,901,1, 10447110,1,2843,3549,1,
104212818,3516,1,2819,3729, 104482844,3554,1,2105,939,
1042216,0,110,1,2037, 104491,2582,3737,16,0,
10423879,1,1574,921,1, 10450110,1,1958,3738,16,
104241958,3730,16,0,110, 104510,110,1,57,3739,
104251,57,3731,19,109, 1045219,109,1,57,3740,
104261,57,3732,5,53, 104535,53,1,0,3741,
104271,0,3733,16,0, 1045416,0,107,1,2075,
10428107,1,2837,3530,1, 104553742,16,0,107,1,
104292838,3536,1,2839,3541, 104562841,3538,1,2842,3544,
104301,2840,3546,1,1860, 104571,1804,3743,16,0,
10431943,1,10,3734,16, 10458107,1,10,3744,16,
104320,107,1,2413,3735, 104590,107,1,2413,3745,
1043316,0,107,1,2198, 1046016,0,107,1,2198,
104343736,16,0,107,1,
104351873,958,1,21,3737,
1043616,0,107,1,1657,
104371016,1,2030,853,1,
104381989,1038,1,1990,3738,
1043916,0,107,1,2458,
10440998,1,2459,1004,1,
104411775,3739,16,0,107,
104421,32,3740,16,0,
10443107,1,2105,936,1,
104442106,3741,16,0,107,
104451,2766,3742,16,0,
10446107,1,2227,1030,1,
104472337,3743,16,0,107,
104481,2075,3744,16,0,
10449107,1,52,3745,16,
104500,107,1,2779,3510,
104511,1803,909,1,1804,
104523746,16,0,107,1, 104613746,16,0,107,1,
104531901,3747,16,0,107, 104621873,961,1,21,3747,
104541,2462,1011,1,2136, 1046316,0,107,1,1657,
10455965,1,2464,1021,1, 104641019,1,2029,850,1,
104562029,847,1,2466,3525, 104652030,856,1,1989,1041,
104571,2031,858,1,2032, 104661,1990,3748,16,0,
10458863,1,2033,868,1, 10467107,1,2459,1007,1,
104592035,874,1,2581,3748, 104681775,3749,16,0,107,
1046016,0,107,1,2364, 104691,32,3750,16,0,
10461949,1,2039,884,1, 10470107,1,2105,939,1,
104621931,983,1,2041,890, 104712106,3751,16,0,107,
104631,2021,840,1,2043, 104721,1574,924,1,2770,
10464896,1,2807,3551,1, 104733752,16,0,107,1,
104652045,901,1,2818,3516, 104742227,1033,1,2337,3753,
104661,2819,3749,16,0, 1047516,0,107,1,52,
10467107,1,2037,879,1, 104763754,16,0,107,1,
104681574,921,1,1958,3750, 104772783,3517,1,1803,912,
1046916,0,107,1,58, 104781,2458,1001,1,1901,
104703751,19,386,1,58, 104793755,16,0,107,1,
104713752,5,30,1,2644, 104802462,1014,1,2136,968,
104721753,1,2520,1758,1, 104811,2464,1024,1,1860,
104732639,1765,1,2640,1770, 10482946,1,2466,3532,1,
104741,2641,1775,1,2642, 104832031,861,1,2032,866,
104751780,1,2643,1747,1, 104841,2033,871,1,2035,
104762535,1785,1,2645,1791, 10485877,1,2364,952,1,
104771,2646,1796,1,2648, 104862039,887,1,1931,986,
104781875,1,2649,1802,1, 104871,2041,893,1,2021,
104792650,1807,1,2651,1812, 10488843,1,2043,899,1,
104801,2652,1817,1,2653, 104892045,904,1,2811,3559,
104811822,1,2654,1827,1, 104901,2037,882,1,2822,
104822655,1832,1,2657,3753, 104913523,1,2823,3756,16,
1048316,0,384,1,2550, 104920,107,1,2843,3549,
104841843,1,2579,1861,1, 104931,2844,3554,1,2582,
104852558,1849,1,2566,1855, 104943757,16,0,107,1,
104861,2459,1004,1,2464, 104951958,3758,16,0,107,
104871021,1,2574,1837,1, 104961,58,3759,19,396,
104882470,3754,16,0,384, 104971,58,3760,5,30,
104891,2700,3755,16,0, 104981,2536,1750,1,2521,
10490384,1,2594,1868,1, 104991767,1,2641,1779,1,
104912596,3756,16,0,384, 105002642,1784,1,2643,1756,
104921,59,3757,19,383, 105011,2644,1789,1,2645,
104931,59,3758,5,30, 105021794,1,2646,1799,1,
104941,2644,1753,1,2520, 105032647,1762,1,2648,1878,
104951758,1,2639,1765,1, 105041,2650,1811,1,2651,
104962640,1770,1,2641,1775, 105051816,1,2652,1821,1,
104971,2642,1780,1,2643, 105062653,1826,1,2654,1831,
104981747,1,2535,1785,1, 105071,2655,1836,1,2656,
104992645,1791,1,2646,1796, 105081841,1,2657,1774,1,
105001,2648,1875,1,2649, 105092659,3761,16,0,394,
105011802,1,2650,1807,1, 105101,2551,1852,1,2559,
105022651,1812,1,2652,1817, 105111864,1,2567,1805,1,
105031,2653,1822,1,2654, 105122459,1007,1,2464,1024,
105041827,1,2655,1832,1, 105131,2575,1846,1,2470,
105052657,3759,16,0,381, 105143762,16,0,394,1,
105061,2550,1843,1,2579, 105152580,1858,1,2703,3763,
105071861,1,2558,1849,1, 1051616,0,394,1,2595,
105082566,1855,1,2459,1004, 105171871,1,2597,3764,16,
105091,2464,1021,1,2574, 105180,394,1,59,3765,
105101837,1,2470,3760,16, 1051919,393,1,59,3766,
105110,381,1,2700,3761, 105205,30,1,2536,1750,
1051216,0,381,1,2594, 105211,2521,1767,1,2641,
105131868,1,2596,3762,16, 105221779,1,2642,1784,1,
105140,381,1,60,3763, 105232643,1756,1,2644,1789,
1051519,545,1,60,3764, 105241,2645,1794,1,2646,
105165,30,1,2644,1753, 105251799,1,2647,1762,1,
105171,2520,1758,1,2639, 105262648,1878,1,2650,1811,
105181765,1,2640,1770,1, 105271,2651,1816,1,2652,
105192641,1775,1,2642,1780, 105281821,1,2653,1826,1,
105201,2643,1747,1,2535, 105292654,1831,1,2655,1836,
105211785,1,2645,1791,1, 105301,2656,1841,1,2657,
105222646,1796,1,2648,1875, 105311774,1,2659,3767,16,
105231,2649,1802,1,2650, 105320,391,1,2551,1852,
105241807,1,2651,1812,1, 105331,2559,1864,1,2567,
105252652,1817,1,2653,1822, 105341805,1,2459,1007,1,
105261,2654,1827,1,2655, 105352464,1024,1,2575,1846,
105271832,1,2657,3765,16, 105361,2470,3768,16,0,
105280,543,1,2550,1843, 10537391,1,2580,1858,1,
105291,2579,1861,1,2558, 105382703,3769,16,0,391,
105301849,1,2566,1855,1, 105391,2595,1871,1,2597,
105312459,1004,1,2464,1021, 105403770,16,0,391,1,
105321,2574,1837,1,2470, 1054160,3771,19,557,1,
105333766,16,0,543,1, 1054260,3772,5,30,1,
105342700,3767,16,0,543, 105432536,1750,1,2521,1767,
105351,2594,1868,1,2596, 105441,2641,1779,1,2642,
105363768,16,0,543,1, 105451784,1,2643,1756,1,
1053761,3769,19,423,1, 105462644,1789,1,2645,1794,
1053861,3770,5,30,1, 105471,2646,1799,1,2647,
105392644,1753,1,2520,1758, 105481762,1,2648,1878,1,
105401,2639,1765,1,2640, 105492650,1811,1,2651,1816,
105411770,1,2641,1775,1, 105501,2652,1821,1,2653,
105422642,1780,1,2643,1747, 105511826,1,2654,1831,1,
105431,2535,1785,1,2645, 105522655,1836,1,2656,1841,
105441791,1,2646,1796,1, 105531,2657,1774,1,2659,
105452648,1875,1,2649,1802, 105543773,16,0,555,1,
105461,2650,1807,1,2651, 105552551,1852,1,2559,1864,
105471812,1,2652,1817,1, 105561,2567,1805,1,2459,
105482653,1822,1,2654,1827, 105571007,1,2464,1024,1,
105491,2655,1832,1,2657, 105582575,1846,1,2470,3774,
105503771,16,0,421,1, 1055916,0,555,1,2580,
105512550,1843,1,2579,1861, 105601858,1,2703,3775,16,
105521,2558,1849,1,2566, 105610,555,1,2595,1871,
105531855,1,2459,1004,1, 105621,2597,3776,16,0,
105542464,1021,1,2574,1837, 10563555,1,61,3777,19,
105551,2470,3772,16,0, 10564433,1,61,3778,5,
10556421,1,2700,3773,16, 1056530,1,2536,1750,1,
105570,421,1,2594,1868, 105662521,1767,1,2641,1779,
105581,2596,3774,16,0, 105671,2642,1784,1,2643,
10559421,1,62,3775,19, 105681756,1,2644,1789,1,
10560541,1,62,3776,5, 105692645,1794,1,2646,1799,
1056130,1,2644,1753,1, 105701,2647,1762,1,2648,
105622520,1758,1,2639,1765, 105711878,1,2650,1811,1,
105631,2640,1770,1,2641, 105722651,1816,1,2652,1821,
105641775,1,2642,1780,1, 105731,2653,1826,1,2654,
105652643,1747,1,2535,1785, 105741831,1,2655,1836,1,
105661,2645,1791,1,2646, 105752656,1841,1,2657,1774,
105671796,1,2648,1875,1, 105761,2659,3779,16,0,
105682649,1802,1,2650,1807, 10577431,1,2551,1852,1,
105691,2651,1812,1,2652, 105782559,1864,1,2567,1805,
105701817,1,2653,1822,1, 105791,2459,1007,1,2464,
105712654,1827,1,2655,1832, 105801024,1,2575,1846,1,
105721,2657,3777,16,0, 105812470,3780,16,0,431,
10573539,1,2550,1843,1, 105821,2580,1858,1,2703,
105742579,1861,1,2558,1849, 105833781,16,0,431,1,
105751,2566,1855,1,2459, 105842595,1871,1,2597,3782,
105761004,1,2464,1021,1, 1058516,0,431,1,62,
105772574,1837,1,2470,3778, 105863783,19,553,1,62,
1057816,0,539,1,2700, 105873784,5,30,1,2536,
105793779,16,0,539,1, 105881750,1,2521,1767,1,
105802594,1868,1,2596,3780, 105892641,1779,1,2642,1784,
1058116,0,539,1,63, 105901,2643,1756,1,2644,
105823781,19,653,1,63, 105911789,1,2645,1794,1,
105833782,5,30,1,2644, 105922646,1799,1,2647,1762,
105841753,1,2520,1758,1, 105931,2648,1878,1,2650,
105852639,1765,1,2640,1770, 105941811,1,2651,1816,1,
105861,2641,1775,1,2642, 105952652,1821,1,2653,1826,
105871780,1,2643,1747,1, 105961,2654,1831,1,2655,
105882535,1785,1,2645,1791, 105971836,1,2656,1841,1,
105891,2646,1796,1,2648, 105982657,1774,1,2659,3785,
105901875,1,2649,1802,1, 1059916,0,551,1,2551,
105912650,1807,1,2651,1812, 106001852,1,2559,1864,1,
105921,2652,1817,1,2653, 106012567,1805,1,2459,1007,
105931822,1,2654,1827,1, 106021,2464,1024,1,2575,
105942655,1832,1,2657,3783, 106031846,1,2470,3786,16,
1059516,0,651,1,2550, 106040,551,1,2580,1858,
105961843,1,2579,1861,1, 106051,2703,3787,16,0,
105972558,1849,1,2566,1855, 10606551,1,2595,1871,1,
105981,2459,1004,1,2464, 106072597,3788,16,0,551,
105991021,1,2574,1837,1, 106081,63,3789,19,666,
106002470,3784,16,0,651, 106091,63,3790,5,30,
106011,2700,3785,16,0, 106101,2536,1750,1,2521,
10602651,1,2594,1868,1, 106111767,1,2641,1779,1,
106032596,3786,16,0,651, 106122642,1784,1,2643,1756,
106041,64,3787,19,416, 106131,2644,1789,1,2645,
106051,64,3788,5,30, 106141794,1,2646,1799,1,
106061,2644,1753,1,2520, 106152647,1762,1,2648,1878,
106071758,1,2639,1765,1, 106161,2650,1811,1,2651,
106082640,1770,1,2641,1775, 106171816,1,2652,1821,1,
106091,2642,1780,1,2643, 106182653,1826,1,2654,1831,
106101747,1,2535,1785,1, 106191,2655,1836,1,2656,
106112645,1791,1,2646,1796, 106201841,1,2657,1774,1,
106121,2648,1875,1,2649, 106212659,3791,16,0,664,
106131802,1,2650,1807,1, 106221,2551,1852,1,2559,
106142651,1812,1,2652,1817, 106231864,1,2567,1805,1,
106151,2653,1822,1,2654, 106242459,1007,1,2464,1024,
106161827,1,2655,1832,1, 106251,2575,1846,1,2470,
106172657,3789,16,0,414, 106263792,16,0,664,1,
106181,2550,1843,1,2579, 106272580,1858,1,2703,3793,
106191861,1,2558,1849,1, 1062816,0,664,1,2595,
106202566,1855,1,2459,1004, 106291871,1,2597,3794,16,
106211,2464,1021,1,2574, 106300,664,1,64,3795,
106221837,1,2470,3790,16, 1063119,426,1,64,3796,
106230,414,1,2700,3791, 106325,30,1,2536,1750,
1062416,0,414,1,2594, 106331,2521,1767,1,2641,
106251868,1,2596,3792,16, 106341779,1,2642,1784,1,
106260,414,1,65,3793, 106352643,1756,1,2644,1789,
1062719,380,1,65,3794, 106361,2645,1794,1,2646,
106285,30,1,2644,1753, 106371799,1,2647,1762,1,
106291,2520,1758,1,2639, 106382648,1878,1,2650,1811,
106301765,1,2640,1770,1, 106391,2651,1816,1,2652,
106312641,1775,1,2642,1780, 106401821,1,2653,1826,1,
106321,2643,1747,1,2535, 106412654,1831,1,2655,1836,
106331785,1,2645,1791,1, 106421,2656,1841,1,2657,
106342646,1796,1,2648,1875, 106431774,1,2659,3797,16,
106351,2649,1802,1,2650, 106440,424,1,2551,1852,
106361807,1,2651,1812,1, 106451,2559,1864,1,2567,
106372652,1817,1,2653,1822, 106461805,1,2459,1007,1,
106381,2654,1827,1,2655, 106472464,1024,1,2575,1846,
106391832,1,2657,3795,16, 106481,2470,3798,16,0,
106400,378,1,2550,1843, 10649424,1,2580,1858,1,
106411,2579,1861,1,2558, 106502703,3799,16,0,424,
106421849,1,2566,1855,1, 106511,2595,1871,1,2597,
106432459,1004,1,2464,1021, 106523800,16,0,424,1,
106441,2574,1837,1,2470, 1065365,3801,19,390,1,
106453796,16,0,378,1, 1065465,3802,5,30,1,
106462700,3797,16,0,378, 106552536,1750,1,2521,1767,
106471,2594,1868,1,2596, 106561,2641,1779,1,2642,
106483798,16,0,378,1, 106571784,1,2643,1756,1,
1064966,3799,19,465,1, 106582644,1789,1,2645,1794,
1065066,3800,5,30,1, 106591,2646,1799,1,2647,
106512644,1753,1,2520,1758, 106601762,1,2648,1878,1,
106521,2639,1765,1,2640, 106612650,1811,1,2651,1816,
106531770,1,2641,1775,1, 106621,2652,1821,1,2653,
106542642,1780,1,2643,1747, 106631826,1,2654,1831,1,
106551,2535,1785,1,2645, 106642655,1836,1,2656,1841,
106561791,1,2646,1796,1, 106651,2657,1774,1,2659,
106572648,1875,1,2649,1802, 106663803,16,0,388,1,
106581,2650,1807,1,2651, 106672551,1852,1,2559,1864,
106591812,1,2652,1817,1, 106681,2567,1805,1,2459,
106602653,1822,1,2654,1827, 106691007,1,2464,1024,1,
106611,2655,1832,1,2657, 106702575,1846,1,2470,3804,
106623801,16,0,463,1, 1067116,0,388,1,2580,
106632550,1843,1,2579,1861, 106721858,1,2703,3805,16,
106641,2558,1849,1,2566, 106730,388,1,2595,1871,
106651855,1,2459,1004,1, 106741,2597,3806,16,0,
106662464,1021,1,2574,1837, 10675388,1,66,3807,19,
106671,2470,3802,16,0, 10676778,1,66,3808,5,
10668463,1,2700,3803,16, 1067730,1,2536,1750,1,
106690,463,1,2594,1868, 106782521,1767,1,2641,1779,
106701,2596,3804,16,0, 106791,2642,1784,1,2643,
10671463,1,67,3805,19, 106801756,1,2644,1789,1,
10672462,1,67,3806,5, 106812645,1794,1,2646,1799,
1067330,1,2644,1753,1, 106821,2647,1762,1,2648,
106742520,1758,1,2639,1765, 106831878,1,2650,1811,1,
106751,2640,1770,1,2641, 106842651,1816,1,2652,1821,
106761775,1,2642,1780,1, 106851,2653,1826,1,2654,
106772643,1747,1,2535,1785, 106861831,1,2655,1836,1,
106781,2645,1791,1,2646, 106872656,1841,1,2657,1774,
106791796,1,2648,1875,1, 106881,2659,3809,16,0,
106802649,1802,1,2650,1807, 10689776,1,2551,1852,1,
106811,2651,1812,1,2652, 106902559,1864,1,2567,1805,
106821817,1,2653,1822,1, 106911,2459,1007,1,2464,
106832654,1827,1,2655,1832, 106921024,1,2575,1846,1,
106841,2657,3807,16,0, 106932470,3810,16,0,776,
10685460,1,2550,1843,1, 106941,2580,1858,1,2703,
106862579,1861,1,2558,1849, 106953811,16,0,776,1,
106871,2566,1855,1,2459, 106962595,1871,1,2597,3812,
106881004,1,2464,1021,1, 1069716,0,776,1,67,
106892574,1837,1,2470,3808, 106983813,19,475,1,67,
1069016,0,460,1,2700, 106993814,5,30,1,2536,
106913809,16,0,460,1, 107001750,1,2521,1767,1,
106922594,1868,1,2596,3810, 107012641,1779,1,2642,1784,
1069316,0,460,1,68, 107021,2643,1756,1,2644,
106943811,19,459,1,68, 107031789,1,2645,1794,1,
106953812,5,30,1,2644, 107042646,1799,1,2647,1762,
106961753,1,2520,1758,1, 107051,2648,1878,1,2650,
106972639,1765,1,2640,1770, 107061811,1,2651,1816,1,
106981,2641,1775,1,2642, 107072652,1821,1,2653,1826,
106991780,1,2643,1747,1, 107081,2654,1831,1,2655,
107002535,1785,1,2645,1791, 107091836,1,2656,1841,1,
107011,2646,1796,1,2648, 107102657,1774,1,2659,3815,
107021875,1,2649,1802,1, 1071116,0,473,1,2551,
107032650,1807,1,2651,1812, 107121852,1,2559,1864,1,
107041,2652,1817,1,2653, 107132567,1805,1,2459,1007,
107051822,1,2654,1827,1, 107141,2464,1024,1,2575,
107062655,1832,1,2657,3813, 107151846,1,2470,3816,16,
1070716,0,457,1,2550, 107160,473,1,2580,1858,
107081843,1,2579,1861,1, 107171,2703,3817,16,0,
107092558,1849,1,2566,1855, 10718473,1,2595,1871,1,
107101,2459,1004,1,2464, 107192597,3818,16,0,473,
107111021,1,2574,1837,1, 107201,68,3819,19,472,
107122470,3814,16,0,457, 107211,68,3820,5,30,
107131,2700,3815,16,0, 107221,2536,1750,1,2521,
10714457,1,2594,1868,1, 107231767,1,2641,1779,1,
107152596,3816,16,0,457, 107242642,1784,1,2643,1756,
107161,69,3817,19,395, 107251,2644,1789,1,2645,
107171,69,3818,5,30, 107261794,1,2646,1799,1,
107181,2644,1753,1,2520, 107272647,1762,1,2648,1878,
107191758,1,2639,1765,1, 107281,2650,1811,1,2651,
107202640,1770,1,2641,1775, 107291816,1,2652,1821,1,
107211,2642,1780,1,2643, 107302653,1826,1,2654,1831,
107221747,1,2535,1785,1, 107311,2655,1836,1,2656,
107232645,1791,1,2646,1796, 107321841,1,2657,1774,1,
107241,2648,1875,1,2649, 107332659,3821,16,0,470,
107251802,1,2650,1807,1, 107341,2551,1852,1,2559,
107262651,1812,1,2652,1817, 107351864,1,2567,1805,1,
107271,2653,1822,1,2654, 107362459,1007,1,2464,1024,
107281827,1,2655,1832,1, 107371,2575,1846,1,2470,
107292657,3819,16,0,393, 107383822,16,0,470,1,
107301,2550,1843,1,2579, 107392580,1858,1,2703,3823,
107311861,1,2558,1849,1, 1074016,0,470,1,2595,
107322566,1855,1,2459,1004, 107411871,1,2597,3824,16,
107331,2464,1021,1,2574, 107420,470,1,69,3825,
107341837,1,2470,3820,16, 1074319,405,1,69,3826,
107350,393,1,2700,3821, 107445,30,1,2536,1750,
1073616,0,393,1,2594, 107451,2521,1767,1,2641,
107371868,1,2596,3822,16, 107461779,1,2642,1784,1,
107380,393,1,70,3823, 107472643,1756,1,2644,1789,
1073919,392,1,70,3824, 107481,2645,1794,1,2646,
107405,30,1,2644,1753, 107491799,1,2647,1762,1,
107411,2520,1758,1,2639, 107502648,1878,1,2650,1811,
107421765,1,2640,1770,1, 107511,2651,1816,1,2652,
107432641,1775,1,2642,1780, 107521821,1,2653,1826,1,
107441,2643,1747,1,2535, 107532654,1831,1,2655,1836,
107451785,1,2645,1791,1, 107541,2656,1841,1,2657,
107462646,1796,1,2648,1875, 107551774,1,2659,3827,16,
107471,2649,1802,1,2650, 107560,403,1,2551,1852,
107481807,1,2651,1812,1, 107571,2559,1864,1,2567,
107492652,1817,1,2653,1822, 107581805,1,2459,1007,1,
107501,2654,1827,1,2655, 107592464,1024,1,2575,1846,
107511832,1,2657,3825,16, 107601,2470,3828,16,0,
107520,390,1,2550,1843, 10761403,1,2580,1858,1,
107531,2579,1861,1,2558, 107622703,3829,16,0,403,
107541849,1,2566,1855,1, 107631,2595,1871,1,2597,
107552459,1004,1,2464,1021, 107643830,16,0,403,1,
107561,2574,1837,1,2470, 1076570,3831,19,402,1,
107573826,16,0,390,1, 1076670,3832,5,30,1,
107582700,3827,16,0,390, 107672536,1750,1,2521,1767,
107591,2594,1868,1,2596, 107681,2641,1779,1,2642,
107603828,16,0,390,1, 107691784,1,2643,1756,1,
1076171,3829,19,389,1, 107702644,1789,1,2645,1794,
1076271,3830,5,30,1, 107711,2646,1799,1,2647,
107632644,1753,1,2520,1758, 107721762,1,2648,1878,1,
107641,2639,1765,1,2640, 107732650,1811,1,2651,1816,
107651770,1,2641,1775,1, 107741,2652,1821,1,2653,
107662642,1780,1,2643,1747, 107751826,1,2654,1831,1,
107671,2535,1785,1,2645, 107762655,1836,1,2656,1841,
107681791,1,2646,1796,1, 107771,2657,1774,1,2659,
107692648,1875,1,2649,1802, 107783833,16,0,400,1,
107701,2650,1807,1,2651, 107792551,1852,1,2559,1864,
107711812,1,2652,1817,1, 107801,2567,1805,1,2459,
107722653,1822,1,2654,1827, 107811007,1,2464,1024,1,
107731,2655,1832,1,2657, 107822575,1846,1,2470,3834,
107743831,16,0,387,1, 1078316,0,400,1,2580,
107752550,1843,1,2579,1861, 107841858,1,2703,3835,16,
107761,2558,1849,1,2566, 107850,400,1,2595,1871,
107771855,1,2459,1004,1, 107861,2597,3836,16,0,
107782464,1021,1,2574,1837, 10787400,1,71,3837,19,
107791,2470,3832,16,0, 10788399,1,71,3838,5,
10780387,1,2700,3833,16, 1078930,1,2536,1750,1,
107810,387,1,2594,1868, 107902521,1767,1,2641,1779,
107821,2596,3834,16,0, 107911,2642,1784,1,2643,
10783387,1,72,3835,19, 107921756,1,2644,1789,1,
10784456,1,72,3836,5, 107932645,1794,1,2646,1799,
1078530,1,2644,1753,1, 107941,2647,1762,1,2648,
107862520,1758,1,2639,1765, 107951878,1,2650,1811,1,
107871,2640,1770,1,2641, 107962651,1816,1,2652,1821,
107881775,1,2642,1780,1, 107971,2653,1826,1,2654,
107892643,1747,1,2535,1785, 107981831,1,2655,1836,1,
107901,2645,1791,1,2646, 107992656,1841,1,2657,1774,
107911796,1,2648,1875,1, 108001,2659,3839,16,0,
107922649,1802,1,2650,1807, 10801397,1,2551,1852,1,
107931,2651,1812,1,2652, 108022559,1864,1,2567,1805,
107941817,1,2653,1822,1, 108031,2459,1007,1,2464,
107952654,1827,1,2655,1832, 108041024,1,2575,1846,1,
107961,2657,3837,16,0, 108052470,3840,16,0,397,
10797454,1,2550,1843,1, 108061,2580,1858,1,2703,
107982579,1861,1,2558,1849, 108073841,16,0,397,1,
107991,2566,1855,1,2459, 108082595,1871,1,2597,3842,
108001004,1,2464,1021,1, 1080916,0,397,1,72,
108012574,1837,1,2470,3838, 108103843,19,469,1,72,
1080216,0,454,1,2700, 108113844,5,30,1,2536,
108033839,16,0,454,1, 108121750,1,2521,1767,1,
108042594,1868,1,2596,3840, 108132641,1779,1,2642,1784,
1080516,0,454,1,73, 108141,2643,1756,1,2644,
108063841,19,453,1,73, 108151789,1,2645,1794,1,
108073842,5,30,1,2644, 108162646,1799,1,2647,1762,
108081753,1,2520,1758,1, 108171,2648,1878,1,2650,
108092639,1765,1,2640,1770, 108181811,1,2651,1816,1,
108101,2641,1775,1,2642, 108192652,1821,1,2653,1826,
108111780,1,2643,1747,1, 108201,2654,1831,1,2655,
108122535,1785,1,2645,1791, 108211836,1,2656,1841,1,
108131,2646,1796,1,2648, 108222657,1774,1,2659,3845,
108141875,1,2649,1802,1, 1082316,0,467,1,2551,
108152650,1807,1,2651,1812, 108241852,1,2559,1864,1,
108161,2652,1817,1,2653, 108252567,1805,1,2459,1007,
108171822,1,2654,1827,1, 108261,2464,1024,1,2575,
108182655,1832,1,2657,3843, 108271846,1,2470,3846,16,
1081916,0,451,1,2550, 108280,467,1,2580,1858,
108201843,1,2579,1861,1, 108291,2703,3847,16,0,
108212558,1849,1,2566,1855, 10830467,1,2595,1871,1,
108221,2459,1004,1,2464, 108312597,3848,16,0,467,
108231021,1,2574,1837,1, 108321,73,3849,19,466,
108242470,3844,16,0,451, 108331,73,3850,5,30,
108251,2700,3845,16,0, 108341,2536,1750,1,2521,
10826451,1,2594,1868,1, 108351767,1,2641,1779,1,
108272596,3846,16,0,451, 108362642,1784,1,2643,1756,
108281,74,3847,19,450, 108371,2644,1789,1,2645,
108291,74,3848,5,30, 108381794,1,2646,1799,1,
108301,2644,1753,1,2520, 108392647,1762,1,2648,1878,
108311758,1,2639,1765,1, 108401,2650,1811,1,2651,
108322640,1770,1,2641,1775, 108411816,1,2652,1821,1,
108331,2642,1780,1,2643, 108422653,1826,1,2654,1831,
108341747,1,2535,1785,1, 108431,2655,1836,1,2656,
108352645,1791,1,2646,1796, 108441841,1,2657,1774,1,
108361,2648,1875,1,2649, 108452659,3851,16,0,464,
108371802,1,2650,1807,1, 108461,2551,1852,1,2559,
108382651,1812,1,2652,1817, 108471864,1,2567,1805,1,
108391,2653,1822,1,2654, 108482459,1007,1,2464,1024,
108401827,1,2655,1832,1, 108491,2575,1846,1,2470,
108412657,3849,16,0,448, 108503852,16,0,464,1,
108421,2550,1843,1,2579, 108512580,1858,1,2703,3853,
108431861,1,2558,1849,1, 1085216,0,464,1,2595,
108442566,1855,1,2459,1004, 108531871,1,2597,3854,16,
108451,2464,1021,1,2574, 108540,464,1,74,3855,
108461837,1,2470,3850,16, 1085519,463,1,74,3856,
108470,448,1,2700,3851, 108565,30,1,2536,1750,
1084816,0,448,1,2594, 108571,2521,1767,1,2641,
108491868,1,2596,3852,16, 108581779,1,2642,1784,1,
108500,448,1,75,3853, 108592643,1756,1,2644,1789,
1085119,439,1,75,3854, 108601,2645,1794,1,2646,
108525,30,1,2644,1753, 108611799,1,2647,1762,1,
108531,2520,1758,1,2639, 108622648,1878,1,2650,1811,
108541765,1,2640,1770,1, 108631,2651,1816,1,2652,
108552641,1775,1,2642,1780, 108641821,1,2653,1826,1,
108561,2643,1747,1,2535, 108652654,1831,1,2655,1836,
108571785,1,2645,1791,1, 108661,2656,1841,1,2657,
108582646,1796,1,2648,1875, 108671774,1,2659,3857,16,
108591,2649,1802,1,2650, 108680,461,1,2551,1852,
108601807,1,2651,1812,1, 108691,2559,1864,1,2567,
108612652,1817,1,2653,1822, 108701805,1,2459,1007,1,
108621,2654,1827,1,2655, 108712464,1024,1,2575,1846,
108631832,1,2657,3855,16, 108721,2470,3858,16,0,
108640,437,1,2550,1843, 10873461,1,2580,1858,1,
108651,2579,1861,1,2558, 108742703,3859,16,0,461,
108661849,1,2566,1855,1, 108751,2595,1871,1,2597,
108672459,1004,1,2464,1021, 108763860,16,0,461,1,
108681,2574,1837,1,2470, 1087775,3861,19,449,1,
108693856,16,0,437,1, 1087875,3862,5,30,1,
108702700,3857,16,0,437, 108792536,1750,1,2521,1767,
108711,2594,1868,1,2596, 108801,2641,1779,1,2642,
108723858,16,0,437,1, 108811784,1,2643,1756,1,
1087376,3859,19,560,1, 108822644,1789,1,2645,1794,
1087476,3860,5,30,1, 108831,2646,1799,1,2647,
108752644,1753,1,2520,1758, 108841762,1,2648,1878,1,
108761,2639,1765,1,2640, 108852650,1811,1,2651,1816,
108771770,1,2641,1775,1, 108861,2652,1821,1,2653,
108782642,1780,1,2643,1747, 108871826,1,2654,1831,1,
108791,2535,1785,1,2645, 108882655,1836,1,2656,1841,
108801791,1,2646,1796,1, 108891,2657,1774,1,2659,
108812648,1875,1,2649,1802, 108903863,16,0,447,1,
108821,2650,1807,1,2651, 108912551,1852,1,2559,1864,
108831812,1,2652,1817,1, 108921,2567,1805,1,2459,
108842653,1822,1,2654,1827, 108931007,1,2464,1024,1,
108851,2655,1832,1,2657, 108942575,1846,1,2470,3864,
108863861,16,0,558,1, 1089516,0,447,1,2580,
108872550,1843,1,2579,1861, 108961858,1,2703,3865,16,
108881,2558,1849,1,2566, 108970,447,1,2595,1871,
108891855,1,2459,1004,1, 108981,2597,3866,16,0,
108902464,1021,1,2574,1837, 10899447,1,76,3867,19,
108911,2470,3862,16,0, 10900570,1,76,3868,5,
10892558,1,2700,3863,16, 1090130,1,2536,1750,1,
108930,558,1,2594,1868, 109022521,1767,1,2641,1779,
108941,2596,3864,16,0, 109031,2642,1784,1,2643,
10895558,1,77,3865,19, 109041756,1,2644,1789,1,
10896435,1,77,3866,5, 109052645,1794,1,2646,1799,
1089730,1,2644,1753,1, 109061,2647,1762,1,2648,
108982520,1758,1,2639,1765, 109071878,1,2650,1811,1,
108991,2640,1770,1,2641, 109082651,1816,1,2652,1821,
109001775,1,2642,1780,1, 109091,2653,1826,1,2654,
109012643,1747,1,2535,1785, 109101831,1,2655,1836,1,
109021,2645,1791,1,2646, 109112656,1841,1,2657,1774,
109031796,1,2648,1875,1, 109121,2659,3869,16,0,
109042649,1802,1,2650,1807, 10913568,1,2551,1852,1,
109051,2651,1812,1,2652, 109142559,1864,1,2567,1805,
109061817,1,2653,1822,1, 109151,2459,1007,1,2464,
109072654,1827,1,2655,1832, 109161024,1,2575,1846,1,
109081,2657,3867,16,0, 109172470,3870,16,0,568,
10909433,1,2550,1843,1, 109181,2580,1858,1,2703,
109102579,1861,1,2558,1849, 109193871,16,0,568,1,
109111,2566,1855,1,2459, 109202595,1871,1,2597,3872,
109121004,1,2464,1021,1, 1092116,0,568,1,77,
109132574,1837,1,2470,3868, 109223873,19,445,1,77,
1091416,0,433,1,2700, 109233874,5,30,1,2536,
109153869,16,0,433,1, 109241750,1,2521,1767,1,
109162594,1868,1,2596,3870, 109252641,1779,1,2642,1784,
1091716,0,433,1,78, 109261,2643,1756,1,2644,
109183871,19,554,1,78, 109271789,1,2645,1794,1,
109193872,5,30,1,2644, 109282646,1799,1,2647,1762,
109201753,1,2520,1758,1, 109291,2648,1878,1,2650,
109212639,1765,1,2640,1770, 109301811,1,2651,1816,1,
109221,2641,1775,1,2642, 109312652,1821,1,2653,1826,
109231780,1,2643,1747,1, 109321,2654,1831,1,2655,
109242535,1785,1,2645,1791, 109331836,1,2656,1841,1,
109251,2646,1796,1,2648, 109342657,1774,1,2659,3875,
109261875,1,2649,1802,1, 1093516,0,443,1,2551,
109272650,1807,1,2651,1812, 109361852,1,2559,1864,1,
109281,2652,1817,1,2653, 109372567,1805,1,2459,1007,
109291822,1,2654,1827,1, 109381,2464,1024,1,2575,
109302655,1832,1,2657,3873, 109391846,1,2470,3876,16,
1093116,0,552,1,2550, 109400,443,1,2580,1858,
109321843,1,2579,1861,1, 109411,2703,3877,16,0,
109332558,1849,1,2566,1855, 10942443,1,2595,1871,1,
109341,2459,1004,1,2464, 109432597,3878,16,0,443,
109351021,1,2574,1837,1, 109441,78,3879,19,566,
109362470,3874,16,0,552, 109451,78,3880,5,30,
109371,2700,3875,16,0, 109461,2536,1750,1,2521,
10938552,1,2594,1868,1, 109471767,1,2641,1779,1,
109392596,3876,16,0,552, 109482642,1784,1,2643,1756,
109401,79,3877,19,551, 109491,2644,1789,1,2645,
109411,79,3878,5,30, 109501794,1,2646,1799,1,
109421,2644,1753,1,2520, 109512647,1762,1,2648,1878,
109431758,1,2639,1765,1, 109521,2650,1811,1,2651,
109442640,1770,1,2641,1775, 109531816,1,2652,1821,1,
109451,2642,1780,1,2643, 109542653,1826,1,2654,1831,
109461747,1,2535,1785,1, 109551,2655,1836,1,2656,
109472645,1791,1,2646,1796, 109561841,1,2657,1774,1,
109481,2648,1875,1,2649, 109572659,3881,16,0,564,
109491802,1,2650,1807,1, 109581,2551,1852,1,2559,
109502651,1812,1,2652,1817, 109591864,1,2567,1805,1,
109511,2653,1822,1,2654, 109602459,1007,1,2464,1024,
109521827,1,2655,1832,1, 109611,2575,1846,1,2470,
109532657,3879,16,0,549, 109623882,16,0,564,1,
109541,2550,1843,1,2579, 109632580,1858,1,2703,3883,
109551861,1,2558,1849,1, 1096416,0,564,1,2595,
109562566,1855,1,2459,1004, 109651871,1,2597,3884,16,
109571,2464,1021,1,2574, 109660,564,1,79,3885,
109581837,1,2470,3880,16, 1096719,563,1,79,3886,
109590,549,1,2700,3881, 109685,30,1,2536,1750,
1096016,0,549,1,2594, 109691,2521,1767,1,2641,
109611868,1,2596,3882,16, 109701779,1,2642,1784,1,
109620,549,1,80,3883, 109712643,1756,1,2644,1789,
1096319,426,1,80,3884, 109721,2645,1794,1,2646,
109645,30,1,2644,1753, 109731799,1,2647,1762,1,
109651,2520,1758,1,2639, 109742648,1878,1,2650,1811,
109661765,1,2640,1770,1, 109751,2651,1816,1,2652,
109672641,1775,1,2642,1780, 109761821,1,2653,1826,1,
109681,2643,1747,1,2535, 109772654,1831,1,2655,1836,
109691785,1,2645,1791,1, 109781,2656,1841,1,2657,
109702646,1796,1,2648,1875, 109791774,1,2659,3887,16,
109711,2649,1802,1,2650, 109800,561,1,2551,1852,
109721807,1,2651,1812,1, 109811,2559,1864,1,2567,
109732652,1817,1,2653,1822, 109821805,1,2459,1007,1,
109741,2654,1827,1,2655, 109832464,1024,1,2575,1846,
109751832,1,2657,3885,16, 109841,2470,3888,16,0,
109760,424,1,2550,1843, 10985561,1,2580,1858,1,
109771,2579,1861,1,2558, 109862703,3889,16,0,561,
109781849,1,2566,1855,1, 109871,2595,1871,1,2597,
109792459,1004,1,2464,1021, 109883890,16,0,561,1,
109801,2574,1837,1,2470, 1098980,3891,19,436,1,
109813886,16,0,424,1, 1099080,3892,5,30,1,
109822700,3887,16,0,424, 109912536,1750,1,2521,1767,
109831,2594,1868,1,2596, 109921,2641,1779,1,2642,
109843888,16,0,424,1, 109931784,1,2643,1756,1,
1098581,3889,19,413,1, 109942644,1789,1,2645,1794,
1098681,3890,5,30,1, 109951,2646,1799,1,2647,
109872644,1753,1,2520,1758, 109961762,1,2648,1878,1,
109881,2639,1765,1,2640, 109972650,1811,1,2651,1816,
109891770,1,2641,1775,1, 109981,2652,1821,1,2653,
109902642,1780,1,2643,1747, 109991826,1,2654,1831,1,
109911,2535,1785,1,2645, 110002655,1836,1,2656,1841,
109921791,1,2646,1796,1, 110011,2657,1774,1,2659,
109932648,1875,1,2649,1802, 110023893,16,0,434,1,
109941,2650,1807,1,2651, 110032551,1852,1,2559,1864,
109951812,1,2652,1817,1, 110041,2567,1805,1,2459,
109962653,1822,1,2654,1827, 110051007,1,2464,1024,1,
109971,2655,1832,1,2657, 110062575,1846,1,2470,3894,
109983891,16,0,411,1, 1100716,0,434,1,2580,
109992550,1843,1,2579,1861, 110081858,1,2703,3895,16,
110001,2558,1849,1,2566, 110090,434,1,2595,1871,
110011855,1,2459,1004,1, 110101,2597,3896,16,0,
110022464,1021,1,2574,1837, 11011434,1,81,3897,19,
110031,2470,3892,16,0, 11012423,1,81,3898,5,
11004411,1,2700,3893,16, 1101330,1,2536,1750,1,
110050,411,1,2594,1868, 110142521,1767,1,2641,1779,
110061,2596,3894,16,0, 110151,2642,1784,1,2643,
11007411,1,82,3895,19, 110161756,1,2644,1789,1,
11008758,1,82,3896,5, 110172645,1794,1,2646,1799,
1100930,1,2644,1753,1, 110181,2647,1762,1,2648,
110102520,1758,1,2639,1765, 110191878,1,2650,1811,1,
110111,2640,1770,1,2641, 110202651,1816,1,2652,1821,
110121775,1,2642,1780,1, 110211,2653,1826,1,2654,
110132643,1747,1,2535,1785, 110221831,1,2655,1836,1,
110141,2645,1791,1,2646, 110232656,1841,1,2657,1774,
110151796,1,2648,1875,1, 110241,2659,3899,16,0,
110162649,1802,1,2650,1807, 11025421,1,2551,1852,1,
110171,2651,1812,1,2652, 110262559,1864,1,2567,1805,
110181817,1,2653,1822,1, 110271,2459,1007,1,2464,
110192654,1827,1,2655,1832, 110281024,1,2575,1846,1,
110201,2657,3897,16,0, 110292470,3900,16,0,421,
11021756,1,2550,1843,1, 110301,2580,1858,1,2703,
110222579,1861,1,2558,1849, 110313901,16,0,421,1,
110231,2566,1855,1,2459, 110322595,1871,1,2597,3902,
110241004,1,2464,1021,1, 1103316,0,421,1,82,
110252574,1837,1,2470,3898, 110343903,19,460,1,82,
1102616,0,756,1,2700, 110353904,5,30,1,2536,
110273899,16,0,756,1, 110361750,1,2521,1767,1,
110282594,1868,1,2596,3900, 110372641,1779,1,2642,1784,
1102916,0,756,1,83, 110381,2643,1756,1,2644,
110303901,19,410,1,83, 110391789,1,2645,1794,1,
110313902,5,30,1,2644, 110402646,1799,1,2647,1762,
110321753,1,2520,1758,1, 110411,2648,1878,1,2650,
110332639,1765,1,2640,1770, 110421811,1,2651,1816,1,
110341,2641,1775,1,2642, 110432652,1821,1,2653,1826,
110351780,1,2643,1747,1, 110441,2654,1831,1,2655,
110362535,1785,1,2645,1791, 110451836,1,2656,1841,1,
110371,2646,1796,1,2648, 110462657,1774,1,2659,3905,
110381875,1,2649,1802,1, 1104716,0,458,1,2551,
110392650,1807,1,2651,1812, 110481852,1,2559,1864,1,
110401,2652,1817,1,2653, 110492567,1805,1,2459,1007,
110411822,1,2654,1827,1, 110501,2464,1024,1,2575,
110422655,1832,1,2657,3903, 110511846,1,2470,3906,16,
1104316,0,408,1,2550, 110520,458,1,2580,1858,
110441843,1,2579,1861,1, 110531,2703,3907,16,0,
110452558,1849,1,2566,1855, 11054458,1,2595,1871,1,
110461,2459,1004,1,2464, 110552597,3908,16,0,458,
110471021,1,2574,1837,1, 110561,83,3909,19,420,
110482470,3904,16,0,408, 110571,83,3910,5,30,
110491,2700,3905,16,0, 110581,2536,1750,1,2521,
11050408,1,2594,1868,1, 110591767,1,2641,1779,1,
110512596,3906,16,0,408, 110602642,1784,1,2643,1756,
110521,84,3907,19,407, 110611,2644,1789,1,2645,
110531,84,3908,5,30, 110621794,1,2646,1799,1,
110541,2644,1753,1,2520, 110632647,1762,1,2648,1878,
110551758,1,2639,1765,1, 110641,2650,1811,1,2651,
110562640,1770,1,2641,1775, 110651816,1,2652,1821,1,
110571,2642,1780,1,2643, 110662653,1826,1,2654,1831,
110581747,1,2535,1785,1, 110671,2655,1836,1,2656,
110592645,1791,1,2646,1796, 110681841,1,2657,1774,1,
110601,2648,1875,1,2649, 110692659,3911,16,0,418,
110611802,1,2650,1807,1, 110701,2551,1852,1,2559,
110622651,1812,1,2652,1817, 110711864,1,2567,1805,1,
110631,2653,1822,1,2654, 110722459,1007,1,2464,1024,
110641827,1,2655,1832,1, 110731,2575,1846,1,2470,
110652657,3909,16,0,405, 110743912,16,0,418,1,
110661,2550,1843,1,2579, 110752580,1858,1,2703,3913,
110671861,1,2558,1849,1, 1107616,0,418,1,2595,
110682566,1855,1,2459,1004, 110771871,1,2597,3914,16,
110691,2464,1021,1,2574, 110780,418,1,84,3915,
110701837,1,2470,3910,16, 1107919,417,1,84,3916,
110710,405,1,2700,3911, 110805,30,1,2536,1750,
1107216,0,405,1,2594, 110811,2521,1767,1,2641,
110731868,1,2596,3912,16, 110821779,1,2642,1784,1,
110740,405,1,85,3913, 110832643,1756,1,2644,1789,
1107519,570,1,85,3914, 110841,2645,1794,1,2646,
110765,30,1,2644,1753, 110851799,1,2647,1762,1,
110771,2520,1758,1,2639, 110862648,1878,1,2650,1811,
110781765,1,2640,1770,1, 110871,2651,1816,1,2652,
110792641,1775,1,2642,1780, 110881821,1,2653,1826,1,
110801,2643,1747,1,2535, 110892654,1831,1,2655,1836,
110811785,1,2645,1791,1, 110901,2656,1841,1,2657,
110822646,1796,1,2648,1875, 110911774,1,2659,3917,16,
110831,2649,1802,1,2650, 110920,415,1,2551,1852,
110841807,1,2651,1812,1, 110931,2559,1864,1,2567,
110852652,1817,1,2653,1822, 110941805,1,2459,1007,1,
110861,2654,1827,1,2655, 110952464,1024,1,2575,1846,
110871832,1,2657,3915,16, 110961,2470,3918,16,0,
110880,568,1,2550,1843, 11097415,1,2580,1858,1,
110891,2579,1861,1,2558, 110982703,3919,16,0,415,
110901849,1,2566,1855,1, 110991,2595,1871,1,2597,
110912459,1004,1,2464,1021, 111003920,16,0,415,1,
110921,2574,1837,1,2470, 1110185,3921,19,578,1,
110933916,16,0,568,1, 1110285,3922,5,30,1,
110942700,3917,16,0,568, 111032536,1750,1,2521,1767,
110951,2594,1868,1,2596, 111041,2641,1779,1,2642,
110963918,16,0,568,1, 111051784,1,2643,1756,1,
1109786,3919,19,442,1, 111062644,1789,1,2645,1794,
1109886,3920,5,30,1, 111071,2646,1799,1,2647,
110992644,1753,1,2520,1758, 111081762,1,2648,1878,1,
111001,2639,1765,1,2640, 111092650,1811,1,2651,1816,
111011770,1,2641,1775,1, 111101,2652,1821,1,2653,
111022642,1780,1,2643,1747, 111111826,1,2654,1831,1,
111031,2535,1785,1,2645, 111122655,1836,1,2656,1841,
111041791,1,2646,1796,1, 111131,2657,1774,1,2659,
111052648,1875,1,2649,1802, 111143923,16,0,576,1,
111061,2650,1807,1,2651, 111152551,1852,1,2559,1864,
111071812,1,2652,1817,1, 111161,2567,1805,1,2459,
111082653,1822,1,2654,1827, 111171007,1,2464,1024,1,
111091,2655,1832,1,2657, 111182575,1846,1,2470,3924,
111103921,16,0,440,1, 1111916,0,576,1,2580,
111112550,1843,1,2579,1861, 111201858,1,2703,3925,16,
111121,2558,1849,1,2566, 111210,576,1,2595,1871,
111131855,1,2459,1004,1, 111221,2597,3926,16,0,
111142464,1021,1,2574,1837, 11123576,1,86,3927,19,
111151,2470,3922,16,0, 11124452,1,86,3928,5,
11116440,1,2700,3923,16, 1112530,1,2536,1750,1,
111170,440,1,2594,1868, 111262521,1767,1,2641,1779,
111181,2596,3924,16,0, 111271,2642,1784,1,2643,
11119440,1,87,3925,19, 111281756,1,2644,1789,1,
11120548,1,87,3926,5, 111292645,1794,1,2646,1799,
1112130,1,2644,1753,1, 111301,2647,1762,1,2648,
111222520,1758,1,2639,1765, 111311878,1,2650,1811,1,
111231,2640,1770,1,2641, 111322651,1816,1,2652,1821,
111241775,1,2642,1780,1, 111331,2653,1826,1,2654,
111252643,1747,1,2535,1785, 111341831,1,2655,1836,1,
111261,2645,1791,1,2646, 111352656,1841,1,2657,1774,
111271796,1,2648,1875,1, 111361,2659,3929,16,0,
111282649,1802,1,2650,1807, 11137450,1,2551,1852,1,
111291,2651,1812,1,2652, 111382559,1864,1,2567,1805,
111301817,1,2653,1822,1, 111391,2459,1007,1,2464,
111312654,1827,1,2655,1832, 111401024,1,2575,1846,1,
111321,2657,3927,16,0, 111412470,3930,16,0,450,
11133546,1,2550,1843,1, 111421,2580,1858,1,2703,
111342579,1861,1,2558,1849, 111433931,16,0,450,1,
111351,2566,1855,1,2459, 111442595,1871,1,2597,3932,
111361004,1,2464,1021,1, 1114516,0,450,1,87,
111372574,1837,1,2470,3928, 111463933,19,560,1,87,
1113816,0,546,1,2700, 111473934,5,30,1,2536,
111393929,16,0,546,1, 111481750,1,2521,1767,1,
111402594,1868,1,2596,3930, 111492641,1779,1,2642,1784,
1114116,0,546,1,88, 111501,2643,1756,1,2644,
111423931,19,404,1,88, 111511789,1,2645,1794,1,
111433932,5,30,1,2644, 111522646,1799,1,2647,1762,
111441753,1,2520,1758,1, 111531,2648,1878,1,2650,
111452639,1765,1,2640,1770, 111541811,1,2651,1816,1,
111461,2641,1775,1,2642, 111552652,1821,1,2653,1826,
111471780,1,2643,1747,1, 111561,2654,1831,1,2655,
111482535,1785,1,2645,1791, 111571836,1,2656,1841,1,
111491,2646,1796,1,2648, 111582657,1774,1,2659,3935,
111501875,1,2649,1802,1, 1115916,0,558,1,2551,
111512650,1807,1,2651,1812, 111601852,1,2559,1864,1,
111521,2652,1817,1,2653, 111612567,1805,1,2459,1007,
111531822,1,2654,1827,1, 111621,2464,1024,1,2575,
111542655,1832,1,2657,3933, 111631846,1,2470,3936,16,
1115516,0,402,1,2550, 111640,558,1,2580,1858,
111561843,1,2579,1861,1, 111651,2703,3937,16,0,
111572558,1849,1,2566,1855, 11166558,1,2595,1871,1,
111581,2459,1004,1,2464, 111672597,3938,16,0,558,
111591021,1,2574,1837,1, 111681,88,3939,19,414,
111602470,3934,16,0,402, 111691,88,3940,5,30,
111611,2700,3935,16,0, 111701,2536,1750,1,2521,
11162402,1,2594,1868,1, 111711767,1,2641,1779,1,
111632596,3936,16,0,402, 111722642,1784,1,2643,1756,
111641,89,3937,19,398, 111731,2644,1789,1,2645,
111651,89,3938,5,30, 111741794,1,2646,1799,1,
111661,2644,1753,1,2520, 111752647,1762,1,2648,1878,
111671758,1,2639,1765,1, 111761,2650,1811,1,2651,
111682640,1770,1,2641,1775, 111771816,1,2652,1821,1,
111691,2642,1780,1,2643, 111782653,1826,1,2654,1831,
111701747,1,2535,1785,1, 111791,2655,1836,1,2656,
111712645,1791,1,2646,1796, 111801841,1,2657,1774,1,
111721,2648,1875,1,2649, 111812659,3941,16,0,412,
111731802,1,2650,1807,1, 111821,2551,1852,1,2559,
111742651,1812,1,2652,1817, 111831864,1,2567,1805,1,
111751,2653,1822,1,2654, 111842459,1007,1,2464,1024,
111761827,1,2655,1832,1, 111851,2575,1846,1,2470,
111772657,3939,16,0,396, 111863942,16,0,412,1,
111781,2550,1843,1,2579, 111872580,1858,1,2703,3943,
111791861,1,2558,1849,1, 1118816,0,412,1,2595,
111802566,1855,1,2459,1004, 111891871,1,2597,3944,16,
111811,2464,1021,1,2574, 111900,412,1,89,3945,
111821837,1,2470,3940,16, 1119119,408,1,89,3946,
111830,396,1,2700,3941, 111925,30,1,2536,1750,
1118416,0,396,1,2594, 111931,2521,1767,1,2641,
111851868,1,2596,3942,16, 111941779,1,2642,1784,1,
111860,396,1,90,3943, 111952643,1756,1,2644,1789,
1118719,401,1,90,3944, 111961,2645,1794,1,2646,
111885,30,1,2644,1753, 111971799,1,2647,1762,1,
111891,2520,1758,1,2639, 111982648,1878,1,2650,1811,
111901765,1,2640,1770,1, 111991,2651,1816,1,2652,
111912641,1775,1,2642,1780, 112001821,1,2653,1826,1,
111921,2643,1747,1,2535, 112012654,1831,1,2655,1836,
111931785,1,2645,1791,1, 112021,2656,1841,1,2657,
111942646,1796,1,2648,1875, 112031774,1,2659,3947,16,
111951,2649,1802,1,2650, 112040,406,1,2551,1852,
111961807,1,2651,1812,1, 112051,2559,1864,1,2567,
111972652,1817,1,2653,1822, 112061805,1,2459,1007,1,
111981,2654,1827,1,2655, 112072464,1024,1,2575,1846,
111991832,1,2657,3945,16, 112081,2470,3948,16,0,
112000,399,1,2550,1843, 11209406,1,2580,1858,1,
112011,2579,1861,1,2558, 112102703,3949,16,0,406,
112021849,1,2566,1855,1, 112111,2595,1871,1,2597,
112032459,1004,1,2464,1021, 112123950,16,0,406,1,
112041,2574,1837,1,2470, 1121390,3951,19,411,1,
112053946,16,0,399,1, 1121490,3952,5,30,1,
112062700,3947,16,0,399, 112152536,1750,1,2521,1767,
112071,2594,1868,1,2596, 112161,2641,1779,1,2642,
112083948,16,0,399,1, 112171784,1,2643,1756,1,
1120991,3949,19,446,1, 112182644,1789,1,2645,1794,
1121091,3950,5,30,1, 112191,2646,1799,1,2647,
112112644,1753,1,2520,1758, 112201762,1,2648,1878,1,
112121,2639,1765,1,2640, 112212650,1811,1,2651,1816,
112131770,1,2641,1775,1, 112221,2652,1821,1,2653,
112142642,1780,1,2643,1747, 112231826,1,2654,1831,1,
112151,2535,1785,1,2645, 112242655,1836,1,2656,1841,
112161791,1,2646,1796,1, 112251,2657,1774,1,2659,
112172648,1875,1,2649,1802, 112263953,16,0,409,1,
112181,2650,1807,1,2651, 112272551,1852,1,2559,1864,
112191812,1,2652,1817,1, 112281,2567,1805,1,2459,
112202653,1822,1,2654,1827, 112291007,1,2464,1024,1,
112211,2655,1832,1,2657, 112302575,1846,1,2470,3954,
112223951,16,0,444,1, 1123116,0,409,1,2580,
112232550,1843,1,2579,1861, 112321858,1,2703,3955,16,
112241,2558,1849,1,2566, 112330,409,1,2595,1871,
112251855,1,2459,1004,1, 112341,2597,3956,16,0,
112262464,1021,1,2574,1837, 11235409,1,91,3957,19,
112271,2470,3952,16,0, 11236768,1,91,3958,5,
11228444,1,2700,3953,16, 1123730,1,2536,1750,1,
112290,444,1,2594,1868, 112382521,1767,1,2641,1779,
112301,2596,3954,16,0, 112391,2642,1784,1,2643,
11231444,1,92,3955,19, 112401756,1,2644,1789,1,
11232133,1,92,3956,5, 112412645,1794,1,2646,1799,
11233129,1,0,3957,16, 112421,2647,1762,1,2648,
112340,314,1,1,2236, 112431878,1,2650,1811,1,
112351,2,2242,1,3, 112442651,1816,1,2652,1821,
112362247,1,4,2252,1, 112451,2653,1826,1,2654,
112375,2257,1,6,2262, 112461831,1,2655,1836,1,
112381,7,2267,1,8, 112472656,1841,1,2657,1774,
112393958,16,0,131,1, 112481,2659,3959,16,0,
112401515,3959,16,0,184, 11249766,1,2551,1852,1,
112411,2021,840,1,2022, 112502559,1864,1,2567,1805,
112423960,16,0,575,1, 112511,2459,1007,1,2464,
11243256,3961,16,0,192, 112521024,1,2575,1846,1,
112441,2526,3962,16,0, 112532470,3960,16,0,766,
11245300,1,2025,3963,16, 112541,2580,1858,1,2703,
112460,579,1,18,3964, 112553961,16,0,766,1,
1124716,0,138,1,2027, 112562595,1871,1,2597,3962,
112483965,16,0,583,1, 1125716,0,766,1,92,
112492029,847,1,2030,853, 112583963,19,456,1,92,
112501,2031,858,1,2032, 112593964,5,30,1,2536,
11251863,1,2033,868,1, 112601750,1,2521,1767,1,
11252277,3966,16,0,192, 112612641,1779,1,2642,1784,
112531,2035,874,1,2037, 112621,2643,1756,1,2644,
11254879,1,2541,3967,16, 112631789,1,2645,1794,1,
112550,512,1,32,3968, 112642646,1799,1,2647,1762,
1125616,0,184,1,2041, 112651,2648,1878,1,2650,
11257890,1,2293,3969,16, 112661811,1,2651,1816,1,
112580,192,1,2043,896, 112672652,1821,1,2653,1826,
112591,2045,901,1,41, 112681,2654,1831,1,2655,
112603970,16,0,192,1, 112691836,1,2656,1841,1,
112611297,3971,16,0,184, 112702657,1774,1,2659,3965,
112621,43,3972,16,0, 1127116,0,454,1,2551,
11263192,1,46,3973,16, 112721852,1,2559,1864,1,
112640,197,1,1804,3974, 112732567,1805,1,2459,1007,
1126516,0,184,1,299, 112741,2464,1024,1,2575,
112663975,16,0,192,1, 112751846,1,2470,3966,16,
1126752,3976,16,0,184, 112760,454,1,2580,1858,
112681,2818,3516,1,2819, 112771,2703,3967,16,0,
112693977,16,0,314,1, 11278454,1,2595,1871,1,
112702318,3978,16,0,184, 112792597,3968,16,0,454,
112711,62,3979,16,0, 112801,93,3969,19,133,
11272221,1,65,3980,16, 112811,93,3970,5,129,
112730,223,1,2075,3981, 112821,0,3971,16,0,
1127416,0,184,1,1574, 11283789,1,1,2244,1,
11275921,1,71,3982,16, 112842,2250,1,3,2255,
112760,192,1,1775,3983, 112851,4,2260,1,5,
1127716,0,184,1,2837, 112862265,1,6,2270,1,
112783530,1,2838,3536,1, 112877,2275,1,8,3972,
112792337,3984,16,0,184, 1128816,0,131,1,1515,
112801,79,3985,16,0, 112893973,16,0,181,1,
11281192,1,1335,3986,16, 112902021,843,1,2022,3974,
112820,184,1,2511,3987, 1129116,0,583,1,256,
1128316,0,477,1,322, 112923975,16,0,189,1,
112843988,16,0,192,1, 112932527,3976,16,0,311,
1128576,3989,16,0,192, 112941,18,3977,16,0,
112861,85,3990,16,0, 11295138,1,2027,3978,16,
11287192,1,1261,3991,16, 112960,591,1,2029,850,
112880,184,1,89,3992, 112971,2030,856,1,2031,
1128916,0,192,1,509, 11298861,1,2032,866,1,
112903993,16,0,192,1, 112992786,3979,16,0,189,
11291346,3994,16,0,192, 113001,277,3980,16,0,
112921,2039,884,1,97, 11301189,1,2035,877,1,
112933995,16,0,192,1, 113022037,882,1,2039,887,
112942106,3996,16,0,184, 113031,32,3981,16,0,
112951,102,3997,16,0, 11304181,1,2041,893,1,
11296192,1,1860,943,1, 113052293,3982,16,0,189,
112971803,909,1,2364,949, 113061,2043,899,1,2045,
112981,2779,3510,1,2782, 11307904,1,41,3983,16,
112993998,16,0,192,1, 113080,189,1,1297,3984,
11300112,3999,16,0,192, 1130916,0,181,1,43,
113011,1117,4000,16,0, 113103985,16,0,189,1,
11302184,1,1873,958,1, 1131146,3986,16,0,194,
113031876,4001,16,0,184, 113121,1804,3987,16,0,
113041,372,4002,16,0, 11313181,1,299,3988,16,
11305613,1,374,4003,16, 113140,189,1,2811,3559,
113060,615,1,124,4004, 113151,52,3989,16,0,
1130716,0,192,1,376, 11316181,1,509,3990,16,
113084005,16,0,617,1, 113170,189,1,2318,3991,
11309378,4006,16,0,619, 1131816,0,181,1,2822,
113101,2136,965,1,381, 113193523,1,62,3992,16,
113114007,16,0,192,1, 113200,218,1,65,3993,
11312525,4008,16,0,192, 1132116,0,220,1,2075,
113131,2807,3551,1,1834, 113223994,16,0,181,1,
113144009,16,0,184,1, 113231574,924,1,71,3995,
11315137,4010,16,0,192, 1132416,0,189,1,1775,
113161,1901,4011,16,0, 113253996,16,0,181,1,
11317184,1,1113,4012,16, 1132676,3997,16,0,189,
113180,176,1,1153,4013, 113271,1834,3998,16,0,
1131916,0,184,1,151, 11328181,1,2337,3999,16,
113204014,16,0,192,1, 113290,181,1,79,4000,
113211407,4015,16,0,184, 1133016,0,189,1,1335,
113221,1659,4016,16,0, 113314001,16,0,181,1,
11323184,1,2413,4017,16, 113322842,3544,1,2843,3549,
113240,184,1,406,4018, 113331,2844,3554,1,85,
1132516,0,192,1,1371, 113344002,16,0,189,1,
113264019,16,0,184,1, 113351261,4003,16,0,181,
113272105,936,1,166,4020, 113361,89,4004,16,0,
1132816,0,192,1,2839, 11337189,1,2033,871,1,
113293541,1,2840,3546,1, 11338322,4005,16,0,189,
113301931,983,1,1933,4021, 113391,97,4006,16,0,
1133116,0,184,1,431, 11340189,1,2106,4007,16,
113324022,16,0,192,1, 113410,181,1,102,4008,
113331585,4023,16,0,192, 1134216,0,189,1,1860,
113341,182,4024,16,0, 11343946,1,1803,912,1,
11335192,1,1189,4025,16, 113442364,952,1,346,4009,
113360,184,1,1443,4026, 1134516,0,189,1,1113,
1133716,0,184,1,1695, 113464010,16,0,173,1,
113384027,16,0,184,1, 113472783,3517,1,112,4011,
113392198,4028,16,0,184, 1134816,0,189,1,1117,
113401,447,4029,16,0, 113494012,16,0,181,1,
11341192,1,2458,998,1, 113501371,4013,16,0,181,
113422459,1004,1,1958,4030, 113511,1876,4014,16,0,
1134316,0,184,1,2462, 11352181,1,372,4015,16,
113441011,1,1657,1016,1, 113530,621,1,374,4016,
113452464,1021,1,2466,3525, 1135416,0,623,1,124,
113461,459,4031,16,0, 113554017,16,0,189,1,
11347192,1,2468,4032,16, 11356376,4018,16,0,625,
113480,376,1,462,4033, 113571,378,4019,16,0,
1134916,0,192,1,199, 11358627,1,2136,968,1,
113504034,16,0,192,1, 11359381,4020,16,0,189,
11351217,4035,16,0,192, 113601,525,4021,16,0,
113521,2227,1030,1,1622, 11361189,1,137,4022,16,
113534036,16,0,192,1, 113620,189,1,1901,4023,
113541225,4037,16,0,184, 1136316,0,181,1,2025,
113551,1479,4038,16,0, 113644024,16,0,587,1,
11356184,1,1731,4039,16, 113651153,4025,16,0,181,
113570,192,1,1989,1038, 113661,151,4026,16,0,
113581,1990,4040,16,0, 11367189,1,1407,4027,16,
11359184,1,236,4041,16, 113680,181,1,1659,4028,
113600,192,1,2507,4042, 1136916,0,181,1,2413,
1136116,0,471,1,1756, 113704029,16,0,181,1,
113624043,16,0,184,1, 11371406,4030,16,0,189,
1136393,4044,19,731,1, 113721,2512,4031,16,0,
1136493,4045,5,95,1, 11373490,1,2105,939,1,
11365256,4046,16,0,729, 11374166,4032,16,0,189,
113661,1261,4047,16,0, 113751,1622,4033,16,0,
11367729,1,509,4048,16, 11376189,1,2841,3538,1,
113680,729,1,1515,4049, 113771931,986,1,1873,961,
1136916,0,729,1,2021, 113781,431,4034,16,0,
11370840,1,1775,4050,16, 11379189,1,1585,4035,16,
113710,729,1,2029,847, 113800,189,1,182,4036,
113721,2030,853,1,2031, 1138116,0,189,1,1189,
11373858,1,2032,863,1, 113824037,16,0,181,1,
113742033,868,1,277,4051, 113831443,4038,16,0,181,
1137516,0,729,1,2035, 113841,1695,4039,16,0,
11376874,1,2037,879,1, 11385181,1,2198,4040,16,
113772039,884,1,32,4052, 113860,181,1,2542,4041,
1137816,0,729,1,2041, 1138716,0,644,1,447,
11379890,1,2293,4053,16, 113884042,16,0,189,1,
113800,729,1,2043,896, 113892458,1001,1,2459,1007,
113811,2045,901,1,41, 113901,1958,4043,16,0,
113824054,16,0,729,1, 11391181,1,2462,1014,1,
113831297,4055,16,0,729, 113921657,1019,1,2464,1024,
113841,43,4056,16,0, 113931,2466,3532,1,459,
11385729,1,1803,909,1, 113944044,16,0,189,1,
113861804,4057,16,0,729, 113952468,4045,16,0,386,
113871,299,4058,16,0, 113961,462,4046,16,0,
11388729,1,52,4059,16, 11397189,1,199,4047,16,
113890,729,1,2318,4060, 113980,189,1,217,4048,
1139016,0,729,1,62, 1139916,0,189,1,2227,
113914061,16,0,729,1, 114001033,1,1225,4049,16,
113922075,4062,16,0,729, 114010,181,1,1479,4050,
113931,1574,921,1,71, 1140216,0,181,1,1731,
113944063,16,0,729,1, 114034051,16,0,189,1,
1139576,4064,16,0,729, 114041989,1041,1,1990,4052,
113961,1834,4065,16,0, 1140516,0,181,1,236,
11397729,1,2337,4066,16, 114064053,16,0,189,1,
113980,729,1,79,4067, 114071933,4054,16,0,181,
1139916,0,729,1,1335, 114081,2823,4055,16,0,
114004068,16,0,729,1, 11409789,1,2508,4056,16,
11401322,4069,16,0,729, 114100,484,1,1756,4057,
114021,85,4070,16,0, 1141116,0,181,1,94,
11403729,1,89,4071,16, 114124058,19,746,1,94,
114040,729,1,346,4072, 114134059,5,95,1,256,
1140516,0,729,1,2105, 114144060,16,0,744,1,
11406936,1,2106,4073,16, 114151261,4061,16,0,744,
114070,729,1,97,4074, 114161,509,4062,16,0,
1140816,0,729,1,1860, 11417744,1,1515,4063,16,
11409943,1,2364,949,1, 114180,744,1,2021,843,
11410102,4075,16,0,729, 114191,1775,4064,16,0,
114111,2782,4076,16,0, 11420744,1,2029,850,1,
11412729,1,112,4077,16, 114212030,856,1,2031,861,
114130,729,1,1117,4078, 114221,2032,866,1,2033,
1141416,0,729,1,1873, 11423871,1,277,4065,16,
11415958,1,1876,4079,16, 114240,744,1,2035,877,
114160,729,1,124,4080, 114251,2037,882,1,2039,
1141716,0,729,1,2136, 11426887,1,32,4066,16,
11418965,1,381,4081,16, 114270,744,1,2041,893,
114190,729,1,525,4082, 114281,2293,4067,16,0,
1142016,0,729,1,137, 11429744,1,2043,899,1,
114214083,16,0,729,1, 114302045,904,1,41,4068,
114221901,4084,16,0,729, 1143116,0,744,1,1297,
114231,1153,4085,16,0, 114324069,16,0,744,1,
11424729,1,151,4086,16, 1143343,4070,16,0,744,
114250,729,1,1407,4087, 114341,1803,912,1,1804,
1142616,0,729,1,1659, 114354071,16,0,744,1,
114274088,16,0,729,1, 11436299,4072,16,0,744,
114282413,4089,16,0,729, 114371,52,4073,16,0,
114291,406,4090,16,0, 11438744,1,2318,4074,16,
11430729,1,1371,4091,16, 114390,744,1,62,4075,
114310,729,1,166,4092, 1144016,0,744,1,2075,
1143216,0,729,1,1622, 114414076,16,0,744,1,
114334093,16,0,729,1, 114421574,924,1,71,4077,
114341931,983,1,1933,4094, 1144316,0,744,1,76,
1143516,0,729,1,431, 114444078,16,0,744,1,
114364095,16,0,729,1, 114451834,4079,16,0,744,
114371585,4096,16,0,729, 114461,2337,4080,16,0,
114381,182,4097,16,0, 11447744,1,79,4081,16,
11439729,1,1189,4098,16, 114480,744,1,1335,4082,
114400,729,1,1443,4099, 1144916,0,744,1,322,
1144116,0,729,1,1695, 114504083,16,0,744,1,
114424100,16,0,729,1, 1145185,4084,16,0,744,
114432198,4101,16,0,729, 114521,89,4085,16,0,
114441,447,4102,16,0, 11453744,1,346,4086,16,
11445729,1,2458,998,1, 114540,744,1,2105,939,
114462459,1004,1,1958,4103, 114551,2106,4087,16,0,
1144716,0,729,1,2462, 11456744,1,97,4088,16,
114481011,1,1657,1016,1, 114570,744,1,1860,946,
114492464,1021,1,199,4104, 114581,2364,952,1,102,
1145016,0,729,1,459, 114594089,16,0,744,1,
114514105,16,0,729,1, 11460112,4090,16,0,744,
11452462,4106,16,0,729, 114611,1117,4091,16,0,
114531,217,4107,16,0, 11462744,1,2786,4092,16,
11454729,1,2227,1030,1, 114630,744,1,1873,961,
114551225,4108,16,0,729, 114641,1876,4093,16,0,
114561,1479,4109,16,0, 11465744,1,124,4094,16,
11457729,1,1731,4110,16, 114660,744,1,2136,968,
114580,729,1,1989,1038, 114671,381,4095,16,0,
114591,1990,4111,16,0, 11468744,1,525,4096,16,
11460729,1,236,4112,16, 114690,744,1,137,4097,
114610,729,1,1756,4113, 1147016,0,744,1,1901,
1146216,0,729,1,94, 114714098,16,0,744,1,
114634114,19,728,1,94, 114721153,4099,16,0,744,
114644115,5,95,1,256, 114731,151,4100,16,0,
114654116,16,0,726,1, 11474744,1,1407,4101,16,
114661261,4117,16,0,726, 114750,744,1,1659,4102,
114671,509,4118,16,0, 1147616,0,744,1,2413,
11468726,1,1515,4119,16, 114774103,16,0,744,1,
114690,726,1,2021,840, 11478406,4104,16,0,744,
114701,1775,4120,16,0, 114791,1371,4105,16,0,
11471726,1,2029,847,1, 11480744,1,166,4106,16,
114722030,853,1,2031,858, 114810,744,1,1622,4107,
114731,2032,863,1,2033, 1148216,0,744,1,1931,
11474868,1,277,4121,16, 11483986,1,1933,4108,16,
114750,726,1,2035,874, 114840,744,1,431,4109,
114761,2037,879,1,2039, 1148516,0,744,1,1585,
11477884,1,32,4122,16, 114864110,16,0,744,1,
114780,726,1,2041,890, 11487182,4111,16,0,744,
114791,2293,4123,16,0, 114881,1189,4112,16,0,
11480726,1,2043,896,1, 11489744,1,1443,4113,16,
114812045,901,1,41,4124, 114900,744,1,1695,4114,
1148216,0,726,1,1297, 1149116,0,744,1,2198,
114834125,16,0,726,1, 114924115,16,0,744,1,
1148443,4126,16,0,726, 11493447,4116,16,0,744,
114851,1803,909,1,1804, 114941,2458,1001,1,2459,
114864127,16,0,726,1, 114951007,1,1958,4117,16,
11487299,4128,16,0,726, 114960,744,1,2462,1014,
114881,52,4129,16,0, 114971,1657,1019,1,2464,
11489726,1,2318,4130,16, 114981024,1,199,4118,16,
114900,726,1,62,4131, 114990,744,1,459,4119,
1149116,0,726,1,2075, 1150016,0,744,1,462,
114924132,16,0,726,1, 115014120,16,0,744,1,
114931574,921,1,71,4133, 11502217,4121,16,0,744,
1149416,0,726,1,76, 115031,2227,1033,1,1225,
114954134,16,0,726,1, 115044122,16,0,744,1,
114961834,4135,16,0,726, 115051479,4123,16,0,744,
114971,2337,4136,16,0, 115061,1731,4124,16,0,
11498726,1,79,4137,16, 11507744,1,1989,1041,1,
114990,726,1,1335,4138, 115081990,4125,16,0,744,
1150016,0,726,1,322, 115091,236,4126,16,0,
115014139,16,0,726,1, 11510744,1,1756,4127,16,
1150285,4140,16,0,726, 115110,744,1,95,4128,
115031,89,4141,16,0, 1151219,743,1,95,4129,
11504726,1,346,4142,16, 115135,95,1,256,4130,
115050,726,1,2105,936, 1151416,0,741,1,1261,
115061,2106,4143,16,0, 115154131,16,0,741,1,
11507726,1,97,4144,16, 11516509,4132,16,0,741,
115080,726,1,1860,943, 115171,1515,4133,16,0,
115091,2364,949,1,102, 11518741,1,2021,843,1,
115104145,16,0,726,1, 115191775,4134,16,0,741,
115112782,4146,16,0,726, 115201,2029,850,1,2030,
115121,112,4147,16,0, 11521856,1,2031,861,1,
11513726,1,1117,4148,16, 115222032,866,1,2033,871,
115140,726,1,1873,958, 115231,277,4135,16,0,
115151,1876,4149,16,0, 11524741,1,2035,877,1,
11516726,1,124,4150,16, 115252037,882,1,2039,887,
115170,726,1,2136,965, 115261,32,4136,16,0,
115181,381,4151,16,0, 11527741,1,2041,893,1,
11519726,1,525,4152,16, 115282293,4137,16,0,741,
115200,726,1,137,4153, 115291,2043,899,1,2045,
1152116,0,726,1,1901, 11530904,1,41,4138,16,
115224154,16,0,726,1, 115310,741,1,1297,4139,
115231153,4155,16,0,726, 1153216,0,741,1,43,
115241,151,4156,16,0, 115334140,16,0,741,1,
11525726,1,1407,4157,16, 115341803,912,1,1804,4141,
115260,726,1,1659,4158, 1153516,0,741,1,299,
1152716,0,726,1,2413, 115364142,16,0,741,1,
115284159,16,0,726,1, 1153752,4143,16,0,741,
11529406,4160,16,0,726, 115381,2318,4144,16,0,
115301,1371,4161,16,0, 11539741,1,62,4145,16,
11531726,1,166,4162,16, 115400,741,1,2075,4146,
115320,726,1,1622,4163, 1154116,0,741,1,1574,
1153316,0,726,1,1931, 11542924,1,71,4147,16,
11534983,1,1933,4164,16, 115430,741,1,76,4148,
115350,726,1,431,4165, 1154416,0,741,1,1834,
1153616,0,726,1,1585, 115454149,16,0,741,1,
115374166,16,0,726,1, 115462337,4150,16,0,741,
11538182,4167,16,0,726, 115471,79,4151,16,0,
115391,1189,4168,16,0, 11548741,1,1335,4152,16,
11540726,1,1443,4169,16, 115490,741,1,322,4153,
115410,726,1,1695,4170, 1155016,0,741,1,85,
1154216,0,726,1,2198, 115514154,16,0,741,1,
115434171,16,0,726,1, 1155289,4155,16,0,741,
11544447,4172,16,0,726, 115531,346,4156,16,0,
115451,2458,998,1,2459, 11554741,1,2105,939,1,
115461004,1,1958,4173,16, 115552106,4157,16,0,741,
115470,726,1,2462,1011, 115561,97,4158,16,0,
115481,1657,1016,1,2464, 11557741,1,1860,946,1,
115491021,1,199,4174,16, 115582364,952,1,102,4159,
115500,726,1,459,4175, 1155916,0,741,1,112,
1155116,0,726,1,462, 115604160,16,0,741,1,
115524176,16,0,726,1, 115611117,4161,16,0,741,
11553217,4177,16,0,726, 115621,2786,4162,16,0,
115541,2227,1030,1,1225, 11563741,1,1873,961,1,
115554178,16,0,726,1, 115641876,4163,16,0,741,
115561479,4179,16,0,726, 115651,124,4164,16,0,
115571,1731,4180,16,0, 11566741,1,2136,968,1,
11558726,1,1989,1038,1, 11567381,4165,16,0,741,
115591990,4181,16,0,726, 115681,525,4166,16,0,
115601,236,4182,16,0, 11569741,1,137,4167,16,
11561726,1,1756,4183,16, 115700,741,1,1901,4168,
115620,726,1,95,4184, 1157116,0,741,1,1153,
1156319,725,1,95,4185, 115724169,16,0,741,1,
115645,95,1,256,4186, 11573151,4170,16,0,741,
1156516,0,723,1,1261, 115741,1407,4171,16,0,
115664187,16,0,723,1, 11575741,1,1659,4172,16,
11567509,4188,16,0,723, 115760,741,1,2413,4173,
115681,1515,4189,16,0, 1157716,0,741,1,406,
11569723,1,2021,840,1, 115784174,16,0,741,1,
115701775,4190,16,0,723, 115791371,4175,16,0,741,
115711,2029,847,1,2030, 115801,166,4176,16,0,
11572853,1,2031,858,1, 11581741,1,1622,4177,16,
115732032,863,1,2033,868, 115820,741,1,1931,986,
115741,277,4191,16,0, 115831,1933,4178,16,0,
11575723,1,2035,874,1, 11584741,1,431,4179,16,
115762037,879,1,2039,884, 115850,741,1,1585,4180,
115771,32,4192,16,0, 1158616,0,741,1,182,
11578723,1,2041,890,1, 115874181,16,0,741,1,
115792293,4193,16,0,723, 115881189,4182,16,0,741,
115801,2043,896,1,2045, 115891,1443,4183,16,0,
11581901,1,41,4194,16, 11590741,1,1695,4184,16,
115820,723,1,1297,4195, 115910,741,1,2198,4185,
1158316,0,723,1,43, 1159216,0,741,1,447,
115844196,16,0,723,1, 115934186,16,0,741,1,
115851803,909,1,1804,4197, 115942458,1001,1,2459,1007,
1158616,0,723,1,299, 115951,1958,4187,16,0,
115874198,16,0,723,1, 11596741,1,2462,1014,1,
1158852,4199,16,0,723, 115971657,1019,1,2464,1024,
115891,2318,4200,16,0, 115981,199,4188,16,0,
11590723,1,62,4201,16, 11599741,1,459,4189,16,
115910,723,1,2075,4202, 116000,741,1,462,4190,
1159216,0,723,1,1574, 1160116,0,741,1,217,
11593921,1,71,4203,16, 116024191,16,0,741,1,
115940,723,1,76,4204, 116032227,1033,1,1225,4192,
1159516,0,723,1,1834, 1160416,0,741,1,1479,
115964205,16,0,723,1, 116054193,16,0,741,1,
115972337,4206,16,0,723, 116061731,4194,16,0,741,
115981,79,4207,16,0, 116071,1989,1041,1,1990,
11599723,1,1335,4208,16, 116084195,16,0,741,1,
116000,723,1,322,4209, 11609236,4196,16,0,741,
1160116,0,723,1,85, 116101,1756,4197,16,0,
116024210,16,0,723,1, 11611741,1,96,4198,19,
1160389,4211,16,0,723, 11612740,1,96,4199,5,
116041,346,4212,16,0, 1161395,1,256,4200,16,
11605723,1,2105,936,1, 116140,738,1,1261,4201,
116062106,4213,16,0,723, 1161516,0,738,1,509,
116071,97,4214,16,0, 116164202,16,0,738,1,
11608723,1,1860,943,1, 116171515,4203,16,0,738,
116092364,949,1,102,4215, 116181,2021,843,1,1775,
1161016,0,723,1,2782, 116194204,16,0,738,1,
116114216,16,0,723,1, 116202029,850,1,2030,856,
11612112,4217,16,0,723, 116211,2031,861,1,2032,
116131,1117,4218,16,0, 11622866,1,2033,871,1,
11614723,1,1873,958,1, 11623277,4205,16,0,738,
116151876,4219,16,0,723, 116241,2035,877,1,2037,
116161,124,4220,16,0, 11625882,1,2039,887,1,
11617723,1,2136,965,1, 1162632,4206,16,0,738,
11618381,4221,16,0,723, 116271,2041,893,1,2293,
116191,525,4222,16,0, 116284207,16,0,738,1,
11620723,1,137,4223,16, 116292043,899,1,2045,904,
116210,723,1,1901,4224, 116301,41,4208,16,0,
1162216,0,723,1,1153, 11631738,1,1297,4209,16,
116234225,16,0,723,1, 116320,738,1,43,4210,
11624151,4226,16,0,723, 1163316,0,738,1,1803,
116251,1407,4227,16,0, 11634912,1,1804,4211,16,
11626723,1,1659,4228,16, 116350,738,1,299,4212,
116270,723,1,2413,4229, 1163616,0,738,1,52,
1162816,0,723,1,406, 116374213,16,0,738,1,
116294230,16,0,723,1, 116382318,4214,16,0,738,
116301371,4231,16,0,723, 116391,62,4215,16,0,
116311,166,4232,16,0, 11640738,1,2075,4216,16,
11632723,1,1622,4233,16, 116410,738,1,1574,924,
116330,723,1,1931,983, 116421,71,4217,16,0,
116341,1933,4234,16,0, 11643738,1,76,4218,16,
11635723,1,431,4235,16, 116440,738,1,1834,4219,
116360,723,1,1585,4236, 1164516,0,738,1,2337,
1163716,0,723,1,182, 116464220,16,0,738,1,
116384237,16,0,723,1, 1164779,4221,16,0,738,
116391189,4238,16,0,723, 116481,1335,4222,16,0,
116401,1443,4239,16,0, 11649738,1,322,4223,16,
11641723,1,1695,4240,16, 116500,738,1,85,4224,
116420,723,1,2198,4241, 1165116,0,738,1,89,
1164316,0,723,1,447, 116524225,16,0,738,1,
116444242,16,0,723,1, 11653346,4226,16,0,738,
116452458,998,1,2459,1004, 116541,2105,939,1,2106,
116461,1958,4243,16,0, 116554227,16,0,738,1,
11647723,1,2462,1011,1, 1165697,4228,16,0,738,
116481657,1016,1,2464,1021, 116571,1860,946,1,2364,
116491,199,4244,16,0, 11658952,1,102,4229,16,
11650723,1,459,4245,16, 116590,738,1,112,4230,
116510,723,1,462,4246, 1166016,0,738,1,1117,
1165216,0,723,1,217, 116614231,16,0,738,1,
116534247,16,0,723,1, 116622786,4232,16,0,738,
116542227,1030,1,1225,4248, 116631,1873,961,1,1876,
1165516,0,723,1,1479, 116644233,16,0,738,1,
116564249,16,0,723,1, 11665124,4234,16,0,738,
116571731,4250,16,0,723, 116661,2136,968,1,381,
116581,1989,1038,1,1990, 116674235,16,0,738,1,
116594251,16,0,723,1, 11668525,4236,16,0,738,
11660236,4252,16,0,723, 116691,137,4237,16,0,
116611,1756,4253,16,0, 11670738,1,1901,4238,16,
11662723,1,96,4254,19, 116710,738,1,1153,4239,
11663103,1,96,4255,5, 1167216,0,738,1,151,
116641,1,0,4256,16, 116734240,16,0,738,1,
116650,104,1,97,4257, 116741407,4241,16,0,738,
1166619,172,1,97,4258, 116751,1659,4242,16,0,
116675,1,1,0,4259, 11676738,1,2413,4243,16,
1166816,0,170,1,98, 116770,738,1,406,4244,
116694260,19,213,1,98, 1167816,0,738,1,1371,
116704261,5,2,1,0, 116794245,16,0,738,1,
116714262,16,0,211,1, 11680166,4246,16,0,738,
116722819,4263,16,0,366, 116811,1622,4247,16,0,
116731,99,4264,19,210, 11682738,1,1931,986,1,
116741,99,4265,5,2, 116831933,4248,16,0,738,
116751,0,4266,16,0, 116841,431,4249,16,0,
11676208,1,2819,4267,16, 11685738,1,1585,4250,16,
116770,365,1,100,4268, 116860,738,1,182,4251,
1167819,292,1,100,4269, 1168716,0,738,1,1189,
116795,2,1,0,4270, 116884252,16,0,738,1,
1168016,0,775,1,2819, 116891443,4253,16,0,738,
116814271,16,0,290,1, 116901,1695,4254,16,0,
11682101,4272,19,781,1, 11691738,1,2198,4255,16,
11683101,4273,5,4,1, 116920,738,1,447,4256,
116840,4274,16,0,782, 1169316,0,738,1,2458,
116851,2830,4275,16,0, 116941001,1,2459,1007,1,
11686779,1,2819,4276,16, 116951958,4257,16,0,738,
116870,782,1,2760,4277, 116961,2462,1014,1,1657,
1168816,0,779,1,102, 116971019,1,2464,1024,1,
116894278,19,698,1,102, 11698199,4258,16,0,738,
116904279,5,2,1,2470, 116991,459,4259,16,0,
116914280,16,0,696,1, 11700738,1,462,4260,16,
116922657,4281,16,0,719, 117010,738,1,217,4261,
116931,103,4282,19,157, 1170216,0,738,1,2227,
116941,103,4283,5,4, 117031033,1,1225,4262,16,
116951,2596,4284,16,0, 117040,738,1,1479,4263,
11696155,1,2470,4285,16, 1170516,0,738,1,1731,
116970,674,1,2700,4286, 117064264,16,0,738,1,
1169816,0,155,1,2657, 117071989,1041,1,1990,4265,
116994287,16,0,674,1, 1170816,0,738,1,236,
11700104,4288,19,154,1, 117094266,16,0,738,1,
11701104,4289,5,4,1, 117101756,4267,16,0,738,
117022596,4290,16,0,152, 117111,97,4268,19,103,
117031,2470,4291,16,0, 117121,97,4269,5,1,
11704177,1,2700,4292,16, 117131,0,4270,16,0,
117050,152,1,2657,4293, 11714104,1,98,4271,19,
1170616,0,177,1,105, 11715647,1,98,4272,5,
117074294,19,657,1,105, 117161,1,0,4273,16,
117084295,5,4,1,2596, 117170,645,1,99,4274,
117094296,16,0,655,1, 1171819,210,1,99,4275,
117102470,4297,16,0,672, 117195,2,1,0,4276,
117111,2700,4298,16,0, 1172016,0,312,1,2823,
11712655,1,2657,4299,16, 117214277,16,0,208,1,
117130,672,1,106,4300, 11722100,4278,19,207,1,
1171419,175,1,106,4301, 11723100,4279,5,2,1,
117155,4,1,2596,4302, 117240,4280,16,0,286,
1171616,0,654,1,2470, 117251,2823,4281,16,0,
117174303,16,0,173,1, 11726205,1,101,4282,19,
117182700,4304,16,0,654, 11727301,1,101,4283,5,
117191,2657,4305,16,0, 117282,1,0,4284,16,
11720173,1,107,4306,19, 117290,785,1,2823,4285,
11721670,1,107,4307,5, 1173016,0,299,1,102,
117224,1,2596,4308,16, 117314286,19,320,1,102,
117230,742,1,2470,4309, 117324287,5,4,1,0,
1172416,0,668,1,2700, 117334288,16,0,788,1,
117254310,16,0,742,1, 117342764,4289,16,0,318,
117262657,4311,16,0,668, 117351,2823,4290,16,0,
117271,108,4312,19,169, 11736788,1,2834,4291,16,
117281,108,4313,5,4, 117370,318,1,103,4292,
117291,2596,4314,16,0, 1173819,714,1,103,4293,
11730650,1,2470,4315,16, 117395,2,1,2470,4294,
117310,167,1,2700,4316, 1174016,0,712,1,2659,
1173216,0,650,1,2657, 117414295,16,0,734,1,
117334317,16,0,167,1, 11742104,4296,19,280,1,
11734109,4318,19,741,1, 11743104,4297,5,4,1,
11735109,4319,5,4,1, 117442597,4298,16,0,680,
117362596,4320,16,0,739, 117451,2703,4299,16,0,
117371,2470,4321,16,0, 11746680,1,2470,4300,16,
11738751,1,2700,4322,16, 117470,278,1,2659,4301,
117390,739,1,2657,4323, 1174816,0,278,1,105,
1174016,0,751,1,110, 117494302,19,679,1,105,
117414324,19,648,1,110, 117504303,5,4,1,2597,
117424325,5,4,1,2596, 117514304,16,0,677,1,
117434326,16,0,646,1, 117522703,4305,16,0,677,
117442470,4327,16,0,663, 117531,2470,4306,16,0,
117451,2700,4328,16,0, 11754690,1,2659,4307,16,
11746646,1,2657,4329,16, 117550,690,1,106,4308,
117470,663,1,111,4330, 1175619,157,1,106,4309,
1174819,141,1,111,4331, 117575,4,1,2597,4310,
117495,3,1,2766,4332, 1175816,0,155,1,2703,
1175016,0,791,1,2581, 117594311,16,0,155,1,
117514333,16,0,355,1, 117602470,4312,16,0,769,
1175210,4334,16,0,139, 117611,2659,4313,16,0,
117531,112,4335,19,557, 11762769,1,107,4314,19,
117541,112,4336,5,1, 11763154,1,107,4315,5,
117551,2568,4337,16,0, 117644,1,2597,4316,16,
11756555,1,113,4338,19, 117650,152,1,2703,4317,
11757745,1,113,4339,5, 1176616,0,152,1,2470,
117581,1,2560,4340,16, 117674318,16,0,174,1,
117590,743,1,114,4341, 117682659,4319,16,0,174,
1176019,529,1,114,4342, 117691,108,4320,19,672,
117615,1,1,2552,4343, 117701,108,4321,5,4,
1176216,0,527,1,115, 117711,2597,4322,16,0,
117634344,19,251,1,115, 11772670,1,2703,4323,16,
117644345,5,1,1,2537, 117730,670,1,2470,4324,
117654346,16,0,249,1, 1177416,0,685,1,2659,
11766116,4347,19,502,1, 117754325,16,0,685,1,
11767116,4348,5,1,1, 11776109,4326,19,669,1,
117682522,4349,16,0,500, 11777109,4327,5,4,1,
117691,117,4350,19,486, 117782597,4328,16,0,667,
117701,117,4351,5,1, 117791,2703,4329,16,0,
117711,2506,4352,16,0, 11780667,1,2470,4330,16,
11772484,1,118,4353,19, 117810,684,1,2659,4331,
11773160,1,118,4354,5, 1178216,0,684,1,110,
1177417,1,0,4355,16, 117834332,19,172,1,110,
117750,794,1,2581,4356, 117844333,5,4,1,2597,
1177616,0,372,1,2075, 117854334,16,0,752,1,
117774357,16,0,753,1, 117862703,4335,16,0,752,
117782337,4358,16,0,753, 117871,2470,4336,16,0,
117791,2819,4359,16,0, 11788170,1,2659,4337,16,
11780794,1,2413,4360,16, 117890,170,1,111,4338,
117810,753,1,10,4361, 1179019,169,1,111,4339,
1178216,0,372,1,1901, 117915,4,1,2597,4340,
117834362,16,0,753,1, 1179216,0,663,1,2703,
117842198,4363,16,0,753, 117934341,16,0,663,1,
117851,21,4364,16,0, 117942470,4342,16,0,167,
11786158,1,2106,4365,16, 117951,2659,4343,16,0,
117870,753,1,2766,4366, 11796167,1,112,4344,19,
1178816,0,372,1,1804, 11797141,1,112,4345,5,
117894367,16,0,753,1, 117983,1,2582,4346,16,
117901990,4368,16,0,753, 117990,293,1,2770,4347,
117911,32,4369,16,0, 1180016,0,331,1,10,
11792753,1,1958,4370,16, 118014348,16,0,139,1,
117930,753,1,1775,4371, 11802113,4349,19,688,1,
1179416,0,753,1,119, 11803113,4350,5,1,1,
117954372,19,474,1,119, 118042569,4351,16,0,686,
117964373,5,2,1,2568, 118051,114,4352,19,676,
117974374,16,0,671,1, 118061,114,4353,5,1,
117982506,4375,16,0,472, 118071,2561,4354,16,0,
117991,120,4376,19,480, 11808674,1,115,4355,19,
118001,120,4377,5,5, 11809660,1,115,4356,5,
118011,2510,4378,16,0, 118101,1,2553,4357,16,
11802478,1,2522,4379,16, 118110,658,1,116,4358,
118030,491,1,2514,4380, 1181219,535,1,116,4359,
1180416,0,483,1,2537, 118135,1,1,2538,4360,
118054381,16,0,509,1, 1181416,0,533,1,117,
118062560,4382,16,0,537, 118154361,19,638,1,117,
118071,121,4383,19,309, 118164362,5,1,1,2523,
118081,121,4384,5,3, 118174363,16,0,636,1,
118091,2552,4385,16,0, 11818118,4364,19,498,1,
11810737,1,2525,4386,16, 11819118,4365,5,1,1,
118110,307,1,2529,4387, 118202507,4366,16,0,496,
1181216,0,499,1,122, 118211,119,4367,19,160,
118134388,19,636,1,122, 118221,119,4368,5,17,
118144389,5,2,1,2544, 118231,0,4369,16,0,
118154390,16,0,637,1, 11824333,1,2582,4370,16,
118162540,4391,16,0,634, 118250,382,1,2075,4371,
118171,123,4392,19,130, 1182616,0,763,1,2337,
118181,123,4393,5,18, 118274372,16,0,763,1,
118191,0,4394,16,0, 118282413,4373,16,0,763,
11820128,1,2581,4395,16, 118291,10,4374,16,0,
118210,137,1,2075,4396, 11830382,1,2823,4375,16,
1182216,0,137,1,2337, 118310,333,1,1901,4376,
118234397,16,0,137,1, 1183216,0,763,1,2198,
118242819,4398,16,0,128, 118334377,16,0,763,1,
118251,2413,4399,16,0, 1183421,4378,16,0,158,
11826137,1,10,4400,16, 118351,2106,4379,16,0,
118270,137,1,2198,4401, 11836763,1,2770,4380,16,
1182816,0,137,1,1901, 118370,382,1,1804,4381,
118294402,16,0,137,1, 1183816,0,763,1,1990,
1183052,4403,16,0,219, 118394382,16,0,763,1,
118311,21,4404,16,0, 1184032,4383,16,0,763,
11832137,1,2106,4405,16, 118411,1958,4384,16,0,
118330,137,1,2766,4406, 11842763,1,1775,4385,16,
1183416,0,137,1,1804, 118430,763,1,120,4386,
118354407,16,0,137,1, 1184419,487,1,120,4387,
118361990,4408,16,0,137, 118455,2,1,2569,4388,
118371,32,4409,16,0, 1184616,0,567,1,2507,
11838137,1,1958,4410,16, 118474389,16,0,485,1,
118390,137,1,1775,4411, 11848121,4390,19,493,1,
1184016,0,137,1,124, 11849121,4391,5,5,1,
118414412,19,765,1,124, 118502511,4392,16,0,491,
118424413,5,4,1,2596, 118511,2523,4393,16,0,
118434414,16,0,763,1, 11852506,1,2515,4394,16,
118442470,4415,16,0,763, 118530,495,1,2538,4395,
118451,2700,4416,16,0, 1185416,0,523,1,2561,
11846763,1,2657,4417,16, 118554396,16,0,753,1,
118470,763,1,125,4418, 11856122,4397,19,514,1,
1184819,567,1,125,4419, 11857122,4398,5,3,1,
118495,4,1,2596,4420, 118582530,4399,16,0,516,
1185016,0,565,1,2470, 118591,2553,4400,16,0,
118514421,16,0,565,1, 11860542,1,2526,4401,16,
118522700,4422,16,0,565, 118610,512,1,123,4402,
118531,2657,4423,16,0, 1186219,248,1,123,4403,
11854565,1,126,4424,19, 118635,2,1,2541,4404,
11855666,1,126,4425,5, 1186416,0,527,1,2545,
118564,1,2596,4426,16, 118654405,16,0,246,1,
118570,664,1,2470,4427, 11866124,4406,19,130,1,
1185816,0,664,1,2700, 11867124,4407,5,18,1,
118594428,16,0,664,1, 118680,4408,16,0,128,
118602657,4429,16,0,664, 118691,2582,4409,16,0,
118611,127,4430,19,535, 11870137,1,2075,4410,16,
118621,127,4431,5,4, 118710,137,1,2337,4411,
118631,2596,4432,16,0, 1187216,0,137,1,2413,
11864533,1,2470,4433,16, 118734412,16,0,137,1,
118650,533,1,2700,4434, 1187410,4413,16,0,137,
1186616,0,533,1,2657, 118751,2823,4414,16,0,
118674435,16,0,533,1, 11876128,1,2198,4415,16,
11868128,4436,19,524,1, 118770,137,1,1901,4416,
11869128,4437,5,4,1, 1187816,0,137,1,52,
118702596,4438,16,0,522, 118794417,16,0,216,1,
118711,2470,4439,16,0, 1188021,4418,16,0,137,
11872522,1,2700,4440,16, 118811,2106,4419,16,0,
118730,522,1,2657,4441, 11882137,1,2770,4420,16,
1187416,0,522,1,129, 118830,137,1,1804,4421,
118754442,19,632,1,129, 1188416,0,137,1,1990,
118764443,5,4,1,2596, 118854422,16,0,137,1,
118774444,16,0,630,1, 1188632,4423,16,0,137,
118782470,4445,16,0,630, 118871,1958,4424,16,0,
118791,2700,4446,16,0, 11888137,1,1775,4425,16,
11880630,1,2657,4447,16, 118890,137,1,125,4426,
118810,630,1,130,4448, 1189019,359,1,125,4427,
1188219,778,1,130,4449, 118915,4,1,2597,4428,
118835,4,1,2596,4450, 1189216,0,357,1,2703,
1188416,0,776,1,2470, 118934429,16,0,357,1,
118854451,16,0,776,1, 118942470,4430,16,0,357,
118862700,4452,16,0,776, 118951,2659,4431,16,0,
118871,2657,4453,16,0, 11896357,1,126,4432,19,
11888776,1,131,4454,19, 11897772,1,126,4433,5,
11889768,1,131,4455,5, 118984,1,2597,4434,16,
118904,1,2596,4456,16, 118990,770,1,2703,4435,
118910,766,1,2470,4457, 1190016,0,770,1,2470,
1189216,0,766,1,2700, 119014436,16,0,770,1,
118934458,16,0,766,1, 119022659,4437,16,0,770,
118942657,4459,16,0,766, 119031,127,4438,19,760,
118951,132,4460,19,328, 119041,127,4439,5,4,
118961,132,4461,5,21, 119051,2597,4440,16,0,
118971,2518,4462,16,0, 11906758,1,2703,4441,16,
11898699,1,2075,4463,16, 119070,758,1,2470,4442,
118990,584,1,2548,4464, 1190816,0,758,1,2659,
1190016,0,736,1,2337, 119094443,16,0,758,1,
119014465,16,0,584,1, 11910128,4444,19,548,1,
119022413,4466,16,0,584, 11911128,4445,5,4,1,
119031,2564,4467,16,0, 119122597,4446,16,0,546,
11904542,1,2556,4468,16, 119131,2703,4447,16,0,
119050,532,1,2592,4469, 11914546,1,2470,4448,16,
1190616,0,695,1,1901, 119150,546,1,2659,4449,
119074470,16,0,584,1, 1191616,0,546,1,129,
119082198,4471,16,0,584, 119174450,19,655,1,129,
119091,2533,4472,16,0, 119184451,5,4,1,2597,
11910504,1,2777,4473,16, 119194452,16,0,653,1,
119110,326,1,2572,4474, 119202703,4453,16,0,653,
1191216,0,675,1,2106, 119211,2470,4454,16,0,
119134475,16,0,584,1, 11922653,1,2659,4455,16,
119142577,4476,16,0,681, 119230,653,1,130,4456,
119151,1804,4477,16,0, 1192419,643,1,130,4457,
11916584,1,1990,4478,16, 119255,4,1,2597,4458,
119170,584,1,31,4479, 1192616,0,641,1,2703,
1191816,0,371,1,32, 119274459,16,0,641,1,
119194480,16,0,584,1, 119282470,4460,16,0,641,
119201958,4481,16,0,584, 119291,2659,4461,16,0,
119211,1775,4482,16,0, 11930641,1,131,4462,19,
11922584,1,133,4483,19, 11931504,1,131,4463,5,
11923337,1,133,4484,5, 119324,1,2597,4464,16,
119241,1,32,4485,16, 119330,502,1,2703,4465,
119250,335,1,134,4486, 1193416,0,502,1,2470,
1192619,286,1,134,4487, 119354466,16,0,502,1,
119275,11,1,2075,4488, 119362659,4467,16,0,502,
1192816,0,682,1,2337, 119371,132,4468,19,481,
119294489,16,0,293,1, 119381,132,4469,5,4,
119302413,4490,16,0,505, 119391,2597,4470,16,0,
119311,1901,4491,16,0, 11940479,1,2703,4471,16,
11932427,1,2198,4492,16, 119410,479,1,2470,4472,
119330,354,1,2106,4493, 1194216,0,479,1,2659,
119434473,16,0,479,1,
11944133,4474,19,381,1,
11945133,4475,5,21,1,
119462781,4476,16,0,798,
119471,2519,4477,16,0,
11948784,1,2557,4478,16,
119490,545,1,2337,4479,
1195016,0,592,1,2413,
119514480,16,0,592,1,
119522593,4481,16,0,711,
119531,2565,4482,16,0,
11954681,1,1901,4483,16,
119550,592,1,2198,4484,
1195616,0,592,1,2534,
119574485,16,0,640,1,
119582573,4486,16,0,575,
119591,2106,4487,16,0,
11960592,1,2578,4488,16,
119610,775,1,2075,4489,
1196216,0,592,1,1804,
119634490,16,0,592,1,
119641990,4491,16,0,592,
119651,31,4492,16,0,
11966379,1,32,4493,16,
119670,592,1,2549,4494,
1196816,0,538,1,1958,
119694495,16,0,592,1,
119701775,4496,16,0,592,
119711,134,4497,19,342,
119721,134,4498,5,1,
119731,32,4499,16,0,
11974340,1,135,4500,19,
11975289,1,135,4501,5,
1197611,1,2075,4502,16,
119770,697,1,2337,4503,
1197816,0,294,1,2413,
119794504,16,0,520,1,
119801901,4505,16,0,437,
119811,2198,4506,16,0,
11982362,1,2106,4507,16,
119830,730,1,1804,4508,
1198416,0,322,1,1990,
119854509,16,0,580,1,
1198632,4510,16,0,375,
119871,1958,4511,16,0,
11988529,1,1775,4512,16,
119890,287,1,136,4513,
1199019,703,1,136,4514,
119915,11,1,2075,4515,
1199216,0,701,1,2337,
119934516,16,0,701,1,
119942413,4517,16,0,701,
119951,1901,4518,16,0,
11996701,1,2198,4519,16,
119970,701,1,2106,4520,
1199816,0,701,1,1804,
119994521,16,0,701,1,
120001990,4522,16,0,701,
120011,32,4523,16,0,
12002701,1,1958,4524,16,
120030,701,1,1775,4525,
1200416,0,701,1,137,
120054526,19,756,1,137,
120064527,5,11,1,2075,
120074528,16,0,754,1,
120082337,4529,16,0,754,
120091,2413,4530,16,0,
12010754,1,1901,4531,16,
120110,754,1,2198,4532,
1201216,0,754,1,2106,
120134533,16,0,754,1,
120141804,4534,16,0,754,
120151,1990,4535,16,0,
12016754,1,32,4536,16,
120170,754,1,1958,4537,
1201816,0,754,1,1775,
120194538,16,0,754,1,
12020138,4539,19,177,1,
12021138,4540,5,31,1,
120221901,4541,16,0,762,
120231,1479,4542,16,0,
12024648,1,2075,4543,16,
120250,762,1,1695,4544,
1202616,0,214,1,1756,
120274545,16,0,204,1,
120282413,4546,16,0,762,
120291,2198,4547,16,0,
12030762,1,1876,4548,16,
120310,781,1,1659,4549,
1203216,0,204,1,1443,
120334550,16,0,608,1,
120341117,4551,16,0,175,
120351,1990,4552,16,0,
12036762,1,1189,4553,16,
120370,264,1,1775,4554,
1203816,0,762,1,32,
120394555,16,0,762,1,
120402106,4556,16,0,762,
120411,1515,4557,16,0,
12042699,1,2337,4558,16,
120430,762,1,52,4559,
1193416,0,715,1,1804, 1204416,0,715,1,1804,
119354494,16,0,317,1, 120454560,16,0,762,1,
119361990,4495,16,0,572, 120461261,4561,16,0,338,
119371,32,4496,16,0, 120471,1153,4562,16,0,
11938367,1,1958,4497,16, 12048271,1,1225,4563,16,
119390,515,1,1775,4498, 120490,307,1,1335,4564,
1194016,0,284,1,135, 1205016,0,511,1,1933,
119414499,19,688,1,135, 120514565,16,0,651,1,
119424500,5,11,1,2075, 120521834,4566,16,0,352,
119434501,16,0,686,1, 120531,1297,4567,16,0,
119442337,4502,16,0,686, 12054366,1,1407,4568,16,
119451,2413,4503,16,0, 120550,682,1,2318,4569,
11946686,1,1901,4504,16, 1205616,0,204,1,1958,
119470,686,1,2198,4505, 120574570,16,0,762,1,
1194816,0,686,1,2106, 120581371,4571,16,0,500,
119494506,16,0,686,1, 120591,139,4572,19,617,
119501804,4507,16,0,686, 120601,139,4573,5,11,
119511,1990,4508,16,0, 120611,2075,4574,16,0,
11952686,1,32,4509,16, 12062615,1,2337,4575,16,
119530,686,1,1958,4510, 120630,615,1,2413,4576,
1195416,0,686,1,1775, 1206416,0,615,1,1901,
119554511,16,0,686,1, 120654577,16,0,615,1,
11956136,4512,19,748,1, 120662198,4578,16,0,615,
11957136,4513,5,11,1, 120671,2106,4579,16,0,
119582075,4514,16,0,746, 12068615,1,1804,4580,16,
119591,2337,4515,16,0, 120690,615,1,1990,4581,
11960746,1,2413,4516,16, 1207016,0,615,1,32,
119610,746,1,1901,4517, 120714582,16,0,615,1,
1196216,0,746,1,2198, 120721958,4583,16,0,615,
119634518,16,0,746,1, 120731,1775,4584,16,0,
119642106,4519,16,0,746, 12074615,1,140,4585,19,
119651,1804,4520,16,0, 12075613,1,140,4586,5,
11966746,1,1990,4521,16, 1207611,1,2075,4587,16,
119670,746,1,32,4522, 120770,611,1,2337,4588,
1196816,0,746,1,1958, 1207816,0,611,1,2413,
119694523,16,0,746,1, 120794589,16,0,611,1,
119701775,4524,16,0,746, 120801901,4590,16,0,611,
119711,137,4525,19,180, 120811,2198,4591,16,0,
119721,137,4526,5,31, 12082611,1,2106,4592,16,
119731,1901,4527,16,0, 120830,611,1,1804,4593,
11974752,1,1479,4528,16, 1208416,0,611,1,1990,
119750,638,1,2075,4529, 120854594,16,0,611,1,
1197616,0,752,1,1695, 1208632,4595,16,0,611,
119774530,16,0,217,1, 120871,1958,4596,16,0,
119781756,4531,16,0,207, 12088611,1,1775,4597,16,
119791,2413,4532,16,0, 120890,611,1,141,4598,
11980752,1,2198,4533,16, 1209019,694,1,141,4599,
119810,752,1,1876,4534, 120915,11,1,2075,4600,
1198216,0,771,1,1659, 1209216,0,692,1,2337,
119834535,16,0,207,1, 120934601,16,0,692,1,
119841443,4536,16,0,600, 120942413,4602,16,0,692,
119851,1117,4537,16,0, 120951,1901,4603,16,0,
11986178,1,1990,4538,16, 12096692,1,2198,4604,16,
119870,752,1,1189,4539, 120970,692,1,2106,4605,
1198816,0,267,1,1775, 1209816,0,692,1,1804,
119894540,16,0,752,1, 120994606,16,0,692,1,
1199032,4541,16,0,752, 121001990,4607,16,0,692,
119911,2106,4542,16,0, 121011,32,4608,16,0,
11992752,1,1515,4543,16, 12102692,1,1958,4609,16,
119930,684,1,2337,4544, 121030,692,1,1775,4610,
1199416,0,752,1,52, 1210416,0,692,1,142,
119954545,16,0,700,1, 121054611,19,607,1,142,
119961804,4546,16,0,752, 121064612,5,11,1,2075,
119971,1261,4547,16,0, 121074613,16,0,605,1,
11998331,1,1153,4548,16, 121082337,4614,16,0,605,
119990,274,1,1225,4549, 121091,2413,4615,16,0,
1200016,0,303,1,1335, 12110605,1,1901,4616,16,
120014550,16,0,497,1, 121110,605,1,2198,4617,
120021933,4551,16,0,640, 1211216,0,605,1,2106,
120031,1834,4552,16,0, 121134618,16,0,605,1,
12004347,1,1297,4553,16, 121141804,4619,16,0,605,
120050,359,1,1407,4554, 121151,1990,4620,16,0,
1200616,0,667,1,2318, 12116605,1,32,4621,16,
120074555,16,0,207,1, 121170,605,1,1958,4622,
120081958,4556,16,0,752, 1211816,0,605,1,1775,
120091,1371,4557,16,0, 121194623,16,0,605,1,
12010488,1,138,4558,19, 12120143,4624,19,604,1,
12011609,1,138,4559,5, 12121143,4625,5,11,1,
1201211,1,2075,4560,16, 121222075,4626,16,0,602,
120130,607,1,2337,4561, 121231,2337,4627,16,0,
1201416,0,607,1,2413, 12124602,1,2413,4628,16,
120154562,16,0,607,1, 121250,602,1,1901,4629,
120161901,4563,16,0,607, 1212616,0,602,1,2198,
120171,2198,4564,16,0, 121274630,16,0,602,1,
12018607,1,2106,4565,16, 121282106,4631,16,0,602,
120190,607,1,1804,4566, 121291,1804,4632,16,0,
1202016,0,607,1,1990, 12130602,1,1990,4633,16,
120214567,16,0,607,1, 121310,602,1,32,4634,
1202232,4568,16,0,607, 1213216,0,602,1,1958,
120231,1958,4569,16,0, 121334635,16,0,602,1,
12024607,1,1775,4570,16, 121341775,4636,16,0,602,
120250,607,1,139,4571, 121351,144,4637,19,601,
1202619,605,1,139,4572, 121361,144,4638,5,11,
120275,11,1,2075,4573, 121371,2075,4639,16,0,
1202816,0,603,1,2337, 12138599,1,2337,4640,16,
120294574,16,0,603,1, 121390,599,1,2413,4641,
120302413,4575,16,0,603, 1214016,0,599,1,1901,
120311,1901,4576,16,0, 121414642,16,0,599,1,
12032603,1,2198,4577,16, 121422198,4643,16,0,599,
120330,603,1,2106,4578, 121431,2106,4644,16,0,
1203416,0,603,1,1804, 12144599,1,1804,4645,16,
120354579,16,0,603,1, 121450,599,1,1990,4646,
120361990,4580,16,0,603, 1214616,0,599,1,32,
120371,32,4581,16,0, 121474647,16,0,599,1,
12038603,1,1958,4582,16, 121481958,4648,16,0,599,
120390,603,1,1775,4583, 121491,1775,4649,16,0,
1204016,0,603,1,140, 12150599,1,145,4650,19,
120414584,19,679,1,140, 12151598,1,145,4651,5,
120424585,5,11,1,2075, 1215211,1,2075,4652,16,
120434586,16,0,677,1, 121530,596,1,2337,4653,
120442337,4587,16,0,677, 1215416,0,596,1,2413,
120451,2413,4588,16,0, 121554654,16,0,596,1,
12046677,1,1901,4589,16, 121561901,4655,16,0,596,
120470,677,1,2198,4590, 121571,2198,4656,16,0,
1204816,0,677,1,2106, 12158596,1,2106,4657,16,
120494591,16,0,677,1, 121590,596,1,1804,4658,
120501804,4592,16,0,677, 1216016,0,596,1,1990,
120511,1990,4593,16,0, 121614659,16,0,596,1,
12052677,1,32,4594,16, 1216232,4660,16,0,596,
120530,677,1,1958,4595, 121631,1958,4661,16,0,
1205416,0,677,1,1775, 12164596,1,1775,4662,16,
120554596,16,0,677,1, 121650,596,1,146,4663,
12056141,4597,19,599,1, 1216619,595,1,146,4664,
12057141,4598,5,11,1, 121675,11,1,2075,4665,
120582075,4599,16,0,597, 1216816,0,593,1,2337,
120591,2337,4600,16,0, 121694666,16,0,593,1,
12060597,1,2413,4601,16, 121702413,4667,16,0,593,
120610,597,1,1901,4602, 121711,1901,4668,16,0,
1206216,0,597,1,2198, 12172593,1,2198,4669,16,
120634603,16,0,597,1, 121730,593,1,2106,4670,
120642106,4604,16,0,597, 1217416,0,593,1,1804,
120651,1804,4605,16,0, 121754671,16,0,593,1,
12066597,1,1990,4606,16, 121761990,4672,16,0,593,
120670,597,1,32,4607, 121771,32,4673,16,0,
1206816,0,597,1,1958, 12178593,1,1958,4674,16,
120694608,16,0,597,1, 121790,593,1,1775,4675,
120701775,4609,16,0,597, 1218016,0,593,1,147,
120711,142,4610,19,596, 121814676,19,147,1,147,
120721,142,4611,5,11, 121824677,5,3,1,1756,
120731,2075,4612,16,0, 121834678,16,0,321,1,
12074594,1,2337,4613,16, 121842318,4679,16,0,337,
120750,594,1,2413,4614, 121851,1659,4680,16,0,
1207616,0,594,1,1901, 12186145,1,148,4681,19,
120774615,16,0,594,1, 12187634,1,148,4682,5,
120782198,4616,16,0,594, 1218868,1,1901,4683,16,
120791,2106,4617,16,0, 121890,632,1,1479,4684,
12080594,1,1804,4618,16, 1219016,0,632,1,112,
120810,594,1,1990,4619, 121914685,16,0,632,1,
1208216,0,594,1,32, 121922293,4686,16,0,632,
120834620,16,0,594,1, 121931,1804,4687,16,0,
120841958,4621,16,0,594, 12194632,1,431,4688,16,
120851,1775,4622,16,0, 121950,632,1,1443,4689,
12086594,1,143,4623,19, 1219616,0,632,1,1756,
12087593,1,143,4624,5, 121974690,16,0,632,1,
1208811,1,2075,4625,16, 12198124,4691,16,0,632,
120890,591,1,2337,4626, 121991,525,4692,16,0,
1209016,0,591,1,2413, 12200632,1,236,4693,16,
120914627,16,0,591,1, 122010,632,1,346,4694,
120921901,4628,16,0,591, 1220216,0,632,1,1876,
120931,2198,4629,16,0, 122034695,16,0,632,1,
12094591,1,2106,4630,16, 122041659,4696,16,0,632,
120950,591,1,1804,4631, 122051,1225,4697,16,0,
1209616,0,591,1,1990, 12206632,1,1117,4698,16,
120974632,16,0,591,1, 122070,632,1,137,4699,
1209832,4633,16,0,591, 1220816,0,632,1,2318,
120991,1958,4634,16,0, 122094700,16,0,632,1,
12100591,1,1775,4635,16, 122101775,4701,16,0,632,
121010,591,1,144,4636, 122111,32,4702,16,0,
1210219,590,1,144,4637, 12212632,1,1407,4703,16,
121035,11,1,2075,4638, 122130,632,1,256,4704,
1210416,0,588,1,2337, 1221416,0,632,1,459,
121054639,16,0,588,1, 122154705,16,0,632,1,
121062413,4640,16,0,588, 12216406,4706,16,0,632,
121071,1901,4641,16,0, 122171,41,4707,16,0,
12108588,1,2198,4642,16, 12218632,1,151,4708,16,
121090,588,1,2106,4643, 122190,632,1,43,4709,
1211016,0,588,1,1804, 1222016,0,632,1,1585,
121114644,16,0,588,1, 122214710,16,0,632,1,
121121990,4645,16,0,588, 122221990,4711,16,0,632,
121131,32,4646,16,0, 122231,2337,4712,16,0,
12114588,1,1958,4647,16, 12224632,1,509,4713,16,
121150,588,1,1775,4648, 122250,632,1,52,4714,
1211616,0,588,1,145, 1222616,0,632,1,381,
121174649,19,587,1,145, 122274715,16,0,632,1,
121184650,5,11,1,2075, 12228447,4716,16,0,632,
121194651,16,0,585,1, 122291,166,4717,16,0,
121202337,4652,16,0,585, 12230632,1,462,4718,16,
121211,2413,4653,16,0, 122310,632,1,277,4719,
12122585,1,1901,4654,16, 1223216,0,632,1,1695,
121230,585,1,2198,4655, 122334720,16,0,632,1,
1212416,0,585,1,2106, 122342786,4721,16,0,632,
121254656,16,0,585,1, 122351,62,4722,16,0,
121261804,4657,16,0,585, 12236707,1,1153,4723,16,
121271,1990,4658,16,0, 122370,632,1,2106,4724,
12128585,1,32,4659,16, 1223816,0,632,1,1335,
121290,585,1,1958,4660, 122394725,16,0,632,1,
1213016,0,585,1,1775, 1224071,4726,16,0,632,
121314661,16,0,585,1, 122411,182,4727,16,0,
12132146,4662,19,150,1, 12242632,1,76,4728,16,
12133146,4663,5,3,1, 122430,632,1,79,4729,
121341756,4664,16,0,316, 1224416,0,632,1,1933,
121351,2318,4665,16,0, 122454730,16,0,632,1,
12136330,1,1659,4666,16, 12246299,4731,16,0,632,
121370,148,1,147,4667, 122471,85,4732,16,0,
1213819,626,1,147,4668, 12248632,1,1515,4733,16,
121395,68,1,1901,4669, 122490,632,1,2198,4734,
1214016,0,624,1,1479, 1225016,0,632,1,89,
121414670,16,0,624,1, 122514735,16,0,632,1,
12142112,4671,16,0,624, 122521834,4736,16,0,632,
121431,2293,4672,16,0, 122531,1622,4737,16,0,
12144624,1,1804,4673,16, 12254632,1,2413,4738,16,
121450,624,1,431,4674, 122550,632,1,2075,4739,
1214616,0,624,1,1443, 1225616,0,632,1,1731,
121474675,16,0,624,1, 122574740,16,0,632,1,
121481756,4676,16,0,624, 1225897,4741,16,0,632,
121491,124,4677,16,0, 122591,1297,4742,16,0,
12150624,1,525,4678,16, 12260632,1,1189,4743,16,
121510,624,1,236,4679, 122610,632,1,102,4744,
1215216,0,624,1,346, 1226216,0,632,1,1261,
121534680,16,0,624,1, 122634745,16,0,632,1,
121541876,4681,16,0,624, 12264322,4746,16,0,632,
121551,1659,4682,16,0, 122651,1958,4747,16,0,
12156624,1,1225,4683,16, 12266632,1,199,4748,16,
121570,624,1,1117,4684, 122670,632,1,1371,4749,
1215816,0,624,1,137, 1226816,0,632,1,217,
121594685,16,0,624,1, 122694750,16,0,632,1,
121602318,4686,16,0,624, 12270149,4751,19,725,1,
121611,1775,4687,16,0, 12271149,4752,5,2,1,
12162624,1,32,4688,16, 12272459,4753,16,0,723,
121630,624,1,1407,4689, 122731,41,4754,16,0,
1216416,0,624,1,2782, 12274786,1,150,4755,19,
121654690,16,0,624,1, 12275729,1,150,4756,5,
12166256,4691,16,0,624, 122763,1,462,4757,16,
121671,459,4692,16,0, 122770,727,1,459,4758,
12168624,1,406,4693,16, 1227816,0,750,1,41,
121690,624,1,41,4694, 122794759,16,0,750,1,
1217016,0,624,1,151, 12280151,4760,19,4761,4,
121714695,16,0,624,1, 1228136,69,0,120,0,
1217243,4696,16,0,624, 12282112,0,114,0,101,
121731,1585,4697,16,0, 122830,115,0,115,0,
12174624,1,1990,4698,16, 12284105,0,111,0,110,
121750,624,1,2337,4699, 122850,65,0,114,0,
1217616,0,624,1,509, 12286103,0,117,0,109,
121774700,16,0,624,1, 122870,101,0,110,0,
1217852,4701,16,0,624, 12288116,0,1,151,4756,
121791,381,4702,16,0, 122891,152,4762,19,630,
12180624,1,447,4703,16, 122901,152,4763,5,68,
121810,624,1,166,4704, 122911,1901,4764,16,0,
1218216,0,624,1,462, 12292628,1,1479,4765,16,
121834705,16,0,624,1, 122930,628,1,112,4766,
12184277,4706,16,0,624, 1229416,0,628,1,2293,
121851,1695,4707,16,0, 122954767,16,0,628,1,
12186624,1,62,4708,16, 122961804,4768,16,0,628,
121870,692,1,1153,4709, 122971,431,4769,16,0,
1218816,0,624,1,2106, 12298628,1,1443,4770,16,
121894710,16,0,624,1, 122990,628,1,1756,4771,
121901335,4711,16,0,624, 1230016,0,628,1,124,
121911,71,4712,16,0, 123014772,16,0,628,1,
12192624,1,182,4713,16, 12302525,4773,16,0,628,
121930,624,1,76,4714, 123031,236,4774,16,0,
1219416,0,624,1,79, 12304628,1,346,4775,16,
121954715,16,0,624,1, 123050,628,1,1876,4776,
121961933,4716,16,0,624, 1230616,0,628,1,1659,
121971,299,4717,16,0, 123074777,16,0,628,1,
12198624,1,85,4718,16, 123081225,4778,16,0,628,
121990,624,1,1515,4719, 123091,1117,4779,16,0,
1220016,0,624,1,2198, 12310628,1,137,4780,16,
122014720,16,0,624,1, 123110,628,1,2318,4781,
1220289,4721,16,0,624, 1231216,0,628,1,1775,
122031,1834,4722,16,0, 123134782,16,0,628,1,
12204624,1,1622,4723,16, 1231432,4783,16,0,628,
122050,624,1,2413,4724, 123151,1407,4784,16,0,
1220616,0,624,1,2075, 12316628,1,256,4785,16,
122074725,16,0,624,1, 123170,628,1,459,4786,
122081731,4726,16,0,624, 1231816,0,628,1,406,
122091,97,4727,16,0, 123194787,16,0,628,1,
12210624,1,1297,4728,16, 1232041,4788,16,0,628,
122110,624,1,1189,4729, 123211,151,4789,16,0,
1221216,0,624,1,102, 12322628,1,43,4790,16,
122134730,16,0,624,1, 123230,628,1,1585,4791,
122141261,4731,16,0,624, 1232416,0,628,1,1990,
122151,322,4732,16,0, 123254792,16,0,628,1,
12216624,1,1958,4733,16, 123262337,4793,16,0,628,
122170,624,1,199,4734, 123271,509,4794,16,0,
1221816,0,624,1,1371, 12328628,1,52,4795,16,
122194735,16,0,624,1, 123290,628,1,381,4796,
12220217,4736,16,0,624, 1233016,0,628,1,447,
122211,148,4737,19,710, 123314797,16,0,628,1,
122221,148,4738,5,2, 12332166,4798,16,0,628,
122231,459,4739,16,0, 123331,462,4799,16,0,
12224708,1,41,4740,16, 12334628,1,277,4800,16,
122250,783,1,149,4741, 123350,628,1,1695,4801,
1222619,714,1,149,4742, 1233616,0,628,1,2786,
122275,3,1,462,4743, 123374802,16,0,628,1,
1222816,0,712,1,459, 1233862,4803,16,0,708,
122294744,16,0,735,1, 123391,1153,4804,16,0,
1223041,4745,16,0,735, 12340628,1,2106,4805,16,
122311,150,4746,19,4747, 123410,628,1,1335,4806,
122324,36,69,0,120, 1234216,0,628,1,71,
122330,112,0,114,0, 123434807,16,0,628,1,
12234101,0,115,0,115, 12344182,4808,16,0,628,
122350,105,0,111,0, 123451,76,4809,16,0,
12236110,0,65,0,114, 12346628,1,79,4810,16,
122370,103,0,117,0, 123470,628,1,1933,4811,
12238109,0,101,0,110, 1234816,0,628,1,299,
122390,116,0,1,150, 123494812,16,0,628,1,
122404742,1,151,4748,19, 1235085,4813,16,0,628,
12241622,1,151,4749,5, 123511,1515,4814,16,0,
1224268,1,1901,4750,16, 12352628,1,2198,4815,16,
122430,620,1,1479,4751, 123530,628,1,89,4816,
1224416,0,620,1,112, 1235416,0,628,1,1834,
122454752,16,0,620,1, 123554817,16,0,628,1,
122462293,4753,16,0,620, 123561622,4818,16,0,628,
122471,1804,4754,16,0, 123571,2413,4819,16,0,
12248620,1,431,4755,16, 12358628,1,2075,4820,16,
122490,620,1,1443,4756, 123590,628,1,1731,4821,
1225016,0,620,1,1756, 1236016,0,628,1,97,
122514757,16,0,620,1, 123614822,16,0,628,1,
12252124,4758,16,0,620, 123621297,4823,16,0,628,
122531,525,4759,16,0, 123631,1189,4824,16,0,
12254620,1,236,4760,16, 12364628,1,102,4825,16,
122550,620,1,346,4761, 123650,628,1,1261,4826,
1225616,0,620,1,1876, 1236616,0,628,1,322,
122574762,16,0,620,1, 123674827,16,0,628,1,
122581659,4763,16,0,620, 123681958,4828,16,0,628,
122591,1225,4764,16,0, 123691,199,4829,16,0,
12260620,1,1117,4765,16, 12370628,1,1371,4830,16,
122610,620,1,137,4766, 123710,628,1,217,4831,
1226216,0,620,1,2318, 1237216,0,628,1,153,
122634767,16,0,620,1, 123734832,19,4833,4,28,
122641775,4768,16,0,620, 1237486,0,101,0,99,
122651,32,4769,16,0, 123750,116,0,111,0,
12266620,1,1407,4770,16, 12376114,0,67,0,111,
122670,620,1,2782,4771, 123770,110,0,115,0,
1226816,0,620,1,256, 12378116,0,97,0,110,
122694772,16,0,620,1, 123790,116,0,1,153,
12270459,4773,16,0,620, 123804763,1,154,4834,19,
122711,406,4774,16,0, 123814835,4,32,82,0,
12272620,1,41,4775,16, 12382111,0,116,0,97,
122730,620,1,151,4776, 123830,116,0,105,0,
1227416,0,620,1,43, 12384111,0,110,0,67,
122754777,16,0,620,1,
122761585,4778,16,0,620,
122771,1990,4779,16,0,
12278620,1,2337,4780,16,
122790,620,1,509,4781,
1228016,0,620,1,52,
122814782,16,0,620,1,
12282381,4783,16,0,620,
122831,447,4784,16,0,
12284620,1,166,4785,16,
122850,620,1,462,4786,
1228616,0,620,1,277,
122874787,16,0,620,1,
122881695,4788,16,0,620,
122891,62,4789,16,0,
12290693,1,1153,4790,16,
122910,620,1,2106,4791,
1229216,0,620,1,1335,
122934792,16,0,620,1,
1229471,4793,16,0,620,
122951,182,4794,16,0,
12296620,1,76,4795,16,
122970,620,1,79,4796,
1229816,0,620,1,1933,
122994797,16,0,620,1,
12300299,4798,16,0,620,
123011,85,4799,16,0,
12302620,1,1515,4800,16,
123030,620,1,2198,4801,
1230416,0,620,1,89,
123054802,16,0,620,1,
123061834,4803,16,0,620,
123071,1622,4804,16,0,
12308620,1,2413,4805,16,
123090,620,1,2075,4806,
1231016,0,620,1,1731,
123114807,16,0,620,1,
1231297,4808,16,0,620,
123131,1297,4809,16,0,
12314620,1,1189,4810,16,
123150,620,1,102,4811,
1231616,0,620,1,1261,
123174812,16,0,620,1,
12318322,4813,16,0,620,
123191,1958,4814,16,0,
12320620,1,199,4815,16,
123210,620,1,1371,4816,
1232216,0,620,1,217,
123234817,16,0,620,1,
12324152,4818,19,4819,4,
1232528,86,0,101,0,
1232699,0,116,0,111,
123270,114,0,67,0,
12328111,0,110,0,115,
123290,116,0,97,0,
12330110,0,116,0,1,
12331152,4749,1,153,4820,
1233219,4821,4,32,82,
123330,111,0,116,0,
1233497,0,116,0,105,
123350,111,0,110,0,
1233667,0,111,0,110,
123370,115,0,116,0,
1233897,0,110,0,116,
123390,1,153,4749,1,
12340154,4822,19,4823,4,
1234124,76,0,105,0,
12342115,0,116,0,67,
123430,111,0,110,0, 123850,111,0,110,0,
12344115,0,116,0,97, 12386115,0,116,0,97,
123450,110,0,116,0, 123870,110,0,116,0,
123461,154,4749,1,155, 123881,154,4763,1,155,
123474824,19,188,1,155, 123894836,19,4837,4,24,
123484825,5,67,1,1901, 1239076,0,105,0,115,
123494826,16,0,690,1, 123910,116,0,67,0,
123501479,4827,16,0,611, 12392111,0,110,0,115,
123511,112,4828,16,0, 123930,116,0,97,0,
12352276,1,2293,4829,16, 12394110,0,116,0,1,
123530,302,1,1804,4830, 12395155,4763,1,156,4838,
1235416,0,690,1,431, 1239619,185,1,156,4839,
123554831,16,0,685,1, 123975,67,1,1901,4840,
123561443,4832,16,0,538, 1239816,0,705,1,1479,
123571,1756,4833,16,0, 123994841,16,0,619,1,
12358793,1,124,4834,16, 12400112,4842,16,0,273,
123590,283,1,525,4835, 124011,2293,4843,16,0,
1236016,0,340,1,236, 12402306,1,1804,4844,16,
123614836,16,0,377,1, 124030,705,1,431,4845,
12362346,4837,16,0,574, 1240416,0,700,1,1443,
123631,1876,4838,16,0, 124054846,16,0,550,1,
12364353,1,1659,4839,16, 124061756,4847,16,0,796,
123650,793,1,1225,4840, 124071,124,4848,16,0,
1236616,0,275,1,1117, 12408285,1,525,4849,16,
123674841,16,0,245,1, 124090,345,1,236,4850,
12368137,4842,16,0,301, 1241016,0,387,1,346,
123691,2318,4843,16,0, 124114851,16,0,582,1,
12370793,1,1775,4844,16, 124121876,4852,16,0,361,
123710,690,1,32,4845, 124131,1659,4853,16,0,
1237216,0,690,1,1407, 12414796,1,1225,4854,16,
123734846,16,0,561,1, 124150,272,1,1117,4855,
123742782,4847,16,0,256, 1241616,0,242,1,137,
123751,256,4848,16,0, 124174856,16,0,305,1,
12376431,1,459,4849,16, 124182318,4857,16,0,796,
123770,186,1,406,4850, 124191,1775,4858,16,0,
1237816,0,649,1,41, 12420705,1,32,4859,16,
123794851,16,0,186,1, 124210,705,1,1407,4860,
12380151,4852,16,0,315, 1242216,0,571,1,256,
123811,43,4853,16,0, 124234861,16,0,441,1,
12382738,1,1990,4854,16, 12424459,4862,16,0,183,
123830,690,1,2337,4855, 124251,406,4863,16,0,
1238416,0,690,1,509, 12426662,1,41,4864,16,
123854856,16,0,762,1, 124270,183,1,151,4865,
1238652,4857,16,0,702, 1242816,0,317,1,43,
123871,381,4858,16,0, 124294866,16,0,751,1,
12388629,1,447,4859,16, 124301990,4867,16,0,705,
123890,340,1,166,4860, 124311,2337,4868,16,0,
1239016,0,329,1,462, 12432705,1,509,4869,16,
123914861,16,0,186,1, 124330,774,1,52,4870,
12392277,4862,16,0,476, 1243416,0,717,1,381,
123931,1695,4863,16,0, 124354871,16,0,639,1,
12394298,1,1261,4864,16, 12436447,4872,16,0,345,
123950,313,1,1153,4865, 124371,166,4873,16,0,
1239616,0,193,1,2106, 12438332,1,462,4874,16,
123974866,16,0,690,1, 124390,183,1,277,4875,
123981335,4867,16,0,362, 1244016,0,488,1,1695,
123991,71,4868,16,0, 124414876,16,0,302,1,
12400229,1,182,4869,16, 124422786,4877,16,0,254,
124010,340,1,76,4870, 124431,1261,4878,16,0,
1240216,0,627,1,79, 12444316,1,1153,4879,16,
124034871,16,0,244,1, 124450,190,1,2106,4880,
124041933,4872,16,0,443, 1244616,0,705,1,1335,
124051,299,4873,16,0, 124474881,16,0,372,1,
12406503,1,85,4874,16, 1244871,4882,16,0,226,
124070,526,1,1515,4875, 124491,182,4883,16,0,
1240816,0,644,1,2198, 12450345,1,76,4884,16,
124094876,16,0,690,1, 124510,635,1,79,4885,
1241089,4877,16,0,257, 1245216,0,241,1,1933,
124111,1834,4878,16,0, 124534886,16,0,453,1,
12412325,1,1622,4879,16, 12454299,4887,16,0,517,
124130,761,1,2413,4880, 124551,85,4888,16,0,
1241416,0,690,1,2075, 12456541,1,1515,4889,16,
124154881,16,0,690,1, 124570,657,1,2198,4890,
124161731,4882,16,0,277, 1245816,0,705,1,89,
124171,97,4883,16,0, 124594891,16,0,253,1,
12418447,1,1297,4884,16, 124601834,4892,16,0,330,
124190,364,1,1189,4885, 124611,1622,4893,16,0,
1242016,0,243,1,102, 12462773,1,2413,4894,16,
124214886,16,0,265,1, 124630,705,1,2075,4895,
124221585,4887,16,0,773, 1246416,0,705,1,1731,
124231,322,4888,16,0, 124654896,16,0,274,1,
12424530,1,1958,4889,16, 1246697,4897,16,0,457,
124250,690,1,199,4890, 124671,1297,4898,16,0,
1242616,0,351,1,1371, 12468374,1,1189,4899,16,
124274891,16,0,432,1, 124690,240,1,102,4900,
12428217,4892,16,0,361, 1247016,0,262,1,1585,
124291,156,4893,19,4894, 124714901,16,0,783,1,
124304,36,67,0,111, 12472322,4902,16,0,543,
124310,110,0,115,0, 124731,1958,4903,16,0,
12432116,0,97,0,110, 12474705,1,199,4904,16,
124330,116,0,69,0, 124750,356,1,1371,4905,
12434120,0,112,0,114, 1247616,0,442,1,217,
124350,101,0,115,0, 124774906,16,0,368,1,
12436115,0,105,0,111, 12478157,4907,19,4908,4,
124370,110,0,1,156, 1247936,67,0,111,0,
124384825,1,157,4895,19, 12480110,0,115,0,116,
124394896,4,30,73,0, 124810,97,0,110,0,
12440100,0,101,0,110, 12482116,0,69,0,120,
124830,112,0,114,0,
12484101,0,115,0,115,
124850,105,0,111,0,
12486110,0,1,157,4839,
124871,158,4909,19,4910,
124884,30,73,0,100,
124890,101,0,110,0,
12490116,0,69,0,120,
124910,112,0,114,0,
12492101,0,115,0,115,
124930,105,0,111,0,
12494110,0,1,158,4839,
124951,159,4911,19,4912,
124964,36,73,0,100,
124970,101,0,110,0,
12498116,0,68,0,111,
124410,116,0,69,0, 124990,116,0,69,0,
12442120,0,112,0,114, 12500120,0,112,0,114,
124430,101,0,115,0, 125010,101,0,115,0,
12444115,0,105,0,111, 12502115,0,105,0,111,
124450,110,0,1,157, 125030,110,0,1,159,
124464825,1,158,4897,19, 125044839,1,160,4913,19,
124474898,4,36,73,0, 125054914,4,44,70,0,
12448100,0,101,0,110, 12506117,0,110,0,99,
124490,116,0,68,0, 125070,116,0,105,0,
12450111,0,116,0,69, 12508111,0,110,0,67,
125090,97,0,108,0,
12510108,0,69,0,120,
125110,112,0,114,0,
12512101,0,115,0,115,
125130,105,0,111,0,
12514110,0,1,160,4839,
125151,161,4915,19,4916,
125164,32,66,0,105,
125170,110,0,97,0,
12518114,0,121,0,69,
124510,120,0,112,0, 125190,120,0,112,0,
12452114,0,101,0,115, 12520114,0,101,0,115,
124530,115,0,105,0, 125210,115,0,105,0,
12454111,0,110,0,1, 12522111,0,110,0,1,
12455158,4825,1,159,4899, 12523161,4839,1,162,4917,
1245619,4900,4,44,70, 1252419,4918,4,30,85,
124570,117,0,110,0, 125250,110,0,97,0,
1245899,0,116,0,105, 12526114,0,121,0,69,
124590,111,0,110,0, 125270,120,0,112,0,
1246067,0,97,0,108, 12528114,0,101,0,115,
124610,108,0,69,0, 125290,115,0,105,0,
12462120,0,112,0,114, 12530111,0,110,0,1,
124630,101,0,115,0, 12531162,4839,1,163,4919,
12464115,0,105,0,111, 1253219,4920,4,36,84,
124650,110,0,1,159, 125330,121,0,112,0,
124664825,1,160,4901,19, 12534101,0,99,0,97,
124674902,4,32,66,0, 125350,115,0,116,0,
12468105,0,110,0,97,
124690,114,0,121,0,
1247069,0,120,0,112, 1253669,0,120,0,112,
124710,114,0,101,0, 125370,114,0,101,0,
12472115,0,115,0,105, 12538115,0,115,0,105,
124730,111,0,110,0, 125390,111,0,110,0,
124741,160,4825,1,161, 125401,163,4839,1,164,
124754903,19,4904,4,30, 125414921,19,4922,4,42,
1247685,0,110,0,97, 1254280,0,97,0,114,
124770,114,0,121,0, 125430,101,0,110,0,
1247869,0,120,0,112, 12544116,0,104,0,101,
125450,115,0,105,0,
12546115,0,69,0,120,
125470,112,0,114,0,
12548101,0,115,0,115,
125490,105,0,111,0,
12550110,0,1,164,4839,
125511,165,4923,19,4924,
125524,56,73,0,110,
125530,99,0,114,0,
12554101,0,109,0,101,
125550,110,0,116,0,
1255668,0,101,0,99,
124790,114,0,101,0, 125570,114,0,101,0,
12480115,0,115,0,105, 12558109,0,101,0,110,
124810,111,0,110,0, 125590,116,0,69,0,
124821,161,4825,1,162,
124834905,19,4906,4,36,
1248484,0,121,0,112,
124850,101,0,99,0,
1248697,0,115,0,116,
124870,69,0,120,0,
12488112,0,114,0,101,
124890,115,0,115,0,
12490105,0,111,0,110,
124910,1,162,4825,1,
12492163,4907,19,4908,4,
1249342,80,0,97,0,
12494114,0,101,0,110,
124950,116,0,104,0,
12496101,0,115,0,105,
124970,115,0,69,0,
12498120,0,112,0,114, 12560120,0,112,0,114,
124990,101,0,115,0, 125610,101,0,115,0,
12500115,0,105,0,111, 12562115,0,105,0,111,
125010,110,0,1,163, 125630,110,0,1,165,
125024825,1,164,4909,19, 125644839,1,167,4925,19,
125034910,4,56,73,0, 12565830,1,167,4269,1,
12504110,0,99,0,114, 12566168,4926,19,808,1,
125050,101,0,109,0, 12567168,4269,1,169,4927,
12506101,0,110,0,116, 1256819,3557,1,169,4272,
125070,68,0,101,0, 125691,170,4928,19,3547,
1250899,0,114,0,101, 125701,170,4272,1,171,
125090,109,0,101,0, 125714929,19,3552,1,171,
12510110,0,116,0,69, 125724272,1,172,4930,19,
125110,120,0,112,0, 125733542,1,172,4272,1,
12512114,0,101,0,115, 12574173,4931,19,3527,1,
125130,115,0,105,0, 12575173,4275,1,174,4932,
12514111,0,110,0,1, 1257619,3562,1,174,4275,
12515164,4825,1,166,4911, 125771,175,4933,19,3521,
1251619,822,1,166,4255, 125781,175,4279,1,176,
125171,167,4912,19,832, 125794934,19,3535,1,176,
125181,167,4255,1,168, 125804279,1,177,4935,19,
125194913,19,3549,1,168, 12581814,1,177,4283,1,
125204258,1,169,4914,19, 12582178,4936,19,825,1,
125213539,1,169,4258,1, 12583178,4283,1,179,4937,
12522170,4915,19,3544,1, 1258419,820,1,179,4287,
12523170,4258,1,171,4916, 125851,180,4938,19,835,
1252419,3534,1,171,4258, 125861,180,4287,1,181,
125251,172,4917,19,3520, 125874939,19,1777,1,181,
125261,172,4261,1,173, 125884293,1,182,4940,19,
125274918,19,3554,1,173, 125891881,1,182,4293,1,
125284261,1,174,4919,19, 12590183,4941,19,1844,1,
125293514,1,174,4265,1, 12591183,4293,1,184,4942,
12530175,4920,19,3528,1, 1259219,1765,1,184,4293,
12531175,4265,1,176,4921, 125931,185,4943,19,1839,
1253219,805,1,176,4269, 125941,185,4293,1,186,
125331,177,4922,19,816, 125954944,19,1802,1,186,
125341,177,4269,1,178, 125964293,1,187,4945,19,
125354923,19,811,1,178, 125971834,1,187,4293,1,
125364273,1,179,4924,19, 12598188,4946,19,1797,1,
12537827,1,179,4273,1, 12599188,4293,1,189,4947,
12538180,4925,19,1835,1, 1260019,1829,1,189,4293,
12539180,4279,1,181,4926, 126011,190,4948,19,1792,
1254019,1799,1,181,4279, 126021,190,4293,1,191,
125411,182,4927,19,1830, 126034949,19,1824,1,191,
125421,182,4279,1,183, 126044293,1,192,4950,19,
125434928,19,1794,1,183, 126051760,1,192,4293,1,
125444279,1,184,4929,19, 12606193,4951,19,1819,1,
125451825,1,184,4279,1, 12607193,4293,1,194,4952,
12546185,4930,19,1756,1, 1260819,1787,1,194,4293,
12547185,4279,1,186,4931, 126091,195,4953,19,1814,
1254819,1820,1,186,4279, 126101,195,4293,1,196,
125491,187,4932,19,1751, 126114954,19,1782,1,196,
125501,187,4279,1,188, 126124293,1,197,4955,19,
125514933,19,1815,1,188, 126131875,1,197,4297,1,
125524279,1,189,4934,19, 12614198,4956,19,1862,1,
125531783,1,189,4279,1, 12615198,4303,1,199,4957,
12554190,4935,19,1810,1, 1261619,1850,1,199,4309,
12555190,4279,1,191,4936, 126171,200,4958,19,1809,
1255619,1778,1,191,4279, 126181,200,4315,1,201,
125571,192,4937,19,1805, 126194959,19,1868,1,201,
125581,192,4279,1,193, 126204321,1,202,4960,19,
125594938,19,1773,1,193, 126211856,1,202,4327,1,
125604279,1,194,4939,19, 12622203,4961,19,1754,1,
125611878,1,194,4279,1, 12623203,4333,1,204,4962,
12562195,4940,19,1768,1, 1262419,1771,1,204,4339,
12563195,4279,1,196,4941, 126251,205,4963,19,1945,
1256419,1872,1,196,4283, 126261,205,4345,1,206,
125651,197,4942,19,1865, 126274964,19,1904,1,206,
125661,197,4289,1,198, 126284345,1,207,4965,19,
125674943,19,1841,1,198, 126292337,1,207,4350,1,
125684295,1,199,4944,19, 12630208,4966,19,2308,1,
125691859,1,199,4301,1, 12631208,4353,1,209,4967,
12570200,4945,19,1853,1, 1263219,2302,1,209,4356,
12571200,4307,1,201,4946, 126331,210,4968,19,2294,
1257219,1847,1,201,4313, 126341,210,4359,1,211,
125731,202,4947,19,1789, 126354969,19,2287,1,211,
125741,202,4319,1,203, 126364362,1,212,4970,19,
125754948,19,1762,1,203, 126372319,1,212,4365,1,
125764325,1,204,4949,19, 12638213,4971,19,1242,1,
125771941,1,204,4331,1, 12639213,4368,1,214,4972,
12578205,4950,19,1907,1, 1264019,1964,1,214,4387,
12579205,4331,1,206,4951, 126411,215,4973,19,1890,
1258019,2302,1,206,4336, 126421,215,4391,1,216,
125811,207,4952,19,2294, 126434974,19,1931,1,216,
125821,207,4339,1,208, 126444398,1,217,4975,19,
125834953,19,2327,1,208, 126451910,1,217,4403,1,
125844342,1,209,4954,19, 12646218,4976,19,1027,1,
125852285,1,209,4345,1, 12647218,4475,1,219,4977,
12586210,4955,19,2279,1, 1264819,1011,1,219,4475,
12587210,4348,1,211,4956, 126491,220,4978,19,1017,
1258819,2313,1,211,4351, 126501,220,4498,1,221,
125891,212,4957,19,1239, 126514979,19,1005,1,221,
125901,212,4354,1,213, 126524498,1,222,4980,19,
125914958,19,1960,1,213, 126531270,1,222,4514,1,
125924373,1,214,4959,19, 12654223,4981,19,907,1,
125931886,1,214,4377,1, 12655223,4501,1,224,4982,
12594215,4960,19,1899,1, 1265619,1022,1,224,4501,
12595215,4384,1,216,4961, 126571,225,4983,19,902,
1259619,1913,1,216,4389, 126581,225,4501,1,226,
125971,217,4962,19,1024, 126594984,19,927,1,226,
125981,217,4461,1,218, 126604501,1,227,4985,19,
125994963,19,1008,1,218, 12661896,1,227,4501,1,
126004461,1,219,4964,19, 12662228,4986,19,890,1,
126011014,1,219,4484,1, 12663228,4501,1,229,4987,
12602220,4965,19,1002,1, 1266419,885,1,229,4501,
12603220,4484,1,221,4966, 126651,230,4988,19,880,
1260419,1267,1,221,4500, 126661,230,4501,1,231,
126051,222,4967,19,904, 126674989,19,874,1,231,
126061,222,4487,1,223, 126684501,1,232,4990,19,
126074968,19,1019,1,223, 12669869,1,232,4501,1,
126084487,1,224,4969,19, 12670233,4991,19,864,1,
12609899,1,224,4487,1, 12671233,4501,1,234,4992,
12610225,4970,19,924,1, 1267219,859,1,234,4501,
12611225,4487,1,226,4971, 126731,235,4993,19,854,
1261219,893,1,226,4487, 126741,235,4501,1,236,
126131,227,4972,19,887, 126754994,19,1277,1,236,
126141,227,4487,1,228, 126764586,1,237,4995,19,
126154973,19,882,1,228, 126771417,1,237,4599,1,
126164487,1,229,4974,19, 12678238,4996,19,1264,1,
12617877,1,229,4487,1, 12679238,4612,1,239,4997,
12618230,4975,19,871,1, 1268019,1405,1,239,4612,
12619230,4487,1,231,4976, 126811,240,4998,19,1044,
1262019,866,1,231,4487, 126821,240,4625,1,241,
126211,232,4977,19,861, 126834999,19,847,1,241,
126221,232,4487,1,233, 126844625,1,242,5000,19,
126234978,19,856,1,233, 12685942,1,242,4625,1,
126244487,1,234,4979,19, 12686243,5001,19,971,1,
12625851,1,234,4487,1, 12687243,4625,1,244,5002,
12626235,4980,19,1274,1, 1268819,990,1,244,4638,
12627235,4572,1,236,4981, 126891,245,5003,19,1036,
1262819,1413,1,236,4585, 126901,245,4638,1,246,
126291,237,4982,19,1261, 126915004,19,950,1,246,
126301,237,4598,1,238, 126924651,1,247,5005,19,
126314983,19,1401,1,238, 12693964,1,247,4651,1,
126324598,1,239,4984,19, 12694248,5006,19,916,1,
126331041,1,239,4611,1, 12695248,4664,1,249,5007,
12634240,4985,19,844,1, 1269619,955,1,249,4664,
12635240,4611,1,241,4986, 126971,250,5008,19,1603,
1263619,939,1,241,4611, 126981,250,4677,1,251,
126371,242,4987,19,968, 126995009,19,1283,1,251,
126381,242,4611,1,243, 127004677,1,252,5010,19,
126394988,19,987,1,243, 127011635,1,252,4677,1,
126404624,1,244,4989,19, 12702253,5011,19,1667,1,
126411033,1,244,4624,1, 12703253,4677,1,254,5012,
12642245,4990,19,947,1, 1270419,1532,1,254,4527,
12643245,4637,1,246,4991, 127051,255,5013,19,1592,
1264419,961,1,246,4637, 127061,255,4527,1,256,
126451,247,4992,19,913, 127075014,19,1258,1,256,
126461,247,4650,1,248, 127084540,1,257,5015,19,
126474993,19,952,1,248, 127091699,1,257,4540,1,
126484650,1,249,4994,19, 12710258,5016,19,1630,1,
126491594,1,249,4663,1, 12711258,4540,1,259,5017,
12650250,4995,19,1280,1, 1271219,1576,1,259,4540,
12651250,4663,1,251,4996, 127131,260,5018,19,1500,
1265219,1626,1,251,4663, 127141,260,4540,1,261,
126531,252,4997,19,1658, 127155019,19,1427,1,261,
126541,252,4663,1,253, 127164540,1,262,5020,19,
126554998,19,1524,1,253, 127171437,1,262,4540,1,
126564513,1,254,4999,19, 12718263,5021,19,1253,1,
126571583,1,254,4513,1, 12719263,4540,1,264,5022,
12658255,5000,19,1255,1, 1272019,1683,1,264,4540,
12659255,4526,1,256,5001, 127211,265,5023,19,1625,
1266019,1690,1,256,4526, 127221,265,4540,1,266,
126611,257,5002,19,1621, 127235024,19,1566,1,266,
126621,257,4526,1,258, 127244540,1,267,5025,19,
126635003,19,1568,1,258, 127251489,1,267,4540,1,
126644526,1,259,5004,19, 12726268,5026,19,1453,1,
126651492,1,259,4526,1, 12727268,4540,1,269,5027,
12666260,5005,19,1423,1, 1272819,1236,1,269,4540,
12667260,4526,1,261,5006, 127291,270,5028,19,1586,
1266819,1433,1,261,4526, 127301,270,4540,1,271,
126691,262,5007,19,1250, 127315029,19,1613,1,271,
126701,262,4526,1,263, 127324540,1,272,5030,19,
126715008,19,1674,1,263, 127331559,1,272,4540,1,
126724526,1,264,5009,19, 12734273,5031,19,1581,1,
126731616,1,264,4526,1, 12735273,4540,1,274,5032,
12674265,5010,19,1558,1, 1273619,1393,1,274,4540,
12675265,4526,1,266,5011, 127371,275,5033,19,1297,
1267619,1481,1,266,4526, 127381,275,4540,1,276,
126771,267,5012,19,1443, 127395034,19,1225,1,276,
126781,267,4526,1,268, 127404540,1,277,5035,19,
126795013,19,1233,1,268, 127411657,1,277,4540,1,
126804526,1,269,5014,19, 12742278,5036,19,1608,1,
126811578,1,269,4526,1, 12743278,4540,1,279,5037,
12682270,5015,19,1604,1, 1274419,1554,1,279,4540,
12683270,4526,1,271,5016, 127451,280,5038,19,1422,
1268419,1551,1,271,4526, 127461,280,4573,1,281,
126851,272,5017,19,1573, 127475039,19,1400,1,281,
126861,272,4526,1,273, 127484573,1,282,5040,19,
126875018,19,1389,1,273, 127491688,1,282,4763,1,
126884526,1,274,5019,19, 12750283,5041,19,1711,1,
126891293,1,274,4526,1, 12751283,4763,1,284,5042,
12690275,5020,19,1222,1, 1275219,1678,1,284,4763,
12691275,4526,1,276,5021, 127531,285,5043,19,1673,
1269219,1648,1,276,4526, 127541,285,4763,1,286,
126931,277,5022,19,1599, 127555044,19,1694,1,286,
126941,277,4526,1,278, 127564763,1,287,5045,19,
126955023,19,1546,1,278, 127571641,1,287,4763,1,
126964526,1,279,5024,19, 12758288,5046,19,1347,1,
126971418,1,279,4559,1, 12759288,4763,1,289,5047,
12698280,5025,19,1396,1, 1276019,1521,1,289,4839,
12699280,4559,1,281,5026, 127611,290,5048,19,1308,
1270019,1679,1,281,4749, 127621,290,4839,1,291,
127011,282,5027,19,1708, 127635049,19,1315,1,291,
127021,282,4749,1,283, 127644839,1,292,5050,19,
127035028,19,1669,1,283, 127651336,1,292,4839,1,
127044749,1,284,5029,19, 12766293,5051,19,1331,1,
127051664,1,284,4749,1, 12767293,4839,1,294,5052,
12706285,5030,19,1685,1, 1276819,1326,1,294,4839,
12707285,4749,1,286,5031, 127691,295,5053,19,1321,
1270819,1632,1,286,4749, 127701,295,4839,1,296,
127091,287,5032,19,1343, 127715054,19,1510,1,296,
127101,287,4749,1,288, 127724839,1,297,5055,19,
127115033,19,1513,1,288, 127731538,1,297,4839,1,
127124825,1,289,5034,19, 12774298,5056,19,1515,1,
127131304,1,289,4825,1, 12775298,4839,1,299,5057,
12714290,5035,19,1311,1, 1277619,1505,1,299,4839,
12715290,4825,1,291,5036, 127771,300,5058,19,1495,
1271619,1332,1,291,4825, 127781,300,4839,1,301,
127171,292,5037,19,1327, 127795059,19,1478,1,301,
127181,292,4825,1,293, 127804839,1,302,5060,19,
127195038,19,1322,1,293, 127811432,1,302,4839,1,
127204825,1,294,5039,19, 12782303,5061,19,1341,1,
127211317,1,294,4825,1, 12783303,4839,1,304,5062,
12722295,5040,19,1502,1, 1278419,1302,1,304,4839,
12723295,4825,1,296,5041, 127851,305,5063,19,1248,
1272419,1530,1,296,4825, 127861,305,4839,1,306,
127251,297,5042,19,1507, 127875064,19,1706,1,306,
127261,297,4825,1,298, 127884839,1,307,5065,19,
127275043,19,1497,1,298, 127891662,1,307,4839,1,
127284825,1,299,5044,19, 12790308,5066,19,1652,1,
127291487,1,299,4825,1, 12791308,4839,1,309,5067,
12730300,5045,19,1470,1, 1279219,1647,1,309,4839,
12731300,4825,1,301,5046, 127931,310,5068,19,1598,
1273219,1428,1,301,4825, 127941,310,4839,1,311,
127331,302,5047,19,1337, 127955069,19,1571,1,311,
127341,302,4825,1,303, 127964839,1,312,5070,19,
127355048,19,1298,1,303, 127971548,1,312,4839,1,
127364825,1,304,5049,19, 12798313,5071,19,1543,1,
127371245,1,304,4825,1, 12799313,4839,1,314,5072,
12738305,5050,19,1703,1, 1280019,1484,1,314,4839,
12739305,4825,1,306,5051, 128011,315,5073,19,1460,
1274019,1653,1,306,4825, 128021,315,4839,1,316,
127411,307,5052,19,1643, 128035074,19,1526,1,316,
127421,307,4825,1,308, 128044839,1,317,5075,19,
127435053,19,1638,1,308, 128051619,1,317,4839,1,
127444825,1,309,5054,19, 12806318,5076,19,1473,1,
127451589,1,309,4825,1, 12807318,4839,1,319,5077,
12746310,5055,19,1563,1, 1280819,1467,1,319,4839,
12747310,4825,1,311,5056, 128091,320,5078,19,1448,
1274819,1540,1,311,4825, 128101,320,4839,1,321,
127491,312,5057,19,1535, 128115079,19,1411,1,321,
127501,312,4825,1,313, 128124839,1,322,5080,19,
127515058,19,1476,1,313, 128131388,1,322,4839,1,
127524825,1,314,5059,19, 12814323,5081,19,1231,1,
127531451,1,314,4825,1, 12815323,4839,1,324,5082,
12754315,5060,19,1518,1, 1281619,1721,1,324,4839,
12755315,4825,1,316,5061, 128171,325,5083,19,1353,
1275619,1610,1,316,4825, 128181,325,4839,1,326,
127571,317,5062,19,1465, 128195084,19,1358,1,326,
127581,317,4825,1,318, 128204839,1,327,5085,19,
127595063,19,1458,1,318, 128211378,1,327,4839,1,
127604825,1,319,5064,19, 12822328,5086,19,1368,1,
127611438,1,319,4825,1, 12823328,4839,1,329,5087,
12762320,5065,19,1407,1, 1282419,1373,1,329,4839,
12763320,4825,1,321,5066, 128251,330,5088,19,1363,
1276419,1384,1,321,4825, 128261,330,4839,1,331,
127651,322,5067,19,1228, 128275089,19,1716,1,331,
127661,322,4825,1,323, 128284839,1,332,5090,19,
127675068,19,1718,1,323, 128291383,1,332,4839,1,
127684825,1,324,5069,19, 12830333,5091,19,1443,1,
127691349,1,324,4825,1, 12831333,4682,1,334,5092,
12770325,5070,19,1354,1, 1283219,1958,1,334,4752,
12771325,4825,1,326,5071, 128331,335,5093,19,1951,
1277219,1374,1,326,4825, 128341,335,4752,1,336,
127731,327,5072,19,1364, 128355094,19,1921,1,336,
127741,327,4825,1,328, 128364756,1,337,5095,19,
127755073,19,1369,1,328, 128372278,1,337,4407,1,
127764825,1,329,5074,19, 12838338,5096,19,2273,1,
127771359,1,329,4825,1, 12839338,4407,1,339,5097,
12778330,5075,19,1713,1, 1284019,2268,1,339,4407,
12779330,4825,1,331,5076, 128411,340,5098,19,2263,
1278019,1379,1,331,4825, 128421,340,4407,1,341,
127811,332,5077,19,1698, 128435099,19,2258,1,341,
127821,332,4668,1,333, 128444407,1,342,5100,19,
127835078,19,1954,1,333, 128452253,1,342,4407,1,
127844738,1,334,5079,19, 12846343,5101,19,2248,1,
127851947,1,334,4738,1, 12847343,4407,1,344,5102,
12786335,5080,19,1924,1, 1284819,2237,1,344,4427,
12787335,4742,1,336,5081, 128491,345,5103,19,2232,
1278819,2270,1,336,4393, 128501,345,4427,1,346,
127891,337,5082,19,2265, 128515104,19,2227,1,346,
127901,337,4393,1,338, 128524427,1,347,5105,19,
127915083,19,2260,1,338, 128532222,1,347,4427,1,
127924393,1,339,5084,19, 12854348,5106,19,2217,1,
127932255,1,339,4393,1, 12855348,4427,1,349,5107,
12794340,5085,19,2250,1, 1285619,2212,1,349,4427,
12795340,4393,1,341,5086, 128571,350,5108,19,2207,
1279619,2245,1,341,4393, 128581,350,4427,1,351,
127971,342,5087,19,2240, 128595109,19,2202,1,351,
127981,342,4393,1,343, 128604427,1,352,5110,19,
127995088,19,2229,1,343, 128612197,1,352,4427,1,
128004413,1,344,5089,19, 12862353,5111,19,2191,1,
128012224,1,344,4413,1, 12863353,4433,1,354,5112,
12802345,5090,19,2219,1, 1286419,2019,1,354,4433,
12803345,4413,1,346,5091, 128651,355,5113,19,2185,
1280419,2214,1,346,4413, 128661,355,4433,1,356,
128051,347,5092,19,2209, 128675114,19,2180,1,356,
128061,347,4413,1,348, 128684433,1,357,5115,19,
128075093,19,2204,1,348, 128692175,1,357,4433,1,
128084413,1,349,5094,19, 12870358,5116,19,2012,1,
128092199,1,349,4413,1, 12871358,4433,1,359,5117,
12810350,5095,19,2194,1, 1287219,2170,1,359,4433,
12811350,4413,1,351,5096, 128731,360,5118,19,2165,
1281219,2188,1,351,4419, 128741,360,4433,1,361,
128131,352,5097,19,2014, 128755119,19,2160,1,361,
128141,352,4419,1,353, 128764439,1,362,5120,19,
128155098,19,2182,1,353, 128772155,1,362,4439,1,
128164419,1,354,5099,19, 12878363,5121,19,2149,1,
128172177,1,354,4419,1, 12879363,4445,1,364,5122,
12818355,5100,19,2172,1, 1288019,2144,1,364,4445,
12819355,4419,1,356,5101, 128811,365,5123,19,2004,
1282019,2007,1,356,4419, 128821,365,4445,1,366,
128211,357,5102,19,2167, 128835124,19,2138,1,366,
128221,357,4419,1,358, 128844445,1,367,5125,19,
128235103,19,2162,1,358, 128852133,1,367,4445,1,
128244419,1,359,5104,19, 12886368,5126,19,2128,1,
128252157,1,359,4425,1, 12887368,4445,1,369,5127,
12826360,5105,19,2152,1, 1288819,1997,1,369,4445,
12827360,4425,1,361,5106, 128891,370,5128,19,2122,
1282819,2146,1,361,4431, 128901,370,4445,1,371,
128291,362,5107,19,2141, 128915129,19,2049,1,371,
128301,362,4431,1,363, 128924445,1,372,5130,19,
128315108,19,1998,1,363, 128932117,1,372,4445,1,
128324431,1,364,5109,19, 12894373,5131,19,2112,1,
128332135,1,364,4431,1, 12895373,4451,1,374,5132,
12834365,5110,19,2130,1, 1289619,2107,1,374,4451,
12835365,4431,1,366,5111, 128971,375,5133,19,2102,
1283619,2125,1,366,4431, 128981,375,4451,1,376,
128371,367,5112,19,1992, 128995134,19,2096,1,376,
128381,367,4431,1,368, 129004457,1,377,5135,19,
128395113,19,2119,1,368, 129012090,1,377,4463,1,
128404431,1,369,5114,19, 12902378,5136,19,2084,1,
128412047,1,369,4431,1, 12903378,4469,1,379,5137,
12842370,5115,19,2114,1, 1290419,5138,4,50,65,
12843370,4431,1,371,5116, 129050,114,0,103,0,
1284419,2109,1,371,4437, 12906117,0,109,0,101,
128451,372,5117,19,2104, 129070,110,0,116,0,
128461,372,4437,1,373, 1290868,0,101,0,99,
128475118,19,2099,1,373, 129090,108,0,97,0,
128484437,1,374,5119,19, 12910114,0,97,0,116,
128492093,1,374,4443,1, 129110,105,0,111,0,
12850375,5120,19,2087,1, 12912110,0,76,0,105,
12851375,4449,1,376,5121, 129130,115,0,116,0,
1285219,2081,1,376,4455, 1291495,0,51,0,1,
128531,377,5122,19,5123, 12915379,4345,1,380,5139,
128544,50,65,0,114, 1291619,5140,4,28,65,
128550,103,0,117,0, 129170,114,0,103,0,
12856109,0,101,0,110, 12918117,0,109,0,101,
128570,116,0,68,0, 129190,110,0,116,0,
12858101,0,99,0,108,
128590,97,0,114,0,
1286097,0,116,0,105,
128610,111,0,110,0,
1286276,0,105,0,115, 1292076,0,105,0,115,
128630,116,0,95,0, 129210,116,0,95,0,
1286451,0,1,377,4331, 1292251,0,1,380,4752,
128651,378,5124,19,5125, 129231,381,5141,19,5142,
128664,28,65,0,114, 129244,28,65,0,114,
128670,103,0,117,0, 129250,103,0,117,0,
12868109,0,101,0,110, 12926109,0,101,0,110,
128690,116,0,76,0, 129270,116,0,76,0,
12870105,0,115,0,116, 12928105,0,115,0,116,
128710,95,0,51,0, 129290,95,0,52,0,
128721,378,4738,1,379, 129301,381,4752,1,382,
128735126,19,5127,4,50, 129315143,19,5144,4,50,
1287465,0,114,0,103, 1293265,0,114,0,103,
128750,117,0,109,0, 129330,117,0,109,0,
12876101,0,110,0,116, 12934101,0,110,0,116,
@@ -12881,27 +12939,19 @@ public yyLSLSyntax
128810,110,0,76,0, 129390,110,0,76,0,
12882105,0,115,0,116, 12940105,0,115,0,116,
128830,95,0,52,0, 129410,95,0,52,0,
128841,379,4331,1,380, 129421,382,4345,1,383,
128855128,19,5129,4,28, 129435145,19,5146,4,50,
1288665,0,114,0,103, 1294465,0,114,0,103,
128870,117,0,109,0, 129450,117,0,109,0,
12888101,0,110,0,116, 12946101,0,110,0,116,
128890,76,0,105,0, 129470,68,0,101,0,
12890115,0,116,0,95, 1294899,0,108,0,97,
128910,52,0,1,380, 129490,114,0,97,0,
128924738,1,381,5130,19, 12950116,0,105,0,111,
128935131,4,50,65,0, 129510,110,0,76,0,
12894114,0,103,0,117, 12952105,0,115,0,116,
128950,109,0,101,0, 129530,95,0,53,0,
12896110,0,116,0,68, 129541,383,4345,2,0,0};
128970,101,0,99,0,
12898108,0,97,0,114,
128990,97,0,116,0,
12900105,0,111,0,110,
129010,76,0,105,0,
12902115,0,116,0,95,
129030,53,0,1,381,
129044331,2,0,0};
12905new Sfactory(this,"ExpressionArgument_1",new SCreator(ExpressionArgument_1_factory)); 12955new Sfactory(this,"ExpressionArgument_1",new SCreator(ExpressionArgument_1_factory));
12906new Sfactory(this,"VectorArgStateEvent",new SCreator(VectorArgStateEvent_factory)); 12956new Sfactory(this,"VectorArgStateEvent",new SCreator(VectorArgStateEvent_factory));
12907new Sfactory(this,"IntVecVecArgStateEvent",new SCreator(IntVecVecArgStateEvent_factory)); 12957new Sfactory(this,"IntVecVecArgStateEvent",new SCreator(IntVecVecArgStateEvent_factory));
@@ -12998,7 +13048,7 @@ new Sfactory(this,"SimpleAssignment_22",new SCreator(SimpleAssignment_22_factory
12998new Sfactory(this,"KeyIntIntArgStateEvent",new SCreator(KeyIntIntArgStateEvent_factory)); 13048new Sfactory(this,"KeyIntIntArgStateEvent",new SCreator(KeyIntIntArgStateEvent_factory));
12999new Sfactory(this,"TypecastExpression_9",new SCreator(TypecastExpression_9_factory)); 13049new Sfactory(this,"TypecastExpression_9",new SCreator(TypecastExpression_9_factory));
13000new Sfactory(this,"VoidArgEvent_2",new SCreator(VoidArgEvent_2_factory)); 13050new Sfactory(this,"VoidArgEvent_2",new SCreator(VoidArgEvent_2_factory));
13001new Sfactory(this,"VoidArgEvent_3",new SCreator(VoidArgEvent_3_factory)); 13051new Sfactory(this,"Event_9",new SCreator(Event_9_factory));
13002new Sfactory(this,"ArgumentDeclarationList_1",new SCreator(ArgumentDeclarationList_1_factory)); 13052new Sfactory(this,"ArgumentDeclarationList_1",new SCreator(ArgumentDeclarationList_1_factory));
13003new Sfactory(this,"ArgumentDeclarationList_2",new SCreator(ArgumentDeclarationList_2_factory)); 13053new Sfactory(this,"ArgumentDeclarationList_2",new SCreator(ArgumentDeclarationList_2_factory));
13004new Sfactory(this,"GlobalDefinitions_1",new SCreator(GlobalDefinitions_1_factory)); 13054new Sfactory(this,"GlobalDefinitions_1",new SCreator(GlobalDefinitions_1_factory));
@@ -13142,6 +13192,7 @@ new Sfactory(this,"BinaryExpression_13",new SCreator(BinaryExpression_13_factory
13142new Sfactory(this,"GlobalFunctionDefinition_2",new SCreator(GlobalFunctionDefinition_2_factory)); 13192new Sfactory(this,"GlobalFunctionDefinition_2",new SCreator(GlobalFunctionDefinition_2_factory));
13143new Sfactory(this,"StateChange_2",new SCreator(StateChange_2_factory)); 13193new Sfactory(this,"StateChange_2",new SCreator(StateChange_2_factory));
13144new Sfactory(this,"VoidArgEvent_1",new SCreator(VoidArgEvent_1_factory)); 13194new Sfactory(this,"VoidArgEvent_1",new SCreator(VoidArgEvent_1_factory));
13195new Sfactory(this,"VoidArgEvent_3",new SCreator(VoidArgEvent_3_factory));
13145new Sfactory(this,"BinaryExpression_10",new SCreator(BinaryExpression_10_factory)); 13196new Sfactory(this,"BinaryExpression_10",new SCreator(BinaryExpression_10_factory));
13146new Sfactory(this,"VoidArgEvent_5",new SCreator(VoidArgEvent_5_factory)); 13197new Sfactory(this,"VoidArgEvent_5",new SCreator(VoidArgEvent_5_factory));
13147new Sfactory(this,"VoidArgEvent_6",new SCreator(VoidArgEvent_6_factory)); 13198new Sfactory(this,"VoidArgEvent_6",new SCreator(VoidArgEvent_6_factory));
@@ -13285,7 +13336,7 @@ public static object SimpleAssignment_22_factory(Parser yyp) { return new Simple
13285public static object KeyIntIntArgStateEvent_factory(Parser yyp) { return new KeyIntIntArgStateEvent(yyp); } 13336public static object KeyIntIntArgStateEvent_factory(Parser yyp) { return new KeyIntIntArgStateEvent(yyp); }
13286public static object TypecastExpression_9_factory(Parser yyp) { return new TypecastExpression_9(yyp); } 13337public static object TypecastExpression_9_factory(Parser yyp) { return new TypecastExpression_9(yyp); }
13287public static object VoidArgEvent_2_factory(Parser yyp) { return new VoidArgEvent_2(yyp); } 13338public static object VoidArgEvent_2_factory(Parser yyp) { return new VoidArgEvent_2(yyp); }
13288public static object VoidArgEvent_3_factory(Parser yyp) { return new VoidArgEvent_3(yyp); } 13339public static object Event_9_factory(Parser yyp) { return new Event_9(yyp); }
13289public static object ArgumentDeclarationList_1_factory(Parser yyp) { return new ArgumentDeclarationList_1(yyp); } 13340public static object ArgumentDeclarationList_1_factory(Parser yyp) { return new ArgumentDeclarationList_1(yyp); }
13290public static object ArgumentDeclarationList_2_factory(Parser yyp) { return new ArgumentDeclarationList_2(yyp); } 13341public static object ArgumentDeclarationList_2_factory(Parser yyp) { return new ArgumentDeclarationList_2(yyp); }
13291public static object GlobalDefinitions_1_factory(Parser yyp) { return new GlobalDefinitions_1(yyp); } 13342public static object GlobalDefinitions_1_factory(Parser yyp) { return new GlobalDefinitions_1(yyp); }
@@ -13429,6 +13480,7 @@ public static object BinaryExpression_13_factory(Parser yyp) { return new Binary
13429public static object GlobalFunctionDefinition_2_factory(Parser yyp) { return new GlobalFunctionDefinition_2(yyp); } 13480public static object GlobalFunctionDefinition_2_factory(Parser yyp) { return new GlobalFunctionDefinition_2(yyp); }
13430public static object StateChange_2_factory(Parser yyp) { return new StateChange_2(yyp); } 13481public static object StateChange_2_factory(Parser yyp) { return new StateChange_2(yyp); }
13431public static object VoidArgEvent_1_factory(Parser yyp) { return new VoidArgEvent_1(yyp); } 13482public static object VoidArgEvent_1_factory(Parser yyp) { return new VoidArgEvent_1(yyp); }
13483public static object VoidArgEvent_3_factory(Parser yyp) { return new VoidArgEvent_3(yyp); }
13432public static object BinaryExpression_10_factory(Parser yyp) { return new BinaryExpression_10(yyp); } 13484public static object BinaryExpression_10_factory(Parser yyp) { return new BinaryExpression_10(yyp); }
13433public static object VoidArgEvent_5_factory(Parser yyp) { return new VoidArgEvent_5(yyp); } 13485public static object VoidArgEvent_5_factory(Parser yyp) { return new VoidArgEvent_5(yyp); }
13434public static object VoidArgEvent_6_factory(Parser yyp) { return new VoidArgEvent_6(yyp); } 13486public static object VoidArgEvent_6_factory(Parser yyp) { return new VoidArgEvent_6(yyp); }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/Properties/AssemblyInfo.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/Properties/AssemblyInfo.cs
index 815d11b..3eaaed0 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.8.0.*")] 32[assembly: AssemblyVersion("0.8.2.*")]
33 33
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 275b608..49df5e7 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -52,6 +52,7 @@ using OpenSim.Region.ScriptEngine.Shared.Api.Runtime;
52using OpenSim.Region.ScriptEngine.Shared.ScriptBase; 52using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
53using OpenSim.Region.ScriptEngine.Shared.CodeTools; 53using OpenSim.Region.ScriptEngine.Shared.CodeTools;
54using OpenSim.Region.ScriptEngine.Interfaces; 54using OpenSim.Region.ScriptEngine.Interfaces;
55using System.Diagnostics;
55 56
56namespace OpenSim.Region.ScriptEngine.Shared.Instance 57namespace OpenSim.Region.ScriptEngine.Shared.Instance
57{ 58{
@@ -59,6 +60,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
59 { 60 {
60 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 61 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
61 62
63 public bool StatePersistedHere { get { return m_AttachedAvatar == UUID.Zero; } }
64
62 /// <summary> 65 /// <summary>
63 /// The current work item if an event for this script is running or waiting to run, 66 /// The current work item if an event for this script is running or waiting to run,
64 /// </summary> 67 /// </summary>
@@ -72,14 +75,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
72 private bool m_TimerQueued; 75 private bool m_TimerQueued;
73 private DateTime m_EventStart; 76 private DateTime m_EventStart;
74 private bool m_InEvent; 77 private bool m_InEvent;
75 private string m_Assembly; 78 private string m_assemblyPath;
79 private string m_dataPath;
76 private string m_CurrentEvent = String.Empty; 80 private string m_CurrentEvent = String.Empty;
77 private bool m_InSelfDelete; 81 private bool m_InSelfDelete;
78 private int m_MaxScriptQueue; 82 private int m_MaxScriptQueue;
79 private bool m_SaveState = true; 83 private bool m_SaveState;
80 private int m_ControlEventsInQueue; 84 private int m_ControlEventsInQueue;
81 private int m_LastControlLevel; 85 private int m_LastControlLevel;
82 private bool m_CollisionInQueue; 86 private bool m_CollisionInQueue;
87 private bool m_StateChangeInProgress;
83 88
84 // The following is for setting a minimum delay between events 89 // The following is for setting a minimum delay between events
85 private double m_minEventDelay; 90 private double m_minEventDelay;
@@ -96,6 +101,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
96 101
97 public int DebugLevel { get; set; } 102 public int DebugLevel { get; set; }
98 103
104 public WaitHandle CoopWaitHandle { get; private set; }
105 public Stopwatch ExecutionTimer { get; private set; }
106
99 public Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> LineMap { get; set; } 107 public Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> LineMap { get; set; }
100 108
101 private Dictionary<string,IScriptApi> m_Apis = new Dictionary<string,IScriptApi>(); 109 private Dictionary<string,IScriptApi> m_Apis = new Dictionary<string,IScriptApi>();
@@ -122,7 +130,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
122 } 130 }
123 } 131 }
124 132
125 public bool Running { get; set; } 133 public bool Running
134 {
135 get { return m_running; }
136
137 set
138 {
139 m_running = value;
140 if (m_running)
141 StayStopped = false;
142 }
143 }
144 private bool m_running;
126 145
127 public bool Suspended 146 public bool Suspended
128 { 147 {
@@ -154,6 +173,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
154 173
155 public string State { get; set; } 174 public string State { get; set; }
156 175
176 public bool StayStopped { get; set; }
177
157 public IScriptEngine Engine { get; private set; } 178 public IScriptEngine Engine { get; private set; }
158 179
159 public UUID AppDomain { get; set; } 180 public UUID AppDomain { get; set; }
@@ -195,11 +216,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
195 216
196 public DateTime TimeStarted { get; private set; } 217 public DateTime TimeStarted { get; private set; }
197 218
198 public long MeasurementPeriodTickStart { get; private set; } 219 public MetricsCollectorTime ExecutionTime { get; private set; }
199
200 public long MeasurementPeriodExecutionTime { get; private set; }
201 220
202 public static readonly long MaxMeasurementPeriod = 30 * TimeSpan.TicksPerMinute; 221 private static readonly int MeasurementWindow = 30 * 1000; // show the *recent* time used by the script, to find currently active scripts
203 222
204 private bool m_coopTermination; 223 private bool m_coopTermination;
205 224
@@ -208,6 +227,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
208 public void ClearQueue() 227 public void ClearQueue()
209 { 228 {
210 m_TimerQueued = false; 229 m_TimerQueued = false;
230 m_StateChangeInProgress = false;
211 EventQueue.Clear(); 231 EventQueue.Clear();
212 } 232 }
213 233
@@ -218,6 +238,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
218 { 238 {
219 State = "default"; 239 State = "default";
220 EventQueue = new Queue(32); 240 EventQueue = new Queue(32);
241 ExecutionTimer = new Stopwatch();
221 242
222 Engine = engine; 243 Engine = engine;
223 Part = part; 244 Part = part;
@@ -240,11 +261,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
240 m_AttachedAvatar = part.ParentGroup.AttachedAvatar; 261 m_AttachedAvatar = part.ParentGroup.AttachedAvatar;
241 m_RegionID = part.ParentGroup.Scene.RegionInfo.RegionID; 262 m_RegionID = part.ParentGroup.Scene.RegionInfo.RegionID;
242 263
243 if (Engine.Config.GetString("ScriptStopStrategy", "abort") == "co-op") 264 m_SaveState = StatePersistedHere;
244 { 265
245 m_coopTermination = true; 266 ExecutionTime = new MetricsCollectorTime(MeasurementWindow, 10);
246 m_coopSleepHandle = new XEngineEventWaitHandle(false, EventResetMode.AutoReset); 267
247 } 268// m_log.DebugFormat(
269// "[SCRIPT INSTANCE]: Instantiated script instance {0} (id {1}) in part {2} (id {3}) in object {4} attached avatar {5} in {6}",
270// ScriptTask.Name, ScriptTask.ItemID, Part.Name, Part.UUID, Part.ParentGroup.Name, m_AttachedAvatar, Engine.World.Name);
248 } 271 }
249 272
250 /// <summary> 273 /// <summary>
@@ -252,86 +275,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
252 /// </summary> 275 /// </summary>
253 /// <param name='dom'></param> 276 /// <param name='dom'></param>
254 /// <param name='assembly'></param> 277 /// <param name='assembly'></param>
278 /// <param name='dataPath'>
279 /// Path for all script associated data (state, etc.). In a multi-region set up
280 /// with all scripts loading into the same AppDomain this may not be the same place as the DLL itself.
281 /// </param>
255 /// <param name='stateSource'></param> 282 /// <param name='stateSource'></param>
256 /// <returns>false if load failed, true if suceeded</returns> 283 /// <returns>false if load failed, true if suceeded</returns>
257 public bool Load(AppDomain dom, string assembly, StateSource stateSource) 284 public bool Load(
285 IScript script, EventWaitHandle coopSleepHandle, string assemblyPath,
286 string dataPath, StateSource stateSource, bool coopTermination)
258 { 287 {
259 m_Assembly = assembly; 288 m_Script = script;
289 m_coopSleepHandle = coopSleepHandle;
290 m_assemblyPath = assemblyPath;
291 m_dataPath = dataPath;
260 m_stateSource = stateSource; 292 m_stateSource = stateSource;
293 m_coopTermination = coopTermination;
294
295 if (m_coopTermination)
296 CoopWaitHandle = coopSleepHandle;
297 else
298 CoopWaitHandle = null;
261 299
262 ApiManager am = new ApiManager(); 300 ApiManager am = new ApiManager();
263 301
264 foreach (string api in am.GetApis()) 302 foreach (string api in am.GetApis())
265 { 303 {
266 m_Apis[api] = am.CreateApi(api); 304 m_Apis[api] = am.CreateApi(api);
267 m_Apis[api].Initialize(Engine, Part, ScriptTask, m_coopSleepHandle); 305 m_Apis[api].Initialize(Engine, Part, ScriptTask);
268 }
269
270 try
271 {
272 object[] constructorParams;
273
274 Assembly scriptAssembly = dom.Load(Path.GetFileNameWithoutExtension(assembly));
275 Type scriptType = scriptAssembly.GetType("SecondLife.XEngineScript");
276
277 if (scriptType != null)
278 {
279 constructorParams = new object[] { m_coopSleepHandle };
280 }
281 else if (!m_coopTermination)
282 {
283 scriptType = scriptAssembly.GetType("SecondLife.Script");
284 constructorParams = null;
285 }
286 else
287 {
288 m_log.ErrorFormat(
289 "[SCRIPT INSTANCE]: Not starting script {0} (id {1}) in part {2} (id {3}) in object {4} in {5}. You must remove all existing {6}* script DLL files before using enabling co-op termination"
290 + ", either by setting DeleteScriptsOnStartup = true in [XEngine] for one run"
291 + " or by deleting these files manually.",
292 ScriptTask.Name, ScriptTask.ItemID, Part.Name, Part.UUID, Part.ParentGroup.Name, Engine.World.Name, assembly);
293
294 return false;
295 }
296
297// m_log.DebugFormat(
298// "[SCRIPT INSTANCE]: Looking to load {0} from assembly {1} in {2}",
299// scriptType.FullName, Path.GetFileNameWithoutExtension(assembly), Engine.World.Name);
300
301 if (dom != System.AppDomain.CurrentDomain)
302 m_Script
303 = (IScript)dom.CreateInstanceAndUnwrap(
304 Path.GetFileNameWithoutExtension(assembly),
305 scriptType.FullName,
306 false,
307 BindingFlags.Default,
308 null,
309 constructorParams,
310 null,
311 null,
312 null);
313 else
314 m_Script
315 = (IScript)scriptAssembly.CreateInstance(
316 scriptType.FullName,
317 false,
318 BindingFlags.Default,
319 null,
320 constructorParams,
321 null,
322 null);
323
324 //ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass);
325 //RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass);
326// lease.Register(this);
327 }
328 catch (Exception e)
329 {
330 m_log.ErrorFormat(
331 "[SCRIPT INSTANCE]: Not starting script {0} (id {1}) in part {2} (id {3}) in object {4} in {5}. Error loading assembly {6}. Exception {7}{8}",
332 ScriptTask.Name, ScriptTask.ItemID, Part.Name, Part.UUID, Part.ParentGroup.Name, Engine.World.Name, assembly, e.Message, e.StackTrace);
333
334 return false;
335 } 306 }
336 307
337 try 308 try
@@ -341,10 +312,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
341 m_Script.InitApi(kv.Key, kv.Value); 312 m_Script.InitApi(kv.Key, kv.Value);
342 } 313 }
343 314
344// // m_log.Debug("[Script] Script instance created"); 315 // // m_log.Debug("[Script] Script instance created");
345 316
346 Part.SetScriptEvents(ItemID, 317 Part.SetScriptEvents(ItemID, (int)m_Script.GetStateEventFlags(State));
347 (int)m_Script.GetStateEventFlags(State));
348 } 318 }
349 catch (Exception e) 319 catch (Exception e)
350 { 320 {
@@ -355,12 +325,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
355 return false; 325 return false;
356 } 326 }
357 327
358 m_SaveState = true; 328 // For attachments, XEngine saves the state into a .state file when XEngine.SetXMLState() is called.
329 string savedState = Path.Combine(m_dataPath, ItemID.ToString() + ".state");
359 330
360 string savedState = Path.Combine(Path.GetDirectoryName(assembly),
361 ItemID.ToString() + ".state");
362 if (File.Exists(savedState)) 331 if (File.Exists(savedState))
363 { 332 {
333 // m_log.DebugFormat(
334 // "[SCRIPT INSTANCE]: Found state for script {0} for {1} ({2}) at {3} in {4}",
335 // ItemID, savedState, Part.Name, Part.ParentGroup.Name, Part.ParentGroup.Scene.Name);
336
364 string xml = String.Empty; 337 string xml = String.Empty;
365 338
366 try 339 try
@@ -380,13 +353,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
380 ScriptSerializer.Deserialize(xml, this); 353 ScriptSerializer.Deserialize(xml, this);
381 354
382 AsyncCommandManager.CreateFromData(Engine, 355 AsyncCommandManager.CreateFromData(Engine,
383 LocalID, ItemID, ObjectID, 356 LocalID, ItemID, ObjectID,
384 PluginData); 357 PluginData);
385 358
386// m_log.DebugFormat("[Script] Successfully retrieved state for script {0}.{1}", PrimName, m_ScriptName); 359 // m_log.DebugFormat("[Script] Successfully retrieved state for script {0}.{1}", PrimName, m_ScriptName);
387 360
388 Part.SetScriptEvents(ItemID, 361 Part.SetScriptEvents(ItemID,
389 (int)m_Script.GetStateEventFlags(State)); 362 (int)m_Script.GetStateEventFlags(State));
390 363
391 if (!Running) 364 if (!Running)
392 m_startOnInit = false; 365 m_startOnInit = false;
@@ -401,29 +374,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
401 m_SaveState = false; 374 m_SaveState = false;
402 m_startedFromSavedState = true; 375 m_startedFromSavedState = true;
403 } 376 }
377
378 // If this script is in an attachment then we no longer need the state file.
379 if (!StatePersistedHere)
380 RemoveState();
404 } 381 }
405 else 382 // else
406 { 383 // {
407 m_log.WarnFormat( 384 // m_log.WarnFormat(
408 "[SCRIPT INSTANCE]: Not starting script {0} (id {1}) in part {2} (id {3}) in object {4} in {5}. Unable to load script state file {6}. Memory limit exceeded.", 385 // "[SCRIPT INSTANCE]: Not starting script {0} (id {1}) in part {2} (id {3}) in object {4} in {5}. Unable to load script state file {6}. Memory limit exceeded.",
409 ScriptTask.Name, ScriptTask.ItemID, Part.Name, Part.UUID, Part.ParentGroup.Name, Engine.World.Name, savedState); 386 // ScriptTask.Name, ScriptTask.ItemID, Part.Name, Part.UUID, Part.ParentGroup.Name, Engine.World.Name, savedState);
410 } 387 // }
411 } 388 }
412 catch (Exception e) 389 catch (Exception e)
413 { 390 {
414 m_log.ErrorFormat( 391 m_log.ErrorFormat(
415 "[SCRIPT INSTANCE]: Not starting script {0} (id {1}) in part {2} (id {3}) in object {4} in {5}. Unable to load script state file {6}. XML is {7}. Exception {8}{9}", 392 "[SCRIPT INSTANCE]: Not starting script {0} (id {1}) in part {2} (id {3}) in object {4} in {5}. Unable to load script state file {6}. XML is {7}. Exception {8}{9}",
416 ScriptTask.Name, ScriptTask.ItemID, Part.Name, Part.UUID, Part.ParentGroup.Name, Engine.World.Name, savedState, xml, e.Message, e.StackTrace); 393 ScriptTask.Name, ScriptTask.ItemID, Part.Name, Part.UUID, Part.ParentGroup.Name, Engine.World.Name, savedState, xml, e.Message, e.StackTrace);
417 } 394 }
418 } 395 }
419// else 396 // else
420// { 397 // {
421// ScenePresence presence = Engine.World.GetScenePresence(part.OwnerID); 398 // m_log.DebugFormat(
422 399 // "[SCRIPT INSTANCE]: Did not find state for script {0} for {1} ({2}) at {3} in {4}",
423// if (presence != null && (!postOnRez)) 400 // ItemID, savedState, Part.Name, Part.ParentGroup.Name, Part.ParentGroup.Scene.Name);
424// presence.ControllingClient.SendAgentAlertMessage("Compile successful", false); 401 // }
425
426// }
427 402
428 return true; 403 return true;
429 } 404 }
@@ -522,8 +497,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
522 497
523 public void RemoveState() 498 public void RemoveState()
524 { 499 {
525 string savedState = Path.Combine(Path.GetDirectoryName(m_Assembly), 500 string savedState = Path.Combine(m_dataPath, ItemID.ToString() + ".state");
526 ItemID.ToString() + ".state"); 501
502// m_log.DebugFormat(
503// "[SCRIPT INSTANCE]: Deleting state {0} for script {1} (id {2}) in part {3} (id {4}) in object {5} in {6}.",
504// savedState, ScriptTask.Name, ScriptTask.ItemID, Part.Name, Part.UUID, Part.ParentGroup.Name, Engine.World.Name);
527 505
528 try 506 try
529 { 507 {
@@ -558,8 +536,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
558 Running = true; 536 Running = true;
559 537
560 TimeStarted = DateTime.Now; 538 TimeStarted = DateTime.Now;
561 MeasurementPeriodTickStart = Util.EnvironmentTickCount(); 539
562 MeasurementPeriodExecutionTime = 0; 540 // Note: we don't reset ExecutionTime. The reason is that runaway scripts are stopped and restarted
541 // automatically, and we *do* want to show that they had high CPU in that case. If we had reset
542 // ExecutionTime here then runaway scripts, paradoxically, would never show up in the "Top Scripts" dialog.
563 543
564 if (EventQueue.Count > 0) 544 if (EventQueue.Count > 0)
565 { 545 {
@@ -571,7 +551,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
571 } 551 }
572 } 552 }
573 553
574 public bool Stop(int timeout) 554 public bool Stop(int timeout, bool clearEventQueue = false)
575 { 555 {
576 if (DebugLevel >= 1) 556 if (DebugLevel >= 1)
577 m_log.DebugFormat( 557 m_log.DebugFormat(
@@ -582,6 +562,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
582 562
583 lock (EventQueue) 563 lock (EventQueue)
584 { 564 {
565 if (clearEventQueue)
566 ClearQueue();
567
585 if (!Running) 568 if (!Running)
586 return true; 569 return true;
587 570
@@ -671,6 +654,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
671 if (state == State) 654 if (state == State)
672 return; 655 return;
673 656
657<<<<<<< HEAD
658 EventParams lastTimerEv = null;
659
660 lock (EventQueue)
661 {
662 // Remove all queued events, remembering the last timer event
663 while (EventQueue.Count > 0)
664 {
665 EventParams tempv = (EventParams)EventQueue.Dequeue();
666 if (tempv.EventName == "timer") lastTimerEv = tempv;
667 }
668
669 // Post events
670 PostEvent(new EventParams("state_exit", new Object[0],
671 new DetectParams[0]));
672 PostEvent(new EventParams("state", new Object[] { state },
673 new DetectParams[0]));
674 PostEvent(new EventParams("state_entry", new Object[0],
675 new DetectParams[0]));
676
677 // Requeue the timer event after the state changing events
678 if (lastTimerEv != null) EventQueue.Enqueue(lastTimerEv);
679
680 // This will stop events from being queued and processed
681 // until the new state is started
682 m_StateChangeInProgress = true;
683 }
684
685=======
674 PostEvent(new EventParams("state_exit", new Object[0], 686 PostEvent(new EventParams("state_exit", new Object[0],
675 new DetectParams[0])); 687 new DetectParams[0]));
676 PostEvent(new EventParams("state", new Object[] { state }, 688 PostEvent(new EventParams("state", new Object[] { state },
@@ -678,6 +690,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
678 PostEvent(new EventParams("state_entry", new Object[0], 690 PostEvent(new EventParams("state_entry", new Object[0],
679 new DetectParams[0])); 691 new DetectParams[0]));
680 692
693>>>>>>> avn/ubitvar
681 throw new EventAbortException(); 694 throw new EventAbortException();
682 } 695 }
683 696
@@ -708,6 +721,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
708 721
709 lock (EventQueue) 722 lock (EventQueue)
710 { 723 {
724 // The only events that persist across state changes are timers
725 if (m_StateChangeInProgress && data.EventName != "timer")
726 return;
727
711 if (EventQueue.Count >= m_MaxScriptQueue) 728 if (EventQueue.Count >= m_MaxScriptQueue)
712 return; 729 return;
713 730
@@ -774,12 +791,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
774 791
775// m_log.DebugFormat("[XEngine]: EventProcessor() invoked for {0}.{1}", PrimName, ScriptName); 792// m_log.DebugFormat("[XEngine]: EventProcessor() invoked for {0}.{1}", PrimName, ScriptName);
776 793
794<<<<<<< HEAD
795 if (Suspended)
796 return 0;
797
798 ExecutionTimer.Restart();
799
800 try
801 {
802 return EventProcessorInt();
803 }
804 finally
805 {
806 ExecutionTimer.Stop();
807 ExecutionTime.AddSample(ExecutionTimer);
808 Part.ParentGroup.Scene.AddScriptExecutionTime(ExecutionTimer.ElapsedTicks);
809 }
810 }
811 }
812
813 private object EventProcessorInt()
814 {
815 EventParams data = null;
816
817 lock (EventQueue)
818 {
819 data = (EventParams)EventQueue.Dequeue();
820=======
777 if (Suspended) 821 if (Suspended)
778 return 0; 822 return 0;
779 823
780 lock (EventQueue) 824 lock (EventQueue)
781 { 825 {
782 data = (EventParams) EventQueue.Dequeue(); 826 data = (EventParams) EventQueue.Dequeue();
827>>>>>>> avn/ubitvar
783 if (data == null) // Shouldn't happen 828 if (data == null) // Shouldn't happen
784 { 829 {
785 if (EventQueue.Count > 0 && Running && !ShuttingDown) 830 if (EventQueue.Count > 0 && Running && !ShuttingDown)
@@ -804,6 +849,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
804 m_CollisionInQueue = false; 849 m_CollisionInQueue = false;
805 } 850 }
806 851
852<<<<<<< HEAD
853 if (DebugLevel >= 2)
854 m_log.DebugFormat(
855 "[SCRIPT INSTANCE]: Processing event {0} for {1}/{2}({3})/{4}({5}) @ {6}/{7}",
856 data.EventName,
857 ScriptName,
858 Part.Name,
859 Part.LocalId,
860 Part.ParentGroup.Name,
861 Part.ParentGroup.UUID,
862 Part.AbsolutePosition,
863 Part.ParentGroup.Scene.Name);
864
865 m_DetectParams = data.DetectParams;
866
867 if (data.EventName == "state") // Hardcoded state change
868 {
869 State = data.Params[0].ToString();
870
871 if (DebugLevel >= 1)
872 m_log.DebugFormat(
873 "[SCRIPT INSTANCE]: Changing state to {0} for {1}/{2}({3})/{4}({5}) @ {6}/{7}",
874 State,
875 ScriptName,
876 Part.Name,
877 Part.LocalId,
878 Part.ParentGroup.Name,
879 Part.ParentGroup.UUID,
880 Part.AbsolutePosition,
881 Part.ParentGroup.Scene.Name);
882=======
807 lock(m_Script) 883 lock(m_Script)
808 { 884 {
809 885
@@ -821,13 +897,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
821 part.ParentGroup.UUID, 897 part.ParentGroup.UUID,
822 part.AbsolutePosition, 898 part.AbsolutePosition,
823 part.ParentGroup.Scene.Name); 899 part.ParentGroup.Scene.Name);
900>>>>>>> avn/ubitvar
824 901
825 m_DetectParams = data.DetectParams; 902 AsyncCommandManager.StateChange(Engine,
903 LocalID, ItemID);
904 // we are effectively in the new state now, so we can resume queueing
905 // and processing other non-timer events
906 m_StateChangeInProgress = false;
826 907
827 if (data.EventName == "state") // Hardcoded state change 908 Part.SetScriptEvents(ItemID, (int)m_Script.GetStateEventFlags(State));
909 }
910 else
911 {
912 if (Engine.World.PipeEventsForScript(LocalID) ||
913 data.EventName == "control") // Don't freeze avies!
828 { 914 {
829 State = data.Params[0].ToString(); 915 // m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}",
916 // PrimName, ScriptName, data.EventName, State);
830 917
918<<<<<<< HEAD
919 try
920=======
831 if (DebugLevel >= 1) 921 if (DebugLevel >= 1)
832 m_log.DebugFormat( 922 m_log.DebugFormat(
833 "[SCRIPT INSTANCE]: Changing state to {0} for {1}/{2}({3})/{4}({5}) @ {6}/{7}", 923 "[SCRIPT INSTANCE]: Changing state to {0} for {1}/{2}({3})/{4}({5}) @ {6}/{7}",
@@ -853,41 +943,68 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
853 { 943 {
854 if (Engine.World.PipeEventsForScript(LocalID) || 944 if (Engine.World.PipeEventsForScript(LocalID) ||
855 data.EventName == "control") // Don't freeze avies! 945 data.EventName == "control") // Don't freeze avies!
946>>>>>>> avn/ubitvar
856 { 947 {
857 // m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}", 948 m_CurrentEvent = data.EventName;
858 // PrimName, ScriptName, data.EventName, State); 949 m_EventStart = DateTime.Now;
950 m_InEvent = true;
859 951
860 try 952 try
861 { 953 {
862 m_CurrentEvent = data.EventName;
863 m_EventStart = DateTime.Now;
864 m_InEvent = true;
865
866 int start = Util.EnvironmentTickCount();
867
868 // Reset the measurement period when we reach the end of the current one.
869 if (start - MeasurementPeriodTickStart > MaxMeasurementPeriod)
870 MeasurementPeriodTickStart = start;
871
872 m_Script.ExecuteEvent(State, data.EventName, data.Params); 954 m_Script.ExecuteEvent(State, data.EventName, data.Params);
873 955 }
874 MeasurementPeriodExecutionTime += Util.EnvironmentTickCount() - start; 956 finally
875 957 {
876 m_InEvent = false; 958 m_InEvent = false;
877 m_CurrentEvent = String.Empty; 959 m_CurrentEvent = String.Empty;
960 }
878 961
879 if (m_SaveState) 962 if (m_SaveState)
880 { 963 {
881 // This will be the very first event we deliver 964 // This will be the very first event we deliver
882 // (state_entry) in default state 965 // (state_entry) in default state
883 // 966 //
884 SaveState(m_Assembly); 967 SaveState();
885 968
886 m_SaveState = false; 969 m_SaveState = false;
887 }
888 } 970 }
889 catch (Exception e) 971 }
972 catch (Exception e)
973 {
974 // m_log.DebugFormat(
975 // "[SCRIPT] Exception in script {0} {1}: {2}{3}",
976 // ScriptName, ItemID, e.Message, e.StackTrace);
977
978 if ((!(e is TargetInvocationException)
979 || (!(e.InnerException is SelfDeleteException)
980 && !(e.InnerException is ScriptDeleteException)
981 && !(e.InnerException is ScriptCoopStopException)))
982 && !(e is ThreadAbortException))
890 { 983 {
984<<<<<<< HEAD
985 try
986 {
987 // DISPLAY ERROR INWORLD
988 string text = FormatException(e);
989
990 if (text.Length > 1000)
991 text = text.Substring(0, 1000);
992 Engine.World.SimChat(Utils.StringToBytes(text),
993 ChatTypeEnum.DebugChannel, 2147483647,
994 Part.AbsolutePosition,
995 Part.Name, Part.UUID, false);
996
997
998 m_log.Debug(string.Format(
999 "[SCRIPT INSTANCE]: Runtime error in script {0} (event {1}), part {2} {3} at {4} in {5} ",
1000 ScriptName,
1001 data.EventName,
1002 PrimName,
1003 Part.UUID,
1004 Part.AbsolutePosition,
1005 Part.ParentGroup.Scene.Name),
1006 e);
1007=======
891// m_log.DebugFormat( 1008// m_log.DebugFormat(
892// "[SCRIPT] Exception in script {0} {1}: {2}{3}", 1009// "[SCRIPT] Exception in script {0} {1}: {2}{3}",
893// ScriptName, ItemID, e.Message, e.StackTrace); 1010// ScriptName, ItemID, e.Message, e.StackTrace);
@@ -942,9 +1059,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
942 m_InSelfDelete = true; 1059 m_InSelfDelete = true;
943 if (part != null) 1060 if (part != null)
944 Engine.World.DeleteSceneObject(part.ParentGroup, false); 1061 Engine.World.DeleteSceneObject(part.ParentGroup, false);
1062>>>>>>> avn/ubitvar
945 } 1063 }
946 else if ((e is TargetInvocationException) && (e.InnerException is ScriptDeleteException)) 1064 catch (Exception)
947 { 1065 {
1066<<<<<<< HEAD
1067=======
948 m_InSelfDelete = true; 1068 m_InSelfDelete = true;
949 if (part != null) 1069 if (part != null)
950 part.Inventory.RemoveInventoryItem(ItemID); 1070 part.Inventory.RemoveInventoryItem(ItemID);
@@ -955,31 +1075,68 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
955 m_log.DebugFormat( 1075 m_log.DebugFormat(
956 "[SCRIPT INSTANCE]: Script {0}.{1} in event {2}, state {3} stopped co-operatively.", 1076 "[SCRIPT INSTANCE]: Script {0}.{1} in event {2}, state {3} stopped co-operatively.",
957 PrimName, ScriptName, data.EventName, State); 1077 PrimName, ScriptName, data.EventName, State);
1078>>>>>>> avn/ubitvar
958 } 1079 }
1080 // catch (Exception e2) // LEGIT: User Scripting
1081 // {
1082 // m_log.Error("[SCRIPT]: "+
1083 // "Error displaying error in-world: " +
1084 // e2.ToString());
1085 // m_log.Error("[SCRIPT]: " +
1086 // "Errormessage: Error compiling script:\r\n" +
1087 // e.ToString());
1088 // }
1089 }
1090 else if ((e is TargetInvocationException) && (e.InnerException is SelfDeleteException))
1091 {
1092 m_InSelfDelete = true;
1093 Engine.World.DeleteSceneObject(Part.ParentGroup, false);
1094 }
1095 else if ((e is TargetInvocationException) && (e.InnerException is ScriptDeleteException))
1096 {
1097 m_InSelfDelete = true;
1098 Part.Inventory.RemoveInventoryItem(ItemID);
1099 }
1100 else if ((e is TargetInvocationException) && (e.InnerException is ScriptCoopStopException))
1101 {
1102 if (DebugLevel >= 1)
1103 m_log.DebugFormat(
1104 "[SCRIPT INSTANCE]: Script {0}.{1} in event {2}, state {3} stopped co-operatively.",
1105 PrimName, ScriptName, data.EventName, State);
959 } 1106 }
960 } 1107 }
961 } 1108 }
1109 }
962 1110
963 // If there are more events and we are currently running and not shutting down, then ask the 1111 // If there are more events and we are currently running and not shutting down, then ask the
964 // script engine to run the next event. 1112 // script engine to run the next event.
965 lock (EventQueue) 1113 lock (EventQueue)
1114 {
1115 // Increase processed events counter and prevent wrap;
1116 if (++EventsProcessed == 1000000)
1117 EventsProcessed = 100000;
1118
1119 if ((EventsProcessed % 100000) == 0 && DebugLevel > 0)
966 { 1120 {
967 EventsProcessed++; 1121 m_log.DebugFormat("[SCRIPT INSTANCE]: Script \"{0}\" (Object \"{1}\" {2} @ {3}.{4}, Item ID {5}, Asset {6}) in event {7}: processed {8:n0} script events",
1122 ScriptTask.Name,
1123 Part.ParentGroup.Name, Part.ParentGroup.UUID, Part.ParentGroup.AbsolutePosition, Part.ParentGroup.Scene.Name,
1124 ScriptTask.ItemID, ScriptTask.AssetID, data.EventName, EventsProcessed);
1125 }
968 1126
969 if (EventQueue.Count > 0 && Running && !ShuttingDown) 1127 if (EventQueue.Count > 0 && Running && !ShuttingDown)
970 { 1128 {
971 m_CurrentWorkItem = Engine.QueueEventHandler(this); 1129 m_CurrentWorkItem = Engine.QueueEventHandler(this);
972 } 1130 }
973 else 1131 else
974 { 1132 {
975 m_CurrentWorkItem = null; 1133 m_CurrentWorkItem = null;
976 }
977 } 1134 }
1135 }
978 1136
979 m_DetectParams = null; 1137 m_DetectParams = null;
980 1138
981 return 0; 1139 return 0;
982 }
983 } 1140 }
984 1141
985 public int EventTime() 1142 public int EventTime()
@@ -1008,13 +1165,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
1008 AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID); 1165 AsyncCommandManager.RemoveScript(Engine, LocalID, ItemID);
1009 EventQueue.Clear(); 1166 EventQueue.Clear();
1010 m_Script.ResetVars(); 1167 m_Script.ResetVars();
1168 StartParam = 0;
1011 State = "default"; 1169 State = "default";
1012 1170
1013 part.SetScriptEvents(ItemID, 1171 part.SetScriptEvents(ItemID,
1014 (int)m_Script.GetStateEventFlags(State)); 1172 (int)m_Script.GetStateEventFlags(State));
1015 if (running) 1173 if (running)
1016 Start(); 1174 Start();
1017 m_SaveState = true; 1175
1176 m_SaveState = StatePersistedHere;
1177
1018 PostEvent(new EventParams("state_entry", 1178 PostEvent(new EventParams("state_entry",
1019 new Object[0], new DetectParams[0])); 1179 new Object[0], new DetectParams[0]));
1020 } 1180 }
@@ -1036,14 +1196,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
1036 1196
1037 EventQueue.Clear(); 1197 EventQueue.Clear();
1038 m_Script.ResetVars(); 1198 m_Script.ResetVars();
1199 string oldState = State;
1200 StartParam = 0;
1039 State = "default"; 1201 State = "default";
1040 1202
1041 part.SetScriptEvents(ItemID, 1203 part.SetScriptEvents(ItemID,
1042 (int)m_Script.GetStateEventFlags(State)); 1204 (int)m_Script.GetStateEventFlags(State));
1043 1205
1044 if (m_CurrentEvent != "state_entry") 1206 if (m_CurrentEvent != "state_entry" || oldState != "default")
1045 { 1207 {
1046 m_SaveState = true; 1208 m_SaveState = StatePersistedHere;
1047 PostEvent(new EventParams("state_entry", 1209 PostEvent(new EventParams("state_entry",
1048 new Object[0], new DetectParams[0])); 1210 new Object[0], new DetectParams[0]));
1049 throw new EventAbortException(); 1211 throw new EventAbortException();
@@ -1057,6 +1219,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
1057 1219
1058 public void SetVars(Dictionary<string, object> vars) 1220 public void SetVars(Dictionary<string, object> vars)
1059 { 1221 {
1222// foreach (KeyValuePair<string, object> kvp in vars)
1223// m_log.DebugFormat("[SCRIPT INSTANCE]: Setting var {0}={1}", kvp.Key, kvp.Value);
1224
1060 m_Script.SetVars(vars); 1225 m_Script.SetVars(vars);
1061 } 1226 }
1062 1227
@@ -1080,42 +1245,63 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
1080 return m_DetectParams[idx].Key; 1245 return m_DetectParams[idx].Key;
1081 } 1246 }
1082 1247
1083 public void SaveState(string assembly) 1248 public void SaveState()
1084 { 1249 {
1085 // If we're currently in an event, just tell it to save upon return 1250 if (!Running && !StayStopped)
1086 //
1087 if (m_InEvent)
1088 {
1089 m_SaveState = true;
1090 return; 1251 return;
1091 }
1092 1252
1253 // We cannot call this inside the EventQueue lock since it will currently take AsyncCommandManager.staticLock.
1254 // This may already be held by AsyncCommandManager.DoOneCmdHandlerPass() which in turn can take EventQueue
1255 // lock via ScriptInstance.PostEvent().
1093 PluginData = AsyncCommandManager.GetSerializationData(Engine, ItemID); 1256 PluginData = AsyncCommandManager.GetSerializationData(Engine, ItemID);
1094 1257
1095 string xml = ScriptSerializer.Serialize(this); 1258 // We need to lock here to avoid any race with a thread that is removing this script.
1096 1259 lock (EventQueue)
1097 // Compare hash of the state we just just created with the state last written to disk
1098 // If the state is different, update the disk file.
1099 UUID hash = UUID.Parse(Utils.MD5String(xml));
1100
1101 if (hash != m_CurrentStateHash)
1102 { 1260 {
1103 try 1261 // Check again to avoid a race with a thread in Stop()
1262 if (!Running && !StayStopped)
1263 return;
1264
1265 // If we're currently in an event, just tell it to save upon return
1266 //
1267 if (m_InEvent)
1104 { 1268 {
1105 FileStream fs = File.Create(Path.Combine(Path.GetDirectoryName(assembly), ItemID.ToString() + ".state")); 1269 m_SaveState = true;
1106 Byte[] buf = Util.UTF8NoBomEncoding.GetBytes(xml); 1270 return;
1107 fs.Write(buf, 0, buf.Length);
1108 fs.Close();
1109 } 1271 }
1110 catch(Exception) 1272
1273 // m_log.DebugFormat(
1274 // "[SCRIPT INSTANCE]: Saving state for script {0} (id {1}) in part {2} (id {3}) in object {4} in {5}",
1275 // ScriptTask.Name, ScriptTask.ItemID, Part.Name, Part.UUID, Part.ParentGroup.Name, Engine.World.Name);
1276
1277 string xml = ScriptSerializer.Serialize(this);
1278
1279 // Compare hash of the state we just just created with the state last written to disk
1280 // If the state is different, update the disk file.
1281 UUID hash = UUID.Parse(Utils.MD5String(xml));
1282
1283 if (hash != m_CurrentStateHash)
1111 { 1284 {
1112 // m_log.Error("Unable to save xml\n"+e.ToString()); 1285 try
1286 {
1287 using (FileStream fs = File.Create(Path.Combine(m_dataPath, ItemID.ToString() + ".state")))
1288 {
1289 Byte[] buf = Util.UTF8NoBomEncoding.GetBytes(xml);
1290 fs.Write(buf, 0, buf.Length);
1291 }
1292 }
1293 catch(Exception)
1294 {
1295 // m_log.Error("Unable to save xml\n"+e.ToString());
1296 }
1297 //if (!File.Exists(Path.Combine(Path.GetDirectoryName(assembly), ItemID.ToString() + ".state")))
1298 //{
1299 // throw new Exception("Completed persistence save, but no file was created");
1300 //}
1301 m_CurrentStateHash = hash;
1113 } 1302 }
1114 //if (!File.Exists(Path.Combine(Path.GetDirectoryName(assembly), ItemID.ToString() + ".state"))) 1303
1115 //{ 1304 StayStopped = false;
1116 // throw new Exception("Completed persistence save, but no file was created");
1117 //}
1118 m_CurrentStateHash = hash;
1119 } 1305 }
1120 } 1306 }
1121 1307
@@ -1185,7 +1371,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
1185 1371
1186 public string GetAssemblyName() 1372 public string GetAssemblyName()
1187 { 1373 {
1188 return m_Assembly; 1374 return m_assemblyPath;
1189 } 1375 }
1190 1376
1191 public string GetXMLState() 1377 public string GetXMLState()
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs
index ac822c6..5b9794b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs
@@ -37,7 +37,6 @@ using OpenSim.Region.Framework.Scenes;
37using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.ScriptEngine.XEngine; 38using OpenSim.Region.ScriptEngine.XEngine;
39using OpenSim.Tests.Common; 39using OpenSim.Tests.Common;
40using OpenSim.Tests.Common.Mock;
41 40
42namespace OpenSim.Region.ScriptEngine.Shared.Instance.Tests 41namespace OpenSim.Region.ScriptEngine.Shared.Instance.Tests
43{ 42{
@@ -77,6 +76,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance.Tests
77 //AppDomain.CurrentDomain.SetData("APPBASE", Environment.CurrentDirectory + "/bin"); 76 //AppDomain.CurrentDomain.SetData("APPBASE", Environment.CurrentDirectory + "/bin");
78// Console.WriteLine(AppDomain.CurrentDomain.BaseDirectory); 77// Console.WriteLine(AppDomain.CurrentDomain.BaseDirectory);
79 m_xEngine = new OpenSim.Region.ScriptEngine.XEngine.XEngine(); 78 m_xEngine = new OpenSim.Region.ScriptEngine.XEngine.XEngine();
79 m_xEngine.DebugLevel = 1;
80 80
81 IniConfigSource configSource = new IniConfigSource(); 81 IniConfigSource configSource = new IniConfigSource();
82 82
@@ -337,7 +337,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance.Tests
337 public void TestStopOnInfiniteJumpLoop() 337 public void TestStopOnInfiniteJumpLoop()
338 { 338 {
339 TestHelpers.InMethod(); 339 TestHelpers.InMethod();
340// TestHelpers.EnableLogging(); 340 TestHelpers.EnableLogging();
341 341
342 string script = 342 string script =
343@"default 343@"default
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index 8f02230..885559a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -102,19 +102,31 @@ namespace OpenSim.Region.ScriptEngine.Shared
102 102
103 public override string ToString() 103 public override string ToString()
104 { 104 {
105<<<<<<< HEAD
106 string s=String.Format(Culture.FormatProvider,"<{0:0.000000},{1:0.000000},{2:0.000000}>", x, y, z);
107=======
105 string s = String.Format(Culture.FormatProvider, "<{0:0.000000}, {1:0.000000}, {2:0.000000}>", x, y, z); 108 string s = String.Format(Culture.FormatProvider, "<{0:0.000000}, {1:0.000000}, {2:0.000000}>", x, y, z);
109>>>>>>> avn/ubitvar
106 return s; 110 return s;
107 } 111 }
108 112
109 public static explicit operator LSLString(Vector3 vec) 113 public static explicit operator LSLString(Vector3 vec)
110 { 114 {
115<<<<<<< HEAD
116 string s=String.Format(Culture.FormatProvider,"<{0:0.000000},{1:0.000000},{2:0.000000}>", vec.x, vec.y, vec.z);
117=======
111 string s = String.Format("<{0:0.000000}, {1:0.000000}, {2:0.000000}>", vec.x, vec.y, vec.z); 118 string s = String.Format("<{0:0.000000}, {1:0.000000}, {2:0.000000}>", vec.x, vec.y, vec.z);
119>>>>>>> avn/ubitvar
112 return new LSLString(s); 120 return new LSLString(s);
113 } 121 }
114 122
115 public static explicit operator string(Vector3 vec) 123 public static explicit operator string(Vector3 vec)
116 { 124 {
125<<<<<<< HEAD
126 string s=String.Format(Culture.FormatProvider,"<{0:0.000000},{1:0.000000},{2:0.000000}>", vec.x, vec.y, vec.z);
127=======
117 string s = String.Format("<{0:0.000000}, {1:0.000000}, {2:0.000000}>", vec.x, vec.y, vec.z); 128 string s = String.Format("<{0:0.000000}, {1:0.000000}, {2:0.000000}>", vec.x, vec.y, vec.z);
129>>>>>>> avn/ubitvar
118 return s; 130 return s;
119 } 131 }
120 132
@@ -502,7 +514,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
502 } 514 }
503 515
504 [Serializable] 516 [Serializable]
505 public class list 517 public struct list
506 { 518 {
507 private object[] m_data; 519 private object[] m_data;
508 520
@@ -583,7 +595,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
583 /// <param name='itemIndex'></param> 595 /// <param name='itemIndex'></param>
584 public Type GetLSLListItemType(int itemIndex) 596 public Type GetLSLListItemType(int itemIndex)
585 { 597 {
586 return m_data[itemIndex].GetType(); 598 return Data[itemIndex].GetType();
587 } 599 }
588 600
589 /// <summary> 601 /// <summary>
@@ -600,107 +612,107 @@ namespace OpenSim.Region.ScriptEngine.Shared
600 /// <param name='itemIndex'></param> 612 /// <param name='itemIndex'></param>
601 public LSL_Types.LSLFloat GetLSLFloatItem(int itemIndex) 613 public LSL_Types.LSLFloat GetLSLFloatItem(int itemIndex)
602 { 614 {
603 if (m_data[itemIndex] is LSL_Types.LSLInteger) 615 if (Data[itemIndex] is LSL_Types.LSLInteger)
604 { 616 {
605 return (LSL_Types.LSLInteger)m_data[itemIndex]; 617 return (LSL_Types.LSLInteger)Data[itemIndex];
606 } 618 }
607 else if (m_data[itemIndex] is Int32) 619 else if (Data[itemIndex] is Int32)
608 { 620 {
609 return new LSL_Types.LSLFloat((int)m_data[itemIndex]); 621 return new LSL_Types.LSLFloat((int)Data[itemIndex]);
610 } 622 }
611 else if (m_data[itemIndex] is float) 623 else if (Data[itemIndex] is float)
612 { 624 {
613 return new LSL_Types.LSLFloat((float)m_data[itemIndex]); 625 return new LSL_Types.LSLFloat((float)Data[itemIndex]);
614 } 626 }
615 else if (m_data[itemIndex] is Double) 627 else if (Data[itemIndex] is Double)
616 { 628 {
617 return new LSL_Types.LSLFloat((Double)m_data[itemIndex]); 629 return new LSL_Types.LSLFloat((Double)Data[itemIndex]);
618 } 630 }
619 else if (m_data[itemIndex] is LSL_Types.LSLString) 631 else if (Data[itemIndex] is LSL_Types.LSLString)
620 { 632 {
621 return new LSL_Types.LSLFloat(m_data[itemIndex].ToString()); 633 return new LSL_Types.LSLFloat(Data[itemIndex].ToString());
622 } 634 }
623 else 635 else
624 { 636 {
625 return (LSL_Types.LSLFloat)m_data[itemIndex]; 637 return (LSL_Types.LSLFloat)Data[itemIndex];
626 } 638 }
627 } 639 }
628 640
629 public LSL_Types.LSLString GetLSLStringItem(int itemIndex) 641 public LSL_Types.LSLString GetLSLStringItem(int itemIndex)
630 { 642 {
631 if (m_data[itemIndex] is LSL_Types.key) 643 if (Data[itemIndex] is LSL_Types.key)
632 { 644 {
633 return (LSL_Types.key)m_data[itemIndex]; 645 return (LSL_Types.key)Data[itemIndex];
634 } 646 }
635 else 647 else
636 { 648 {
637 return new LSL_Types.LSLString(m_data[itemIndex].ToString()); 649 return new LSL_Types.LSLString(Data[itemIndex].ToString());
638 } 650 }
639 } 651 }
640 652
641 public LSL_Types.LSLInteger GetLSLIntegerItem(int itemIndex) 653 public LSL_Types.LSLInteger GetLSLIntegerItem(int itemIndex)
642 { 654 {
643 if (m_data[itemIndex] is LSL_Types.LSLInteger) 655 if (Data[itemIndex] is LSL_Types.LSLInteger)
644 return (LSL_Types.LSLInteger)m_data[itemIndex]; 656 return (LSL_Types.LSLInteger)Data[itemIndex];
645 if (m_data[itemIndex] is LSL_Types.LSLFloat) 657 if (Data[itemIndex] is LSL_Types.LSLFloat)
646 return new LSLInteger((int)m_data[itemIndex]); 658 return new LSLInteger((int)Data[itemIndex]);
647 else if (m_data[itemIndex] is Int32) 659 else if (Data[itemIndex] is Int32)
648 return new LSLInteger((int)m_data[itemIndex]); 660 return new LSLInteger((int)Data[itemIndex]);
649 else if (m_data[itemIndex] is LSL_Types.LSLString) 661 else if (Data[itemIndex] is LSL_Types.LSLString)
650 return new LSLInteger(m_data[itemIndex].ToString()); 662 return new LSLInteger(Data[itemIndex].ToString());
651 else 663 else
652 throw new InvalidCastException(string.Format( 664 throw new InvalidCastException(string.Format(
653 "{0} expected but {1} given", 665 "{0} expected but {1} given",
654 typeof(LSL_Types.LSLInteger).Name, 666 typeof(LSL_Types.LSLInteger).Name,
655 m_data[itemIndex] != null ? 667 Data[itemIndex] != null ?
656 m_data[itemIndex].GetType().Name : "null")); 668 Data[itemIndex].GetType().Name : "null"));
657 } 669 }
658 670
659 public LSL_Types.Vector3 GetVector3Item(int itemIndex) 671 public LSL_Types.Vector3 GetVector3Item(int itemIndex)
660 { 672 {
661 if (m_data[itemIndex] is LSL_Types.Vector3) 673 if (Data[itemIndex] is LSL_Types.Vector3)
662 { 674 {
663 return (LSL_Types.Vector3)m_data[itemIndex]; 675 return (LSL_Types.Vector3)Data[itemIndex];
664 } 676 }
665 else if(m_data[itemIndex] is OpenMetaverse.Vector3) 677 else if(Data[itemIndex] is OpenMetaverse.Vector3)
666 { 678 {
667 return new LSL_Types.Vector3( 679 return new LSL_Types.Vector3(
668 (OpenMetaverse.Vector3)m_data[itemIndex]); 680 (OpenMetaverse.Vector3)Data[itemIndex]);
669 } 681 }
670 else 682 else
671 { 683 {
672 throw new InvalidCastException(string.Format( 684 throw new InvalidCastException(string.Format(
673 "{0} expected but {1} given", 685 "{0} expected but {1} given",
674 typeof(LSL_Types.Vector3).Name, 686 typeof(LSL_Types.Vector3).Name,
675 m_data[itemIndex] != null ? 687 Data[itemIndex] != null ?
676 m_data[itemIndex].GetType().Name : "null")); 688 Data[itemIndex].GetType().Name : "null"));
677 } 689 }
678 } 690 }
679 691
680 public LSL_Types.Quaternion GetQuaternionItem(int itemIndex) 692 public LSL_Types.Quaternion GetQuaternionItem(int itemIndex)
681 { 693 {
682 if (m_data[itemIndex] is LSL_Types.Quaternion) 694 if (Data[itemIndex] is LSL_Types.Quaternion)
683 { 695 {
684 return (LSL_Types.Quaternion)m_data[itemIndex]; 696 return (LSL_Types.Quaternion)Data[itemIndex];
685 } 697 }
686 else if(m_data[itemIndex] is OpenMetaverse.Quaternion) 698 else if(Data[itemIndex] is OpenMetaverse.Quaternion)
687 { 699 {
688 return new LSL_Types.Quaternion( 700 return new LSL_Types.Quaternion(
689 (OpenMetaverse.Quaternion)m_data[itemIndex]); 701 (OpenMetaverse.Quaternion)Data[itemIndex]);
690 } 702 }
691 else 703 else
692 { 704 {
693 throw new InvalidCastException(string.Format( 705 throw new InvalidCastException(string.Format(
694 "{0} expected but {1} given", 706 "{0} expected but {1} given",
695 typeof(LSL_Types.Quaternion).Name, 707 typeof(LSL_Types.Quaternion).Name,
696 m_data[itemIndex] != null ? 708 Data[itemIndex] != null ?
697 m_data[itemIndex].GetType().Name : "null")); 709 Data[itemIndex].GetType().Name : "null"));
698 } 710 }
699 } 711 }
700 712
701 public LSL_Types.key GetKeyItem(int itemIndex) 713 public LSL_Types.key GetKeyItem(int itemIndex)
702 { 714 {
703 return (LSL_Types.key)m_data[itemIndex]; 715 return (LSL_Types.key)Data[itemIndex];
704 } 716 }
705 717
706 public static list operator +(list a, list b) 718 public static list operator +(list a, list b)
@@ -715,10 +727,17 @@ namespace OpenSim.Region.ScriptEngine.Shared
715 private void ExtendAndAdd(object o) 727 private void ExtendAndAdd(object o)
716 { 728 {
717 object[] tmp; 729 object[] tmp;
730<<<<<<< HEAD
731 tmp = new object[Data.Length + 1];
732 Data.CopyTo(tmp, 0);
733 tmp.SetValue(o, tmp.Length - 1);
734 Data = tmp;
735=======
718 tmp = new object[m_data.Length + 1]; 736 tmp = new object[m_data.Length + 1];
719 m_data.CopyTo(tmp, 0); 737 m_data.CopyTo(tmp, 0);
720 tmp.SetValue(o, tmp.Length - 1); 738 tmp.SetValue(o, tmp.Length - 1);
721 m_data = tmp; 739 m_data = tmp;
740>>>>>>> avn/ubitvar
722 } 741 }
723 742
724 public static list operator +(list a, LSLString s) 743 public static list operator +(list a, LSLString s)
@@ -758,10 +777,10 @@ namespace OpenSim.Region.ScriptEngine.Shared
758 public void Add(object o) 777 public void Add(object o)
759 { 778 {
760 object[] tmp; 779 object[] tmp;
761 tmp = new object[m_data.Length + 1]; 780 tmp = new object[Data.Length + 1];
762 m_data.CopyTo(tmp, 0); 781 Data.CopyTo(tmp, 0);
763 tmp[m_data.Length] = o; 782 tmp[Data.Length] = o; // Since this is tmp.Length - 1
764 m_data = tmp; 783 Data = tmp;
765 } 784 }
766 785
767 public bool Contains(object o) 786 public bool Contains(object o)
@@ -788,53 +807,53 @@ namespace OpenSim.Region.ScriptEngine.Shared
788 Object[] ret; 807 Object[] ret;
789 808
790 if (start < 0) 809 if (start < 0)
791 start=m_data.Length+start; 810 start=Data.Length+start;
792 811
793 if (start < 0) 812 if (start < 0)
794 start=0; 813 start=0;
795 814
796 if (end < 0) 815 if (end < 0)
797 end=m_data.Length+end; 816 end=Data.Length+end;
798 if (end < 0) 817 if (end < 0)
799 end=0; 818 end=0;
800 819
801 if (start > end) 820 if (start > end)
802 { 821 {
803 if (end >= m_data.Length) 822 if (end >= Data.Length)
804 return new list(new Object[0]); 823 return new list(new Object[0]);
805 824
806 if (start >= m_data.Length) 825 if (start >= Data.Length)
807 start=m_data.Length-1; 826 start=Data.Length-1;
808 827
809 return GetSublist(end, start); 828 return GetSublist(end, start);
810 } 829 }
811 830
812 // start >= 0 && end >= 0 here 831 // start >= 0 && end >= 0 here
813 if (start >= m_data.Length) 832 if (start >= Data.Length)
814 { 833 {
815 ret=new Object[m_data.Length]; 834 ret=new Object[Data.Length];
816 Array.Copy(m_data, 0, ret, 0, m_data.Length); 835 Array.Copy(Data, 0, ret, 0, Data.Length);
817 836
818 return new list(ret); 837 return new list(ret);
819 } 838 }
820 839
821 if (end >= m_data.Length) 840 if (end >= Data.Length)
822 end=m_data.Length-1; 841 end=Data.Length-1;
823 842
824 // now, this makes the math easier 843 // now, this makes the math easier
825 int remove=end+1-start; 844 int remove=end+1-start;
826 845
827 ret=new Object[m_data.Length-remove]; 846 ret=new Object[Data.Length-remove];
828 if (ret.Length == 0) 847 if (ret.Length == 0)
829 return new list(ret); 848 return new list(ret);
830 849
831 int src; 850 int src;
832 int dest=0; 851 int dest=0;
833 852
834 for (src = 0; src < m_data.Length; src++) 853 for (src = 0; src < Data.Length; src++)
835 { 854 {
836 if (src < start || src > end) 855 if (src < start || src > end)
837 ret[dest++]=m_data[src]; 856 ret[dest++]=Data[src];
838 } 857 }
839 858
840 return new list(ret); 859 return new list(ret);
@@ -854,12 +873,12 @@ namespace OpenSim.Region.ScriptEngine.Shared
854 873
855 if (start < 0) 874 if (start < 0)
856 { 875 {
857 start = m_data.Length + start; 876 start = Data.Length + start;
858 } 877 }
859 878
860 if (end < 0) 879 if (end < 0)
861 { 880 {
862 end = m_data.Length + end; 881 end = Data.Length + end;
863 } 882 }
864 883
865 // The conventional case is start <= end 884 // The conventional case is start <= end
@@ -873,15 +892,15 @@ namespace OpenSim.Region.ScriptEngine.Shared
873 892
874 // Start sublist beyond length 893 // Start sublist beyond length
875 // Also deals with start AND end still negative 894 // Also deals with start AND end still negative
876 if (start >= m_data.Length || end < 0) 895 if (start >= Data.Length || end < 0)
877 { 896 {
878 return new list(); 897 return new list();
879 } 898 }
880 899
881 // Sublist extends beyond the end of the supplied list 900 // Sublist extends beyond the end of the supplied list
882 if (end >= m_data.Length) 901 if (end >= Data.Length)
883 { 902 {
884 end = m_data.Length - 1; 903 end = Data.Length - 1;
885 } 904 }
886 905
887 // Sublist still starts before the beginning of the list 906 // Sublist still starts before the beginning of the list
@@ -892,7 +911,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
892 911
893 ret = new object[end - start + 1]; 912 ret = new object[end - start + 1];
894 913
895 Array.Copy(m_data, start, ret, 0, end - start + 1); 914 Array.Copy(Data, start, ret, 0, end - start + 1);
896 915
897 return new list(ret); 916 return new list(ret);
898 917
@@ -903,7 +922,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
903 else 922 else
904 { 923 {
905 924
906 list result = null; 925 list result;
907 926
908 // If end is negative, then prefix list is empty 927 // If end is negative, then prefix list is empty
909 if (end < 0) 928 if (end < 0)
@@ -925,7 +944,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
925 944
926 // If start is outside of list, then just return 945 // If start is outside of list, then just return
927 // the prefix, whatever it is. 946 // the prefix, whatever it is.
928 if (start >= m_data.Length) 947 if (start >= Data.Length)
929 { 948 {
930 return result; 949 return result;
931 } 950 }
@@ -1106,11 +1125,11 @@ namespace OpenSim.Region.ScriptEngine.Shared
1106 { 1125 {
1107 string output; 1126 string output;
1108 output = String.Empty; 1127 output = String.Empty;
1109 if (m_data.Length == 0) 1128 if (Data.Length == 0)
1110 { 1129 {
1111 return String.Empty; 1130 return String.Empty;
1112 } 1131 }
1113 foreach (object o in m_data) 1132 foreach (object o in Data)
1114 { 1133 {
1115 output = output + o.ToString(); 1134 output = output + o.ToString();
1116 } 1135 }
@@ -1305,12 +1324,12 @@ namespace OpenSim.Region.ScriptEngine.Shared
1305 public string ToPrettyString() 1324 public string ToPrettyString()
1306 { 1325 {
1307 string output; 1326 string output;
1308 if (m_data.Length == 0) 1327 if (Data.Length == 0)
1309 { 1328 {
1310 return "[]"; 1329 return "[]";
1311 } 1330 }
1312 output = "["; 1331 output = "[";
1313 foreach (object o in m_data) 1332 foreach (object o in Data)
1314 { 1333 {
1315 if (o is String) 1334 if (o is String)
1316 { 1335 {
@@ -1377,27 +1396,6 @@ namespace OpenSim.Region.ScriptEngine.Shared
1377 } 1396 }
1378 } 1397 }
1379 1398
1380 //
1381 // BELOW IS WORK IN PROGRESS... IT WILL CHANGE, SO DON'T USE YET! :)
1382 //
1383
1384 public struct StringTest
1385 {
1386 // Our own little string
1387 internal string actualString;
1388 public static implicit operator bool(StringTest mString)
1389 {
1390 if (mString.actualString.Length == 0)
1391 return true;
1392 return false;
1393 }
1394 public override string ToString()
1395 {
1396 return actualString;
1397 }
1398
1399 }
1400
1401 [Serializable] 1399 [Serializable]
1402 public struct key 1400 public struct key
1403 { 1401 {
@@ -1451,6 +1449,16 @@ namespace OpenSim.Region.ScriptEngine.Shared
1451 return false; 1449 return false;
1452 } 1450 }
1453 } 1451 }
1452
1453 public static bool operator true(key k)
1454 {
1455 return (Boolean)k;
1456 }
1457
1458 public static bool operator false(key k)
1459 {
1460 return !(Boolean)k;
1461 }
1454 1462
1455 static public implicit operator key(string s) 1463 static public implicit operator key(string s)
1456 { 1464 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs
new file mode 100644
index 0000000..af1da7c
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs
@@ -0,0 +1,158 @@
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
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using System.Text;
32using log4net;
33using Nini.Config;
34using NUnit.Framework;
35using OpenMetaverse;
36using OpenMetaverse.Assets;
37using OpenMetaverse.StructuredData;
38using OpenSim.Framework;
39using OpenSim.Region.CoreModules.Avatar.AvatarFactory;
40using OpenSim.Region.OptionalModules.World.NPC;
41using OpenSim.Region.Framework.Scenes;
42using OpenSim.Region.ScriptEngine.Shared;
43using OpenSim.Region.ScriptEngine.Shared.Api;
44using OpenSim.Region.ScriptEngine.Shared.Instance;
45using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
46using OpenSim.Services.Interfaces;
47using OpenSim.Tests.Common;
48using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
49using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
50
51namespace OpenSim.Region.ScriptEngine.Shared.Tests
52{
53 /// <summary>
54 /// Tests relating directly to avatars
55 /// </summary>
56 [TestFixture]
57 public class LSL_ApiAvatarTests : OpenSimTestCase
58 {
59 protected Scene m_scene;
60 protected XEngine.XEngine m_engine;
61
62 [SetUp]
63 public override void SetUp()
64 {
65 base.SetUp();
66
67 IConfigSource initConfigSource = new IniConfigSource();
68 IConfig config = initConfigSource.AddConfig("XEngine");
69 config.Set("Enabled", "true");
70
71 m_scene = new SceneHelpers().SetupScene();
72 SceneHelpers.SetupSceneModules(m_scene, initConfigSource);
73
74 m_engine = new XEngine.XEngine();
75 m_engine.Initialise(initConfigSource);
76 m_engine.AddRegion(m_scene);
77 }
78
79 /// <summary>
80 /// Test llSetLinkPrimtiveParams for agents.
81 /// </summary>
82 /// <remarks>
83 /// Also testing entity updates here as well. Possibly that's putting 2 different concerns into one test and
84 /// this should be separated.
85 /// </remarks>
86 [Test]
87 public void TestllSetLinkPrimitiveParamsForAgent()
88 {
89 TestHelpers.InMethod();
90// TestHelpers.EnableLogging();
91
92 UUID userId = TestHelpers.ParseTail(0x1);
93
94 SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart;
95 part.RotationOffset = new Quaternion(0.7071068f, 0, 0, 0.7071068f);
96
97 LSL_Api apiGrp1 = new LSL_Api();
98 apiGrp1.Initialize(m_engine, part, null);
99
100 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
101
102 // sp has to be less than 10 meters away from 0, 0, 0 (default part position)
103 Vector3 startPos = new Vector3(3, 2, 1);
104 sp.AbsolutePosition = startPos;
105
106 sp.HandleAgentRequestSit(sp.ControllingClient, sp.UUID, part.UUID, Vector3.Zero);
107
108 int entityUpdates = 0;
109 ((TestClient)sp.ControllingClient).OnReceivedEntityUpdate += (entity, flags) => { if (entity is ScenePresence) { entityUpdates++; }};
110
111 // Test position
112 {
113 Vector3 newPos = new Vector3(1, 2, 3);
114 apiGrp1.llSetLinkPrimitiveParams(2, new LSL_Types.list(ScriptBaseClass.PRIM_POSITION, newPos));
115
116 Assert.That(sp.OffsetPosition, Is.EqualTo(newPos));
117
118 m_scene.Update(1);
119 Assert.That(entityUpdates, Is.EqualTo(1));
120 }
121
122 // Test small reposition
123 {
124 Vector3 newPos = new Vector3(1.001f, 2, 3);
125 apiGrp1.llSetLinkPrimitiveParams(2, new LSL_Types.list(ScriptBaseClass.PRIM_POSITION, newPos));
126
127 Assert.That(sp.OffsetPosition, Is.EqualTo(newPos));
128
129 m_scene.Update(1);
130 Assert.That(entityUpdates, Is.EqualTo(2));
131 }
132
133 // Test world rotation
134 {
135 Quaternion newRot = new Quaternion(0, 0.7071068f, 0, 0.7071068f);
136 apiGrp1.llSetLinkPrimitiveParams(2, new LSL_Types.list(ScriptBaseClass.PRIM_ROTATION, newRot));
137
138 Assert.That(
139 sp.Rotation, new QuaternionToleranceConstraint(part.GetWorldRotation() * newRot, 0.000001));
140
141 m_scene.Update(1);
142 Assert.That(entityUpdates, Is.EqualTo(3));
143 }
144
145 // Test local rotation
146 {
147 Quaternion newRot = new Quaternion(0, 0.7071068f, 0, 0.7071068f);
148 apiGrp1.llSetLinkPrimitiveParams(2, new LSL_Types.list(ScriptBaseClass.PRIM_ROT_LOCAL, newRot));
149
150 Assert.That(
151 sp.Rotation, new QuaternionToleranceConstraint(newRot, 0.000001));
152
153 m_scene.Update(1);
154 Assert.That(entityUpdates, Is.EqualTo(4));
155 }
156 }
157 }
158}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs
index ab44e38..9a5ebce 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs
@@ -45,7 +45,6 @@ using OpenSim.Region.ScriptEngine.Shared.Api;
45using OpenSim.Region.ScriptEngine.Shared.ScriptBase; 45using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
46using OpenSim.Services.Interfaces; 46using OpenSim.Services.Interfaces;
47using OpenSim.Tests.Common; 47using OpenSim.Tests.Common;
48using OpenSim.Tests.Common.Mock;
49 48
50namespace OpenSim.Region.ScriptEngine.Shared.Tests 49namespace OpenSim.Region.ScriptEngine.Shared.Tests
51{ 50{
@@ -101,12 +100,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
101 SceneHelpers.SetupSceneModules(m_scene, new IniConfigSource(), m_engine, m_urlModule); 100 SceneHelpers.SetupSceneModules(m_scene, new IniConfigSource(), m_engine, m_urlModule);
102 101
103 SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene); 102 SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene);
104 m_scriptItem = TaskInventoryHelpers.AddScript(m_scene, so.RootPart); 103 m_scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, so.RootPart);
105 104
106 // This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm. 105 // This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm.
107 // Possibly this could be done and we could obtain it directly from the MockScriptEngine. 106 // Possibly this could be done and we could obtain it directly from the MockScriptEngine.
108 m_lslApi = new LSL_Api(); 107 m_lslApi = new LSL_Api();
109 m_lslApi.Initialize(m_engine, so.RootPart, m_scriptItem, null); 108 m_lslApi.Initialize(m_engine, so.RootPart, m_scriptItem);
110 } 109 }
111 110
112 [TearDown] 111 [TearDown]
@@ -246,4 +245,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
246 } 245 }
247 } 246 }
248 } 247 }
249} \ No newline at end of file 248}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
index 6dd6c17..9b7cab2 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
@@ -44,7 +44,7 @@ using OpenSim.Region.ScriptEngine.Shared.Api;
44using OpenSim.Region.ScriptEngine.Shared.Instance; 44using OpenSim.Region.ScriptEngine.Shared.Instance;
45using OpenSim.Services.Interfaces; 45using OpenSim.Services.Interfaces;
46using OpenSim.Tests.Common; 46using OpenSim.Tests.Common;
47using OpenSim.Tests.Common.Mock; 47using PermissionMask = OpenSim.Framework.PermissionMask;
48 48
49namespace OpenSim.Region.ScriptEngine.Shared.Tests 49namespace OpenSim.Region.ScriptEngine.Shared.Tests
50{ 50{
@@ -91,10 +91,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
91 91
92 // Create an object embedded inside the first 92 // Create an object embedded inside the first
93 UUID itemId = TestHelpers.ParseTail(0x20); 93 UUID itemId = TestHelpers.ParseTail(0x20);
94 TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, userId); 94 TaskInventoryHelpers.AddSceneObject(m_scene.AssetService, so1.RootPart, inventoryItemName, itemId, userId);
95 95
96 LSL_Api api = new LSL_Api(); 96 LSL_Api api = new LSL_Api();
97 api.Initialize(m_engine, so1.RootPart, null, null); 97 api.Initialize(m_engine, so1.RootPart, null);
98 98
99 // Create a second object 99 // Create a second object
100 SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, userId, "so2", 0x100); 100 SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, userId, "so2", 0x100);
@@ -127,17 +127,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
127 SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10); 127 SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10);
128 m_scene.AddSceneObject(so1); 128 m_scene.AddSceneObject(so1);
129 LSL_Api api = new LSL_Api(); 129 LSL_Api api = new LSL_Api();
130 api.Initialize(m_engine, so1.RootPart, null, null); 130 api.Initialize(m_engine, so1.RootPart, null);
131 131
132 // Create an object embedded inside the first 132 // Create an object embedded inside the first
133 UUID itemId = TestHelpers.ParseTail(0x20); 133 UUID itemId = TestHelpers.ParseTail(0x20);
134 TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, user1Id); 134 TaskInventoryHelpers.AddSceneObject(m_scene.AssetService, so1.RootPart, inventoryItemName, itemId, user1Id);
135 135
136 // Create a second object 136 // Create a second object
137 SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100); 137 SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100);
138 m_scene.AddSceneObject(so2); 138 m_scene.AddSceneObject(so2);
139 LSL_Api api2 = new LSL_Api(); 139 LSL_Api api2 = new LSL_Api();
140 api2.Initialize(m_engine, so2.RootPart, null, null); 140 api2.Initialize(m_engine, so2.RootPart, null);
141 141
142 // *** Firstly, we test where llAllowInventoryDrop() has not been called. *** 142 // *** Firstly, we test where llAllowInventoryDrop() has not been called. ***
143 api.llGiveInventory(so2.UUID.ToString(), inventoryItemName); 143 api.llGiveInventory(so2.UUID.ToString(), inventoryItemName);
@@ -167,5 +167,122 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
167 Assert.That(copiedItems[0].Name, Is.EqualTo(inventoryItemName)); 167 Assert.That(copiedItems[0].Name, Is.EqualTo(inventoryItemName));
168 } 168 }
169 } 169 }
170
171 /// <summary>
172 /// Test giving inventory from an object to an avatar that is not the object's owner.
173 /// </summary>
174 [Test]
175 public void TestLlGiveInventoryO2DifferentAvatar()
176 {
177 TestHelpers.InMethod();
178 // TestHelpers.EnableLogging();
179
180 UUID user1Id = TestHelpers.ParseTail(0x1);
181 UUID user2Id = TestHelpers.ParseTail(0x2);
182 string inventoryItemName = "item1";
183
184 SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10);
185 m_scene.AddSceneObject(so1);
186 LSL_Api api = new LSL_Api();
187 api.Initialize(m_engine, so1.RootPart, null);
188
189 // Create an object embedded inside the first
190 UUID itemId = TestHelpers.ParseTail(0x20);
191 TaskInventoryHelpers.AddSceneObject(m_scene.AssetService, so1.RootPart, inventoryItemName, itemId, user1Id);
192
193 UserAccountHelpers.CreateUserWithInventory(m_scene, user2Id);
194
195 api.llGiveInventory(user2Id.ToString(), inventoryItemName);
196
197 InventoryItemBase receivedItem
198 = UserInventoryHelpers.GetInventoryItem(
199 m_scene.InventoryService, user2Id, string.Format("Objects/{0}", inventoryItemName));
200
201 Assert.IsNotNull(receivedItem);
202 }
203
204 /// <summary>
205 /// Test giving inventory from an object to an avatar that is not the object's owner and where the next
206 /// permissions do not include mod.
207 /// </summary>
208 [Test]
209 public void TestLlGiveInventoryO2DifferentAvatarNoMod()
210 {
211 TestHelpers.InMethod();
212// TestHelpers.EnableLogging();
213
214 UUID user1Id = TestHelpers.ParseTail(0x1);
215 UUID user2Id = TestHelpers.ParseTail(0x2);
216 string inventoryItemName = "item1";
217
218 SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10);
219 m_scene.AddSceneObject(so1);
220 LSL_Api api = new LSL_Api();
221 api.Initialize(m_engine, so1.RootPart, null);
222
223 // Create an object embedded inside the first
224 UUID itemId = TestHelpers.ParseTail(0x20);
225 TaskInventoryItem tii
226 = TaskInventoryHelpers.AddSceneObject(m_scene.AssetService, so1.RootPart, inventoryItemName, itemId, user1Id);
227 tii.NextPermissions &= ~((uint)PermissionMask.Modify);
228
229 UserAccountHelpers.CreateUserWithInventory(m_scene, user2Id);
230
231 api.llGiveInventory(user2Id.ToString(), inventoryItemName);
232
233 InventoryItemBase receivedItem
234 = UserInventoryHelpers.GetInventoryItem(
235 m_scene.InventoryService, user2Id, string.Format("Objects/{0}", inventoryItemName));
236
237 Assert.IsNotNull(receivedItem);
238 Assert.AreEqual(0, receivedItem.CurrentPermissions & (uint)PermissionMask.Modify);
239 }
240
241 [Test]
242 public void TestLlRemoteLoadScriptPin()
243 {
244 TestHelpers.InMethod();
245// TestHelpers.EnableLogging();
246
247 UUID user1Id = TestHelpers.ParseTail(0x1);
248 UUID user2Id = TestHelpers.ParseTail(0x2);
249
250 SceneObjectGroup sourceSo = SceneHelpers.AddSceneObject(m_scene, "sourceSo", user1Id);
251 m_scene.AddSceneObject(sourceSo);
252 LSL_Api api = new LSL_Api();
253 api.Initialize(m_engine, sourceSo.RootPart, null);
254 TaskInventoryHelpers.AddScript(m_scene.AssetService, sourceSo.RootPart, "script", "Hello World");
255
256 SceneObjectGroup targetSo = SceneHelpers.AddSceneObject(m_scene, "targetSo", user1Id);
257 SceneObjectGroup otherOwnedTargetSo = SceneHelpers.AddSceneObject(m_scene, "otherOwnedTargetSo", user2Id);
258
259 // Test that we cannot load a script when the target pin has never been set (i.e. it is zero)
260 api.llRemoteLoadScriptPin(targetSo.UUID.ToString(), "script", 0, 0, 0);
261 Assert.IsNull(targetSo.RootPart.Inventory.GetInventoryItem("script"));
262
263 // Test that we cannot load a script when the given pin does not match the target
264 targetSo.RootPart.ScriptAccessPin = 5;
265 api.llRemoteLoadScriptPin(targetSo.UUID.ToString(), "script", 3, 0, 0);
266 Assert.IsNull(targetSo.RootPart.Inventory.GetInventoryItem("script"));
267
268 // Test that we cannot load into a prim with a different owner
269 otherOwnedTargetSo.RootPart.ScriptAccessPin = 3;
270 api.llRemoteLoadScriptPin(otherOwnedTargetSo.UUID.ToString(), "script", 3, 0, 0);
271 Assert.IsNull(otherOwnedTargetSo.RootPart.Inventory.GetInventoryItem("script"));
272
273 // Test that we can load a script when given pin and dest pin match.
274 targetSo.RootPart.ScriptAccessPin = 3;
275 api.llRemoteLoadScriptPin(targetSo.UUID.ToString(), "script", 3, 0, 0);
276 TaskInventoryItem insertedItem = targetSo.RootPart.Inventory.GetInventoryItem("script");
277 Assert.IsNotNull(insertedItem);
278
279 // Test that we can no longer load if access pin is unset
280 targetSo.RootPart.Inventory.RemoveInventoryItem(insertedItem.ItemID);
281 Assert.IsNull(targetSo.RootPart.Inventory.GetInventoryItem("script"));
282
283 targetSo.RootPart.ScriptAccessPin = 0;
284 api.llRemoteLoadScriptPin(otherOwnedTargetSo.UUID.ToString(), "script", 3, 0, 0);
285 Assert.IsNull(otherOwnedTargetSo.RootPart.Inventory.GetInventoryItem("script"));
286 }
170 } 287 }
171} \ No newline at end of file 288}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs
index ac9f93b..14b1890 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs
@@ -45,7 +45,6 @@ using OpenSim.Region.ScriptEngine.Shared.Instance;
45using OpenSim.Region.ScriptEngine.Shared.ScriptBase; 45using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
46using OpenSim.Services.Interfaces; 46using OpenSim.Services.Interfaces;
47using OpenSim.Tests.Common; 47using OpenSim.Tests.Common;
48using OpenSim.Tests.Common.Mock;
49 48
50namespace OpenSim.Region.ScriptEngine.Shared.Tests 49namespace OpenSim.Region.ScriptEngine.Shared.Tests
51{ 50{
@@ -93,7 +92,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
93 // FIXME: This should really be a script item (with accompanying script) 92 // FIXME: This should really be a script item (with accompanying script)
94 TaskInventoryItem grp1Item 93 TaskInventoryItem grp1Item
95 = TaskInventoryHelpers.AddNotecard( 94 = TaskInventoryHelpers.AddNotecard(
96 m_scene, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); 95 m_scene.AssetService, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!");
97 grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; 96 grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
98 97
99 SceneObjectGroup grp2 = SceneHelpers.CreateSceneObject(2, ownerId, "grp2-", 0x20); 98 SceneObjectGroup grp2 = SceneHelpers.CreateSceneObject(2, ownerId, "grp2-", 0x20);
@@ -105,7 +104,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
105 m_scene.AddSceneObject(grp2); 104 m_scene.AddSceneObject(grp2);
106 105
107 LSL_Api apiGrp1 = new LSL_Api(); 106 LSL_Api apiGrp1 = new LSL_Api();
108 apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item, null); 107 apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item);
109 108
110 apiGrp1.llCreateLink(grp2.UUID.ToString(), ScriptBaseClass.TRUE); 109 apiGrp1.llCreateLink(grp2.UUID.ToString(), ScriptBaseClass.TRUE);
111 110
@@ -127,12 +126,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
127 // FIXME: This should really be a script item (with accompanying script) 126 // FIXME: This should really be a script item (with accompanying script)
128 TaskInventoryItem grp1Item 127 TaskInventoryItem grp1Item
129 = TaskInventoryHelpers.AddNotecard( 128 = TaskInventoryHelpers.AddNotecard(
130 m_scene, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); 129 m_scene.AssetService, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!");
131 130
132 grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; 131 grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
133 132
134 LSL_Api apiGrp1 = new LSL_Api(); 133 LSL_Api apiGrp1 = new LSL_Api();
135 apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item, null); 134 apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item);
136 135
137 apiGrp1.llBreakLink(2); 136 apiGrp1.llBreakLink(2);
138 137
@@ -141,5 +140,47 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
141 SceneObjectGroup grp2 = m_scene.GetSceneObjectGroup("grp1-Part1"); 140 SceneObjectGroup grp2 = m_scene.GetSceneObjectGroup("grp1-Part1");
142 Assert.That(grp2, Is.Not.Null); 141 Assert.That(grp2, Is.Not.Null);
143 } 142 }
143
144 [Test]
145 public void TestllBreakAllLinks()
146 {
147 TestHelpers.InMethod();
148
149 UUID ownerId = TestHelpers.ParseTail(0x1);
150
151 SceneObjectGroup grp1 = SceneHelpers.CreateSceneObject(3, ownerId, "grp1-", 0x10);
152 grp1.AbsolutePosition = new Vector3(10, 10, 10);
153 m_scene.AddSceneObject(grp1);
154
155 // FIXME: This should really be a script item (with accompanying script)
156 TaskInventoryItem grp1Item
157 = TaskInventoryHelpers.AddNotecard(
158 m_scene.AssetService, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!");
159
160 grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
161
162 LSL_Api apiGrp1 = new LSL_Api();
163 apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item);
164
165 apiGrp1.llBreakAllLinks();
166
167 {
168 SceneObjectGroup nowGrp = m_scene.GetSceneObjectGroup("grp1-Part1");
169 Assert.That(nowGrp, Is.Not.Null);
170 Assert.That(nowGrp.Parts.Length, Is.EqualTo(1));
171 }
172
173 {
174 SceneObjectGroup nowGrp = m_scene.GetSceneObjectGroup("grp1-Part2");
175 Assert.That(nowGrp, Is.Not.Null);
176 Assert.That(nowGrp.Parts.Length, Is.EqualTo(1));
177 }
178
179 {
180 SceneObjectGroup nowGrp = m_scene.GetSceneObjectGroup("grp1-Part3");
181 Assert.That(nowGrp, Is.Not.Null);
182 Assert.That(nowGrp.Parts.Length, Is.EqualTo(1));
183 }
184 }
144 } 185 }
145} \ No newline at end of file 186}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs
index 60de5cb..34a29e6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs
@@ -37,7 +37,6 @@ using OpenSim.Region.ScriptEngine.Shared.Api;
37using OpenSim.Region.ScriptEngine.Shared.Instance; 37using OpenSim.Region.ScriptEngine.Shared.Instance;
38using OpenSim.Region.ScriptEngine.Shared.ScriptBase; 38using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
39using OpenMetaverse; 39using OpenMetaverse;
40using OpenSim.Tests.Common.Mock;
41 40
42using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; 41using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
43using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; 42using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
@@ -68,7 +67,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
68 engine.AddRegion(scene); 67 engine.AddRegion(scene);
69 68
70 m_lslApi = new LSL_Api(); 69 m_lslApi = new LSL_Api();
71 m_lslApi.Initialize(engine, part, null, null); 70 m_lslApi.Initialize(engine, part, null);
72 } 71 }
73 72
74 [Test] 73 [Test]
@@ -134,4 +133,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
134 } 133 }
135 } 134 }
136 } 135 }
137 } \ No newline at end of file 136 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs
index 42d1b3b..9ab3115 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs
@@ -18,7 +18,6 @@ using OpenSim.Region.ScriptEngine.Shared.Api;
18using OpenSim.Region.ScriptEngine.Shared.ScriptBase; 18using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
19using OpenSim.Services.Interfaces; 19using OpenSim.Services.Interfaces;
20using OpenSim.Tests.Common; 20using OpenSim.Tests.Common;
21using OpenSim.Tests.Common.Mock;
22 21
23namespace OpenSim.Region.ScriptEngine.Shared.Tests 22namespace OpenSim.Region.ScriptEngine.Shared.Tests
24{ 23{
@@ -62,12 +61,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
62 SceneHelpers.SetupSceneModules(m_scene, new IniConfigSource(), m_engine); 61 SceneHelpers.SetupSceneModules(m_scene, new IniConfigSource(), m_engine);
63 62
64 m_so = SceneHelpers.AddSceneObject(m_scene); 63 m_so = SceneHelpers.AddSceneObject(m_scene);
65 m_scriptItem = TaskInventoryHelpers.AddScript(m_scene, m_so.RootPart); 64 m_scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, m_so.RootPart);
66 65
67 // This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm. 66 // This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm.
68 // Possibly this could be done and we could obtain it directly from the MockScriptEngine. 67 // Possibly this could be done and we could obtain it directly from the MockScriptEngine.
69 m_lslApi = new LSL_Api(); 68 m_lslApi = new LSL_Api();
70 m_lslApi.Initialize(m_engine, m_so.RootPart, m_scriptItem, null); 69 m_lslApi.Initialize(m_engine, m_so.RootPart, m_scriptItem);
71 } 70 }
72 71
73 [Test] 72 [Test]
@@ -78,7 +77,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
78 string[] ncLines = { "One", "Twoè", "Three" }; 77 string[] ncLines = { "One", "Twoè", "Three" };
79 78
80 TaskInventoryItem ncItem 79 TaskInventoryItem ncItem
81 = TaskInventoryHelpers.AddNotecard(m_scene, m_so.RootPart, "nc", "1", "10", string.Join("\n", ncLines)); 80 = TaskInventoryHelpers.AddNotecard(m_scene.AssetService, m_so.RootPart, "nc", "1", "10", string.Join("\n", ncLines));
82 81
83 AssertValidNotecardLine(ncItem.Name, 0, ncLines[0]); 82 AssertValidNotecardLine(ncItem.Name, 0, ncLines[0]);
84 AssertValidNotecardLine(ncItem.Name, 2, ncLines[2]); 83 AssertValidNotecardLine(ncItem.Name, 2, ncLines[2]);
@@ -103,7 +102,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
103 { 102 {
104 TestHelpers.InMethod(); 103 TestHelpers.InMethod();
105 104
106 TaskInventoryItem ncItem = TaskInventoryHelpers.AddScript(m_scene, m_so.RootPart, "nc1", "Not important"); 105 TaskInventoryItem ncItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, m_so.RootPart, "nc1", "Not important");
107 106
108 AssertInValidNotecardLine(ncItem.Name, 0); 107 AssertInValidNotecardLine(ncItem.Name, 0);
109 } 108 }
@@ -267,4 +266,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
267// } 266// }
268// } 267// }
269 } 268 }
270} \ No newline at end of file 269}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiObjectTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiObjectTests.cs
index ed61dc0..d957bf2 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiObjectTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiObjectTests.cs
@@ -45,7 +45,6 @@ using OpenSim.Region.ScriptEngine.Shared.Instance;
45using OpenSim.Region.ScriptEngine.Shared.ScriptBase; 45using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
46using OpenSim.Services.Interfaces; 46using OpenSim.Services.Interfaces;
47using OpenSim.Tests.Common; 47using OpenSim.Tests.Common;
48using OpenSim.Tests.Common.Mock;
49using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; 48using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
50using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; 49using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
51 50
@@ -90,7 +89,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
90 m_scene.AddSceneObject(grp1); 89 m_scene.AddSceneObject(grp1);
91 90
92 LSL_Api apiGrp1 = new LSL_Api(); 91 LSL_Api apiGrp1 = new LSL_Api();
93 apiGrp1.Initialize(m_engine, grp1.RootPart, null, null); 92 apiGrp1.Initialize(m_engine, grp1.RootPart, null);
94 93
95 // Check simple 1 prim case 94 // Check simple 1 prim case
96 { 95 {
@@ -168,7 +167,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
168 Assert.That(scene.AddNewSceneObject(new SceneObjectGroup(part1), false), Is.True); 167 Assert.That(scene.AddNewSceneObject(new SceneObjectGroup(part1), false), Is.True);
169 168
170 LSL_Api apiGrp1 = new LSL_Api(); 169 LSL_Api apiGrp1 = new LSL_Api();
171 apiGrp1.Initialize(m_engine, part1, null, null); 170 apiGrp1.Initialize(m_engine, part1, null);
172 171
173 // Note that prim hollow check is passed with the other prim params in order to allow the 172 // Note that prim hollow check is passed with the other prim params in order to allow the
174 // specification of a different check value from the prim param. A cylinder, prism, sphere, 173 // specification of a different check value from the prim param. A cylinder, prism, sphere,
@@ -210,11 +209,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
210 ScriptBaseClass.PRIM_TYPE_BOX, // Prim type 209 ScriptBaseClass.PRIM_TYPE_BOX, // Prim type
211 ScriptBaseClass.PRIM_HOLE_TRIANGLE, // Prim hole type 210 ScriptBaseClass.PRIM_HOLE_TRIANGLE, // Prim hole type
212 new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut 211 new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut
213 0.95f, // Prim hollow 212 0.99f, // Prim hollow
214 new LSL_Types.Vector3(1.0d, 0.0d, 0.0d), // Prim twist 213 new LSL_Types.Vector3(1.0d, 0.0d, 0.0d), // Prim twist
215 new LSL_Types.Vector3(1.0d, 1.0d, 0.0d), // Prim taper 214 new LSL_Types.Vector3(1.0d, 1.0d, 0.0d), // Prim taper
216 new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim shear 215 new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim shear
217 0.95f); // Prim hollow check 216 0.99f); // Prim hollow check
218 217
219 // Test a tube. 218 // Test a tube.
220 CheckllSetPrimitiveParams( 219 CheckllSetPrimitiveParams(
@@ -247,7 +246,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
247 ScriptBaseClass.PRIM_TYPE_PRISM, // Prim type 246 ScriptBaseClass.PRIM_TYPE_PRISM, // Prim type
248 ScriptBaseClass.PRIM_HOLE_SQUARE, // Prim hole type 247 ScriptBaseClass.PRIM_HOLE_SQUARE, // Prim hole type
249 new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut 248 new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut
250 0.95f, // Prim hollow 249 0.99f, // Prim hollow
251 // Expression for x selected to test precision problems during sbyte 250 // Expression for x selected to test precision problems during sbyte
252 // cast in SetPrimitiveShapeBlockParams. 251 // cast in SetPrimitiveShapeBlockParams.
253 new LSL_Types.Vector3(0.7d + 0.2d, 0.0d, 0.0d), // Prim twist 252 new LSL_Types.Vector3(0.7d + 0.2d, 0.0d, 0.0d), // Prim twist
@@ -396,4 +395,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
396 } 395 }
397 396
398 } 397 }
399} \ No newline at end of file 398}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
index 7e3726a..d929da8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
@@ -37,7 +37,6 @@ using OpenSim.Region.ScriptEngine.Shared.Instance;
37using OpenSim.Region.ScriptEngine.Shared.ScriptBase; 37using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
38using OpenMetaverse; 38using OpenMetaverse;
39using System; 39using System;
40using OpenSim.Tests.Common.Mock;
41 40
42namespace OpenSim.Region.ScriptEngine.Shared.Tests 41namespace OpenSim.Region.ScriptEngine.Shared.Tests
43{ 42{
@@ -66,7 +65,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
66 engine.AddRegion(scene); 65 engine.AddRegion(scene);
67 66
68 m_lslApi = new LSL_Api(); 67 m_lslApi = new LSL_Api();
69 m_lslApi.Initialize(engine, part, null, null); 68 m_lslApi.Initialize(engine, part, null);
70 } 69 }
71 70
72 [Test] 71 [Test]
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiUserTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiUserTests.cs
new file mode 100644
index 0000000..a8964bf
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiUserTests.cs
@@ -0,0 +1,157 @@
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
28using System;
29using System.Collections.Generic;
30using System.Threading;
31using Nini.Config;
32using NUnit.Framework;
33using OpenMetaverse;
34using OpenSim.Framework;
35using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.ScriptEngine.Shared.Api;
37using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
38using OpenSim.Services.Interfaces;
39using OpenSim.Tests.Common;
40
41namespace OpenSim.Region.ScriptEngine.Shared.Tests
42{
43 [TestFixture]
44 public class LSL_ApiUserTests : OpenSimTestCase
45 {
46 private Scene m_scene;
47 private MockScriptEngine m_engine;
48
49 [SetUp]
50 public override void SetUp()
51 {
52 base.SetUp();
53
54 m_engine = new MockScriptEngine();
55
56 m_scene = new SceneHelpers().SetupScene();
57 SceneHelpers.SetupSceneModules(m_scene, m_engine);
58 }
59
60 [Test]
61 public void TestLlRequestAgentDataOnline()
62 {
63 TestHelpers.InMethod();
64// TestHelpers.EnableLogging();
65
66 UUID userId = TestHelpers.ParseTail(0x1);
67
68 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, userId);
69
70 SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart;
71 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, part);
72
73 LSL_Api apiGrp1 = new LSL_Api();
74 apiGrp1.Initialize(m_engine, part, scriptItem);
75
76 // Initially long timeout to test cache
77 apiGrp1.LlRequestAgentDataCacheTimeoutMs = 20000;
78
79 // Offline test
80 {
81 apiGrp1.llRequestAgentData(userId.ToString(), ScriptBaseClass.DATA_ONLINE);
82
83 Assert.That(m_engine.PostedEvents.ContainsKey(scriptItem.ItemID));
84
85 List<EventParams> events = m_engine.PostedEvents[scriptItem.ItemID];
86 Assert.That(events.Count, Is.EqualTo(1));
87 EventParams eventParams = events[0];
88 Assert.That(eventParams.EventName, Is.EqualTo("dataserver"));
89
90 string data = eventParams.Params[1].ToString();
91 Assert.AreEqual(0, int.Parse(data));
92
93 m_engine.PostedEvents.Clear();
94 }
95
96 // Online test. Should get the 'wrong' result because of caching.
97 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1);
98
99 {
100 apiGrp1.llRequestAgentData(userId.ToString(), ScriptBaseClass.DATA_ONLINE);
101
102 Assert.That(m_engine.PostedEvents.ContainsKey(scriptItem.ItemID));
103
104 List<EventParams> events = m_engine.PostedEvents[scriptItem.ItemID];
105 Assert.That(events.Count, Is.EqualTo(1));
106 EventParams eventParams = events[0];
107 Assert.That(eventParams.EventName, Is.EqualTo("dataserver"));
108
109 string data = eventParams.Params[1].ToString();
110 Assert.AreEqual(0, int.Parse(data));
111
112 m_engine.PostedEvents.Clear();
113 }
114
115 apiGrp1.LlRequestAgentDataCacheTimeoutMs = 1;
116
117 // Make absolutely sure that we should trigger cache timeout.
118 Thread.Sleep(apiGrp1.LlRequestAgentDataCacheTimeoutMs + 1);
119
120 {
121 apiGrp1.llRequestAgentData(userId.ToString(), ScriptBaseClass.DATA_ONLINE);
122
123 Assert.That(m_engine.PostedEvents.ContainsKey(scriptItem.ItemID));
124
125 List<EventParams> events = m_engine.PostedEvents[scriptItem.ItemID];
126 Assert.That(events.Count, Is.EqualTo(1));
127 EventParams eventParams = events[0];
128 Assert.That(eventParams.EventName, Is.EqualTo("dataserver"));
129
130 string data = eventParams.Params[1].ToString();
131 Assert.AreEqual(1, int.Parse(data));
132
133 m_engine.PostedEvents.Clear();
134 }
135
136 m_scene.CloseAgent(userId, false);
137
138 Thread.Sleep(apiGrp1.LlRequestAgentDataCacheTimeoutMs + 1 + 1);
139
140 {
141 apiGrp1.llRequestAgentData(userId.ToString(), ScriptBaseClass.DATA_ONLINE);
142
143 Assert.That(m_engine.PostedEvents.ContainsKey(scriptItem.ItemID));
144
145 List<EventParams> events = m_engine.PostedEvents[scriptItem.ItemID];
146 Assert.That(events.Count, Is.EqualTo(1));
147 EventParams eventParams = events[0];
148 Assert.That(eventParams.EventName, Is.EqualTo("dataserver"));
149
150 string data = eventParams.Params[1].ToString();
151 Assert.AreEqual(0, int.Parse(data));
152
153 m_engine.PostedEvents.Clear();
154 }
155 }
156 }
157}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs
index c88bad5..2f9a564 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs
@@ -44,7 +44,6 @@ using OpenSim.Region.ScriptEngine.Shared.Api;
44using OpenSim.Region.ScriptEngine.Shared.Instance; 44using OpenSim.Region.ScriptEngine.Shared.Instance;
45using OpenSim.Services.Interfaces; 45using OpenSim.Services.Interfaces;
46using OpenSim.Tests.Common; 46using OpenSim.Tests.Common;
47using OpenSim.Tests.Common.Mock;
48 47
49namespace OpenSim.Region.ScriptEngine.Shared.Tests 48namespace OpenSim.Region.ScriptEngine.Shared.Tests
50{ 49{
@@ -94,7 +93,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
94 m_scene.AddSceneObject(so); 93 m_scene.AddSceneObject(so);
95 94
96 OSSL_Api osslApi = new OSSL_Api(); 95 OSSL_Api osslApi = new OSSL_Api();
97 osslApi.Initialize(m_engine, part, null, null); 96 osslApi.Initialize(m_engine, part, null);
98 97
99 string notecardName = "appearanceNc"; 98 string notecardName = "appearanceNc";
100 99
@@ -135,7 +134,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
135 m_scene.AddSceneObject(so); 134 m_scene.AddSceneObject(so);
136 135
137 OSSL_Api osslApi = new OSSL_Api(); 136 OSSL_Api osslApi = new OSSL_Api();
138 osslApi.Initialize(m_engine, part, null, null); 137 osslApi.Initialize(m_engine, part, null);
139 138
140 string notecardName = "appearanceNc"; 139 string notecardName = "appearanceNc";
141 140
@@ -159,4 +158,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
159 Assert.That(savedAppearance.AvatarHeight, Is.EqualTo(sp.Appearance.AvatarHeight)); 158 Assert.That(savedAppearance.AvatarHeight, Is.EqualTo(sp.Appearance.AvatarHeight));
160 } 159 }
161 } 160 }
162} \ No newline at end of file 161}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs
index e422f5b..b6b3f12 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs
@@ -44,7 +44,6 @@ using OpenSim.Region.ScriptEngine.Shared.Api;
44using OpenSim.Region.ScriptEngine.Shared.Instance; 44using OpenSim.Region.ScriptEngine.Shared.Instance;
45using OpenSim.Services.Interfaces; 45using OpenSim.Services.Interfaces;
46using OpenSim.Tests.Common; 46using OpenSim.Tests.Common;
47using OpenSim.Tests.Common.Mock;
48 47
49namespace OpenSim.Region.ScriptEngine.Shared.Tests 48namespace OpenSim.Region.ScriptEngine.Shared.Tests
50{ 49{
@@ -97,16 +96,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
97 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, 0x1); 96 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, 0x1);
98 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1.PrincipalID); 97 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1.PrincipalID);
99 SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); 98 SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID);
100 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); 99 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, inWorldObj.RootPart);
101 100
102 new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); 101 new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem);
103 OSSL_Api osslApi = new OSSL_Api(); 102 OSSL_Api osslApi = new OSSL_Api();
104 osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); 103 osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem);
105 104
106// SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ua1.PrincipalID); 105// SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ua1.PrincipalID);
107 106
108 // Create an object embedded inside the first 107 // Create an object embedded inside the first
109 TaskInventoryHelpers.AddSceneObject(m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID); 108 TaskInventoryHelpers.AddSceneObject(m_scene.AssetService, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID);
110 109
111 osslApi.osForceAttachToAvatarFromInventory(taskInvObjItemName, (int)attachPoint); 110 osslApi.osForceAttachToAvatarFromInventory(taskInvObjItemName, (int)attachPoint);
112 111
@@ -143,15 +142,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
143 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, 0x1); 142 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, 0x1);
144 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1.PrincipalID); 143 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1.PrincipalID);
145 SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); 144 SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID);
146 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); 145 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, inWorldObj.RootPart);
147 146
148 new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); 147 new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem);
149 OSSL_Api osslApi = new OSSL_Api(); 148 OSSL_Api osslApi = new OSSL_Api();
150 osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); 149 osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem);
151 150
152 // Create an object embedded inside the first 151 // Create an object embedded inside the first
153 TaskInventoryHelpers.AddNotecard( 152 TaskInventoryHelpers.AddNotecard(
154 m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, TestHelpers.ParseTail(0x900), "Hello World!"); 153 m_scene.AssetService, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, TestHelpers.ParseTail(0x900), "Hello World!");
155 154
156 bool exceptionCaught = false; 155 bool exceptionCaught = false;
157 156
@@ -191,15 +190,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
191 190
192 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1); 191 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1);
193 SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); 192 SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID);
194 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); 193 TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, inWorldObj.RootPart);
195 194
196 new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); 195 new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem);
197 OSSL_Api osslApi = new OSSL_Api(); 196 OSSL_Api osslApi = new OSSL_Api();
198 osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem, null); 197 osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem);
199 198
200 // Create an object embedded inside the first 199 // Create an object embedded inside the first
201 TaskInventoryHelpers.AddSceneObject( 200 TaskInventoryHelpers.AddSceneObject(
202 m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID); 201 m_scene.AssetService, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID);
203 202
204 ScenePresence sp2 = SceneHelpers.AddScenePresence(m_scene, ua2); 203 ScenePresence sp2 = SceneHelpers.AddScenePresence(m_scene, ua2);
205 204
@@ -230,4 +229,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
230 Assert.That(sp2.Appearance.GetAttachpoint(attachmentsInAppearance2[0].ItemID), Is.EqualTo((uint)attachPoint)); 229 Assert.That(sp2.Appearance.GetAttachpoint(attachmentsInAppearance2[0].ItemID), Is.EqualTo((uint)attachPoint));
231 } 230 }
232 } 231 }
233} \ No newline at end of file 232}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
index 495e684..99bff83 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
@@ -46,7 +46,6 @@ using OpenSim.Region.ScriptEngine.Shared.Instance;
46using OpenSim.Region.ScriptEngine.Shared.ScriptBase; 46using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
47using OpenSim.Services.Interfaces; 47using OpenSim.Services.Interfaces;
48using OpenSim.Tests.Common; 48using OpenSim.Tests.Common;
49using OpenSim.Tests.Common.Mock;
50 49
51namespace OpenSim.Region.ScriptEngine.Shared.Tests 50namespace OpenSim.Region.ScriptEngine.Shared.Tests
52{ 51{
@@ -100,7 +99,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
100 m_scene.AddSceneObject(so); 99 m_scene.AddSceneObject(so);
101 100
102 OSSL_Api osslApi = new OSSL_Api(); 101 OSSL_Api osslApi = new OSSL_Api();
103 osslApi.Initialize(m_engine, part, null, null); 102 osslApi.Initialize(m_engine, part, null);
104 103
105 string notecardName = "appearanceNc"; 104 string notecardName = "appearanceNc";
106 osslApi.osOwnerSaveAppearance(notecardName); 105 osslApi.osOwnerSaveAppearance(notecardName);
@@ -126,7 +125,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
126 m_scene.AddSceneObject(so); 125 m_scene.AddSceneObject(so);
127 126
128 OSSL_Api osslApi = new OSSL_Api(); 127 OSSL_Api osslApi = new OSSL_Api();
129 osslApi.Initialize(m_engine, so.RootPart, null, null); 128 osslApi.Initialize(m_engine, so.RootPart, null);
130 129
131 bool gotExpectedException = false; 130 bool gotExpectedException = false;
132 try 131 try
@@ -161,7 +160,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
161 m_scene.AddSceneObject(so); 160 m_scene.AddSceneObject(so);
162 161
163 OSSL_Api osslApi = new OSSL_Api(); 162 OSSL_Api osslApi = new OSSL_Api();
164 osslApi.Initialize(m_engine, part, null, null); 163 osslApi.Initialize(m_engine, part, null);
165 164
166 string notecardName = "appearanceNc"; 165 string notecardName = "appearanceNc";
167 osslApi.osOwnerSaveAppearance(notecardName); 166 osslApi.osOwnerSaveAppearance(notecardName);
@@ -196,7 +195,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
196 m_scene.AddSceneObject(so); 195 m_scene.AddSceneObject(so);
197 196
198 OSSL_Api osslApi = new OSSL_Api(); 197 OSSL_Api osslApi = new OSSL_Api();
199 osslApi.Initialize(m_engine, part, null, null); 198 osslApi.Initialize(m_engine, part, null);
200 199
201 osslApi.osOwnerSaveAppearance(firstAppearanceNcName); 200 osslApi.osOwnerSaveAppearance(firstAppearanceNcName);
202 201
@@ -234,7 +233,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
234 m_scene.AddSceneObject(so); 233 m_scene.AddSceneObject(so);
235 234
236 OSSL_Api osslApi = new OSSL_Api(); 235 OSSL_Api osslApi = new OSSL_Api();
237 osslApi.Initialize(m_engine, part, null, null); 236 osslApi.Initialize(m_engine, part, null);
238 237
239 osslApi.osOwnerSaveAppearance(firstAppearanceNcName); 238 osslApi.osOwnerSaveAppearance(firstAppearanceNcName);
240 239
@@ -286,10 +285,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
286 m_scene.AddSceneObject(otherSo); 285 m_scene.AddSceneObject(otherSo);
287 286
288 OSSL_Api osslApi = new OSSL_Api(); 287 OSSL_Api osslApi = new OSSL_Api();
289 osslApi.Initialize(m_engine, part, null, null); 288 osslApi.Initialize(m_engine, part, null);
290 289
291 OSSL_Api otherOsslApi = new OSSL_Api(); 290 OSSL_Api otherOsslApi = new OSSL_Api();
292 otherOsslApi.Initialize(m_engine, otherPart, null, null); 291 otherOsslApi.Initialize(m_engine, otherPart, null);
293 292
294 string notecardName = "appearanceNc"; 293 string notecardName = "appearanceNc";
295 osslApi.osOwnerSaveAppearance(notecardName); 294 osslApi.osOwnerSaveAppearance(notecardName);
@@ -333,7 +332,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
333 m_scene.AddSceneObject(so); 332 m_scene.AddSceneObject(so);
334 333
335 OSSL_Api osslApi = new OSSL_Api(); 334 OSSL_Api osslApi = new OSSL_Api();
336 osslApi.Initialize(m_engine, part, null, null); 335 osslApi.Initialize(m_engine, part, null);
337 336
338 string notecardName = "appearanceNc"; 337 string notecardName = "appearanceNc";
339 osslApi.osOwnerSaveAppearance(notecardName); 338 osslApi.osOwnerSaveAppearance(notecardName);
@@ -349,4 +348,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
349 Assert.That(npc, Is.Null); 348 Assert.That(npc, Is.Null);
350 } 349 }
351 } 350 }
352} \ No newline at end of file 351}
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Properties/AssemblyInfo.cs b/OpenSim/Region/ScriptEngine/XEngine/Properties/AssemblyInfo.cs
index 87ea9c4..0094af6 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/Properties/AssemblyInfo.cs
@@ -1,6 +1,7 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.CompilerServices; 2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices; 3using System.Runtime.InteropServices;
4using Mono.Addins;
4 5
5// General Information about an assembly is controlled through the following 6// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information 7// set of attributes. Change these attribute values to modify the information
@@ -29,5 +30,7 @@ using System.Runtime.InteropServices;
29// Build Number 30// Build Number
30// Revision 31// Revision
31// 32//
32[assembly: AssemblyVersion("0.8.0.*")] 33[assembly: AssemblyVersion("0.8.2.*")]
33 34
35[assembly: Addin("OpenSim.Region.ScriptEngine.XEngine", OpenSim.VersionInfo.VersionNumber)]
36[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)]
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Resources/XEngine.addin.xml b/OpenSim/Region/ScriptEngine/XEngine/Resources/XEngine.addin.xml
deleted file mode 100644
index 96c9c3a..0000000
--- a/OpenSim/Region/ScriptEngine/XEngine/Resources/XEngine.addin.xml
+++ /dev/null
@@ -1,13 +0,0 @@
1<Addin id="OpenSim.Region.ScriptEngine.XEngine" version="0.2">
2 <Runtime>
3 <Import assembly="OpenSim.Region.ScriptEngine.XEngine.dll"/>
4 </Runtime>
5
6 <Dependencies>
7 <Addin id="OpenSim" version="0.5" />
8 </Dependencies>
9
10 <Extension path = "/OpenSim/RegionModules">
11 <RegionModule id="XEngine" type="OpenSim.Region.ScriptEngine.XEngine.XEngine" />
12 </Extension>
13</Addin>
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineBasicTests.cs b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineBasicTests.cs
index 5abfe9a..878e571 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineBasicTests.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineBasicTests.cs
@@ -36,15 +36,14 @@ using OpenSim.Region.CoreModules.Scripting.WorldComm;
36using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
37using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Tests.Common; 38using OpenSim.Tests.Common;
39using OpenSim.Tests.Common.Mock;
40 39
41namespace OpenSim.Region.ScriptEngine.XEngine.Tests 40namespace OpenSim.Region.ScriptEngine.XEngine.Tests
42{ 41{
43 /// <summary> 42 /// <summary>
44 /// XEngine tests. 43 /// Basic XEngine tests.
45 /// </summary> 44 /// </summary>
46 [TestFixture] 45 [TestFixture]
47 public class XEngineTest : OpenSimTestCase 46 public class XEngineBasicTests : OpenSimTestCase
48 { 47 {
49 private TestScene m_scene; 48 private TestScene m_scene;
50 private XEngine m_xEngine; 49 private XEngine m_xEngine;
@@ -87,7 +86,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Tests
87 public void TestCompileAndStartScript() 86 public void TestCompileAndStartScript()
88 { 87 {
89 TestHelpers.InMethod(); 88 TestHelpers.InMethod();
90// log4net.Config.XmlConfigurator.Configure(); 89 TestHelpers.EnableLogging();
91 90
92 UUID userId = TestHelpers.ParseTail(0x1); 91 UUID userId = TestHelpers.ParseTail(0x1);
93// UUID objectId = TestHelpers.ParseTail(0x100); 92// UUID objectId = TestHelpers.ParseTail(0x100);
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineCrossingTests.cs b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineCrossingTests.cs
new file mode 100644
index 0000000..587695f
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineCrossingTests.cs
@@ -0,0 +1,195 @@
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
28using System;
29using System.Threading;
30using Nini.Config;
31using NUnit.Framework;
32using OpenMetaverse;
33using OpenSim.Framework;
34using OpenSim.Region.CoreModules.Framework.EntityTransfer;
35using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
36using OpenSim.Region.Framework.Scenes;
37using OpenSim.Region.ScriptEngine.Shared;
38using OpenSim.Tests.Common;
39
40namespace OpenSim.Region.ScriptEngine.XEngine.Tests
41{
42 /// <summary>
43 /// XEngine tests connected with crossing scripts between regions.
44 /// </summary>
45 [TestFixture]
46 public class XEngineCrossingTests : OpenSimTestCase
47 {
48 [TestFixtureSetUp]
49 public void FixtureInit()
50 {
51 // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread.
52 Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest;
53 }
54
55 [TestFixtureTearDown]
56 public void TearDown()
57 {
58 // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple
59 // threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression
60 // tests really shouldn't).
61 Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
62 }
63
64 /// <summary>
65 /// Test script state preservation when a script crosses between regions on the same simulator.
66 /// </summary>
67 [Test]
68 public void TestScriptCrossOnSameSimulator()
69 {
70 TestHelpers.InMethod();
71// TestHelpers.EnableLogging();
72
73 UUID userId = TestHelpers.ParseTail(0x1);
74 int sceneObjectIdTail = 0x2;
75
76 EntityTransferModule etmA = new EntityTransferModule();
77 EntityTransferModule etmB = new EntityTransferModule();
78 LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
79 XEngine xEngineA = new XEngine();
80 XEngine xEngineB = new XEngine();
81 xEngineA.DebugLevel = 1;
82 xEngineB.DebugLevel = 1;
83
84 IConfigSource configSource = new IniConfigSource();
85
86 IConfig startupConfig = configSource.AddConfig("Startup");
87 startupConfig.Set("DefaultScriptEngine", "XEngine");
88
89 IConfig xEngineConfig = configSource.AddConfig("XEngine");
90 xEngineConfig.Set("Enabled", "true");
91 xEngineConfig.Set("StartDelay", "0");
92
93 // These tests will not run with AppDomainLoading = true, at least on mono. For unknown reasons, the call
94 // to AssemblyResolver.OnAssemblyResolve fails.
95 xEngineConfig.Set("AppDomainLoading", "false");
96
97 IConfig modulesConfig = configSource.AddConfig("Modules");
98 modulesConfig.Set("EntityTransferModule", etmA.Name);
99 modulesConfig.Set("SimulationServices", lscm.Name);
100
101 SceneHelpers sh = new SceneHelpers();
102 TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000, configSource);
103 TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1000, 999, configSource);
104
105 SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, configSource, lscm);
106 SceneHelpers.SetupSceneModules(sceneA, configSource, etmA, xEngineA);
107 SceneHelpers.SetupSceneModules(sceneB, configSource, etmB, xEngineB);
108 sceneA.StartScripts();
109 sceneB.StartScripts();
110
111 SceneObjectGroup soSceneA = SceneHelpers.AddSceneObject(sceneA, 1, userId, "so1-", sceneObjectIdTail);
112 soSceneA.AbsolutePosition = new Vector3(128, 10, 20);
113
114 // CREATE SCRIPT TODO
115 InventoryItemBase scriptItemSceneA = new InventoryItemBase();
116 // itemTemplate.ID = itemId;
117 scriptItemSceneA.Name = "script1";
118 scriptItemSceneA.Folder = soSceneA.UUID;
119 scriptItemSceneA.InvType = (int)InventoryType.LSL;
120
121 AutoResetEvent chatEvent = new AutoResetEvent(false);
122 OSChatMessage messageReceived = null;
123 sceneA.EventManager.OnChatFromWorld += (s, m) => { messageReceived = m; chatEvent.Set(); };
124
125 sceneA.RezNewScript(userId, scriptItemSceneA,
126@"integer c = 0;
127
128default
129{
130 state_entry()
131 {
132 llSay(0, ""Script running"");
133 }
134
135 changed(integer change)
136 {
137 llSay(0, ""Changed"");
138 }
139
140 touch_start(integer n)
141 {
142 c = c + 1;
143 llSay(0, (string)c);
144 }
145}");
146
147 chatEvent.WaitOne(60000);
148
149 Assert.That(messageReceived, Is.Not.Null, "No chat message received.");
150 Assert.That(messageReceived.Message, Is.EqualTo("Script running"));
151
152 {
153 // XXX: Should not be doing this so directly. Should call some variant of EventManager.touch() instead.
154 DetectParams[] det = new DetectParams[1];
155 det[0] = new DetectParams();
156 det[0].Key = userId;
157 det[0].Populate(sceneA);
158
159 EventParams ep = new EventParams("touch_start", new Object[] { new LSL_Types.LSLInteger(1) }, det);
160
161 xEngineA.PostObjectEvent(soSceneA.LocalId, ep);
162 chatEvent.WaitOne(60000);
163
164 Assert.That(messageReceived.Message, Is.EqualTo("1"));
165 }
166
167 sceneB.EventManager.OnChatFromWorld += (s, m) => { messageReceived = m; chatEvent.Set(); };
168
169 // Cross with a negative value
170 soSceneA.AbsolutePosition = new Vector3(128, -10, 20);
171
172 chatEvent.WaitOne(60000);
173 Assert.That(messageReceived.Message, Is.EqualTo("Changed"));
174
175 // TEST sending event to moved prim and output
176 {
177 SceneObjectGroup soSceneB = sceneB.GetSceneObjectGroup(soSceneA.Name);
178 TaskInventoryItem scriptItemSceneB = soSceneB.RootPart.Inventory.GetInventoryItem(scriptItemSceneA.Name);
179
180 // XXX: Should not be doing this so directly. Should call some variant of EventManager.touch() instead.
181 DetectParams[] det = new DetectParams[1];
182 det[0] = new DetectParams();
183 det[0].Key = userId;
184 det[0].Populate(sceneB);
185
186 EventParams ep = new EventParams("touch_start", new Object[] { new LSL_Types.LSLInteger(1) }, det);
187
188 xEngineB.PostObjectEvent(soSceneB.LocalId, ep);
189 chatEvent.WaitOne(60000);
190
191 Assert.That(messageReceived.Message, Is.EqualTo("2"));
192 }
193 }
194 }
195} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEnginePersistenceTests.cs b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEnginePersistenceTests.cs
new file mode 100644
index 0000000..2ef4058
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEnginePersistenceTests.cs
@@ -0,0 +1,152 @@
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
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Linq;
32using System.Threading;
33using Nini.Config;
34using NUnit.Framework;
35using OpenMetaverse;
36using OpenSim.Framework;
37using OpenSim.Region.CoreModules.Avatar.Attachments;
38using OpenSim.Region.CoreModules.Framework.InventoryAccess;
39using OpenSim.Region.Framework.Scenes;
40using OpenSim.Region.ScriptEngine.XEngine;
41using OpenSim.Services.Interfaces;
42using OpenSim.Tests.Common;
43
44namespace OpenSim.Region.ScriptEngine.Tests
45{
46 [TestFixture]
47 public class XEnginePersistenceTests : OpenSimTestCase
48 {
49 private AutoResetEvent m_chatEvent = new AutoResetEvent(false);
50
51 private void OnChatFromWorld(object sender, OSChatMessage oscm)
52 {
53 // Console.WriteLine("Got chat [{0}]", oscm.Message);
54
55 // m_osChatMessageReceived = oscm;
56 m_chatEvent.Set();
57 }
58
59 private void AddCommonConfig(IConfigSource config, List<object> modules)
60 {
61 config.AddConfig("Modules");
62 config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
63
64 AttachmentsModule attMod = new AttachmentsModule();
65 attMod.DebugLevel = 1;
66 modules.Add(attMod);
67 modules.Add(new BasicInventoryAccessModule());
68 }
69
70 private void AddScriptingConfig(IConfigSource config, XEngine.XEngine xEngine, List<object> modules)
71 {
72 IConfig startupConfig = config.AddConfig("Startup");
73 startupConfig.Set("DefaultScriptEngine", "XEngine");
74
75 IConfig xEngineConfig = config.AddConfig("XEngine");
76 xEngineConfig.Set("Enabled", "true");
77 xEngineConfig.Set("StartDelay", "0");
78
79 // These tests will not run with AppDomainLoading = true, at least on mono. For unknown reasons, the call
80 // to AssemblyResolver.OnAssemblyResolve fails.
81 xEngineConfig.Set("AppDomainLoading", "false");
82
83 modules.Add(xEngine);
84 }
85
86 private Scene CreateScriptingEnabledTestScene(XEngine.XEngine xEngine)
87 {
88 IConfigSource config = new IniConfigSource();
89 List<object> modules = new List<object>();
90
91 AddCommonConfig(config, modules);
92 AddScriptingConfig(config, xEngine, modules);
93
94 Scene scene
95 = new SceneHelpers().SetupScene(
96 "attachments-test-scene", TestHelpers.ParseTail(999), 1000, 1000, config);
97 SceneHelpers.SetupSceneModules(scene, config, modules.ToArray());
98
99 scene.StartScripts();
100
101 return scene;
102 }
103
104 [Test]
105 public void TestScriptedAttachmentPersistence()
106 {
107 TestHelpers.InMethod();
108// TestHelpers.EnableLogging();
109
110 XEngine.XEngine xEngine = new XEngine.XEngine();
111 Scene scene = CreateScriptingEnabledTestScene(xEngine);
112 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
113 ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1);
114
115 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, sp.UUID, "att-name", 0x10);
116 TaskInventoryHelpers.AddScript(
117 scene.AssetService,
118 so.RootPart,
119 "scriptItem",
120 "default { attach(key id) { if (id != NULL_KEY) { llSay(0, \"Hello World\"); } } }");
121
122 InventoryItemBase userItem = UserInventoryHelpers.AddInventoryItem(scene, so, 0x100, 0x1000);
123
124 // FIXME: Right now, we have to do a tricksy chat listen to make sure we know when the script is running.
125 // In the future, we need to be able to do this programatically more predicably.
126 scene.EventManager.OnChatFromWorld += OnChatFromWorld;
127
128 SceneObjectGroup rezzedSo
129 = scene.AttachmentsModule.RezSingleAttachmentFromInventory(sp, userItem.ID, (uint)AttachmentPoint.Chest);
130 TaskInventoryItem rezzedScriptItem = rezzedSo.RootPart.Inventory.GetInventoryItem("scriptItem");
131
132 // Wait for chat to signal rezzed script has been started.
133 m_chatEvent.WaitOne(60000);
134
135 // Force save
136 xEngine.DoBackup(new Object[] { 0 });
137
138// Console.WriteLine("ItemID {0}", rezzedScriptItem.ItemID);
139//
140// foreach (
141// string s in Directory.EnumerateFileSystemEntries(
142// string.Format("ScriptEngines/{0}", scene.RegionInfo.RegionID)))
143// Console.WriteLine(s);
144
145 Assert.IsFalse(
146 File.Exists(
147 string.Format("ScriptEngines/{0}/{1}.state", scene.RegionInfo.RegionID, rezzedScriptItem.ItemID)));
148
149 scene.AttachmentsModule.DetachSingleAttachmentToInv(sp, rezzedSo);
150 }
151 }
152} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 1831c39..466c190 100644..100755
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -43,6 +43,7 @@ using OpenMetaverse.StructuredData;
43using log4net; 43using log4net;
44using Nini.Config; 44using Nini.Config;
45using Amib.Threading; 45using Amib.Threading;
46using Mono.Addins;
46using OpenSim.Framework; 47using OpenSim.Framework;
47using OpenSim.Framework.Console; 48using OpenSim.Framework.Console;
48using OpenSim.Region.Framework.Scenes; 49using OpenSim.Region.Framework.Scenes;
@@ -61,6 +62,7 @@ using ScriptCompileQueue = OpenSim.Framework.LocklessQueue<object[]>;
61 62
62namespace OpenSim.Region.ScriptEngine.XEngine 63namespace OpenSim.Region.ScriptEngine.XEngine
63{ 64{
65 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "XEngine")]
64 public class XEngine : INonSharedRegionModule, IScriptModule, IScriptEngine 66 public class XEngine : INonSharedRegionModule, IScriptModule, IScriptEngine
65 { 67 {
66 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 68 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -71,7 +73,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
71 /// <remarks> 73 /// <remarks>
72 /// If DebugLevel >= 1, then we log every time that a script is started. 74 /// If DebugLevel >= 1, then we log every time that a script is started.
73 /// </remarks> 75 /// </remarks>
74// public int DebugLevel { get; set; } 76 public int DebugLevel { get; set; }
77
78 /// <summary>
79 /// A parameter to allow us to notify the log if at least one script has a compilation that is not compatible
80 /// with ScriptStopStrategy.
81 /// </summary>
82 public bool HaveNotifiedLogOfScriptStopMistmatch { get; private set; }
75 83
76 private SmartThreadPool m_ThreadPool; 84 private SmartThreadPool m_ThreadPool;
77 private int m_MaxScriptQueue; 85 private int m_MaxScriptQueue;
@@ -87,6 +95,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
87 /// </summary> 95 /// </summary>
88 private int m_StartDelay; 96 private int m_StartDelay;
89 97
98 /// <summary>
99 /// Are we stopping scripts co-operatively by inserting checks in them at C# compile time (true) or aborting
100 /// their threads (false)?
101 /// </summary>
102 private bool m_coopTermination;
103
90 private int m_IdleTimeout; 104 private int m_IdleTimeout;
91 private int m_StackSize; 105 private int m_StackSize;
92 private int m_SleepTime; 106 private int m_SleepTime;
@@ -96,7 +110,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
96 private bool m_InitialStartup = true; 110 private bool m_InitialStartup = true;
97 private int m_ScriptFailCount; // Number of script fails since compile queue was last empty 111 private int m_ScriptFailCount; // Number of script fails since compile queue was last empty
98 private string m_ScriptErrorMessage; 112 private string m_ScriptErrorMessage;
99 private Dictionary<string, string> m_uniqueScripts = new Dictionary<string, string>();
100 private bool m_AppDomainLoading; 113 private bool m_AppDomainLoading;
101 private Dictionary<UUID,ArrayList> m_ScriptErrors = 114 private Dictionary<UUID,ArrayList> m_ScriptErrors =
102 new Dictionary<UUID,ArrayList>(); 115 new Dictionary<UUID,ArrayList>();
@@ -308,12 +321,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
308 m_ScriptConfig = configSource.Configs["XEngine"]; 321 m_ScriptConfig = configSource.Configs["XEngine"];
309 m_ConfigSource = configSource; 322 m_ConfigSource = configSource;
310 323
311 string rawScriptStopStrategy = m_ScriptConfig.GetString("ScriptStopStrategy", "abort"); 324 string rawScriptStopStrategy = m_ScriptConfig.GetString("ScriptStopStrategy", "co-op");
312 325
313 m_log.InfoFormat("[XEngine]: Script stop strategy is {0}", rawScriptStopStrategy); 326 m_log.InfoFormat("[XEngine]: Script stop strategy is {0}", rawScriptStopStrategy);
314 327
315 if (rawScriptStopStrategy == "co-op") 328 if (rawScriptStopStrategy == "co-op")
316 { 329 {
330 m_coopTermination = true;
317 ScriptClassName = "XEngineScript"; 331 ScriptClassName = "XEngineScript";
318 ScriptBaseClassName = typeof(XEngineScriptBase).FullName; 332 ScriptBaseClassName = typeof(XEngineScriptBase).FullName;
319 ScriptBaseClassParameters = typeof(XEngineScriptBase).GetConstructor(new Type[] { typeof(WaitHandle) }).GetParameters(); 333 ScriptBaseClassParameters = typeof(XEngineScriptBase).GetConstructor(new Type[] { typeof(WaitHandle) }).GetParameters();
@@ -457,19 +471,19 @@ namespace OpenSim.Region.ScriptEngine.XEngine
457 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleStartScript)); 471 (module, cmdparams) => HandleScriptsAction(cmdparams, HandleStartScript));
458 472
459 MainConsole.Instance.Commands.AddCommand( 473 MainConsole.Instance.Commands.AddCommand(
460 "Scripts", false, "debug scripts log", "debug scripts log <item-id> <log-level>", "Extra debug logging for a script", 474 "Debug", false, "debug scripts log", "debug scripts log <item-id> <log-level>", "Extra debug logging for a particular script.",
461 "Activates or deactivates extra debug logging for the given script.\n" 475 "Activates or deactivates extra debug logging for the given script.\n"
462 + "Level == 0, deactivate extra debug logging.\n" 476 + "Level == 0, deactivate extra debug logging.\n"
463 + "Level >= 1, log state changes.\n" 477 + "Level >= 1, log state changes.\n"
464 + "Level >= 2, log event invocations.\n", 478 + "Level >= 2, log event invocations.\n",
465 HandleDebugScriptLogCommand); 479 HandleDebugScriptLogCommand);
466 480
467// MainConsole.Instance.Commands.AddCommand( 481 MainConsole.Instance.Commands.AddCommand(
468// "Debug", false, "debug xengine", "debug xengine [<level>]", 482 "Debug", false, "debug xengine log", "debug xengine log [<level>]",
469// "Turn on detailed xengine debugging.", 483 "Turn on detailed xengine debugging.",
470// "If level <= 0, then no extra logging is done.\n" 484 "If level <= 0, then no extra logging is done.\n"
471// + "If level >= 1, then we log every time that a script is started.", 485 + "If level >= 1, then we log every time that a script is started.",
472// HandleDebugLevelCommand); 486 HandleDebugLevelCommand);
473 } 487 }
474 488
475 private void HandleDebugScriptLogCommand(string module, string[] args) 489 private void HandleDebugScriptLogCommand(string module, string[] args)
@@ -512,26 +526,26 @@ namespace OpenSim.Region.ScriptEngine.XEngine
512 /// </summary> 526 /// </summary>
513 /// <param name="module"></param> 527 /// <param name="module"></param>
514 /// <param name="args"></param> 528 /// <param name="args"></param>
515// private void HandleDebugLevelCommand(string module, string[] args) 529 private void HandleDebugLevelCommand(string module, string[] args)
516// { 530 {
517// if (args.Length == 3) 531 if (args.Length >= 4)
518// { 532 {
519// int newDebug; 533 int newDebug;
520// if (int.TryParse(args[2], out newDebug)) 534 if (ConsoleUtil.TryParseConsoleNaturalInt(MainConsole.Instance, args[3], out newDebug))
521// { 535 {
522// DebugLevel = newDebug; 536 DebugLevel = newDebug;
523// MainConsole.Instance.OutputFormat("Debug level set to {0}", newDebug); 537 MainConsole.Instance.OutputFormat("Debug level set to {0} in XEngine for region {1}", newDebug, m_Scene.Name);
524// } 538 }
525// } 539 }
526// else if (args.Length == 2) 540 else if (args.Length == 3)
527// { 541 {
528// MainConsole.Instance.OutputFormat("Current debug level is {0}", DebugLevel); 542 MainConsole.Instance.OutputFormat("Current debug level is {0}", DebugLevel);
529// } 543 }
530// else 544 else
531// { 545 {
532// MainConsole.Instance.Output("Usage: debug xengine 0..1"); 546 MainConsole.Instance.Output("Usage: debug xengine log <level>");
533// } 547 }
534// } 548 }
535 549
536 /// <summary> 550 /// <summary>
537 /// Parse the raw item id into a script instance from the command params if it's present. 551 /// Parse the raw item id into a script instance from the command params if it's present.
@@ -631,7 +645,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
631 } 645 }
632 646
633 sb.AppendFormat("Scripts loaded : {0}\n", scriptsLoaded); 647 sb.AppendFormat("Scripts loaded : {0}\n", scriptsLoaded);
634 sb.AppendFormat("Unique scripts : {0}\n", m_uniqueScripts.Count);
635 sb.AppendFormat("Scripts waiting for load : {0}\n", m_CompileQueue.Count); 648 sb.AppendFormat("Scripts waiting for load : {0}\n", m_CompileQueue.Count);
636 sb.AppendFormat("Max threads : {0}\n", m_ThreadPool.MaxThreads); 649 sb.AppendFormat("Max threads : {0}\n", m_ThreadPool.MaxThreads);
637 sb.AppendFormat("Min threads : {0}\n", m_ThreadPool.MinThreads); 650 sb.AppendFormat("Min threads : {0}\n", m_ThreadPool.MinThreads);
@@ -754,6 +767,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
754 { 767 {
755 if (instance.Running) 768 if (instance.Running)
756 { 769 {
770 instance.StayStopped = true; // the script was stopped explicitly
771
757 instance.Stop(0); 772 instance.Stop(0);
758 773
759 SceneObjectPart sop = m_Scene.GetSceneObjectPart(instance.ObjectID); 774 SceneObjectPart sop = m_Scene.GetSceneObjectPart(instance.ObjectID);
@@ -778,11 +793,20 @@ namespace OpenSim.Region.ScriptEngine.XEngine
778 // 793 //
779 if (m_Assemblies.ContainsKey(instance.AssetID)) 794 if (m_Assemblies.ContainsKey(instance.AssetID))
780 { 795 {
796<<<<<<< HEAD
797 // Force a final state save
798 //
799 try
800 {
801 if (instance.StatePersistedHere)
802 instance.SaveState();
803=======
781 string assembly = m_Assemblies[instance.AssetID]; 804 string assembly = m_Assemblies[instance.AssetID];
782 805
783 try 806 try
784 { 807 {
785 instance.SaveState(assembly); 808 instance.SaveState(assembly);
809>>>>>>> avn/ubitvar
786 } 810 }
787 catch (Exception e) 811 catch (Exception e)
788 { 812 {
@@ -794,10 +818,16 @@ namespace OpenSim.Region.ScriptEngine.XEngine
794 } 818 }
795 } 819 }
796 820
821<<<<<<< HEAD
822 // Clear the event queue and abort the instance thread
823 //
824 instance.Stop(0, true);
825=======
797 // Clear the event queue and abort the instance thread 826 // Clear the event queue and abort the instance thread
798 // 827 //
799 instance.ClearQueue(); 828 instance.ClearQueue();
800 instance.Stop(0); 829 instance.Stop(0);
830>>>>>>> avn/ubitvar
801 831
802 // Release events, timer, etc 832 // Release events, timer, etc
803 // 833 //
@@ -898,6 +928,25 @@ namespace OpenSim.Region.ScriptEngine.XEngine
898 928
899 List<IScriptInstance> instances = new List<IScriptInstance>(); 929 List<IScriptInstance> instances = new List<IScriptInstance>();
900 930
931<<<<<<< HEAD
932 lock (m_Scripts)
933 {
934 foreach (IScriptInstance instance in m_Scripts.Values)
935 {
936 if (instance.StatePersistedHere)
937 {
938// m_log.DebugFormat(
939// "[XEngine]: Adding script {0}.{1}, item UUID {2}, prim UUID {3} in {4} for state persistence",
940// instance.PrimName, instance.ScriptName, instance.ItemID, instance.ObjectID, World.Name);
941
942 instances.Add(instance);
943 }
944 }
945 }
946
947 foreach (IScriptInstance i in instances)
948 {
949=======
901 lockScriptsForRead(true); 950 lockScriptsForRead(true);
902 foreach (IScriptInstance instance in m_Scripts.Values) 951 foreach (IScriptInstance instance in m_Scripts.Values)
903 instances.Add(instance); 952 instances.Add(instance);
@@ -913,9 +962,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
913 assembly = m_Assemblies[i.AssetID]; 962 assembly = m_Assemblies[i.AssetID];
914 963
915 964
965>>>>>>> avn/ubitvar
916 try 966 try
917 { 967 {
918 i.SaveState(assembly); 968 i.SaveState();
919 } 969 }
920 catch (Exception e) 970 catch (Exception e)
921 { 971 {
@@ -927,8 +977,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
927 } 977 }
928 } 978 }
929 979
930 instances.Clear();
931
932 if (saveTime > 0) 980 if (saveTime > 0)
933 m_ThreadPool.QueueWorkItem(new WorkItemCallback(this.DoBackup), 981 m_ThreadPool.QueueWorkItem(new WorkItemCallback(this.DoBackup),
934 new Object[] { saveTime }); 982 new Object[] { saveTime });
@@ -938,6 +986,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
938 986
939 public void SaveAllState() 987 public void SaveAllState()
940 { 988 {
989 DoBackup(new object[] { 0 });
990 }
991
992 public object DoMaintenance(object p)
993 {
994 object[] parms = (object[])p;
995 int sleepTime = (int)parms[0];
996
941 foreach (IScriptInstance inst in m_Scripts.Values) 997 foreach (IScriptInstance inst in m_Scripts.Values)
942 { 998 {
943 if (inst.EventTime() > m_EventLimit) 999 if (inst.EventTime() > m_EventLimit)
@@ -947,14 +1003,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
947 inst.Start(); 1003 inst.Start();
948 } 1004 }
949 } 1005 }
950 }
951
952 public object DoMaintenance(object p)
953 {
954 object[] parms = (object[])p;
955 int sleepTime = (int)parms[0];
956
957 SaveAllState();
958 1006
959 System.Threading.Thread.Sleep(sleepTime); 1007 System.Threading.Thread.Sleep(sleepTime);
960 1008
@@ -1032,8 +1080,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1032 if (restOfFirstLine.StartsWith("c#") 1080 if (restOfFirstLine.StartsWith("c#")
1033 || restOfFirstLine.StartsWith("vb") 1081 || restOfFirstLine.StartsWith("vb")
1034 || restOfFirstLine.StartsWith("lsl") 1082 || restOfFirstLine.StartsWith("lsl")
1035 || restOfFirstLine.StartsWith("js")
1036 || restOfFirstLine.StartsWith("yp")
1037 || restOfFirstLine.Length == 0) 1083 || restOfFirstLine.Length == 0)
1038 warnRunningInXEngine = true; 1084 warnRunningInXEngine = true;
1039 1085
@@ -1067,12 +1113,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1067 if (engine != ScriptEngineName) 1113 if (engine != ScriptEngineName)
1068 return; 1114 return;
1069 1115
1070 // If we've seen this exact script text before, use that reference instead
1071 if (m_uniqueScripts.ContainsKey(script))
1072 script = m_uniqueScripts[script];
1073 else
1074 m_uniqueScripts[script] = script;
1075
1076 Object[] parms = new Object[]{localID, itemID, script, startParam, postOnRez, (StateSource)stateSource}; 1116 Object[] parms = new Object[]{localID, itemID, script, startParam, postOnRez, (StateSource)stateSource};
1077 1117
1078 if (stateSource == (int)StateSource.ScriptedRez) 1118 if (stateSource == (int)StateSource.ScriptedRez)
@@ -1086,11 +1126,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1086 } 1126 }
1087 else 1127 else
1088 { 1128 {
1089 m_CompileQueue.Enqueue(parms);
1090 lock (m_CompileDict) 1129 lock (m_CompileDict)
1091 {
1092 m_CompileDict[itemID] = 0; 1130 m_CompileDict[itemID] = 0;
1093 } 1131
1132 // This must occur after the m_CompileDict so that an existing compile thread cannot hit the check
1133 // in DoOnRezScript() before m_CompileDict has been updated.
1134 m_CompileQueue.Enqueue(parms);
1094 1135
1095// m_log.DebugFormat("[XEngine]: Added script {0} to compile queue", itemID); 1136// m_log.DebugFormat("[XEngine]: Added script {0} to compile queue", itemID);
1096 1137
@@ -1112,49 +1153,81 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1112 1153
1113 public Object DoOnRezScriptQueue(Object dummy) 1154 public Object DoOnRezScriptQueue(Object dummy)
1114 { 1155 {
1115 if (m_InitialStartup) 1156 try
1116 { 1157 {
1117 // This delay exists to stop mono problems where script compilation and startup would stop the sim 1158 if (m_InitialStartup)
1118 // working properly for the session. 1159 {
1119 System.Threading.Thread.Sleep(m_StartDelay); 1160 // This delay exists to stop mono problems where script compilation and startup would stop the sim
1161 // working properly for the session.
1162 System.Threading.Thread.Sleep(m_StartDelay);
1120 1163
1121 m_log.InfoFormat("[XEngine]: Performing initial script startup on {0}", m_Scene.Name); 1164 m_log.InfoFormat("[XEngine]: Performing initial script startup on {0}", m_Scene.Name);
1122 } 1165 }
1123 1166
1124 object[] o; 1167 object[] o;
1125 1168
1126 int scriptsStarted = 0; 1169 int scriptsStarted = 0;
1127 1170
1128 while (m_CompileQueue.Dequeue(out o)) 1171 while (m_CompileQueue.Dequeue(out o))
1129 {
1130 if (DoOnRezScript(o))
1131 { 1172 {
1132 scriptsStarted++; 1173 try
1174 {
1175 if (DoOnRezScript(o))
1176 {
1177 scriptsStarted++;
1133 1178
1134 if (m_InitialStartup) 1179 if (m_InitialStartup)
1135 if (scriptsStarted % 50 == 0) 1180 if (scriptsStarted % 50 == 0)
1136 m_log.InfoFormat( 1181 m_log.InfoFormat(
1137 "[XEngine]: Started {0} scripts in {1}", scriptsStarted, m_Scene.Name); 1182 "[XEngine]: Started {0} scripts in {1}", scriptsStarted, m_Scene.Name);
1183 }
1184 }
1185 catch (Exception e)
1186 {
1187 m_log.Error(
1188 string.Format(
1189 "[XEngine]: Failure in DoOnRezScriptQueue() for item {0} in {1}. Continuing. Exception ",
1190 o[1], m_Scene.Name),
1191 e);
1192 }
1138 } 1193 }
1139 }
1140 1194
1141 if (m_InitialStartup) 1195 if (m_InitialStartup)
1142 m_log.InfoFormat( 1196 m_log.InfoFormat(
1143 "[XEngine]: Completed starting {0} scripts on {1}", scriptsStarted, m_Scene.Name); 1197 "[XEngine]: Completed starting {0} scripts on {1}", scriptsStarted, m_Scene.Name);
1144 1198
1145 // NOTE: Despite having a lockless queue, this lock is required 1199 }
1146 // to make sure there is never no compile thread while there 1200 catch (Exception e)
1147 // are still scripts to compile. This could otherwise happen 1201 {
1148 // due to a race condition 1202 m_log.Error(
1149 // 1203 string.Format("[XEngine]: Failure in DoOnRezScriptQueue() in {0}. Exception ", m_Scene.Name), e);
1150 lock (m_CompileQueue) 1204 }
1151 m_CurrentCompile = null; 1205 finally
1206 {
1207 // FIXME: On failure we must trigger this even if the compile queue is not actually empty so that the
1208 // RegionReadyModule is not forever waiting. This event really needs a different name.
1209 m_Scene.EventManager.TriggerEmptyScriptCompileQueue(m_ScriptFailCount,
1210 m_ScriptErrorMessage);
1152 1211
1153 m_Scene.EventManager.TriggerEmptyScriptCompileQueue(m_ScriptFailCount, 1212 m_ScriptFailCount = 0;
1154 m_ScriptErrorMessage); 1213 m_InitialStartup = false;
1155 1214
1156 m_ScriptFailCount = 0; 1215 // NOTE: Despite having a lockless queue, this lock is required
1157 m_InitialStartup = false; 1216 // to make sure there is never no compile thread while there
1217 // are still scripts to compile. This could otherwise happen
1218 // due to a race condition
1219 //
1220 lock (m_CompileQueue)
1221 {
1222 m_CurrentCompile = null;
1223
1224 // This is to avoid a situation where the m_CompileQueue while loop above could complete but
1225 // OnRezScript() place a new script on the queue and check m_CurrentCompile = null before we hit
1226 // this section.
1227 if (m_CompileQueue.Count > 0)
1228 m_CurrentCompile = m_ThreadPool.QueueWorkItem(DoOnRezScriptQueue, null);
1229 }
1230 }
1158 1231
1159 return null; 1232 return null;
1160 } 1233 }
@@ -1201,16 +1274,17 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1201 return false; 1274 return false;
1202 } 1275 }
1203 1276
1204 m_log.DebugFormat( 1277 if (DebugLevel > 0)
1205 "[XEngine]: Loading script {0}.{1}, item UUID {2}, prim UUID {3} @ {4}.{5}", 1278 m_log.DebugFormat(
1206 part.ParentGroup.RootPart.Name, item.Name, itemID, part.UUID, 1279 "[XEngine]: Loading script {0}.{1}, item UUID {2}, prim UUID {3} @ {4}.{5}",
1207 part.ParentGroup.RootPart.AbsolutePosition, part.ParentGroup.Scene.RegionInfo.RegionName); 1280 part.ParentGroup.RootPart.Name, item.Name, itemID, part.UUID,
1281 part.ParentGroup.RootPart.AbsolutePosition, part.ParentGroup.Scene.RegionInfo.RegionName);
1208 1282
1209 UUID assetID = item.AssetID; 1283 UUID assetID = item.AssetID;
1210 1284
1211 ScenePresence presence = m_Scene.GetScenePresence(item.OwnerID); 1285 ScenePresence presence = m_Scene.GetScenePresence(item.OwnerID);
1212 1286
1213 string assembly = ""; 1287 string assemblyPath = "";
1214 1288
1215 Culture.SetCurrentCulture(); 1289 Culture.SetCurrentCulture();
1216 1290
@@ -1222,12 +1296,16 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1222 { 1296 {
1223 lock (m_AddingAssemblies) 1297 lock (m_AddingAssemblies)
1224 { 1298 {
1225 m_Compiler.PerformScriptCompile(script, assetID.ToString(), item.OwnerID, out assembly, out linemap); 1299 m_Compiler.PerformScriptCompile(script, assetID.ToString(), item.OwnerID, out assemblyPath, out linemap);
1226 1300
1227 if (!m_AddingAssemblies.ContainsKey(assembly)) { 1301// m_log.DebugFormat(
1228 m_AddingAssemblies[assembly] = 1; 1302// "[XENGINE]: Found assembly path {0} onrez {1} in {2}",
1303// assemblyPath, item.ItemID, World.Name);
1304
1305 if (!m_AddingAssemblies.ContainsKey(assemblyPath)) {
1306 m_AddingAssemblies[assemblyPath] = 1;
1229 } else { 1307 } else {
1230 m_AddingAssemblies[assembly]++; 1308 m_AddingAssemblies[assemblyPath]++;
1231 } 1309 }
1232 } 1310 }
1233 1311
@@ -1387,11 +1465,156 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1387 } 1465 }
1388 else 1466 else
1389 { 1467 {
1468<<<<<<< HEAD
1469 m_log.ErrorFormat("[XEngine] Exception creating app domain:\n {0}", e.ToString());
1470 m_ScriptErrorMessage += "Exception creating app domain:\n";
1471 m_ScriptFailCount++;
1472 lock (m_AddingAssemblies)
1473 {
1474 m_AddingAssemblies[assemblyPath]--;
1475 }
1476 return false;
1477=======
1390 sandbox = AppDomain.CurrentDomain; 1478 sandbox = AppDomain.CurrentDomain;
1479>>>>>>> avn/ubitvar
1480 }
1481
1482<<<<<<< HEAD
1483 IScript scriptObj = null;
1484 EventWaitHandle coopSleepHandle;
1485 bool coopTerminationForThisScript;
1486
1487 // Set up assembly name to point to the appropriate scriptEngines directory
1488 AssemblyName assemblyName = new AssemblyName(Path.GetFileNameWithoutExtension(assemblyPath));
1489 assemblyName.CodeBase = Path.GetDirectoryName(assemblyPath);
1490
1491 if (m_coopTermination)
1492 {
1493 try
1494 {
1495 coopSleepHandle = new XEngineEventWaitHandle(false, EventResetMode.AutoReset);
1496
1497 scriptObj
1498 = (IScript)m_AppDomains[appDomain].CreateInstanceAndUnwrap(
1499 assemblyName.FullName,
1500 "SecondLife.XEngineScript",
1501 false,
1502 BindingFlags.Default,
1503 null,
1504 new object[] { coopSleepHandle },
1505 null,
1506 null);
1507
1508 coopTerminationForThisScript = true;
1509 }
1510 catch (TypeLoadException)
1511 {
1512 coopSleepHandle = null;
1513
1514 try
1515 {
1516 scriptObj
1517 = (IScript)m_AppDomains[appDomain].CreateInstanceAndUnwrap(
1518 assemblyName.FullName,
1519 "SecondLife.Script",
1520 false,
1521 BindingFlags.Default,
1522 null,
1523 null,
1524 null,
1525 null);
1526 }
1527 catch (Exception e2)
1528 {
1529 m_log.Error(
1530 string.Format(
1531 "[XENGINE]: Could not load previous SecondLife.Script from assembly {0} in {1}. Not starting. Exception ",
1532 assemblyName.FullName, World.Name),
1533 e2);
1534
1535 return false;
1536 }
1537
1538 coopTerminationForThisScript = false;
1539 }
1540 }
1541 else
1542 {
1543 try
1544 {
1545 scriptObj
1546 = (IScript)m_AppDomains[appDomain].CreateInstanceAndUnwrap(
1547 assemblyName.FullName,
1548 "SecondLife.Script",
1549 false,
1550 BindingFlags.Default,
1551 null,
1552 null,
1553 null,
1554 null);
1555
1556 coopSleepHandle = null;
1557 coopTerminationForThisScript = false;
1391 } 1558 }
1559 catch (TypeLoadException)
1560 {
1561 coopSleepHandle = new XEngineEventWaitHandle(false, EventResetMode.AutoReset);
1562
1563 try
1564 {
1565 scriptObj
1566 = (IScript)m_AppDomains[appDomain].CreateInstanceAndUnwrap(
1567 assemblyName.FullName,
1568 "SecondLife.XEngineScript",
1569 false,
1570 BindingFlags.Default,
1571 null,
1572 new object[] { coopSleepHandle },
1573 null,
1574 null);
1575 }
1576 catch (Exception e2)
1577 {
1578 m_log.Error(
1579 string.Format(
1580 "[XENGINE]: Could not load previous SecondLife.XEngineScript from assembly {0} in {1}. Not starting. Exception ",
1581 assemblyName.FullName, World.Name),
1582 e2);
1583
1584 return false;
1585 }
1586
1587 coopTerminationForThisScript = true;
1588 }
1589 }
1392 1590
1591 if (m_coopTermination != coopTerminationForThisScript && !HaveNotifiedLogOfScriptStopMistmatch)
1592 {
1593 // Notify the log that there is at least one script compile that doesn't match the
1594 // ScriptStopStrategy. Operator has to manually delete old DLLs - we can't do this on Windows
1595 // once the assembly has been loaded evne if the instantiation of a class was unsuccessful.
1596 m_log.WarnFormat(
1597 "[XEngine]: At least one existing compiled script DLL in {0} has {1} as ScriptStopStrategy whereas config setting is {2}."
1598 + "\nContinuing with script compiled strategy but to remove this message please set [XEngine] DeleteScriptsOnStartup = true for one simulator session to remove old script DLLs (script state will not be lost).",
1599 World.Name, coopTerminationForThisScript ? "co-op" : "abort", m_coopTermination ? "co-op" : "abort");
1600
1601 HaveNotifiedLogOfScriptStopMistmatch = true;
1602 }
1603
1604 instance = new ScriptInstance(this, part,
1605 item,
1606 startParam, postOnRez,
1607 m_MaxScriptQueue);
1608
1609 if (
1610 !instance.Load(
1611 scriptObj, coopSleepHandle, assemblyPath,
1612 Path.Combine(ScriptEnginePath, World.RegionInfo.RegionID.ToString()), stateSource, coopTerminationForThisScript))
1613 return false;
1614=======
1393// if (!instance.Load(m_AppDomains[appDomain], assembly, stateSource)) 1615// if (!instance.Load(m_AppDomains[appDomain], assembly, stateSource))
1394// return false; 1616// return false;
1617>>>>>>> avn/ubitvar
1395 1618
1396 m_AppDomains[appDomain] = sandbox; 1619 m_AppDomains[appDomain] = sandbox;
1397 1620
@@ -1444,11 +1667,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1444 } 1667 }
1445 1668
1446 if (!m_Assemblies.ContainsKey(assetID)) 1669 if (!m_Assemblies.ContainsKey(assetID))
1447 m_Assemblies[assetID] = assembly; 1670 m_Assemblies[assetID] = assemblyPath;
1448 1671
1449 lock (m_AddingAssemblies) 1672 lock (m_AddingAssemblies)
1450 { 1673 {
1451 m_AddingAssemblies[assembly]--; 1674 m_AddingAssemblies[assemblyPath]--;
1452 } 1675 }
1453 1676
1454 if (instance!=null) 1677 if (instance!=null)
@@ -1482,6 +1705,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1482 return; 1705 return;
1483 } 1706 }
1484 1707
1708<<<<<<< HEAD
1709 instance.Stop(m_WaitForEventCompletionOnScriptStop, true);
1710=======
1485 IScriptInstance instance=m_Scripts[itemID]; 1711 IScriptInstance instance=m_Scripts[itemID];
1486 lockScriptsForRead(false); 1712 lockScriptsForRead(false);
1487 lockScriptsForWrite(true); 1713 lockScriptsForWrite(true);
@@ -1492,6 +1718,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1492 instance.Stop(m_WaitForEventCompletionOnScriptStop); 1718 instance.Stop(m_WaitForEventCompletionOnScriptStop);
1493 1719
1494// bool objectRemoved = false; 1720// bool objectRemoved = false;
1721>>>>>>> avn/ubitvar
1495 1722
1496 lock (m_PrimObjects) 1723 lock (m_PrimObjects)
1497 { 1724 {
@@ -1504,14 +1731,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1504 1731
1505 // If there are no more scripts, remove prim 1732 // If there are no more scripts, remove prim
1506 if (m_PrimObjects[localID].Count == 0) 1733 if (m_PrimObjects[localID].Count == 0)
1507 {
1508 m_PrimObjects.Remove(localID); 1734 m_PrimObjects.Remove(localID);
1509// objectRemoved = true;
1510 }
1511 } 1735 }
1512 } 1736 }
1513 1737
1514 instance.RemoveState(); 1738 if (instance.StatePersistedHere)
1739 instance.RemoveState();
1740
1515 instance.DestroyScriptInstance(); 1741 instance.DestroyScriptInstance();
1516 1742
1517 if (m_DomainScripts.ContainsKey(instance.AppDomain)) 1743 if (m_DomainScripts.ContainsKey(instance.AppDomain))
@@ -1653,7 +1879,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1653 1879
1654 IScriptInstance instance = (ScriptInstance) parms; 1880 IScriptInstance instance = (ScriptInstance) parms;
1655 1881
1656 //m_log.DebugFormat("[XEngine]: Processing event for {0}", instance); 1882// m_log.DebugFormat("[XEngine]: Processing event for {0}", instance);
1657 1883
1658 return instance.EventProcessor(); 1884 return instance.EventProcessor();
1659 } 1885 }
@@ -1829,6 +2055,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1829 IScriptInstance instance = GetInstance(itemID); 2055 IScriptInstance instance = GetInstance(itemID);
1830 if (instance != null) 2056 if (instance != null)
1831 instance.ApiResetScript(); 2057 instance.ApiResetScript();
2058
2059 // Send the new number of threads that are in use by the thread
2060 // pool, I believe that by adding them to the locations where the
2061 // script is changing states that I will catch all changes to the
2062 // thread pool
2063 m_Scene.setThreadCount(m_ThreadPool.InUseThreads);
1832 } 2064 }
1833 2065
1834 public void ResetScript(UUID itemID) 2066 public void ResetScript(UUID itemID)
@@ -1836,6 +2068,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1836 IScriptInstance instance = GetInstance(itemID); 2068 IScriptInstance instance = GetInstance(itemID);
1837 if (instance != null) 2069 if (instance != null)
1838 instance.ResetScript(m_WaitForEventCompletionOnScriptStop); 2070 instance.ResetScript(m_WaitForEventCompletionOnScriptStop);
2071
2072 // Send the new number of threads that are in use by the thread
2073 // pool, I believe that by adding them to the locations where the
2074 // script is changing states that I will catch all changes to the
2075 // thread pool
2076 m_Scene.setThreadCount(m_ThreadPool.InUseThreads);
1839 } 2077 }
1840 2078
1841 public void StartScript(UUID itemID) 2079 public void StartScript(UUID itemID)
@@ -1845,6 +2083,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1845 instance.Start(); 2083 instance.Start();
1846 else 2084 else
1847 m_runFlags.AddOrUpdate(itemID, true, 240); 2085 m_runFlags.AddOrUpdate(itemID, true, 240);
2086
2087 // Send the new number of threads that are in use by the thread
2088 // pool, I believe that by adding them to the locations where the
2089 // script is changing states that I will catch all changes to the
2090 // thread pool
2091 m_Scene.setThreadCount(m_ThreadPool.InUseThreads);
1848 } 2092 }
1849 2093
1850 public void StopScript(UUID itemID) 2094 public void StopScript(UUID itemID)
@@ -1853,6 +2097,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1853 2097
1854 if (instance != null) 2098 if (instance != null)
1855 { 2099 {
2100 lock (instance.EventQueue)
2101 instance.StayStopped = true; // the script was stopped explicitly
2102
1856 instance.Stop(m_WaitForEventCompletionOnScriptStop); 2103 instance.Stop(m_WaitForEventCompletionOnScriptStop);
1857 } 2104 }
1858 else 2105 else
@@ -1860,6 +2107,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1860// m_log.DebugFormat("[XENGINE]: Could not find script with ID {0} to stop in {1}", itemID, World.Name); 2107// m_log.DebugFormat("[XENGINE]: Could not find script with ID {0} to stop in {1}", itemID, World.Name);
1861 m_runFlags.AddOrUpdate(itemID, false, 240); 2108 m_runFlags.AddOrUpdate(itemID, false, 240);
1862 } 2109 }
2110
2111 // Send the new number of threads that are in use by the thread
2112 // pool, I believe that by adding them to the locations where the
2113 // script is changing states that I will catch all changes to the
2114 // thread pool
2115 m_Scene.setThreadCount(m_ThreadPool.InUseThreads);
1863 } 2116 }
1864 2117
1865 public DetectParams GetDetectParams(UUID itemID, int idx) 2118 public DetectParams GetDetectParams(UUID itemID, int idx)
@@ -2225,7 +2478,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2225 catch (IOException ex) 2478 catch (IOException ex)
2226 { 2479 {
2227 // if there already exists a file at that location, it may be locked. 2480 // if there already exists a file at that location, it may be locked.
2228 m_log.ErrorFormat("[XEngine]: Linemap file {0} already exists! {1}", mappath, ex.Message); 2481 m_log.Error(
2482 string.Format("[XEngine]: Linemap file {0} could not be written. Exception ", mappath), ex);
2229 } 2483 }
2230 } 2484 }
2231 } 2485 }
@@ -2251,6 +2505,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2251 m_log.ErrorFormat("[XEngine]: Error whilst writing state file {0}, {1}", statepath, ex.Message); 2505 m_log.ErrorFormat("[XEngine]: Error whilst writing state file {0}, {1}", statepath, ex.Message);
2252 } 2506 }
2253 2507
2508// m_log.DebugFormat(
2509// "[XEngine]: Wrote state for script item with ID {0} at {1} in {2}", itemID, statepath, m_Scene.Name);
2510
2254 return true; 2511 return true;
2255 } 2512 }
2256 2513
@@ -2272,7 +2529,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2272 2529
2273 public Dictionary<uint, float> GetObjectScriptsExecutionTimes() 2530 public Dictionary<uint, float> GetObjectScriptsExecutionTimes()
2274 { 2531 {
2275 long tickNow = Util.EnvironmentTickCount();
2276 Dictionary<uint, float> topScripts = new Dictionary<uint, float>(); 2532 Dictionary<uint, float> topScripts = new Dictionary<uint, float>();
2277 2533
2278 lock (m_Scripts) 2534 lock (m_Scripts)
@@ -2282,7 +2538,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2282 if (!topScripts.ContainsKey(si.LocalID)) 2538 if (!topScripts.ContainsKey(si.LocalID))
2283 topScripts[si.RootLocalID] = 0; 2539 topScripts[si.RootLocalID] = 0;
2284 2540
2285 topScripts[si.RootLocalID] += CalculateAdjustedExectionTime(si, tickNow); 2541 topScripts[si.RootLocalID] += GetExectionTime(si);
2286 } 2542 }
2287 } 2543 }
2288 2544
@@ -2296,7 +2552,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2296 return 0.0f; 2552 return 0.0f;
2297 } 2553 }
2298 float time = 0.0f; 2554 float time = 0.0f;
2299 long tickNow = Util.EnvironmentTickCount();
2300 IScriptInstance si; 2555 IScriptInstance si;
2301 // Calculate the time for all scripts that this engine is executing 2556 // Calculate the time for all scripts that this engine is executing
2302 // Ignore any others 2557 // Ignore any others
@@ -2305,36 +2560,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2305 si = GetInstance(id); 2560 si = GetInstance(id);
2306 if (si != null && si.Running) 2561 if (si != null && si.Running)
2307 { 2562 {
2308 time += CalculateAdjustedExectionTime(si, tickNow); 2563 time += GetExectionTime(si);
2309 } 2564 }
2310 } 2565 }
2311 return time; 2566 return time;
2312 } 2567 }
2313 2568
2314 private float CalculateAdjustedExectionTime(IScriptInstance si, long tickNow) 2569 private float GetExectionTime(IScriptInstance si)
2315 { 2570 {
2316 long ticksElapsed = tickNow - si.MeasurementPeriodTickStart; 2571 return (float)si.ExecutionTime.GetSumTime().TotalMilliseconds;
2317
2318 // Avoid divide by zero
2319 if (ticksElapsed == 0)
2320 ticksElapsed = 1;
2321
2322 // Scale execution time to the ideal 55 fps frame time for these reasons.
2323 //
2324 // 1) XEngine does not execute scripts per frame, unlike other script engines. Hence, there is no
2325 // 'script execution time per frame', which is the original purpose of this value.
2326 //
2327 // 2) Giving the raw execution times is misleading since scripts start at different times, making
2328 // it impossible to compare scripts.
2329 //
2330 // 3) Scaling the raw execution time to the time that the script has been running is better but
2331 // is still misleading since a script that has just been rezzed may appear to have been running
2332 // for much longer.
2333 //
2334 // 4) Hence, we scale execution time to an idealised frame time (55 fps). This is also not perfect
2335 // since the figure does not represent actual execution time and very hard running scripts will
2336 // never exceed 18ms (though this is a very high number for script execution so is a warning sign).
2337 return ((float)si.MeasurementPeriodExecutionTime / ticksElapsed) * 18.1818f;
2338 } 2572 }
2339 2573
2340 public void SuspendScript(UUID itemID) 2574 public void SuspendScript(UUID itemID)
@@ -2346,6 +2580,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2346 instance.Suspend(); 2580 instance.Suspend();
2347// else 2581// else
2348// m_log.DebugFormat("[XEngine]: Could not find script with ID {0} to resume", itemID); 2582// m_log.DebugFormat("[XEngine]: Could not find script with ID {0} to resume", itemID);
2583
2584 // Send the new number of threads that are in use by the thread
2585 // pool, I believe that by adding them to the locations where the
2586 // script is changing states that I will catch all changes to the
2587 // thread pool
2588 m_Scene.setThreadCount(m_ThreadPool.InUseThreads);
2349 } 2589 }
2350 2590
2351 public void ResumeScript(UUID itemID) 2591 public void ResumeScript(UUID itemID)
@@ -2357,6 +2597,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2357 instance.Resume(); 2597 instance.Resume();
2358// else 2598// else
2359// m_log.DebugFormat("[XEngine]: Could not find script with ID {0} to resume", itemID); 2599// m_log.DebugFormat("[XEngine]: Could not find script with ID {0} to resume", itemID);
2600
2601 // Send the new number of threads that are in use by the thread
2602 // pool, I believe that by adding them to the locations where the
2603 // script is changing states that I will catch all changes to the
2604 // thread pool
2605 m_Scene.setThreadCount(m_ThreadPool.InUseThreads);
2360 } 2606 }
2361 2607
2362 public bool HasScript(UUID itemID, out bool running) 2608 public bool HasScript(UUID itemID, out bool running)
@@ -2370,5 +2616,30 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2370 running = instance.Running; 2616 running = instance.Running;
2371 return true; 2617 return true;
2372 } 2618 }
2619
2620 public void SleepScript(UUID itemID, int delay)
2621 {
2622 IScriptInstance instance = GetInstance(itemID);
2623 if (instance == null)
2624 return;
2625
2626 instance.ExecutionTimer.Stop();
2627 try
2628 {
2629 if (instance.CoopWaitHandle != null)
2630 {
2631 if (instance.CoopWaitHandle.WaitOne(delay))
2632 throw new ScriptCoopStopException();
2633 }
2634 else
2635 {
2636 Thread.Sleep(delay);
2637 }
2638 }
2639 finally
2640 {
2641 instance.ExecutionTimer.Start();
2642 }
2643 }
2373 } 2644 }
2374} 2645}
diff --git a/OpenSim/Region/UserStatistics/Properties/AssemblyInfo.cs b/OpenSim/Region/UserStatistics/Properties/AssemblyInfo.cs
index f2d3255..9fac53e 100644
--- a/OpenSim/Region/UserStatistics/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/UserStatistics/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.8.0.*")] 32[assembly: AssemblyVersion("0.8.2.*")]
33 33
diff --git a/OpenSim/Region/UserStatistics/SimStatsAJAX.cs b/OpenSim/Region/UserStatistics/SimStatsAJAX.cs
index ad848a1..06d9e91 100644
--- a/OpenSim/Region/UserStatistics/SimStatsAJAX.cs
+++ b/OpenSim/Region/UserStatistics/SimStatsAJAX.cs
@@ -162,9 +162,6 @@ namespace OpenSim.Region.UserStatistics
162 output.Append("OthrMS"); 162 output.Append("OthrMS");
163 HTMLUtil.TD_C(ref output); 163 HTMLUtil.TD_C(ref output);
164 HTMLUtil.TD_O(ref output, TDHeaderClass); 164 HTMLUtil.TD_O(ref output, TDHeaderClass);
165 output.Append("ScrLPS");
166 HTMLUtil.TD_C(ref output);
167 HTMLUtil.TD_O(ref output, TDHeaderClass);
168 output.Append("OutPPS"); 165 output.Append("OutPPS");
169 HTMLUtil.TD_C(ref output); 166 HTMLUtil.TD_C(ref output);
170 HTMLUtil.TD_O(ref output, TDHeaderClass); 167 HTMLUtil.TD_O(ref output, TDHeaderClass);
@@ -194,9 +191,6 @@ namespace OpenSim.Region.UserStatistics
194 output.Append(sdata.OtherFrameTime); 191 output.Append(sdata.OtherFrameTime);
195 HTMLUtil.TD_C(ref output); 192 HTMLUtil.TD_C(ref output);
196 HTMLUtil.TD_O(ref output, TDDataClassCenter); 193 HTMLUtil.TD_O(ref output, TDDataClassCenter);
197 output.Append(sdata.ScriptLinesPerSecond);
198 HTMLUtil.TD_C(ref output);
199 HTMLUtil.TD_O(ref output, TDDataClassCenter);
200 output.Append(sdata.OutPacketsPerSecond); 194 output.Append(sdata.OutPacketsPerSecond);
201 HTMLUtil.TD_C(ref output); 195 HTMLUtil.TD_C(ref output);
202 HTMLUtil.TD_O(ref output, TDDataClassCenter); 196 HTMLUtil.TD_O(ref output, TDDataClassCenter);
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs
index b98b762..1383208 100644
--- a/OpenSim/Region/UserStatistics/WebStatsModule.cs
+++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs
@@ -50,8 +50,8 @@ using Caps = OpenSim.Framework.Capabilities.Caps;
50using OSD = OpenMetaverse.StructuredData.OSD; 50using OSD = OpenMetaverse.StructuredData.OSD;
51using OSDMap = OpenMetaverse.StructuredData.OSDMap; 51using OSDMap = OpenMetaverse.StructuredData.OSDMap;
52 52
53[assembly: Addin("WebStats", "1.0")] 53[assembly: Addin("WebStats", OpenSim.VersionInfo.VersionNumber)]
54[assembly: AddinDependency("OpenSim", "0.5")] 54[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)]
55 55
56namespace OpenSim.Region.UserStatistics 56namespace OpenSim.Region.UserStatistics
57{ 57{