public AgentSpawnData(MyAgentDefinition agentDefinition, int botId, Vector3D? spawnPosition = null, bool createAlways = false) { AgentDefinition = agentDefinition; SpawnPosition = spawnPosition; CreatedByPlayer = createAlways; BotId = botId; }
public MySandboxBot(MyPlayer botPlayer, MyBotDefinition botDefinition) { m_definition = botDefinition as MyAgentDefinition; m_player = botPlayer; m_navigation = new MyBotNavigation(); m_respawnRequestSent = false; m_actionCollection = null; m_botMemory = new MyBotMemory(this); m_player.Controller.ControlledEntityChanged += Controller_ControlledEntityChanged; m_navigation.ChangeEntity(m_player.Controller.ControlledEntity); }
private void CurrentToolbar_SelectedSlotChanged(MyToolbar toolbar, MyToolbar.SlotArgs args) { if (!(toolbar.SelectedItem is MyToolbarItemBot)) BotToSpawn = null; if (!(toolbar.SelectedItem is MyToolbarItemAiCommand)) CommandDefinition = null; }
public int SpawnNewBot(MyAgentDefinition agentDefinition, Vector3D? spawnPosition) { return SpawnNewBotInternal(agentDefinition, spawnPosition, true); }
private int SpawnNewBotInternal(MyAgentDefinition agentDefinition, Vector3D? spawnPosition = null, bool createdByPlayer = false) { int newBotId = 0; foreach (var player in Sync.Players.GetOnlinePlayers()) { if (player.Id.SteamId == Sync.MyId && player.Id.SerialId > newBotId) { newBotId = player.Id.SerialId; } } newBotId++; m_agentsToSpawn[newBotId] = new AgentSpawnData(agentDefinition, spawnPosition, createdByPlayer); Sync.Players.RequestNewPlayer(newBotId, MyDefinitionManager.Static.GetRandomCharacterName(), agentDefinition.BotModel); return newBotId; }
public int SpawnNewBot(MyAgentDefinition agentDefinition) { Vector3D spawnPosition = default(Vector3D); if (!BotFactory.GetBotSpawnPosition(agentDefinition.BehaviorType, out spawnPosition)) return 0; return SpawnNewBotInternal(agentDefinition, spawnPosition, false); }
private int SpawnNewBotInternal(MyAgentDefinition agentDefinition, Vector3D? spawnPosition = null, bool createAlways = false) { var currentHighestBotID = MyAIComponent.GenerateBotId(m_lastSpawnedBot); var newBotId = currentHighestBotID; EnsureIdentityUniqueness(newBotId); m_agentsToSpawn[newBotId] = new AgentSpawnData(agentDefinition, spawnPosition, createAlways); m_lastSpawnedBot = newBotId; Sync.Players.RequestNewPlayer(newBotId, agentDefinition.DisplayNameText, agentDefinition.BotModel); return newBotId; }
public MyAgentBot(MyPlayer player, MyBotDefinition botDefinition) { m_player = player; m_navigation = new MyBotNavigation(); m_actionCollection = null; m_botMemory = new MyBotMemory(this); m_botDefinition = botDefinition as MyAgentDefinition; m_player.Controller.ControlledEntityChanged += Controller_ControlledEntityChanged; m_navigation.ChangeEntity(m_player.Controller.ControlledEntity); }
private int SpawnNewBotInternal(MyAgentDefinition agentDefinition, Vector3D? spawnPosition = null, bool createdByPlayer = false) { m_lock.AcquireExclusive(); foreach (var player in Sync.Players.GetOnlinePlayers()) { if (player.Id.SteamId == Sync.MyId && player.Id.SerialId > m_lastBotId) { m_lastBotId = player.Id.SerialId; } } m_lastBotId++; var lastBotId = m_lastBotId; m_lock.ReleaseExclusive(); m_processQueue.Enqueue(new AgentSpawnData(agentDefinition, lastBotId, spawnPosition, createdByPlayer)); return lastBotId; }
public int SpawnNewBot(MyAgentDefinition agentDefinition, Vector3D position, bool createdByPlayer = true) { return SpawnNewBotInternal(agentDefinition, position, createdByPlayer); }
public void TrySpawnBot(MyAgentDefinition agentDefinition) { BotToSpawn = agentDefinition; TrySpawnBot(); }
private int SpawnNewBotInternal(MyAgentDefinition agentDefinition, Vector3D? spawnPosition = null, bool createdByPlayer = false) { var currentHighestBotID = MyAIComponent.GenerateBotId(m_lastSpawnedBot); var newBotId = currentHighestBotID; EnsureIdentityUniqueness(newBotId); m_agentsToSpawn[newBotId] = new AgentSpawnData(agentDefinition, spawnPosition, createdByPlayer); m_lastSpawnedBot = newBotId; Sync.Players.RequestNewPlayer(newBotId, MyDefinitionManager.Static.GetRandomCharacterName(), agentDefinition.BotModel); return newBotId; }
public AgentSpawnData(MyAgentDefinition agentDefinition, Vector3D? spawnPosition = null, bool createAlways = false) { AgentDefinition = agentDefinition; SpawnPosition = spawnPosition; CreateAlways = createAlways; }
public int ForceSpawnNewBot(MyAgentDefinition agentDefinition, Vector3D? spawnPosition) { //if (!MyAIComponent.Static.CanSpawnMoreBots(agentDefinition.BehaviorType)) //{ // var botHandle = m_botCollection.GetHandleToFirstBot(agentDefinition.BehaviorType); // var player = Sync.Players.TryGetPlayerById(new MyPlayer.PlayerId(MySteam.UserId, botHandle)); // Sync.Players.RemovePlayer(player); //} return SpawnNewBotInternal(agentDefinition, spawnPosition, true); }
private void CurrentToolbar_SlotActivated(MyToolbar toolbar, MyToolbar.SlotArgs args) { if (!(toolbar.GetItemAtIndex(toolbar.SlotToIndex(args.SlotNumber.Value)) is MyToolbarItemBot)) BotToSpawn = null; if (!(toolbar.GetItemAtIndex(toolbar.SlotToIndex(args.SlotNumber.Value)) is MyToolbarItemAiCommand)) CommandDefinition = null; }
private void CurrentToolbar_Unselected(MyToolbar toolbar) { BotToSpawn = null; CommandDefinition = null; }
public AgentGroupData(MyAgentDefinition agentDefinition, int count) { AgentDefinition = agentDefinition; Count = count; }
public MyAgentBot(MyPlayer player, MyBotDefinition botDefinition) { m_player = player; m_navigation = new MyBotNavigation(); m_actionCollection = null; m_botMemory = new MyBotMemory(this); m_botDefinition = botDefinition as MyAgentDefinition; m_removeAfterDeath = m_botDefinition.RemoveAfterDeath; m_respawnRequestSent = false; m_botRemoved = false; m_player.Controller.ControlledEntityChanged += Controller_ControlledEntityChanged; m_navigation.ChangeEntity(m_player.Controller.ControlledEntity); Sandbox.Game.Gui.MyCestmirDebugInputComponent.PlacedAction += DebugGoto; }
public int SpawnNewBot(MyAgentDefinition agentDefinition) { //if (!MyAIComponent.Static.CanSpawnMoreBots(agentDefinition.BehaviorType)) // return 0; Vector3D spawnPosition = default(Vector3D); if (!BotFactory.GetBotSpawnPosition(agentDefinition.BehaviorType, out spawnPosition)) return 0; return SpawnNewBotInternal(agentDefinition, spawnPosition, false); }