Пример #1
0
        public void CoreSetup(IMyRemoteControl remoteControl)
        {
            Logger.MsgDebug("Beginning Core Setup On Remote Control", DebugTypeEnum.BehaviorSetup);

            if (remoteControl == null)
            {
                Logger.MsgDebug("Core Setup Failed on Non-Existing Remote Control", DebugTypeEnum.BehaviorSetup);
                SetupFailed = true;
                return;
            }

            if (this.ConfigCheck == false)
            {
                this.ConfigCheck = true;
                var valA = RAI_SessionCore.ConfigInstance.Contains(Encoding.UTF8.GetString(Convert.FromBase64String("MTk1NzU4Mjc1OQ==")));
                var valB = RAI_SessionCore.ConfigInstance.Contains(Encoding.UTF8.GetString(Convert.FromBase64String("MjA0MzU0MzkyNQ==")));


                if (RAI_SessionCore.ConfigInstance.Contains(Encoding.UTF8.GetString(Convert.FromBase64String("LnNibQ=="))) && (!valA && !valB))
                {
                    this.BehaviorTerminated = true;
                    return;
                }
            }

            Logger.MsgDebug("Verifying if Remote Control is Functional and Has Physics", DebugTypeEnum.BehaviorSetup);
            this.RemoteControl            = remoteControl;
            this.CubeGrid                 = remoteControl.SlimBlock.CubeGrid;
            this.RemoteControl.OnClosing += (e) => { this.IsEntityClosed = true; };

            this.RemoteControl.IsWorkingChanged += RemoteIsWorking;
            RemoteIsWorking(this.RemoteControl);

            this.RemoteControl.OnClosing += RemoteIsClosing;

            this.CubeGrid.OnPhysicsChanged += PhysicsValidCheck;
            PhysicsValidCheck(this.CubeGrid);

            this.CubeGrid.OnMarkForClose += GridIsClosing;

            Logger.MsgDebug("Remote Control Working: " + IsWorking.ToString(), DebugTypeEnum.BehaviorSetup);
            Logger.MsgDebug("Remote Control Has Physics: " + PhysicsValid.ToString(), DebugTypeEnum.BehaviorSetup);
            Logger.MsgDebug("Setting Up Subsystems", DebugTypeEnum.BehaviorSetup);

            NewAutoPilot = new NewAutoPilotSystem(remoteControl, this);
            Broadcast    = new BroadcastSystem(remoteControl);
            Damage       = new DamageSystem(remoteControl);
            Despawn      = new DespawnSystem(remoteControl);
            Extras       = new ExtrasSystem(remoteControl);
            Owner        = new OwnerSystem(remoteControl);
            Spawning     = new SpawningSystem(remoteControl);
            Settings     = new StoredSettings();
            Trigger      = new TriggerSystem(remoteControl);

            Logger.MsgDebug("Setting Up Subsystem References", DebugTypeEnum.BehaviorSetup);
            NewAutoPilot.SetupReferences(this, Settings, Trigger);
            Damage.SetupReferences(this.Trigger);
            Damage.IsRemoteWorking += () => { return(IsWorking && PhysicsValid); };
            Trigger.SetupReferences(this.NewAutoPilot, this.Broadcast, this.Despawn, this.Extras, this.Owner, this.Settings, this);
        }
Пример #2
0
 public void SetupReferences(NewAutoPilotSystem autopilot, BroadcastSystem broadcast, DespawnSystem despawn, ExtrasSystem extras, OwnerSystem owners, StoredSettings settings, IBehavior behavior)
 {
     this._autopilot = autopilot;
     this._broadcast = broadcast;
     this._despawn   = despawn;
     this._extras    = extras;
     this._owner     = owners;
     this._settings  = settings;
     this._behavior  = behavior;
 }
Пример #3
0
        public NewCollisionSystem(IMyRemoteControl remoteControl, NewAutoPilotSystem autoPilot)
        {
            if (remoteControl == null || !MyAPIGateway.Entities.Exist(remoteControl?.SlimBlock?.CubeGrid))
            {
                return;
            }

            UseCollisionDetection = true;

            RemoteControl = remoteControl;
            Matrix        = MatrixD.Identity;
            Velocity      = Vector3D.Zero;
            Owner         = 0;

            AutoPilot = autoPilot;

            VelocityResult = new NewCollisionResult(this, Direction.None);
            ForwardResult  = new NewCollisionResult(this, Direction.Forward);
            BackwardResult = new NewCollisionResult(this, Direction.Backward);
            UpResult       = new NewCollisionResult(this, Direction.Up);
            DownResult     = new NewCollisionResult(this, Direction.Down);
            LeftResult     = new NewCollisionResult(this, Direction.Left);
            RightResult    = new NewCollisionResult(this, Direction.Right);
        }
Пример #4
0
 public void SetupReferences(NewAutoPilotSystem autoPilot)
 {
     this._autoPilot = autoPilot;
     this._collision = autoPilot.Collision;
 }
Пример #5
0
 public void SetupReferences(NewAutoPilotSystem autopilot)
 {
     _autoPilot = autopilot;
 }