protected EntityBase( EntityDefinition definition, IResourceLibrary resources, IAvatarFactory avatarFactory, IControllerFactory[] controllerFactories, ControllerConfig[] customControllers, Vector3D position, Vector3D direction, Vector3D velocity) : base( resources.GetSerializedResource <AvatarDefinition>(definition.AvatarId), definition.Mass, controllerFactories, definition.Controllers, customControllers) { #if LOG_VERBOSE Log.Trace("Creating entity '{0}' at {1}...", definition.Id, position); #endif this.Avatar = avatarFactory.Create(this.AvatarDefinition); this.Position = position; this.Direction = direction; this.Velocity = velocity; #if LOG_VERBOSE Log.Trace("Created '{0}' at {1}.", this.Avatar.Id, this.Avatar.Position); #endif }
/// <summary>Initializes a new instance of the UnityEntityFactory class</summary> public UnityEntityFactory( IResourceLibrary resources, IAvatarFactory avatarFactory, IControllerFactory[] controllerFactories) : base(resources, avatarFactory, controllerFactories) { }
/// <summary> /// Creates a new bot inworld /// </summary> /// <param name="FirstName"></param> /// <param name="LastName"></param> /// <param name="cloneAppearanceFrom">UUID of the avatar whos appearance will be copied to give this bot an appearance</param> /// <returns>ID of the bot</returns> public UUID CreateAvatar(string FirstName, string LastName, IScene s, UUID cloneAppearanceFrom) { Scene scene = (Scene)s; AgentCircuitData m_aCircuitData = new AgentCircuitData(); m_aCircuitData.child = false; //Add the circuit data so they can login m_aCircuitData.circuitcode = (uint)Util.RandomClass.Next(); m_aCircuitData.Appearance = GetAppearance(cloneAppearanceFrom); //Sets up appearance if (m_aCircuitData.Appearance == null) { m_aCircuitData.Appearance = new AvatarAppearance(); m_aCircuitData.Appearance.Wearables = AvatarWearable.DefaultWearables; } //Create the new bot data RexBot m_character = new RexBot(scene, m_aCircuitData); m_character.FirstName = FirstName; m_character.LastName = LastName; m_aCircuitData.AgentID = m_character.AgentId; m_aCircuitData.Appearance.Owner = m_character.AgentId; m_character.SetSourceAvatarUUID(cloneAppearanceFrom.ToString()); scene.AuthenticateHandler.AgentCircuits.Add(m_character.CircuitCode, m_aCircuitData); //This adds them to the scene and sets them inworld scene.AddNewClient(m_character); m_character.Initialize(); m_character.SendRegionHandshake(scene.RegionInfo, null); IScenePresence SP = scene.GetScenePresence(m_character.AgentId); SP.MakeRootAgent(false); SP.Invulnerable = false; IAvatarAppearanceModule appearance = SP.RequestModuleInterface <IAvatarAppearanceModule> (); appearance.Appearance.SetAppearance(appearance.Appearance.Texture, appearance.Appearance.VisualParams); appearance.SendAvatarDataToAllAgents(); appearance.SendAppearanceToAllOtherAgents(); appearance.SendOtherAgentsAppearanceToMe(); IAvatarFactory avFactory = scene.RequestModuleInterface <IAvatarFactory> (); if (avFactory != null) { avFactory.QueueInitialAppearanceSend(SP.UUID); } //Save them in the bots list m_bots.Add(m_character.AgentId, m_character); m_log.Info("[RexBotManager]: Added bot " + m_character.Name + " to scene."); //Return their UUID return(m_character.AgentId); }
/// <summary>Initializes a new instance of the TestEntity class</summary> public TestEntity( IResourceLibrary library, IAvatarFactory avatarFactory, IControllerFactory[] controllerFactories, ControllerConfig[] controllers, Vector3D position, Vector3D direction, Vector3D velocity) : this(library.GetResource <EntityDefinition>(GameDataHelper.DeepCreateTestEntityDefinition(library)), library, avatarFactory, controllerFactories, controllers, position, direction, velocity) { }
/// <summary>Initializes a new instance of the TestEntity class</summary> public TestEntity( EntityDefinition definition, IResourceLibrary library, IAvatarFactory avatarFactory, IControllerFactory[] controllerFactories, ControllerConfig[] controllers, Vector3D position, Vector3D direction, Vector3D velocity) : base(definition, library, avatarFactory, controllerFactories, controllers, position, direction, velocity) { }
public void SetUp() { this.resources = new ResourceLibrary(); this.controllers = new ControllerManager(); this.avatarFactory = new TestAvatarFactory(this.resources); this.controllerFactories = new IControllerFactory[] { this.entityControllerFactory = new ReflectionControllerFactory <IEntity>(this.controllers, this.resources), }; new DependencyContainer() .RegisterSingleton <IControllerManager, ControllerManager>() .RegisterSingleton <IInputManager, InputManager>(); }
/// <summary>Initializes a new instance of the UnityEntity class</summary> public UnityEntity( EntityDefinition definition, IResourceLibrary library, IAvatarFactory avatarFactory, IControllerFactory[] controllerFactories, ControllerConfig[] controllers, Vector3D position, Vector3D direction, Vector3D velocity) : base(definition, library, avatarFactory, controllerFactories, controllers, position, direction, velocity) { this.UnityAvatar.AddObjectBehaviour <EntityBehaviour>().Entity = this; this.UnityAvatar.Layer = EntityLayer; }
/// <summary> /// Region side /// </summary> /// <param name="message"></param> /// <returns></returns> protected OSDMap OnMessageReceived(OSDMap message) { //We need to check and see if this is an AgentStatusChange if (message.ContainsKey("Method") && message["Method"] == "UpdateAvatarAppearance") { AvatarAppearance appearance = new AvatarAppearance(message["AgentID"], (OSDMap)message["Appearance"]); ISceneManager manager = m_registry.RequestModuleInterface <ISceneManager>(); if (manager != null && manager.Scene != null) { IAvatarFactory factory = manager.Scene.RequestModuleInterface <IAvatarFactory>(); IScenePresence sp = manager.Scene.GetScenePresence(appearance.Owner); sp.RequestModuleInterface <IAvatarAppearanceModule>().Appearance = appearance; sp.RequestModuleInterface <IAvatarAppearanceModule>().SendAppearanceToAgent(sp); sp.RequestModuleInterface <IAvatarAppearanceModule>().SendAppearanceToAllOtherAgents(); } } return(null); }
public void RegionLoaded (IScene scene) { AvatarFactory = scene.RequestModuleInterface<IAvatarFactory>(); }
/// <summary> /// Sets up references to modules required by the scene /// </summary> public void SetModuleInterfaces() { m_xmlrpcModule = RequestModuleInterface<IXMLRPC>(); m_worldCommModule = RequestModuleInterface<IWorldComm>(); XferManager = RequestModuleInterface<IXfer>(); m_AvatarFactory = RequestModuleInterface<IAvatarFactory>(); m_serialiser = RequestModuleInterface<IRegionSerialiserModule>(); m_interregionCommsOut = RequestModuleInterface<IInterregionCommsOut>(); m_interregionCommsIn = RequestModuleInterface<IInterregionCommsIn>(); m_dialogModule = RequestModuleInterface<IDialogModule>(); m_capsModule = RequestModuleInterface<ICapabilitiesModule>(); m_teleportModule = RequestModuleInterface<ITeleportModule>(); }
/// <summary> /// Sets up references to modules required by the scene /// </summary> public void SetModuleInterfaces() { m_xmlrpcModule = RequestModuleInterface<IXMLRPC>(); m_worldCommModule = RequestModuleInterface<IWorldComm>(); XferManager = RequestModuleInterface<IXfer>(); m_AvatarFactory = RequestModuleInterface<IAvatarFactory>(); AttachmentsModule = RequestModuleInterface<IAttachmentsModule>(); m_serialiser = RequestModuleInterface<IRegionSerialiserModule>(); m_dialogModule = RequestModuleInterface<IDialogModule>(); m_capsModule = RequestModuleInterface<ICapabilitiesModule>(); m_teleportModule = RequestModuleInterface<IEntityTransferModule>(); // Shoving this in here for now, because we have the needed // interfaces at this point // // TODO: Find a better place for this // while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null) { MainConsole.Instance.Output("The current estate " + m_regInfo.EstateSettings.EstateName + " has no owner set."); List<char> excluded = new List<char>(new char[1] { ' ' }); string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded); string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded); UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last); if (account == null) { // Create a new account account = new UserAccount(m_regInfo.ScopeID, first, last, String.Empty); if (account.ServiceURLs == null || (account.ServiceURLs != null && account.ServiceURLs.Count == 0)) { account.ServiceURLs = new Dictionary<string, object>(); account.ServiceURLs["HomeURI"] = string.Empty; account.ServiceURLs["GatekeeperURI"] = string.Empty; account.ServiceURLs["InventoryServerURI"] = string.Empty; account.ServiceURLs["AssetServerURI"] = string.Empty; } if (UserAccountService.StoreUserAccount(account)) { string password = MainConsole.Instance.PasswdPrompt("Password"); string email = MainConsole.Instance.CmdPrompt("Email", ""); account.Email = email; UserAccountService.StoreUserAccount(account); bool success = false; success = AuthenticationService.SetPassword(account.PrincipalID, password); if (!success) m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set password for account {0} {1}.", first, last); GridRegion home = null; if (GridService != null) { List<GridRegion> defaultRegions = GridService.GetDefaultRegions(UUID.Zero); if (defaultRegions != null && defaultRegions.Count >= 1) home = defaultRegions[0]; if (GridUserService != null && home != null) GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); else m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set home for account {0} {1}.", first, last); } else m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to retrieve home region for account {0} {1}.", first, last); if (InventoryService != null) success = InventoryService.CreateUserInventory(account.PrincipalID); if (!success) m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to create inventory for account {0} {1}.", first, last); m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", first, last); m_regInfo.EstateSettings.EstateOwner = account.PrincipalID; m_regInfo.EstateSettings.Save(); } else m_log.ErrorFormat("[SCENE]: Unable to store account. If this simulator is connected to a grid, you must create the estate owner account first."); } else { m_regInfo.EstateSettings.EstateOwner = account.PrincipalID; m_regInfo.EstateSettings.Save(); } } }
public void RegionLoaded(IScene scene) { AvatarFactory = scene.RequestModuleInterface <IAvatarFactory>(); }
/// <summary> /// Sets up references to modules required by the scene /// </summary> public void SetModuleInterfaces() { m_xmlrpcModule = RequestModuleInterface<IXMLRPC>(); m_worldCommModule = RequestModuleInterface<IWorldComm>(); XferManager = RequestModuleInterface<IXfer>(); m_AvatarFactory = RequestModuleInterface<IAvatarFactory>(); AttachmentsModule = RequestModuleInterface<IAttachmentsModule>(); m_serialiser = RequestModuleInterface<IRegionSerialiserModule>(); m_dialogModule = RequestModuleInterface<IDialogModule>(); m_capsModule = RequestModuleInterface<ICapabilitiesModule>(); m_teleportModule = RequestModuleInterface<IEntityTransferModule>(); }
/// <summary>Initializes a new instance of the EntityFactoryBase class</summary> protected EntityFactoryBase(IResourceLibrary resources, IAvatarFactory avatarFactory, IControllerFactory[] controllerFactories) : base(resources) { this.AvatarFactory = avatarFactory; this.ControllerFactories = controllerFactories; }