public void SendFaction(MyMwcObjectBuilder_FactionEnum faction) { Log("Set faction: " + MyFactionConstants.GetFactionProperties(faction).Name); var factionMsg = new MyEventSetFaction(); factionMsg.Faction = faction; Peers.SendToAll(ref factionMsg, NetDeliveryMethod.ReliableOrdered); }
private void OnChooseFactionResponse(ref MyEventChooseFactionResponse msg) { Log("On choose faction response, faction: " + MyFactionConstants.GetFactionProperties(msg.AssignedFaction).Name); // if (MySession.Static.Player.Faction != msg.AssignedFaction) { MySession.Static.Player.Faction = msg.AssignedFaction; SendFaction(msg.AssignedFaction); } }
/// <summary> /// Initializes the <see cref="MyGuiSmallShipHelpers"/> class. /// </summary> static MyGuiSmallShipHelpers() { MyMwcObjectBuilder_SmallShip_AssignmentOfAmmo_FireKeyEnumValues = Enum.GetValues(typeof(MyMwcObjectBuilder_FireKeyEnum)).Cast <MyMwcObjectBuilder_FireKeyEnum>().ToList(); MyMwcObjectBuilder_SmallShip_ToolEnumValues = Enum.GetValues(typeof(MyMwcObjectBuilder_SmallShip_Tool_TypesEnum)); MyMwcObjectBuilder_SmallShip_AssignmentOfAmmo_GroupEnumValues = Enum.GetValues(typeof(MyMwcObjectBuilder_AmmoGroupEnum)); MyMwcObjectBuilder_SmallShip_Ammo_TypesEnumValues = Enum.GetValues(typeof(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum)); MyMwcObjectBuilder_SmallShip_Engine_TypesEnumValues = Enum.GetValues(typeof(MyMwcObjectBuilder_SmallShip_Engine_TypesEnum)); MyMwcObjectBuilder_SmallShip_Weapon_TypesEnumValues = Enum.GetValues(typeof(MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum)); MyMwcObjectBuilder_SmallShip_TypesEnumValues = Enum.GetValues(typeof(MyMwcObjectBuilder_SmallShip_TypesEnum)); MyMwcObjectBuilder_SmallShip_ShipFactionNationalityEnumValues = Enum.GetValues(typeof(MyMwcObjectBuilder_FactionEnum)); MyMwcObjectBuilder_SmallShip_BotAITemplateValues = Enum.GetValues(typeof(MyAITemplateEnum)); MyMwcObjectBuilder_SmallShip_PatrolModes = Enum.GetValues(typeof(MyPatrolMode)); #region Ammo/Weapon binding BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Automatic_Rifle_With_Silencer_High_Speed, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Automatic_Rifle_With_Silencer); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Automatic_Rifle_With_Silencer_SAPHEI, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Automatic_Rifle_With_Silencer); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Automatic_Rifle_With_Silencer_BioChem, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Automatic_Rifle_With_Silencer); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Sniper_High_Speed, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Sniper); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Sniper_SAPHEI, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Sniper); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Sniper_BioChem, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Sniper); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Sniper_EMP, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Sniper); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Autocannon_Basic, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Autocanon); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Autocannon_High_Speed, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Autocanon); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Autocannon_Armor_Piercing_Incendiary, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Autocanon); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Autocannon_SAPHEI, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Autocanon); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Autocannon_BioChem, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Autocanon); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Autocannon_EMP, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Autocanon); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Machine_Gun_Basic, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Machine_Gun); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Machine_Gun_High_Speed, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Machine_Gun); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Machine_Gun_Armor_Piercing_Incendiary, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Machine_Gun); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Machine_Gun_SAPHEI, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Machine_Gun); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Machine_Gun_BioChem, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Machine_Gun); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Machine_Gun_EMP, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Machine_Gun); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Shotgun_Basic, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Shotgun); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Shotgun_High_Speed, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Shotgun); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Shotgun_Armor_Piercing, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Shotgun); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Shotgun_Explosive, MyMwcObjectBuilder_AmmoGroupEnum.Bullet, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Shotgun); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Cannon_Basic, MyMwcObjectBuilder_AmmoGroupEnum.Cannon, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Cannon); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Cannon_BioChem, MyMwcObjectBuilder_AmmoGroupEnum.Cannon, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Cannon); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Cannon_High_Speed, MyMwcObjectBuilder_AmmoGroupEnum.Cannon, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Cannon); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Cannon_Armor_Piercing_Incendiary, MyMwcObjectBuilder_AmmoGroupEnum.Cannon, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Cannon); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Cannon_SAPHEI, MyMwcObjectBuilder_AmmoGroupEnum.Cannon, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Cannon); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Cannon_Proximity_Explosive, MyMwcObjectBuilder_AmmoGroupEnum.Cannon, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Cannon); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Cannon_Tunnel_Buster, MyMwcObjectBuilder_AmmoGroupEnum.Cannon, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Cannon); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Cannon_EMP, MyMwcObjectBuilder_AmmoGroupEnum.Cannon, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Cannon); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Asteroid_Killer, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherBack, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Back); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Decoy_Flare, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherBack, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Back); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Directional_Explosive, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherBack, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Back); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Flash_Bomb, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherBack, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Back); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Gravity_Bomb, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherBack, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Back); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Hologram, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherBack, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Back); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Illuminating_Shell, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherBack, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Back); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Mine_Basic, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherBack, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Back); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Mine_BioChem, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherBack, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Back); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Mine_Smart, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherBack, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Back); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Remote_Bomb, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherBack, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Back); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Remote_Camera, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherBack, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Back); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Smoke_Bomb, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherBack, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Back); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Sphere_Explosive, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherBack, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Back); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Time_Bomb, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherBack, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Back); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_EMP_Bomb, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherBack, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Back); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Asteroid_Killer, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherFront, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Front); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Decoy_Flare, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherFront, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Front); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Directional_Explosive, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherFront, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Front); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Flash_Bomb, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherFront, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Front); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Gravity_Bomb, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherFront, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Front); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Hologram, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherFront, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Front); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Illuminating_Shell, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherFront, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Front); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Mine_Basic, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherFront, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Front); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Mine_BioChem, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherFront, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Front); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Mine_Smart, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherFront, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Front); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Remote_Bomb, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherFront, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Front); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Remote_Camera, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherFront, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Front); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Smoke_Bomb, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherFront, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Front); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Sphere_Explosive, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherFront, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Front); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_Time_Bomb, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherFront, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Front); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Universal_Launcher_EMP_Bomb, MyMwcObjectBuilder_AmmoGroupEnum.UniversalLauncherFront, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Universal_Launcher_Front); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Missile_Basic, MyMwcObjectBuilder_AmmoGroupEnum.Missile, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Missile_Launcher); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Missile_BioChem, MyMwcObjectBuilder_AmmoGroupEnum.Missile, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Missile_Launcher); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Missile_EMP, MyMwcObjectBuilder_AmmoGroupEnum.Missile, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Missile_Launcher); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Guided_Missile_Radar_Detection, MyMwcObjectBuilder_AmmoGroupEnum.Missile, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Missile_Launcher); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Guided_Missile_Engine_Detection, MyMwcObjectBuilder_AmmoGroupEnum.Missile, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Missile_Launcher); BindAmmo(MyMwcObjectBuilder_SmallShip_Ammo_TypesEnum.Guided_Missile_Visual_Detection, MyMwcObjectBuilder_AmmoGroupEnum.Missile, MyMwcObjectBuilder_SmallShip_Weapon_TypesEnum.Missile_Launcher); #endregion #region Create Bot Player Relationship helpers #endregion #region Create Ship Faction Nationality helpers foreach (int factionEnum in Enum.GetValues(typeof(MyMwcObjectBuilder_FactionEnum))) { m_shipFactionNationality.Add(factionEnum, new MyGuiHelperBase(MyFactionConstants.GetFactionProperties((MyMwcObjectBuilder_FactionEnum)factionEnum).NameEnum)); } #endregion #region Create Bot Behaviour helpers #endregion #region Create Bot AI Templates helpers m_botAITemplates.Add((int)MyAITemplateEnum.DEFAULT, new MyGuiHelperBase(MyTextsWrapperEnum.Default)); m_botAITemplates.Add((int)MyAITemplateEnum.AGGRESIVE, new MyGuiHelperBase(MyTextsWrapperEnum.Aggressive)); m_botAITemplates.Add((int)MyAITemplateEnum.DEFENSIVE, new MyGuiHelperBase(MyTextsWrapperEnum.Defensive)); m_botAITemplates.Add((int)MyAITemplateEnum.FLEE, new MyGuiHelperBase(MyTextsWrapperEnum.Flee)); m_botAITemplates.Add((int)MyAITemplateEnum.CRAZY, new MyGuiHelperBase(MyTextsWrapperEnum.Crazy)); m_botAITemplates.Add((int)MyAITemplateEnum.PASSIVE, new MyGuiHelperBase(MyTextsWrapperEnum.Passive)); #endregion #region Create Patrol Mode helpers m_patrolMode.Add((int)MyPatrolMode.CYCLE, new MyGuiHelperBase(MyTextsWrapperEnum.Cycle)); m_patrolMode.Add((int)MyPatrolMode.PING_PONG, new MyGuiHelperBase(MyTextsWrapperEnum.PingPong)); m_patrolMode.Add((int)MyPatrolMode.ONE_WAY, new MyGuiHelperBase(MyTextsWrapperEnum.OneWay)); #endregion }
public static void LogPlayerList(ref MyEventGetPlayerListResponse msg) { for (int i = 0; i < msg.PlayerList.Count; i++) { var p = msg.PlayerList[i]; Log(String.Format("PlayerList[0] {0}, UserId: {3}, PlayerId: {2}, Faction: {1}", p.DisplayName, MyFactionConstants.GetFactionProperties(p.Faction).Name, p.PlayerId, p.UserId)); } }
private void OnChooseFaction(ref MyEventChooseFaction msg) { var response = new MyEventChooseFactionResponse(); response.AssignedFaction = ChooseFaction(msg.PreferredFaction); Log("On choose faction for: " + msg.SenderConnection.GetPlayerName() + ", chosen faction: " + MyFactionConstants.GetFactionProperties(response.AssignedFaction).Name); Peers.NetworkClient.Send(ref response, msg.SenderConnection, NetDeliveryMethod.ReliableOrdered, 0); }
public static void OnSetFaction(ref MyEventSetFaction msg) { Log("On set faction for : " + msg.SenderConnection.GetPlayerName() + ", faction: " + MyFactionConstants.GetFactionProperties(msg.Faction).Name); // Change only player faction, his ship can't change faction until respawn var player = (MyPlayerRemote)msg.SenderConnection.Tag; player.Faction = msg.Faction; if (IsStory()) { MySession.Static.Player.Faction = msg.Faction; } }
private bool GetStats() { if (m_stats == null) { m_stats = new List <MyStatsRow>(); } m_stats.Clear(); if (m_statsTableFactions == null) { m_statsTableFactions = new Dictionary <MyMwcObjectBuilder_FactionEnum, MyFactionStats>(); } m_statsTableFactions.Clear(); m_statsListbox.RemoveAllRows(); //add player first m_playerFaction = MySession.Static.Player.Faction; m_playerId = MyEntityIdentifier.CurrentPlayerId; AddPlayer(MyClientServer.LoggedPlayer.GetDisplayName(), 0, MyClientServer.LoggedPlayer.Statistics.Deaths, MyClientServer.LoggedPlayer.Statistics.PlayersKilled, m_playerId, m_playerFaction); //add other players foreach (MyPlayerRemote player in MyMultiplayerPeers.Static.Players) { AddPlayer(player); } //Debug add random stuff //foreach (MinerWars.AppCode.Game.Entities.MyEntity entity in MinerWars.AppCode.Game.Entities.MyEntities.GetEntities()) //{ // //var bot = entity as MinerWars.AppCode.Game.Entities.MySmallShipBot; // //if (bot != null) // //{ // //AddPlayer(new StringBuilder("Bot"), null, 0, 0, 0, bot.Faction); // //} // AddPlayer(new StringBuilder(entity.GetType().Name), null, 0, 0, 0, entity.Faction); //} //add faction titles if (m_statsTableFactions.Count > 1) // No reason to display just one faction (ie Rainers or Freelancers) { foreach (KeyValuePair <MyMwcObjectBuilder_FactionEnum, MyFactionStats> faction in m_statsTableFactions) { AddPlayer(MyFactionConstants.GetFactionProperties(faction.Value.Faction).Name, null, faction.Value.Deaths, faction.Value.Kills, (byte)faction.Value.Faction, faction.Value.Faction, true); } } // order m_stats.Sort(StatsRowComparer); AddHeaders(); foreach (MyStatsRow row in m_stats) { if (row.IsFaction) { m_statsListbox.AddRow(); } AddStatRowToListbox(row); } return(true); }