void Aggregator1Or2Destroyed() { MyEntity destroy1 = MyScriptWrapper.TryGetEntity((uint)EntityID.PrefabAutodestruct1); MyEntity destroy2 = MyScriptWrapper.TryGetEntity((uint)EntityID.PrefabAutodestruct2); int deadCount = 0; if (destroy1 == null || destroy1.IsDead()) { deadCount++; } if (destroy2 == null || destroy2.IsDead()) { deadCount++; } if (deadCount == 1) { MyScriptWrapper.DestroyEntities(new List <uint> { (uint)EntityID.PrefabAutodestruct3 }); } else if (deadCount == 2) { MyScriptWrapper.DestroyEntities(new List <uint> { (uint)EntityID.PrefabAutodestruct4 }); } }
public override bool IsInvalid(MySmallShipBot bot) { return(m_invalidated || m_entityRemoved || Target == null || Target.IsDead() || bot.IsSpoiledHologram(Target) || !Target.Activated); }
internal override void Update(MySmallShipBot bot) { base.Update(bot); if (m_target != null && !m_target.IsDead()) { MySmallShip smallShipTarget = m_target as MySmallShip; MyPrefabLargeWeapon largeWeaponTarget = m_target as MyPrefabLargeWeapon; if (largeWeaponTarget != null && !largeWeaponTarget.IsWorking()) { m_isInvalid = true; return; } if (m_timeToAlarmCheck >= 0) { m_timeToAlarmCheck -= MyConstants.PHYSICS_STEP_SIZE_IN_SECONDS; // When transition from curious behavior try raise alarm (if this doesn't work pass some flag curious behavior) if (m_timeToAlarmCheck < 0 && smallShipTarget != null && smallShipTarget.HasRadarJammerActive()) { bot.LaunchAlarm(smallShipTarget); } } UpdateVisibility(bot); if (m_targetVisible) { AttackTarget(bot, m_targetVisible); findSmallship.Init(bot); // Attack player to prevent his passivity when we have invicible wingmans m_playerAttackDecisionTimer -= MyConstants.PHYSICS_STEP_SIZE_IN_SECONDS; if (smallShipTarget != null && smallShipTarget.Leader == MySession.PlayerShip && m_playerAttackDecisionTimer <= 0) { m_playerAttackDecisionTimer = 2.5f; if (MyMwcUtils.GetRandomFloat(0, 1.0f) < 0.7f) { m_target = smallShipTarget.Leader; } } } else { m_state = StateEnum.CLOSING; findSmallship.Update(bot, m_target); if (findSmallship.PathNotFound) { bot.IsSleeping = true; m_isInvalid = true; } else if (!findSmallship.GotPosition()) { AttackTarget(bot, false); } } } }