Beispiel #1
0
        public override void Attach()
        {
            base.Attach();

            _patchContext = _patchMgr.AcquireContext();
            GameLoopObserver.Patch(_patchContext);
        }
        public static async Task <(bool, MyCubeGrid)> TryGetSelectedGrid(this IMyPlayer self)
        {
            if (self.TryGetSeatedGrid(out var seatedGrid))
            {
                return(true, seatedGrid);
            }

            try
            {
                await GameLoopObserver.MoveToGameLoop();

                if (self.TryGetGridLookedAt(out var lookedGrid))
                {
                    return(true, lookedGrid);
                }

                return(false, null);
            }
            finally
            {
                await TaskUtils.MoveToThreadPool();
            }
        }