Modding:generator API (0.9.9.7)

From DoomRL Wiki

Revision as of 21:03, 25 January 2012 by Game Hunter (Talk | contribs)

Jump to: navigation, search

The generator holds all of the ever-present functions used to create the random maps in DoomRL. It also contains a variety of helper functions, many of them useful if not vital to the creation of intricate and meticulous game design.

API

Level Interface
Coord Generator.safe_empty_coord()
Coord Generator.standard_empty_coord()
void Generator.set_permanence(Area ar, boolean val, Cell tile)
void Generator.setup_ice_event()
void Generator.setup_perma_event()
void Generator.setup_alarm_event()
void Generator.setup_deadly_air_event(integer step)
void Generator.setup_nuke_event(integer minutes)
void Generator.setup_flood_event(integer direction, integer step, Cell cell, boolean pure)
integer Generator.being_weight()
integer Generator.item_amount()
void Generator.restore_walls(Cell wall_cell, boolean keep_fluids)
list Generator.cell_set(list list)
void Generator.horiz_river(Cell cell, integer width, boolean bridge)
void Generator.vert_river(Cell cell, integer width, boolean bridge, Coord pos)
void Generator.generate_rivers(boolean allow_horiz, boolean allow_more)
void Generator.drunkard_walk(Coord start, integer steps, Cell cell, CellList ignore, boolean break_on_edge)
void Generator.drunkard_walks(integer amount, integer steps, Cell cell, CellList ignore, boolean break_on_edge, Area drunk_area)
void Generator.contd_drunkard_walks(integer amount, integer steps, Cell cell, Cell edges1, Cell edges2, CellList ignore, boolean break_on_edge)
void Generator.plot_lines(Coord where, Area larea, boolean horiz, Cell cell, CellList block)
void Generator.maze_dungeon(Cell floor_cell, Cell wall_cell, integer granularity, integer tries, integer minl, integer maxl)
void Generator.warehouse_fill(Cell wall_cell, Area fill_area, integer box_size, integer amount)
void Generator.warehouse_dungeon()
void Generator.add_room(Area room)
boolean Generator.add_rooms()
Room Generator.get_room(integer min_size, integer max_x, integer max_y)
void Generator.generate_tiled()
void Generator.generate_warehouse_dungeon()
void Generator.generate_tiled_arena_dungeon()
void Generator.generate_city_dungeon()
void Generator.generate_maze_dungeon()
void Generator.generate_archi_dungeon()
void Generator.generate_caves_dungeon()
void Generator.generate_arena_dungeon()
void Generator.generate_fluids(Area drunk_area)
void Generator.generate_barrels()
void Generator.generate_stairs()
void Generator.generate_special_stairs()
void Generator.generate_lever_room()
void Generator.generate_teleport_room()
void Generator.generate_ammo_room()
void Generator.generate_basain()
void Generator.generate_warehouse_room()
void Generator.generate_vault()
void Generator.add_room_feature(boolean no_monsters)
void Generator.handle_rooms(boolean no_monsters)
void Generator.place_player()
void Generator.roll_event()
void Generator.reset()

Generator.safe_empty_coord() → Coord
Gives a coordinate that satisfies all empty flags. If one cannot be found, another attempt is made that excludes EF_NOSAFE; if one still cannot be found, another attempt is made that additionally excludes EF_NOSTAIRS and EF_NOHARM.

Generator.standard_empty_coord() → Coord
Gives a coordinate that satisfies all empty flags other than EF_NOSAFE.

Generator.set_permanence(Area ar, boolean val, Cell tile)
Sets the state of all cells' LFPERMANENT flag within ar. val determines the state of LFPERMANENT: it is true by default. If set, only cells of the tile identifier will be affected: by default, all wall tiles in the area are affected.

Generator.setup_ice_event()
Adds the "frozen" level event to the map and records it in the mortem history. Levels with the frozen event change all walls into ice walls and all fluids into water.

Generator.setup_perma_event()
Adds the "sturdy" level event to the map and records it in the mortem history. Levels with the sturdy event set all wall tiles to be permanent.

Generator.setup_alarm_event()
Adds the "alarm" level event to the map and records it in the mortem history. Levels with the alarm event set all non-player beings' Being Flags|BF_HUNTING flag to true.

Generator.setup_deadly_air_event(integer step)
Adds the "deadly air" event to the map and records it in the mortem history. Levels with the deadly air event cause all beings to lose hit points every step turns.

Generator.setup_nuke_event(integer minutes)
Adds the "armed nuke" event to the map and records it in the mortem history. Levels with the armed nuke event begin with a thermonuclear bomb set at the player's starting position, which will explode in minutes game minutes.

Generator.setup_flood_event(integer direction, integer step, Cell cell, boolean pure)
Adds the "flood" event to the map and records it in the mortem history. Levels with the flood event are slowly filled with a fluid: direction determines whether the floor travels from the right (-1) or from the left (+1); every step turns, cell will replace all tiles in a next column to be flooded. Setting pure to false will move the player and stairs to opposite sides of the map, with the player nearest the flood.

Generator.being_weight() → integer
Gives a value equal to the difficulty-adjusted weight of beings for a given danger level. These are the results used for the base game's monster generation parameters.

Generator.item_amount() → integer
Gives a value equal to the number of items spawned for a given danger level. On level types where the this amount isn't preset, this is the result used for the base game's item generation parameters.

Generator.restore_walls(Cell wall_cell, boolean keep_fluids)
Sets all cells on the edge of the map to wall_cell. If keep_fluids is set to true, fluid tiles will be maintained but set as permanent.

Generator.cell_set(list list) → list
Creates a cellset for all cells in list. The returned list functions just like any CELLSET constant.

Generator.horiz_river(Cell cell, integer width, boolean bridge)
Adds a horizontal river to the map, created using cell tiles. width sets the tile-width of the river. If bridge is set to true, a non-fluid floor bridge will be created on the river.

Generator.vert_river(Cell cell, integer width, boolean bridge, Coord pos)
Generator.vert_river(Cell cell, integer width, boolean bridge, integer pos)
Adds a vertical river to the map, created using cell tiles. width sets the tile-width of the river, and pos sets the starting position of the river. If pos is given as an integer, then the starting y-coordinate of the river is at the top of the map. If bridge is set to true, a non-fluid floor bridge will be created on the river.

Generator.generate_rivers(boolean allow_horiz, boolean allow_more)
Generates a random number of horizontal and vertical rivers on the map. See Rivers for more information. The fluid type varies with map depth.

Generator.drunkard_walk(Coord start, integer steps, Cell cell, CellList ignore, boolean break_on_edge)
Generates cell tiles according to a drunken walk algorithm. It travels steps times, starting at the coordinate start. Any cells in ignore will not be set over but the algorithm will still continue. If break_on_edge is set to true, the drunken walk will stop if it hits a map border: otherwise it will continue, clamping cells within the map as necessary.

Generator.drunkard_walks(integer amount, integer steps, Cell cell, CellList ignore, boolean break_on_edge, Area drunk_area)
As Generator.drunkard_walk, but repeated amount times. Additionally, rather than specifically a starting position, all walks are chosen from a random coordinate within drunk_area.

Generator.contd_drunkard_walks(integer amount, integer steps, Cell cell, Coord edges1, Coord edges2, CellList ignore, boolean break_on_edge)
As Generator.drunkard_walks, but rather than limiting the walk's starting position, the walk will stop prematurely if it has reached the x- or y-coordinates of both edges1 and edges2.

Generator.plot_lines(Coord where, Area larea, boolean horiz, Cell cell, CellList block)
Generates a line of cell tiles on the map, starting at where and extending to the boundaries of larea. horiz set to true will produce horizontal lines: otherwise it will produce vertical lines. If a cell from block is found, the line will end prematurely at the end on which it was blocked.

Generator.maze_dungeon(Cell floor_cell, Cell wall_cell, integer granularity, integer tries, integer minl, integer maxl)
Generates a map-wide maze, using wall_cell as the wall tiles and floor_cell as the floor tiles. Wall corridors are at least minl tiles apart and at most maxl tiles apart: granularity sets a rough complexity of the map. The number of walls attempted to be made is equal to tries.

Generator.warehouse_fill(Cell wall_cell, Area fill_area, integer box_size, integer amount)
Generates wall_cell tiles in the shape of a square within fill_area. boxsize sets the size of the side of a box, and amount sets the number of tries for boxes to be added.

Generator.warehouse_dungeon()
Generates a map-wide warehouse setting. Warehouse dungeons are divided into three large rooms, each attempting 50 tries with boxes of side length 3.

Generator.add_room(Area room)
Adds room to the Generator.room_list and Generator.room_meta lists. This is used in conjunction with room generation functions.

Generator.add_rooms() → boolean
As Generator.add_room, but locates all rooms on the map and adds them to Generator.room_list and Generator.room_meta instead.

Generator.get_room(integer min_size, integer max_x, integer max_y) → Room
Finds a room that contains at least min_size in both height and width, and has a width and height no bigger than max_x and max_y, respectively.

Generator.generate_tiled()
Generates a "normal" map. Normal levels are divided randomly into rectangular rooms.

Generator.generate_warehouse_dungeon()
Builds a "warehouse" level. This includes everything necessary to be played as a typical random level.

Generator.generate_tiled_arena_dungeon()
Builds a "single-monster" level. This includes everything necessary to be played as a typical random level.

Generator.generate_city_dungeon()
Builds a "city" level. This includes everything necessary to be played as a typical random level.

Generator.generate_maze_dungeon()
Builds a "maze" level. This includes everything necessary to be played as a typical random level.

Generator.generate_archi_dungeon()
Builds an "archi" level. This includes everything necessary to be played as a typical random level.

Generator.generate_caves_dungeon()
Builds a "cave" level. This includes everything necessary to be played as a typical random level.

Generator.generate_arena_dungeon()
Builds an "arena" level. This includes everything necessary to be played as a typical random level.

Generator.generate_fluids(Area drunk_area)
Generates all non-river fluids on the map using drunken walks, within drunk_area. The fluid type varies with danger level.

Generator.generate_barrels()
Generates all barrels on the map, The barrel type varies with danger level.

Generator.generate_stairs()
Generates stairs on the map.

Generator.generate_special_stairs()
Generates special stairs on the map, if a special level exists at the current map depth.

Generator.generate_lever_room()
Finds a room of appropriate size and adjusts it into a lever room.

Generator.generate_teleport_room()
Finds a room of appropriate size and adjusts it into a teleporter room.

Generator.generate_ammo_room()
Finds a room of appropriate size and adjusts it into an ammo room. The type of ammo varies with danger level.

Generator.generate_basain()
Finds a room of appropriate size and adjusts it into a room filled with fluid.

Generator.generate_warehouse_room()
Finds a room of appropriate size and adjusts it into a room with boxes (as Generator.warehouse_fill).

Generator.generate_vault()
Finds a room of appropriate size and adjust it into a vault. The monsters, items, and type of vault vary with danger level.

Generator.add_room_feature(boolean no_monsters)
Randomly selects a room generation function to be added to the map. no_monsters set to true excludes the possibility of a vault room being generated.

Generator.handle_rooms(boolean no_monsters)
Generates up to seven special rooms on the map and restores walls that were otherwise removed as a result of the room generation.

Generator.place_player()
Adds to player to the map.

Generator.roll_event()
Randomly select a level event function to be added to the map.

Generator.reset()
Clears all generation properties and hooks, and changes the map into one bordered with the level style's walls and otherwise filled with the level style's floors.
Personal tools