public static MyGuiHelperBase GetMyGuiSmallShipPatrolMode(MyPatrolMode patrolMode) { MyGuiHelperBase ret; if (m_patrolMode.TryGetValue((int)patrolMode, out ret)) { return(ret); } else { return(null); } }
internal MyMwcObjectBuilder_SpawnPoint() : base() { SpawnInGroups = false; SpawnCount = -1; FirstSpawnTimer = 1.0f; RespawnTimer = 1.0f; BoundingRadius = 1.0f; ShipTemplates = new List<MyMwcObjectBuilder_SmallShip_Bot>(); Faction = MyMwcObjectBuilder_FactionEnum.China; WayPointPath = "None"; Activated = true; PatrolMode = MyPatrolMode.CYCLE; }
internal MyMwcObjectBuilder_SpawnPoint() : base() { SpawnInGroups = false; SpawnCount = -1; FirstSpawnTimer = 1.0f; RespawnTimer = 1.0f; BoundingRadius = 1.0f; ShipTemplates = new List <MyMwcObjectBuilder_SmallShip_Bot>(); Faction = MyMwcObjectBuilder_FactionEnum.China; WayPointPath = "None"; Activated = true; PatrolMode = MyPatrolMode.CYCLE; }
public MyMwcObjectBuilder_SmallShip_Bot(MyMwcObjectBuilder_SmallShip smallShip, MyAITemplateEnum aiTemplate, float aggressivity, float seeDistance, float sleepDistance, MyPatrolMode patrolMode, int?shipTemplateId, uint?leader, BotBehaviorType idleBehavior, int aiPriority, bool leaderLostEnabled, bool activeAI) : this(smallShip.ShipType, smallShip.Inventory, smallShip.Weapons, smallShip.Engine, smallShip.AssignmentOfAmmo, smallShip.Armor, smallShip.Radar, smallShip.ShipMaxHealth, smallShip.ShipHealthRatio, smallShip.ArmorHealth, smallShip.Oxygen, smallShip.Fuel, smallShip.ReflectorLight, smallShip.ReflectorLongRange, smallShip.Faction, aiTemplate, aggressivity, seeDistance, sleepDistance, patrolMode, leader, idleBehavior, smallShip.ReflectorShadowDistance, aiPriority, leaderLostEnabled, activeAI) { ShipTemplateID = shipTemplateId; }
public MyMwcObjectBuilder_SmallShip_Bot(MyMwcObjectBuilder_SmallShip_TypesEnum shipType, MyMwcObjectBuilder_Inventory inventory, List <MyMwcObjectBuilder_SmallShip_Weapon> weapons, MyMwcObjectBuilder_SmallShip_Engine engine, List <MyMwcObjectBuilder_AssignmentOfAmmo> assignmentOfAmmo, MyMwcObjectBuilder_SmallShip_Armor armor, MyMwcObjectBuilder_SmallShip_Radar radar, float?shipMaxHealth, float shipHealthRatio, float armorHealth, float oxygen, float fuel, bool reflectorLight, bool reflectorLongRange, MyMwcObjectBuilder_FactionEnum shipFaction, MyAITemplateEnum aiTemplate, float aggressivity, float seeDistance, float sleepDistance, MyPatrolMode patrolMode, uint?leader, BotBehaviorType idleBehavior, float reflectorShadowDistance, int aiPriority, bool leaderLostEnabled, bool activeAI) : base(shipType, inventory, weapons, engine, assignmentOfAmmo, armor, radar, shipMaxHealth, shipHealthRatio, armorHealth, oxygen, fuel, reflectorLight, reflectorLongRange, reflectorShadowDistance, aiPriority) { Faction = shipFaction; AITemplate = aiTemplate; Aggressivity = aggressivity; SeeDistance = seeDistance; SleepDistance = sleepDistance; PatrolMode = patrolMode; Leader = leader; IdleBehavior = idleBehavior; LeaderLostEnabled = leaderLostEnabled; ActiveAI = activeAI; SlowDown = 1; }
public virtual void Init(string hudLabelText, MyMwcObjectBuilder_SmallShip_Bot objectBuilder) { System.Diagnostics.Debug.Assert(objectBuilder.Faction != 0); //StringBuilder label = new StringBuilder(hudLabelText); TotalAliveBots++; string fixedHudLabelText = hudLabelText; if (string.IsNullOrEmpty(hudLabelText) || hudLabelText == GetFriendlyName()) { fixedHudLabelText = MyTextsWrapper.GetFormatString(MyTextsWrapperEnum.Ship); } base.Init(fixedHudLabelText, objectBuilder); Faction = objectBuilder.Faction; m_aiTemplate = MyBotAITemplates.GetTemplate(objectBuilder.AITemplate); Aggressivity = objectBuilder.Aggressivity; SeeDistance = objectBuilder.SeeDistance == 0 ? 1000 : objectBuilder.SeeDistance; SleepDistance = objectBuilder.SleepDistance == 0 ? 1000 : objectBuilder.SleepDistance; PatrolMode = objectBuilder.PatrolMode; ActiveAI = true; m_leaderId = objectBuilder.Leader; AITemplate.SetIdleBehavior(objectBuilder.IdleBehavior); LeaderLostEnabled = objectBuilder.LeaderLostEnabled; ActiveAI = ActiveAI; SetupWeapons(objectBuilder); SetupDifficulty(); //if (hudLabelText == GetFriendlyName()) //{ // label = new StringBuilder(""); //} //if (string.IsNullOrEmpty(hudLabelText) || hudLabelText == GetFriendlyName()) //{ // DisplayName = MyTextsWrapper.GetFormatString(MyTextsWrapperEnum.Ship); //} //MyHud.ChangeText(this, label, null, 10000, MyHudIndicatorFlagsEnum.SHOW_ALL); MyModelDummy dummy; if (GetModelLod0().Dummies.TryGetValue("destruction", out dummy)) { m_biochemEffectLocalMatrix = dummy.Matrix; } m_shock_time = -1; MyBotCoordinator.AddBot(this); InitSpoiledHolograms(); MyEntities.OnEntityRemove += MyEntities_OnEntityRemove; m_dangerZoneId = MyDangerZones.Instance.Register(this); MySession.Static.LinkEntities += OnLinkEntities; }
// Read this object from message-in internal override bool Read(BinaryReader binaryReader, EndPoint senderEndPoint, int gameVersion) { if (base.Read(binaryReader, senderEndPoint, gameVersion) == false) return NetworkError(); // NumberOfTemplates (why?) int ?tempcount = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); if (tempcount == null) return NetworkError(); m_numberOfTemplates = tempcount.Value; MyMwcLog.IfNetVerbose_AddToLog("NumberOfTemplates: " + m_numberOfTemplates); // Bot Templates for (int c = 0; c < m_numberOfTemplates; c++) { MyMwcObjectBuilder_SmallShip_Bot nb = MyMwcObjectBuilder_Base.ReadAndCreateNewObject(binaryReader, senderEndPoint) as MyMwcObjectBuilder_SmallShip_Bot; if (nb == null || nb.Read(binaryReader, senderEndPoint, gameVersion) == false) return NetworkError(); ShipTemplates.Add(nb); } // WayPointPath string pWPP = MyMwcMessageIn.ReadStringEx(binaryReader, senderEndPoint); if (pWPP == null) return NetworkError(); WayPointPath = pWPP; MyMwcLog.IfNetVerbose_AddToLog("WayPointPath: " + WayPointPath); // Faction int ?pFaction = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); if (pFaction == null) return NetworkError(); Faction = (MyMwcObjectBuilder_FactionEnum)pFaction.Value; MyMwcLog.IfNetVerbose_AddToLog("Faction: " + Faction); // SpawnInGroups bool? spawnInGroups = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (spawnInGroups == null) return NetworkError(); SpawnInGroups = spawnInGroups.Value; MyMwcLog.IfNetVerbose_AddToLog("SpawnInGroups: " + SpawnInGroups); // SpawnCount int? spawnCount = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); if (spawnCount == null) return NetworkError(); SpawnCount = spawnCount.Value; MyMwcLog.IfNetVerbose_AddToLog("SpawnCount: " + SpawnCount); // FirstSpawnTimer float? firstSpawnTimer = MyMwcMessageIn.ReadFloat(binaryReader); if (firstSpawnTimer == null) return NetworkError(); FirstSpawnTimer = firstSpawnTimer.Value; MyMwcLog.IfNetVerbose_AddToLog("FirstSpawnTimer: " + FirstSpawnTimer); // RespawnTimer float? respawnTimer = MyMwcMessageIn.ReadFloat(binaryReader); if (respawnTimer == null) return NetworkError(); RespawnTimer = respawnTimer.Value; MyMwcLog.IfNetVerbose_AddToLog("RespawnTimer: " + RespawnTimer); // BoundingRadius float? pBR = MyMwcMessageIn.ReadFloat(binaryReader); if (pBR == null) return NetworkError(); BoundingRadius = pBR.Value; MyMwcLog.IfNetVerbose_AddToLog("BoundingRadius: " + BoundingRadius); // Activated bool? activated = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (activated == null) return NetworkError(); Activated = activated.Value; MyMwcLog.IfNetVerbose_AddToLog("Activated: " + Activated); // Patrol mode int? patrolMode = MyMwcMessageIn.ReadByteEx(binaryReader, senderEndPoint); if (patrolMode == null) return NetworkError(); PatrolMode = (MyPatrolMode)patrolMode.Value; MyMwcLog.IfNetVerbose_AddToLog("PatrolMode: " + PatrolMode); return true; }
// Read this object from message-in internal override bool Read(BinaryReader binaryReader, EndPoint senderEndPoint, int gameVersion) { if (base.Read(binaryReader, senderEndPoint, gameVersion) == false) { return(NetworkError()); } // NumberOfTemplates (why?) int?tempcount = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); if (tempcount == null) { return(NetworkError()); } m_numberOfTemplates = tempcount.Value; MyMwcLog.IfNetVerbose_AddToLog("NumberOfTemplates: " + m_numberOfTemplates); // Bot Templates for (int c = 0; c < m_numberOfTemplates; c++) { MyMwcObjectBuilder_SmallShip_Bot nb = MyMwcObjectBuilder_Base.ReadAndCreateNewObject(binaryReader, senderEndPoint) as MyMwcObjectBuilder_SmallShip_Bot; if (nb == null || nb.Read(binaryReader, senderEndPoint, gameVersion) == false) { return(NetworkError()); } ShipTemplates.Add(nb); } // WayPointPath string pWPP = MyMwcMessageIn.ReadStringEx(binaryReader, senderEndPoint); if (pWPP == null) { return(NetworkError()); } WayPointPath = pWPP; MyMwcLog.IfNetVerbose_AddToLog("WayPointPath: " + WayPointPath); // Faction int?pFaction = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); if (pFaction == null) { return(NetworkError()); } Faction = (MyMwcObjectBuilder_FactionEnum)pFaction.Value; MyMwcLog.IfNetVerbose_AddToLog("Faction: " + Faction); // SpawnInGroups bool?spawnInGroups = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (spawnInGroups == null) { return(NetworkError()); } SpawnInGroups = spawnInGroups.Value; MyMwcLog.IfNetVerbose_AddToLog("SpawnInGroups: " + SpawnInGroups); // SpawnCount int?spawnCount = MyMwcMessageIn.ReadInt32Ex(binaryReader, senderEndPoint); if (spawnCount == null) { return(NetworkError()); } SpawnCount = spawnCount.Value; MyMwcLog.IfNetVerbose_AddToLog("SpawnCount: " + SpawnCount); // FirstSpawnTimer float?firstSpawnTimer = MyMwcMessageIn.ReadFloat(binaryReader); if (firstSpawnTimer == null) { return(NetworkError()); } FirstSpawnTimer = firstSpawnTimer.Value; MyMwcLog.IfNetVerbose_AddToLog("FirstSpawnTimer: " + FirstSpawnTimer); // RespawnTimer float?respawnTimer = MyMwcMessageIn.ReadFloat(binaryReader); if (respawnTimer == null) { return(NetworkError()); } RespawnTimer = respawnTimer.Value; MyMwcLog.IfNetVerbose_AddToLog("RespawnTimer: " + RespawnTimer); // BoundingRadius float?pBR = MyMwcMessageIn.ReadFloat(binaryReader); if (pBR == null) { return(NetworkError()); } BoundingRadius = pBR.Value; MyMwcLog.IfNetVerbose_AddToLog("BoundingRadius: " + BoundingRadius); // Activated bool?activated = MyMwcMessageIn.ReadBoolEx(binaryReader, senderEndPoint); if (activated == null) { return(NetworkError()); } Activated = activated.Value; MyMwcLog.IfNetVerbose_AddToLog("Activated: " + Activated); // Patrol mode int?patrolMode = MyMwcMessageIn.ReadByteEx(binaryReader, senderEndPoint); if (patrolMode == null) { return(NetworkError()); } PatrolMode = (MyPatrolMode)patrolMode.Value; MyMwcLog.IfNetVerbose_AddToLog("PatrolMode: " + PatrolMode); return(true); }
public static MyGuiHelperBase GetMyGuiSmallShipPatrolMode(MyPatrolMode patrolMode) { MyGuiHelperBase ret; if (m_patrolMode.TryGetValue((int)patrolMode, out ret)) return ret; else return null; }
public MyMwcObjectBuilder_SmallShip_Bot(MyMwcObjectBuilder_SmallShip smallShip, MyAITemplateEnum aiTemplate, float aggressivity, float seeDistance, float sleepDistance, MyPatrolMode patrolMode, int? shipTemplateId, uint? leader, BotBehaviorType idleBehavior, int aiPriority, bool leaderLostEnabled, bool activeAI) : this(smallShip.ShipType, smallShip.Inventory, smallShip.Weapons, smallShip.Engine, smallShip.AssignmentOfAmmo, smallShip.Armor, smallShip.Radar, smallShip.ShipMaxHealth, smallShip.ShipHealthRatio, smallShip.ArmorHealth, smallShip.Oxygen, smallShip.Fuel, smallShip.ReflectorLight, smallShip.ReflectorLongRange, smallShip.Faction, aiTemplate, aggressivity, seeDistance, sleepDistance, patrolMode, leader, idleBehavior, smallShip.ReflectorShadowDistance, aiPriority, leaderLostEnabled, activeAI) { ShipTemplateID = shipTemplateId; }
public MyMwcObjectBuilder_SmallShip_Bot(MyMwcObjectBuilder_SmallShip_TypesEnum shipType, MyMwcObjectBuilder_Inventory inventory, List<MyMwcObjectBuilder_SmallShip_Weapon> weapons, MyMwcObjectBuilder_SmallShip_Engine engine, List<MyMwcObjectBuilder_AssignmentOfAmmo> assignmentOfAmmo, MyMwcObjectBuilder_SmallShip_Armor armor, MyMwcObjectBuilder_SmallShip_Radar radar, float? shipMaxHealth, float shipHealthRatio, float armorHealth, float oxygen, float fuel, bool reflectorLight, bool reflectorLongRange, MyMwcObjectBuilder_FactionEnum shipFaction, MyAITemplateEnum aiTemplate, float aggressivity, float seeDistance, float sleepDistance, MyPatrolMode patrolMode, uint? leader, BotBehaviorType idleBehavior, float reflectorShadowDistance, int aiPriority, bool leaderLostEnabled, bool activeAI) : base(shipType, inventory, weapons, engine, assignmentOfAmmo, armor, radar, shipMaxHealth, shipHealthRatio, armorHealth, oxygen, fuel, reflectorLight, reflectorLongRange, reflectorShadowDistance, aiPriority) { Faction = shipFaction; AITemplate = aiTemplate; Aggressivity = aggressivity; SeeDistance = seeDistance; SleepDistance = sleepDistance; PatrolMode = patrolMode; Leader = leader; IdleBehavior = idleBehavior; LeaderLostEnabled = leaderLostEnabled; ActiveAI = activeAI; SlowDown = 1; }