Metadata-Version: 2.4
Name: sagemap
Version: 0.5.1
Summary: A library for reading and writing .map files from SAGE engine games.
Home-page: https://github.com/ClementJ18/sagemap
Classifier: License :: OSI Approved :: MIT License
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Requires: reversebox
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: requires
Dynamic: requires-python
Dynamic: summary

# sagemap

A python library for reading BFME .map files. Can potentially work with the map files of other SAGE games but might need to be adjusted. This implementation is not complete.

All the credit for the parsing logic goes to: https://github.com/OpenSAGE/OpenSAGE. I simply "translated" it to Python and simplified it.

## Installing
The package is available on pip

```
python -m pip install sagemap
```

## Example

```python
from sagemap import parse_map_from_path

# Load a BFME .map file
map = parse_map_from_path('path/to/your/file.map')

# Access map properties
print(map.world_info)
print(map.height_map_data)
print(map.objects_list)
```

## Map Linter

sagemap includes a command-line linter for validating BFME map files. The linter checks for common issues such as terrain flatness, object counts, resource placement, and camera settings.

### Usage

Run the linter from the command line:

```
python -m sagemap.linter <path-to-map-folder>
```

You can list all available error codes or exclude specific checks using command-line options. For more details, run:

```
python -m sagemap.linter --help
```

### Using the Linter Programmatically

You can also use the linter in your own Python scripts:

```python
from sagemap.linter import lint_map
from sagemap import parse_map_from_path

map = parse_map_from_path('path/to/your/file.map')
errors = lint_map(map)

for error in errors:
	print(f"{error.code}: {error.message}")
```
