Exemplo n.º 1
0
        private static void FlyCheck(WorldBase world, int entityId, Vector3i playerpos, string playerName)
        {
            const int offset   = 1;
            var       nearestH = 0;
            var       distY    = 0;

            for (var i = 0; i < flyRadius; i++)
            {
                var jx = jitter[i].Where(jj => jj.y == 0).ToList();
                foreach (var t in jx)
                {
                    var xz = playerpos + t;
                    var h  = world.GetHeight(xz.x, xz.z);
                    if (playerpos.y - offset <= h)
                    {
                        return;
                    }

                    if (h <= nearestH)
                    {
                        continue;
                    }

                    nearestH = h;
                    distY    = playerpos.y - nearestH;
                }
            }

            var text = $"FLY:({entityId}) ({distY}) {playerName} {playerpos} - {GameTimer.Instance.ticks}";

            GameManager.Instance.GameMessageServer(null, EnumGameMessages.Chat, text, "Server", false, string.Empty, false);
        }