Ejemplo n.º 1
0
        static BlockID RotateOther(Game game, BlockID block, string name, Vector3 offset)
        {
            // Fence type blocks
            if (BlockInfo.FindID(name + "-UD") == -1)
            {
                float headY = LocationUpdate.Clamp(game.LocalPlayer.HeadY);
                if (headY < 45 || (headY >= 135 && headY < 225) || headY > 315)
                {
                    return(Find(game, block, name + "-WE"));
                }
                return(Find(game, block, name + "-NS"));
            }

            // Thin pillar type blocks
            BlockFace face = game.SelectedPos.Face;

            if (face == BlockFace.YMax || face == BlockFace.YMin)
            {
                return(Find(game, block, name + "-UD"));
            }
            if (face == BlockFace.XMax || face == BlockFace.XMin)
            {
                return(Find(game, block, name + "-WE"));
            }
            if (face == BlockFace.ZMax || face == BlockFace.ZMin)
            {
                return(Find(game, block, name + "-NS"));
            }
            return(block);
        }
Ejemplo n.º 2
0
        static BlockID Find(Game game, BlockID block, string name)
        {
            int rotated = BlockInfo.FindID(name);

            if (rotated != -1)
            {
                return((BlockID)rotated);
            }
            return(block);
        }