Exemplo n.º 1
0
 public static void GetLinearVelocity(this IMyControllableEntity controlledEntity, ref Vector3 velocityVector, bool useRemoteControlVelocity = true)
 {
     if (controlledEntity.Entity.Physics != null)
     {
         velocityVector = (controlledEntity.Entity.Physics != null) ? controlledEntity.Entity.Physics.LinearVelocity : Vector3.Zero;
     }
     else
     {
         MyCockpit cockpit = controlledEntity as MyCockpit;
         if (cockpit != null)
         {
             velocityVector = (cockpit.CubeGrid.Physics != null) ? cockpit.CubeGrid.Physics.LinearVelocity : Vector3.Zero;
         }
         else
         {
             MyRemoteControl control = controlledEntity as MyRemoteControl;
             if ((control != null) & useRemoteControlVelocity)
             {
                 velocityVector = (control.CubeGrid.Physics != null) ? control.CubeGrid.Physics.LinearVelocity : Vector3.Zero;
             }
             else
             {
                 MyLargeTurretBase base2 = controlledEntity as MyLargeTurretBase;
                 if (base2 != null)
                 {
                     velocityVector = (base2.CubeGrid.Physics != null) ? base2.CubeGrid.Physics.LinearVelocity : Vector3.Zero;
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
            public MyAutopilotWaypoint(Vector3D coords, string name, List<MyObjectBuilder_ToolbarItem> actionBuilders, List<int> indexes, MyRemoteControl owner)
            {
                Coords = coords;
                Name = name;

                if (actionBuilders != null)
                {
                    InitActions();
                    bool hasIndexes = indexes != null && indexes.Count > 0;

                    Debug.Assert(actionBuilders.Count <= MyToolbar.DEF_SLOT_COUNT);
                    if (hasIndexes)
                    {
                        Debug.Assert(indexes.Count == actionBuilders.Count);
                    }
                    for (int i = 0; i < actionBuilders.Count; i++)
                    {
                        if (actionBuilders[i] != null)
                        {
                            if (hasIndexes)
                            {
                                Actions[indexes[i]] = MyToolbarItemFactory.CreateToolbarItem(actionBuilders[i]);
                            }
                            else
                            {
                                Actions[i] = MyToolbarItemFactory.CreateToolbarItem(actionBuilders[i]);
                            }
                        }
                    }
                }
            }
Exemplo n.º 3
0
        private static MyTerminalBlock GetRemoteConrolForGrid(MyCubeGrid cubeGrid)
        {
            if (cubeGrid.HasMainRemoteControl())
            {
                return(cubeGrid.MainRemoteControl);
            }
            MyFatBlockReader <MyRemoteControl> fatBlocks = cubeGrid.GetFatBlocks <MyRemoteControl>();

            if (!fatBlocks.MoveNext())
            {
                return(null);
            }
            MyRemoteControl current = fatBlocks.Current;

            return(fatBlocks.MoveNext() ? null : current);
        }
        public MyDroneStrafeBehaviour(MyRemoteControl remoteControl, MySpaceStrafeData strafeData, bool activate, List<MyUserControllableGun> weapons, List<MyFunctionalBlock> tools, Vector3D firstWaypoint)
        {
            m_remoteControl = remoteControl;
            ReturnPosition = m_remoteControl.PositionComp.GetPosition();

            LoadStrafeData(strafeData);

            m_weapons = weapons;
            m_tools = tools;
            MyPlayer player = m_remoteControl.GetNearestPlayer();
            m_target = player != null ? player.Character as MyEntity : null;
            m_lastTargetUpdate = MySandboxGame.TotalGamePlayTimeInMilliseconds;
            m_lastWeaponUpdate = m_lastTargetUpdate;
            m_waypointReachedTimeMs = m_lastTargetUpdate;
            m_firstWaypoint = firstWaypoint;

            NeedUpdate = activate;
        }
Exemplo n.º 5
0
 private static void OnAction(MyRemoteControl block, ListReader<TerminalActionParameter> paramteres)
 {
     var firstParameter = paramteres.FirstOrDefault();
     if (!firstParameter.IsEmpty)
     {
         block.ChangeDirection((Base6Directions.Direction)firstParameter.Value);
     }
 }
Exemplo n.º 6
0
 public MyDebugRenderComponentRemoteControl(MyRemoteControl remote)
     : base(remote)
 {
     m_remote = remote;
 }
Exemplo n.º 7
0
 public MyAutopilotWaypoint(MyObjectBuilder_AutopilotWaypoint builder, MyRemoteControl owner)
     : this(builder.Coords, builder.Name, builder.Actions, builder.Indexes, owner)
 {
 }
Exemplo n.º 8
0
 public MyAutopilotWaypoint(IMyGps gps, MyRemoteControl owner)
     : this(gps.Coords, gps.Name, null, null, owner)
 {
 }
Exemplo n.º 9
0
 public MyAutopilotWaypoint(Vector3D coords, string name, MyRemoteControl owner)
     : this(coords, name, null, null, owner)
 {
 }
Exemplo n.º 10
0
        public bool CanDespawn(MyCubeGrid grid, MyRemoteControl remote)
        {
            if (remote != null && !remote.IsFunctional) return false;

            BoundingSphereD bs = grid.PositionComp.WorldVolume;
            bs.Radius += 4000.0;

            foreach (var player in Sync.Players.GetOnlinePlayers())
            {
                if (bs.Contains(player.GetPosition()) == ContainmentType.Contains)
                {
                    return false;
                }
            }

            foreach (var gunSet in grid.GridSystems.WeaponSystem.GetGunSets().Values)
            {
                foreach (var gun in gunSet)
                {
                    if (gun.IsShooting) return false;
                }
            }

            return true;
        }
Exemplo n.º 11
0
 public MySyncRemoteControl(MyRemoteControl remoteControl) :
     base(remoteControl)
 {
     m_remoteControl = remoteControl;
 }