コード例 #1
0
        /// <summary>
        /// Creates a Mover for a given ShipControllerBlock and AllNavigationSettings
        /// </summary>
        /// <param name="block">Controlling block for the grid</param>
        /// <param name="NavSet">Navigation settings to use.</param>
        public Mover(ShipControllerBlock block, RotateChecker rotateCheck)
        {
            this.Block       = block;
            this.NavSet      = new AllNavigationSettings(block.CubeBlock);
            this.RotateCheck = rotateCheck;
            this.NavSet.AfterTaskComplete += NavSet_AfterTaskComplete;

            CheckGrid();
        }
コード例 #2
0
        public EnemyFinder(Pathfinder pathfinder, AllNavigationSettings navSet, long entityId)
            : base(navSet, pathfinder.Mover.Block)
        {
            this.m_pathfinder     = pathfinder;
            this.m_navSet         = navSet;
            this.m_targetEntityId = entityId;
            this.m_landingGear    = m_navSet.Settings_Current.LandingBlock;

            Log.DebugLog("Initialized");
        }
コード例 #3
0
        /// <summary>
        /// Creates an Orbiter for a specific entity, fake orbit only.
        /// Does not add itself to navSet.
        /// </summary>
        /// <param name="entity">The entity to be orbited</param>
        /// <param name="distance">The distance between the orbiter and the orbited entity</param>
        /// <param name="name">What to call the orbited entity</param>
        public Orbiter(Pathfinder pathfinder, AllNavigationSettings navSet, IMyEntity entity, float distance, string name)
            : base(pathfinder)
        {
            this.m_orbitEntity_name = name;

            Altitude    = distance;
            OrbitEntity = entity;

            CalcFakeOrbitSpeedForce();
            Log.DebugLog("Orbiting: " + OrbitEntity.getBestName(), Logger.severity.INFO);
        }
コード例 #4
0
        public Shopper(AllNavigationSettings navSet, IMyCubeGrid grid, Dictionary <string, int> shopList)
        {
            this.m_navSet       = navSet;
            this.m_shoppingList = shopList;
            this.m_grid         = grid;

            this.m_currentTask = Return;

            foreach (var pair in m_shoppingList)
            {
                Log.DebugLog("Item: " + pair.Key + ", amount: " + pair.Value);
            }
        }
コード例 #5
0
 public Pathfinder(IMyCubeGrid grid, AllNavigationSettings navSet, Mover mover)
 {
     grid.throwIfNull_argument("grid");
     m_grid             = grid;
     m_logger           = new Logger(() => grid.DisplayName, () => m_pathState.ToString(), () => m_rotateState.ToString());
     m_pathChecker      = new PathChecker(grid);
     m_rotateChecker    = new RotateChecker(grid);
     m_navSet           = navSet;
     m_mover            = mover;
     m_planetCheckDest  = new PlanetChecker(grid);
     m_planetCheckSpeed = new PlanetChecker(grid);
     m_logger.debugLog("Initialized, grid: " + grid.DisplayName);
 }
コード例 #6
0
ファイル: GridFinder.cs プロジェクト: zrisher/ARMS
        /// <summary>
        /// Creates a GridFinder to find an enemy grid based on distance.
        /// </summary>
        public GridFinder(AllNavigationSettings navSet, ShipControllerBlock controller, float maxRange = 0f)
        {
            Log.DebugLog("navSet == null", Logger.severity.FATAL, condition: navSet == null);
            Log.DebugLog("controller == null", Logger.severity.FATAL, condition: controller == null);
            Log.DebugLog("controller.CubeBlock == null", Logger.severity.FATAL, condition: controller.CubeBlock == null);

            this.m_controlBlock = controller;
            //this.m_enemies = new List<LastSeen>();

            this.MaximumRange    = maxRange;
            this.m_navSet        = navSet;
            this.m_mustBeRecent  = true;
            this.m_startPosition = m_controlBlock.CubeBlock.GetPosition();
        }
コード例 #7
0
ファイル: WeldBlock.cs プロジェクト: zrisher/ARMS
        public WeldBlock(Pathfinder pathfinder, AllNavigationSettings navSet, PseudoBlock welder, IMySlimBlock block)
            : base(pathfinder)
        {
            this.m_offset        = welder.Block.LocalAABB.GetLongestDim() * 0.5f;      // this works for default welders, may not work if mod has an exotic design
            this.m_welder        = welder;
            this.m_targetSlim    = block;
            this.m_timeout_start = Globals.UpdateCount + TimeoutStart;

            IMyCubeBlock Projector = ((MyCubeGrid)block.CubeGrid).Projector;

            if (Projector != null)
            {
                this.m_weldProjection     = true;
                this.m_otherGrid          = Projector.CubeGrid;
                this.m_slimTarget_initDmg = 1f;
                this.m_targetCell         = Projector.CubeGrid.WorldToGridInteger(block.CubeGrid.GridIntegerToWorld(block.Position));
            }
            else
            {
                this.m_weldProjection     = false;
                this.m_slimTarget_initDmg = block.Damage();
                this.m_targetCell         = block.Position;
            }

            m_navSet.Settings_Task_NavEngage.NavigatorMover    = this;
            m_navSet.Settings_Task_NavEngage.NavigatorRotator  = this;
            m_navSet.Settings_Task_NavEngage.DestinationEntity = m_realGrid;

            IEnumerator <Vector3I> neighbours = this.m_targetSlim.ForEachNeighbourCell();

            while (neighbours.MoveNext())
            {
                Vector3I cell = m_weldProjection ? Projector.CubeGrid.WorldToGridInteger(block.CubeGrid.GridIntegerToWorld(neighbours.Current)) : neighbours.Current;
                m_neighbours.Add(cell);
                if (this.m_realGrid.GetCubeBlock(cell) == null)
                {
                    m_emptyNeighbours.Add(cell);
                }
            }

            m_targetSlim.ComputeWorldCenter(out m_targetWorld);
            m_lineUp.To = m_targetWorld;
        }
コード例 #8
0
ファイル: GridFinder.cs プロジェクト: zrisher/ARMS
        /// <summary>
        /// Creates a GridFinder to find a friendly grid based on its name.
        /// </summary>
        public GridFinder(AllNavigationSettings navSet, ShipControllerBlock controller, string targetGrid, string targetBlock = null,
                          AttachedGrid.AttachmentKind allowedAttachment = AttachedGrid.AttachmentKind.Permanent, bool mustBeRecent = false)
        {
            Log.DebugLog("navSet == null", Logger.severity.FATAL, condition: navSet == null);
            Log.DebugLog("controller == null", Logger.severity.FATAL, condition: controller == null);
            Log.DebugLog("controller.CubeBlock == null", Logger.severity.FATAL, condition: controller.CubeBlock == null);
            Log.DebugLog("targetGrid == null", Logger.severity.FATAL, condition: targetGrid == null);

            this.m_targetGridName = targetGrid.LowerRemoveWhitespace();
            if (targetBlock != null)
            {
                this.m_targetBlockName = targetBlock.LowerRemoveWhitespace();
            }
            this.m_controlBlock      = controller;
            this.m_allowedAttachment = allowedAttachment;
            this.MaximumRange        = 0f;
            this.m_navSet            = navSet;
            this.m_mustBeRecent      = mustBeRecent;
            this.m_startPosition     = m_controlBlock.CubeBlock.GetPosition();
        }
コード例 #9
0
 public Kamikaze(Pathfinder pathfinder, AllNavigationSettings navSet) : base(pathfinder)
 {
 }
コード例 #10
0
ファイル: Coward.cs プロジェクト: zrisher/ARMS
 public Coward(Pathfinder pathfinder, AllNavigationSettings navSet)
     : base(pathfinder)
 {
     Log.DebugLog("Initialized");
 }
コード例 #11
0
 public Fighter(Pathfinder pathfinder, AllNavigationSettings navSet)
     : base(pathfinder)
 {
     Arm();
 }