Skip to main content

A library that makes automating events in ADOFAI levels more convenient.

Project description

This is a library that makes automating events in ADOFAI levels more convenient.
List of Classes:


LevelDict
Initalize with LevelDict(filename, encoding) (encoding is optional, default is utf-8-sig)

LevelDict.filename : str
The filename of the file from which the LevelDict was obtained.
LevelDict.encoding : str
The encoding of the file from which the LevelDict was obtained.
A list of all decorations (including objects and text) in the level.
LevelDict.nonFloorDecos : list[Decoration]
A list of all decorations in the level that are not tied to any particular tile.
LevelDict.settings : Settings
The level settings, as a Settings object.
LevelDict.tiles : list[Tile]
A list of all tiles in the level. (See Tile class)

LevelDict.appendTile(self, angle : float) -> None:
Adds a single tile to the end of the level.
LevelDict.appendTiles(self, angles : list[float]) -> None:
Adds a list of tiles to the end of the level.
LevelDict.insertTile(self, angle : float, index : int) -> None:
Adds a single tile to the level before the specified index.
LevelDict.insertTiles(self, angles : list[float], index : int) -> None:
Adds a list of tiles to the level before the specified index.
LevelDict.addAction(self, event : Action) -> int:
Adds the given action to the level. Returns the index of the event within the tile.
LevelDict.addDecoration(self, event : Decoration) -> int:
Adds the given decoration to the level. Returns the index of the event within the tile / within the list of non-floor decorations.
LevelDict.getActions(self, condition : Callable) -> list[Action]:
Returns a list of actions in the level that meet the given condition. Returns a list of all actions if condition is not specified.
LevelDict.getDecorations(self, condition : Callable) -> list[Decoration]:
Returns a list of decorations in the level that meet the given condition. Returns a list of all decorations if condition is not specified.
LevelDict.removeActions(self, condition : Callable) -> list[Action]:
Removes all actions in the level that meet the given condition. Returns a list of removed actions.
LevelDict.removeDecorations(self, condition : Callable) -> list[Decoration]:
Removes all decorations in the level that meet the given condition. Returns a list of removed decorations.
LevelDict.popAction(self, tile, index) -> Action:
Removes the action at the specified tile at the specified index. Returns the event.
LevelDict.popDecoration(self, tile, index) -> Decoration:
Removes the decoration at the specified tile at the specified index. Returns the event.
LevelDict.replaceFieldAction(self, condition : Callable, field : str, new) -> None:
Changes the value of "field" to "new" in all actions that meet the given condition.
LevelDict.replaceFieldDecoration(self, condition : Callable, field : str, new) -> None:
Changes the value of "field" to "new" in all decorations that meet the given condition.
LevelDict.writeDictToFile(self, leveldict : dict, filename : str):
Writes the given dictionary to the specified file. Overwrites the original file if filename is not specified.
Use this if you are working with LevelDict.leveldict.
LevelDict.writeToFile(self, filename : str=None) -> None:
Writes the level to the specified file. Overwrites the original file if filename is not specified.

Settings
Part of a LevelDict object. The properties of this class are equivalent to the parameters in the settings field of a .adofai file.
Tile
A list of Tiles is contained within a LevelDict object.
Tile.angle : float
The angle that the tile points towards (0 degrees is facing right, 90 degrees is facing upwards)
Tile.actions : list[Action]
A list of actions which are present on that particular tile.
Tile.decorations : list[Decoration]
A list of decorations which are present on that particular tile.

Action
An event that goes on a tile (one with a purple icon). An Action object behaves like a dict. The keys depend on the event type. Check any entry in the actions field of a .adofai file for more information on the fields used by that event type.

Action objects are found in a list of actions in a Tile object.
Decoration
A decoration, object decoration, or text decoration (anything found in the decorations menu on the left sidebar). A Decoration object behaves like a dict. The keys depend on the event type. Check any entry in the decorations field of a .adofai file for more information on the fields used by that event type.

Decoration objects are found in a list of decorations in a Tile object. If the decoration is not tied to any tile, it is found in the list of non-floor decos.

Changelog

3.0.3 (2023/03/18)


  • Minor bugfixes
  • Fixed writeToFile() no longer working
  • Replaced json.dumps() with faster json.dump() in writeToFile()
  • Known issue: version number is out of sync

3.0.1 (2023/12/02)


  • Minor bugfix
  • Fixed markdown bug on README and CHANGELOG
  • Removed unnessecary files

3.0.0 (2023/12/01)


  • Major update
  • Completely overhauled file structure to use a class-based system
  • Too much to list! Read the docs for more info

2.0.3 (2023/09/23)


  • Minor bugfixes
  • Fixed addEvent() not detecting addObject and addText events
  • Fixed removeEvents() not modifying leveldict
  • Fixed typo in replaceField()
  • Added logo to README

2.0.2 (2023/09/03)


  • Minor bugfix
  • Fixed markdown bug on README and CHANGELOG for real this time

2.0.1 (2023/09/03)


  • Minor bugfix
  • Fixed markdown bug on README and CHANGELOG (hopefully)

2.0.0 (2023/09/03)


  • Major update
  • Completely overhauled file reading to use dictionaries instead of strings
  • Added getFileDict()
  • Added 3 new utility functions: searchEvents(), removeEvents() and replaceField()
  • getAngles(), setAngles() and all event functions are now deprecated
  • Updated documentation
  • README and CHANGELOG now uses markdown

0.1.1 (2023/07/17)


  • Minor bugfixes
  • Fixed encoding incompatibility
  • Fixed output string for moveDecorations()

0.1.0 (2023/06/15)


  • Minor update
  • Added dynamic pivot offset, parallax offset, masking and blending fields to addDecoration() and moveDecorations()
  • Added angleOffset to setSpeed()

0.0.3 (2023/06/14)


  • Minor bugfix: fixed filename __init__.py

0.0.2 (2023/06/13)


  • Minor bugfix: 're' is no longer a dependency

0.0.1 (2023/05/28)


  • First Release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

adofaipy-3.0.3.tar.gz (7.8 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page