Difference between revisions of "Modding:generator API (0.9.9.7)"

From DoomRL Wiki

Jump to: navigation, search
(added descriptions (valkyrie functions still required))
(trying new template)
Line 8: Line 8:
 
   |c1=font-weight:bold; text-align:right; vertical-align:top; padding:0px 2px;
 
   |c1=font-weight:bold; text-align:right; vertical-align:top; padding:0px 2px;
 
   |c2=padding:0px 2px;
 
   |c2=padding:0px 2px;
   |[[Modding:Coord|Coord]]|Generator.[[#generator_safe_empty_coord|safe_empty_coord]]()
+
   |{{modarg|Coord}}|{{moddef|list|safe_empty_coord|dot}}
   |[[Modding:Coord|Coord]]|Generator.[[#generator_standard_empty_coord|standard_empty_coord]]()
+
   |{{modarg|Coord}}|{{moddef|list|standard_empty_coord|dot}}
   |void|Generator.[[#generator_set_permanence|set_permanence]]([[Modding:Area|Area]] ar, '''boolean''' val, [[Modding:Cell|Cell]] tile)
+
   |{{modarg|void}}|{{moddef|list|set_permanence|dot||Area|ar|boolean|val|Cell|tile}}
   |void|Generator.[[#generator_setup_ice_event|setup_ice_event]]()
+
   |{{modarg|void}}|{{moddef|list|setup_ice_event|dot}}
   |void|Generator.[[#generator_setup_perma_event|setup_perma_event]]()
+
   |{{modarg|void}}|{{moddef|list|setup_perma_event|dot}}
   |void|Generator.[[#generator_setup_alarm_event|setup_alarm_event]]()
+
   |{{modarg|void}}|{{moddef|list|setup_alarm_event|dot}}
   |void|Generator.[[#generator_setup_deadly_air_event|setup_deadly_air_event]]('''integer''' step)
+
   |{{modarg|void}}|{{moddef|list|setup_deadly_air_event|dot||integer|step}}
   |void|Generator.[[#generator_setup_nuke_event|setup_nuke_event]]('''integer''' minutes)
+
   |{{modarg|void}}|{{moddef|list|setup_nuke_event|dot||integer|minutes}}
   |void|Generator.[[#generator_setup_flood_event|setup_flood_event]]('''integer''' direction, '''integer''' step, [[Modding:Cell|Cell]] cell, '''boolean''' pure)
+
   |{{modarg|void}}|{{moddef|list|setup_flood_event|dot||integer|direction|integer|step|Cell|cell|boolean|pure}}
   |integer|Generator.[[#generator_being_weight|being_weight]]()
+
   |{{modarg|integer}}|{{moddef|list|being_weight|dot}}
   |integer|Generator.[[#generator_item_amount|item_amount]]()
+
   |{{modarg|integer}}|{{moddef|list|item_amount|dot}}
   |void|Generator.[[#generator_restore_walls|restore_walls]]([[Modding:Cell|Cell]] wall_cell, '''boolean''' keep_fluids)
+
   |{{modarg|void}}|{{moddef|list|restore_walls|dot||Cell|wall_cell|boolean|keep_fluids}}
   |list|Generator.[[#generator_cell_set|cell_set]]('''list''' list)
+
   |{{modarg|Cellset list}}|{{moddef|list|cell_set|dot||list|list}}
   |void|Generator.[[#generator_horiz_river|horiz_river]]([[Modding:Cell|Cell]] cell, '''integer''' width, '''boolean''' bridge)
+
   |{{modarg|void}}|{{moddef|list|horiz_river|dot||Cell|cell|integer|width|boolean|bridge}}
   |void|Generator.[[#generator_vert_river|vert_river]]([[Modding:Cell|Cell]] cell, '''integer''' width, '''boolean''' bridge, [[Modding:Coord|Coord]] pos)
+
   |{{modarg|void}}|{{moddef|list|vert_river|dot||Cell|cell|integer|width|boolean|bridge|Coord|pos}}
   |void|Generator.[[#generator_generate_rivers|generate_rivers]]('''boolean''' allow_horiz, '''boolean''' allow_more)
+
   |{{modarg|void}}|{{moddef|list|generate_rivers|dot||boolean|allow_horiz|boolean|allow_more}}
   |void|Generator.[[#generator_drunkard_walk|drunkard_walk]]([[Modding:Coord|Coord]] start, '''integer''' steps, [[Modding:Cell|Cell]] cell, [[Modding:Cell|Cell]]'''List''' ignore, '''boolean''' break_on_edge)
+
   |{{modarg|void}}|{{moddef|list|drunkard_walk|dot||Coord|start|integer|steps|Cell|cell|Cell list|ignore|boolean|break_on_edge}}
   |void|Generator.[[#generator_drunkard_walks|drunkard_walks]]('''integer''' amount, '''integer''' steps, [[Modding:Cell|Cell]] cell, [[Modding:Cell|Cell]]'''List''' ignore, '''boolean''' break_on_edge, [[Modding:Area|Area]] drunk_area)
+
   |{{modarg|void}}|{{moddef|list|drunkard_walks|dot||integer|amount|integer|steps|Cell|cell|Cell list|ignore|boolean|break_on_edge|Area|drunk_area}}
   |void|Generator.[[#generator_contd_drunkard_walks|contd_drunkard_walks]]('''integer''' amount, '''integer''' steps, [[Modding:Cell|Cell]] cell, [[Modding:Cell|Cell]] edges1, [[Modding:Cell|Cell]] edges2, [[Modding:Cell|Cell]]'''List''' ignore, '''boolean''' break_on_edge)
+
   |{{modarg|void}}|{{moddef|list|contd_drunkard_walks|dot||integer|amount|integer|steps|Cell|cell|Coord|edges1|Coord|edges2|Cell list|ignore|boolean|break_on_edge}}
   |void|Generator.[[#generator_plot_lines|plot_lines]]([[Modding:Coord|Coord]] where, [[Modding:Area|Area]] larea, '''boolean''' horiz, [[Modding:Cell|Cell]] cell, [[Modding:Cell|Cell]]'''List''' block)
+
   |{{modarg|void}}|{{moddef|list|plot_lines|dot||Coord|where|Area|larea|boolean|horiz|Cell|cell|Cell list|block}}
   |void|Generator.[[#generator_maze_dungeon|maze_dungeon]]([[Modding:Cell|Cell]] floor_cell, [[Modding:Cell|Cell]] wall_cell, '''integer''' granularity, '''integer''' tries,  '''integer''' minl, '''integer''' maxl)
+
   |{{modarg|void}}|{{moddef|list|maze_dungeon|dot|Cell|floor_cell|Cell|wall_cell|integer|granularity|integer|tries|integer|minl|integer|maxl}}
   |void|Generator.[[#generator_warehouse_fill|warehouse_fill]]([[Modding:Cell|Cell]] wall_cell, [[Modding:Area|Area]] fill_area, '''integer''' box_size, '''integer''' amount)
+
   |{{modarg|void}}|{{moddef|list|warehouse_fill|dot||Cell|wall_cell|Area|fill_area|integer|box_size|integer|amount}}
   |void|Generator.[[#generator_warehouse_dungeon|warehouse_dungeon]]()
+
   |{{modarg|void}}|{{moddef|list|warehouse_dungeon|dot}}
   |void|Generator.[[#generator_add_room|add_room]]([[Modding:Area|Area]] room)
+
   |{{modarg|void}}|{{moddef|list|add_room|dot||Area|room}}
   |boolean|Generator.[[#generator_add_rooms|add_rooms]]()
+
   |{{modarg|boolean}}|{{moddef|list|add_rooms|dot}}
   |[[Modding:Generator|Room]]|Generator.[[#generator_get_room|get_room]]('''integer''' min_size, '''integer''' max_x, '''integer''' max_y)
+
   |{{modarg|Room}}|{{moddef|list|get_room|dot||integer|min_size|integer|max_x|integer|max_y}}
   |void|Generator.[[#generator_generate_tiled|generate_tiled]]()
+
   |{{modarg|void}}|{{moddef|list|generate_tiled|dot}}
   |void|Generator.[[#generator_generate_warehouse_dungeon|generate_warehouse_dungeon]]()
+
   |{{modarg|void}}|{{moddef|list|generate_warehouse_dungeon|dot}}
   |void|Generator.[[#generator_generate_tiled_arena_dungeon|generate_tiled_arena_dungeon]]()
+
   |{{modarg|void}}|{{moddef|list|generate_tiled_arena_dungeon|dot}}
   |void|Generator.[[#generator_generate_city_dungeon|generate_city_dungeon]]()
+
   |{{modarg|void}}|{{moddef|list|generate_city_dungeon|dot}}
   |void|Generator.[[#generator_generate_maze_dungeon|generate_maze_dungeon]]()
+
   |{{modarg|void}}|{{moddef|list|generate_maze_dungeon|dot}}
   |void|Generator.[[#generator_generate_archi_dungeon|generate_archi_dungeon]]()
+
   |{{modarg|void}}|{{moddef|list|generate_archi_dungeon|dot}}
   |void|Generator.[[#generator_generate_caves_dungeon|generate_caves_dungeon]]()
+
   |{{modarg|void}}|{{moddef|list|generate_caves_dungeon|dot}}
   |void|Generator.[[#generator_generate_arena_dungeon|generate_arena_dungeon]]()
+
   |{{modarg|void}}|{{moddef|list|generate_arena_dungeon|dot}}
   |void|Generator.[[#generator_generate_fluids|generate_fluids]]([[Modding:Area|Area]] drunk_area)
+
   |{{modarg|void}}|{{moddef|list|generate_fluids|dot||Area|drunk_area}}
   |void|Generator.[[#generator_generate_barrels|generate_barrels]]()
+
   |{{modarg|void}}|{{moddef|list|generate_barrels|dot}}
   |void|Generator.[[#generator_generate_stairs|generate_stairs]]()
+
   |{{modarg|void}}|{{moddef|list|generate_stairs|dot}}
   |void|Generator.[[#generator_generate_special_stairs|generate_special_stairs]]()
+
   |{{modarg|void}}|{{moddef|list|generate_special_stairs|dot}}
   |void|Generator.[[#generator_generate_lever_room|generate_lever_room]]()
+
   |{{modarg|void}}|{{moddef|list|generate_lever_room|dot}}
   |void|Generator.[[#generator_generate_teleport_room|generate_teleport_room]]()
+
   |{{modarg|void}}|{{moddef|list|generate_teleport_room|dot}}
   |void|Generator.[[#generator_generate_ammo_room|generate_ammo_room]]()
+
   |{{modarg|void}}|{{moddef|list|generate_ammo_room|dot}}
   |void|Generator.[[#generator_generate_basain|generate_basain]]()
+
   |{{modarg|void}}|{{moddef|list|generate_basain|dot}}
   |void|Generator.[[#generator_generate_warehouse_room|generate_warehouse_room]]()
+
   |{{modarg|void}}|{{moddef|list|generate_warehouse_room|dot}}
   |void|Generator.[[#generator_generate_vault|generate_vault]]()
+
   |{{modarg|void}}|{{moddef|list|generate_vault|dot}}
   |void|Generator.[[#generator_add_room_feature|add_room_feature]]('''boolean''' no_monsters)
+
   |{{modarg|void}}|{{moddef|list|add_room_feature|dot||boolean|no_monsters}}
   |void|Generator.[[#generator_handle_rooms|handle_rooms]]('''boolean''' no_monsters)
+
   |{{modarg|void}}|{{moddef|list|handle_rooms|dot||boolean|no_monsters}}
   |void|Generator.[[#generator_place_player|place_player]]()
+
   |{{modarg|void}}|{{moddef|list|place_player|dot}}
   |void|Generator.[[#generator_roll_event|roll_event]]()
+
   |{{modarg|void}}|{{moddef|list|roll_event|dot}}
   |void|Generator.[[#generator_reset|reset]]()
+
   |{{modarg|void}}|{{moddef|list|reset|dot}}
 
   |}}
 
   |}}
 
|}
 
|}
  
{{Anchor|generator_safe_empty_coord}}
+
;{{moddef|desc|safe_empty_coord|dot}}
;Generator.safe_empty_coord() → [[Modding:Coord|Coord]]
+
 
:Gives a coordinate that satisfies all [[Modding:Constants#Empty Flags|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.
 
:Gives a coordinate that satisfies all [[Modding:Constants#Empty Flags|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.
 
----
 
----
{{Anchor|generator_standard_empty_coord}}
+
;{{moddef|desc|standard_empty_coord|dot}}
;Generator.standard_empty_coord() → [[Modding:Coord|Coord]]
+
 
:Gives a coordinate that satisfies all empty flags other than EF_NOSAFE.
 
:Gives a coordinate that satisfies all empty flags other than EF_NOSAFE.
 
----
 
----
{{Anchor|generator_set_permanence}}
+
;{{moddef|desc|set_permanence}}|dot||Area|ar|boolean|val|Cell|tile}}
;Generator.set_permanence([[Modding:Area|Area]] ar, '''boolean''' val, [[Modding:Cell|Cell]] tile)
+
: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.
:Sets the state of all cells' [[Modding:Constants#LightFlag|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.
+
 
----
 
----
{{Anchor|generator_setup_ice_event}}
+
;{{moddef|desc|setup_ice_event|dot}}
;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.
 
: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.
 
----
 
----
{{Anchor|generator_setup_perma_event}}
+
;{{moddef|desc|setup_perma_event|dot}}
;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.
 
: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.
 
----
 
----
{{Anchor|generator_setup_alarm_event}}
+
;{{moddef|desc|setup_alarm_event|dot}}
;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' [[Modding:Constants|Being Flags|BF_HUNTING]] flag to true.
 
: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' [[Modding:Constants|Being Flags|BF_HUNTING]] flag to true.
 
----
 
----
{{Anchor|generator_setup_deadly_air_event}}
+
;{{moddef|desc|setup_deadly_air_event|dot||integer|step}}
;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.
 
: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.
 
----
 
----
{{Anchor|generator_setup_nuke_event}}
+
;{{moddef|desc|setup_nuke_event|dot||integer|minutes}}
;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.
 
: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.
 
----
 
----
{{Anchor|generator_setup_flood_event}}
+
;{{moddef|desc|setup_flood_event|dot||integer|direction|integer|step|Cell|cell|boolean|pure}}
;Generator.setup_flood_event('''integer''' direction, '''integer''' step, [[Modding:Cell|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.
 
: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.
 
----
 
----
{{Anchor|generator_being_weight}}
+
;{{moddef|desc|being_weight|dot|integer}}
;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.
 
: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.
 
----
 
----
{{Anchor|generator_item_amount}}
+
;{{moddef|desc|item_amount|dot|integer}}
;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.
 
: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.
 
----
 
----
{{Anchor|generator_restore_walls}}
+
;{{moddef|desc|restore_walls|dot||Cell|wall_cell|boolean|keep_fluids}}
;Generator.restore_walls([[Modding:Cell|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.
 
: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.
 
----
 
----
{{Anchor|generator_cell_set}}
+
;{{moddef|desc|cell_set|dot|Cellset list|list|list}}
;Generator.cell_set('''list''' list) → '''list'''
+
 
:Creates a cellset for all cells in ''list''. The returned list functions just like any [[Modding:Constants#Cellsets|CELLSET constant]].
 
:Creates a cellset for all cells in ''list''. The returned list functions just like any [[Modding:Constants#Cellsets|CELLSET constant]].
 
----
 
----
{{Anchor|generator_horiz_river}}
+
;{{moddef|desc|horiz_river|dot||Cell|cell|integer|width|boolean|bridge}}
;Generator.horiz_river([[Modding:Cell|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.
 
: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.
 
----
 
----
{{Anchor|generator_vert_river}}
+
;{{moddef|desc|vert_river|dot||Cell|cell|integer|width|boolean|bridge|Coord|pos}}
;Generator.vert_river([[Modding:Cell|Cell]] cell, '''integer''' width, '''boolean''' bridge, [[Modding:Coord|Coord]] pos)
+
;{{moddef|desc|vert_river|dot||Cell|cell|integer|width|boolean|bridge|integer|pos}}
;Generator.vert_river([[Modding:Cell|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.
 
: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.
 
----
 
----
{{Anchor|generator_generate_rivers}}
+
;{{moddef|desc|generate_rivers|dot||boolean|allow_horiz|boolean|allow_more}}
;Generator.generate_rivers('''boolean''' allow_horiz, '''boolean''' allow_more)
+
 
:Generates a random number of horizontal and vertical rivers on the map. See [[Fluids#Rivers|Rivers]] for more information. The fluid type varies with map depth.
 
:Generates a random number of horizontal and vertical rivers on the map. See [[Fluids#Rivers|Rivers]] for more information. The fluid type varies with map depth.
 
----
 
----
{{Anchor|generator_drunkard_walk}}
+
;{{moddef|desc|drunkard_walk|dot||Coord|start|integer|steps|Cell|cell|Cell list|ignore|boolean|break_on_edge}}
;Generator.drunkard_walk([[Modding:Coord|Coord]] start, '''integer''' steps, [[Modding:Cell|Cell]] cell, [[Modding:Cell|Cell]]'''List''' 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.
 
: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.
 
----
 
----
{{Anchor|generator_drunkard_walks}}
+
;{{moddef|desc|drunkard_walks|dot||integer|amount|integer|steps|Cell|cell|Cell list|ignore|boolean|break_on_edge|Area|drunk_area}}
;Generator.drunkard_walks('''integer''' amount, '''integer''' steps, [[Modding:Cell|Cell]] cell, [[Modding:Cell|Cell]]'''List''' ignore, '''boolean''' break_on_edge, [[Modding:Area|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''.
 
: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''.
 
----
 
----
{{Anchor|generator_contd_drunkard_walks}}
+
;{{moddef|desc|contd_drunkard_walks|dot||integer|amount|integer|steps|Cell|cell|Coord|edges1|Coord|edges2|Cell list|ignore|boolean|break_on_edge}}
;Generator.contd_drunkard_walks('''integer''' amount, '''integer''' steps, [[Modding:Cell|Cell]] cell, [[Modding:Coord|Coord]] edges1, [[Modding:Coord|Coord]] edges2, [[Modding:Cell|Cell]]'''List''' 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''.
 
: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''.
 
----
 
----
{{Anchor|generator_plot_lines}}
+
;{{moddef|desc|plot_lines|dot||Coord|where|Area|larea|boolean|horiz|Cell|cell|Cell list|block}}
;Generator.plot_lines([[Modding:Coord|Coord]] where, [[Modding:Area|Area]] larea, '''boolean''' horiz, [[Modding:Cell|Cell]] cell, [[Modding:Cell|Cell]]'''List''' 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.
 
: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.
 
----
 
----
{{Anchor|generator_maze_dungeon}}
+
;{{moddef|desc|maze_dungeon|dot|Cell|floor_cell|Cell|wall_cell|integer|granularity|integer|tries|integer|minl|integer|maxl}}
;Generator.maze_dungeon([[Modding:Cell|Cell]] floor_cell, [[Modding: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''.
 
: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''.
 
----
 
----
{{Anchor|generator_warehouse_fill}}
+
;{{moddef|desc|warehouse_fill|dot||Cell|wall_cell|Area|fill_area|integer|box_size|integer|amount}}
;Generator.warehouse_fill([[Modding:Cell|Cell]] wall_cell, [[Modding:Area|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.
 
: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.
 
----
 
----
{{Anchor|generator_warehouse_dungeon}}
+
;{{moddef|desc|warehouse_dungeon|dot}}
;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.
 
:Generates a map-wide warehouse setting. Warehouse dungeons are divided into three large rooms, each attempting 50 tries with boxes of side length 3.
 
----
 
----
{{Anchor|generator_add_room}}
+
;{{moddef|desc|add_room|dot||Area|room}}
;Generator.add_room([[Modding:Area|Area]] room)
+
 
:Adds ''room'' to the Generator.room_list and Generator.room_meta lists. This is used in conjunction with room generation functions.
 
:Adds ''room'' to the Generator.room_list and Generator.room_meta lists. This is used in conjunction with room generation functions.
 
----
 
----
{{Anchor|generator_add_rooms}}
+
;{{moddef|desc|add_rooms|dot|boolean}}
;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.
 
:As Generator.add_room, but locates all rooms on the map and adds them to Generator.room_list and Generator.room_meta instead.
 
----
 
----
{{Anchor|generator_get_room}}
+
;{{moddef|desc|get_room|dot|Room|integer|min_size|integer|max_x|integer|max_y}}
;Generator.get_room('''integer''' min_size, '''integer''' max_x, '''integer''' max_y) → [[Modding:Generator|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.
 
: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.
 
----
 
----
{{Anchor|generator_generate_tiled}}
+
;{{moddef|desc|generate_tiled|dot}}
;Generator.generate_tiled()
+
 
:Generates a "normal" map. Normal levels are divided randomly into rectangular rooms.
 
:Generates a "normal" map. Normal levels are divided randomly into rectangular rooms.
 
----
 
----
{{Anchor|generator_generate_warehouse_dungeon}}
+
;{{moddef|desc|generate_warehouse_dungeon|dot}}
;Generator.generate_warehouse_dungeon()
+
 
:Builds a "warehouse" level. This includes everything necessary to be played as a typical random level.
 
:Builds a "warehouse" level. This includes everything necessary to be played as a typical random level.
 
----
 
----
{{Anchor|generator_generate_tiled_arena_dungeon}}
+
;{{moddef|desc|generate_tiled_arena_dungeon|dot}}
;Generator.generate_tiled_arena_dungeon()
+
 
:Builds a "single-monster" level. This includes everything necessary to be played as a typical random level.
 
:Builds a "single-monster" level. This includes everything necessary to be played as a typical random level.
 
----
 
----
{{Anchor|generator_generate_city_dungeon}}
+
;{{moddef|desc|generate_city_dungeon|dot}}
;Generator.generate_city_dungeon()
+
 
:Builds a "city" level. This includes everything necessary to be played as a typical random level.
 
:Builds a "city" level. This includes everything necessary to be played as a typical random level.
 
----
 
----
{{Anchor|generator_generate_maze_dungeon}}
+
;{{moddef|desc|generate_maze_dungeon|dot}}
;Generator.generate_maze_dungeon()
+
 
:Builds a "maze" level. This includes everything necessary to be played as a typical random level.
 
:Builds a "maze" level. This includes everything necessary to be played as a typical random level.
 
----
 
----
{{Anchor|generator_generate_archi_dungeon}}
+
;{{moddef|desc|generate_archi_dungeon|dot}}
;Generator.generate_archi_dungeon()
+
 
:Builds an "archi" level. This includes everything necessary to be played as a typical random level.
 
:Builds an "archi" level. This includes everything necessary to be played as a typical random level.
 
----
 
----
{{Anchor|generator_generate_caves_dungeon}}
+
;{{moddef|desc|generate_caves_dungeon|dot}}
;Generator.generate_caves_dungeon()
+
 
:Builds a "cave" level. This includes everything necessary to be played as a typical random level.
 
:Builds a "cave" level. This includes everything necessary to be played as a typical random level.
 
----
 
----
{{Anchor|generator_generate_arena_dungeon}}
+
;{{moddef|desc|generate_arena_dungeon|dot}}
;Generator.generate_arena_dungeon()
+
 
:Builds an "arena" level. This includes everything necessary to be played as a typical random level.
 
:Builds an "arena" level. This includes everything necessary to be played as a typical random level.
 
----
 
----
{{Anchor|generator_generate_fluids}}
+
;{{moddef|desc|generate_fluids|dot||Area|drunk_area}}
;Generator.generate_fluids([[Modding:Area|Area]] drunk_area)
+
 
:Generates all non-river fluids on the map using drunken walks, within ''drunk_area''. The fluid type varies with danger level.
 
:Generates all non-river fluids on the map using drunken walks, within ''drunk_area''. The fluid type varies with danger level.
 
----
 
----
{{Anchor|generator_generate_barrels}}
+
;{{moddef|desc|generate_barrels|dot}}
;Generator.generate_barrels()
+
 
:Generates all barrels on the map, The barrel type varies with danger level.
 
:Generates all barrels on the map, The barrel type varies with danger level.
 
----
 
----
{{Anchor|generator_generate_stairs}}
+
;{{moddef|desc|generate_stairs|dot}}
;Generator.generate_stairs()
+
 
:Generates stairs on the map.
 
:Generates stairs on the map.
 
----
 
----
{{Anchor|generator_generate_special_stairs}}
+
;{{moddef|desc|generate_special_stairs|dot}}
;Generator.generate_special_stairs()
+
 
:Generates special stairs on the map, if a special level exists at the current map depth.
 
:Generates special stairs on the map, if a special level exists at the current map depth.
 
----
 
----
{{Anchor|generator_generate_lever_room}}
+
;{{moddef|desc|generate_lever_room|dot}}
;Generator.generate_lever_room()
+
 
:Finds a room of appropriate size and adjusts it into a lever room.
 
:Finds a room of appropriate size and adjusts it into a lever room.
 
----
 
----
{{Anchor|generator_generate_teleport_room}}
+
;{{moddef|desc|generate_teleport_room|dot}}
;Generator.generate_teleport_room()
+
 
:Finds a room of appropriate size and adjusts it into a teleporter room.
 
:Finds a room of appropriate size and adjusts it into a teleporter room.
 
----
 
----
{{Anchor|generator_generate_ammo_room}}
+
;{{moddef|desc|generate_ammo_room|dot}}
;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.
 
:Finds a room of appropriate size and adjusts it into an ammo room. The type of ammo varies with danger level.
 
----
 
----
{{Anchor|generator_generate_basain}}
+
;{{moddef|desc|generate_basain|dot}}
;Generator.generate_basain()
+
 
:Finds a room of appropriate size and adjusts it into a room filled with fluid.
 
:Finds a room of appropriate size and adjusts it into a room filled with fluid.
 
----
 
----
{{Anchor|generator_generate_warehouse_room}}
+
;{{moddef|desc|generate_warehouse_room|dot}}
;Generator.generate_warehouse_room()
+
 
:Finds a room of appropriate size and adjusts it into a room with boxes (as Generator.warehouse_fill).
 
:Finds a room of appropriate size and adjusts it into a room with boxes (as Generator.warehouse_fill).
 
----
 
----
{{Anchor|generator_generate_vault}}
+
;{{moddef|desc|generate_vault|dot}}
;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.
 
:Finds a room of appropriate size and adjust it into a vault. The monsters, items, and type of vault vary with danger level.
 
----
 
----
{{Anchor|generator_add_room_feature}}
+
;{{moddef|desc|add_room_feature|dot||boolean|no_monsters}}
;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.
 
: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.
 
----
 
----
{{Anchor|generator_handle_rooms}}
+
;{{moddef|desc|handle_rooms|dot||boolean|no_monsters}}
;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.
 
:Generates up to seven special rooms on the map and restores walls that were otherwise removed as a result of the room generation.
 
----
 
----
{{Anchor|generator_place_player}}
+
;{{moddef|desc|place_player|dot}}
;Generator.place_player()
+
 
:Adds to player to the map.
 
:Adds to player to the map.
 
----
 
----
{{Anchor|generator_roll_event}}
+
;{{moddef|desc|roll_event|dot}}
;Generator.roll_event()
+
 
:Randomly select a level event function to be added to the map.
 
:Randomly select a level event function to be added to the map.
 
----
 
----
{{Anchor|generator_reset}}
+
;{{moddef|desc|reset|dot}}
;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.
 
: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.

Revision as of 03:12, 27 January 2012

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)
Cellset 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, Cell list ignore, boolean break_on_edge)
void generator.drunkard_walks(integer amount, integer steps, Cell cell, Cell list ignore, boolean break_on_edge, Area drunk_area)
void generator.contd_drunkard_walks(integer amount, integer steps, Cell cell, Coord edges1, Coord edges2, Cell list ignore, boolean break_on_edge)
void generator.plot_lines(Coord where, Area larea, boolean horiz, Cell cell, Cell list block)
void generator.maze_dungeon(floor_cell Cell, wall_cell integer, granularity integer, tries integer, minl integer, ) → Cell
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()
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()
Gives a coordinate that satisfies all empty flags other than EF_NOSAFE.

set_permanence()|dot||Area|ar|boolean|val|Cell|tile}}
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_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) → Cellset 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, Cell list 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, Cell list 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, Cell list 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, Cell list 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(floor_cell Cell, wall_cell integer, granularity integer, tries integer, minl integer, ) → Cell
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