예제 #1
0
        public void Update60()
        {
            if (!remoteControl.IsControlledByFaction("GCORP"))
            {
//				return; // No point bothering to remove from the list, it will disappear next time the game reloads
            }

            /*
             * TODO:
             * refill weapon inventory (if designated?)
             * sequence shooting when multiple on same sub-grid
             * appropriate sequencing for missile launchers
             */
            playerTarget = DuckUtils.GetNearestPlayerToPosition(bodyGrid.GetPosition(), Range);
            if (playerTarget != null)
            {
//MyAPIGateway.Utilities.ShowNotification("Found Player: " + info.Type, 2000, MyFontEnum.DarkBlue);

                IHitInfo hitInfo;
                if (MyAPIGateway.Physics.CastLongRay(weapons[0].GetPosition(), playerTarget.GetPosition(), out hitInfo, false))
                {
                    if (!spoken)
                    {
                        bodyGrid.PlaySoundBlocks();
                        spoken = true;
                    }

                    if (timeSincePlayerSeen < 3)
                    {
                        timeSincePlayerSeen++;
                        return;
                    }

                    var info = MyDetectedEntityInfoHelper.Create((MyEntity)hitInfo.HitEntity, remoteControl.OwnerId, hitInfo.Position);
                    if (info.Relationship == MyRelationsBetweenPlayerAndBlock.Enemies ||
                        info.Relationship == MyRelationsBetweenPlayerAndBlock.NoOwnership ||
                        info.Relationship == MyRelationsBetweenPlayerAndBlock.Neutral)
                    {
                        SetWeaponsShooting(true);
                    }
                    else
                    {
                        SetWeaponsShooting(false);
                    }
//					MyAPIGateway.Utilities.ShowNotification("Hit: " + info.Type, 2000, MyFontEnum.DarkBlue);
//					MyAPIGateway.Utilities.ShowNotification("Relation: " + info.Relationship, 2000, MyFontEnum.DarkBlue);
                }
                else
                {
                    SetWeaponsShooting(true);
                }
            }
            else
            {
                SetWeaponsShooting(false);
                StopAllRotors();
            }
        }
예제 #2
0
        public void Update60()
        {
            // TODO: need a reference to the whole base grid to properly determine ownership
            if (!remoteControl.IsControlledByFaction("GCORP"))
            {
//				return; // No point bothering to remove from the list, it will disappear next time the game reloads
            }

            playerTarget = DuckUtils.GetNearestPlayerToPosition(bodyGrid.GetPosition(), Range);
            if (playerTarget != null)
            {
                IHitInfo hitInfo;
                if (MyAPIGateway.Physics.CastLongRay(weapons[0].GetPosition(), playerTarget.GetPosition(), out hitInfo, false))
                {
                    if (!spoken)
                    {
                        bodyGrid.PlaySoundBlocks();
                        spoken = true;
                    }

                    if (timeSincePlayerSeen < 3)
                    {
                        timeSincePlayerSeen++;
                        return;
                    }

                    var info = MyDetectedEntityInfoHelper.Create((MyEntity)hitInfo.HitEntity, remoteControl.OwnerId, hitInfo.Position);
                    if (info.Relationship == MyRelationsBetweenPlayerAndBlock.Enemies ||
                        info.Relationship == MyRelationsBetweenPlayerAndBlock.NoOwnership ||
                        info.Relationship == MyRelationsBetweenPlayerAndBlock.Neutral)
                    {
                        SetWeaponsShooting(true);
                    }
                    else
                    {
                        SetWeaponsShooting(false);
                    }
                    //	MyAPIGateway.Utilities.ShowNotification("Hit: " + info.Type, 2000, MyFontEnum.DarkBlue);
                    //	MyAPIGateway.Utilities.ShowNotification("Relation: " + info.Relationship, 2000, MyFontEnum.DarkBlue);
                }
                else
                {
                    SetWeaponsShooting(true);
                }
            }
            else
            {
                SetWeaponsShooting(false);
                StopAllRotors();
            }
        }
예제 #3
0
        public void Update1()
        {
            if (!arePlayersNear)
            {
                return;
            }

            if (!remoteControl.IsControlledByFaction("GCORP"))
            {
                return;                 // No point bothering to remove from the list, it will disappear next time the game reloads
            }

//            var player = DuckUtils.GetNearestPlayerToPosition(position, 300);
            var player = DuckUtils.GetNearestPlayerToPosition(rotorMountedGrid.GetPosition(), 100);

            if (player == null)
            {
                return;
            }

            if (rotorMountedGrid.HasUsableGun())
            {
                TurnToFacePosition(player.GetPosition());
            }
            else
            {
                rotorMountedGrid.AttemptSelfDestruct();
            }
        }
예제 #4
0
        public void Update1()
        {
            if (!arePlayersNear)
            {
                return;
            }

            // TODO: need a reference to the whole base grid to properly determine ownership
            if (!remoteControl.IsControlledByFaction("GCORP"))
            {
//				return; // No point bothering to remove from the list, it will disappear next time the game reloads
            }

            double useRange = Range * 2;

            useRange = Math.Min(Range, 800);
            var player = DuckUtils.GetNearestPlayerToPosition(rotorMountedGrid.GetPosition(), useRange);

            if (player == null)
            {
                return;
            }

            if (rotorMountedGrid.HasUsableGun())
            {
                TurnToFacePosition(player.GetPosition());
            }
            else
            {
                rotorMountedGrid.AttemptSelfDestruct();
            }
        }