This shows you the differences between two versions of the page.
dcss:help:maps:lua:modules:dgn:build [2014-07-20 07:55] infiniplex [Design Notes] Added |
dcss:help:maps:lua:modules:dgn:build [2014-11-05 03:08] (current) infiniplex [connect_adjacent_rooms] Replaced check_empty parameter with check_distance |
||
---|---|---|---|
Line 522: | Line 522: | ||
<code lua> | <code lua> | ||
connect_adjacent_rooms({ wall = ???, floor = ???, replace = ???, | connect_adjacent_rooms({ wall = ???, floor = ???, replace = ???, | ||
- | max = ???, min = ???, check_empty = ???, | + | max = ???, min = ???, check_distance = ???, |
x1 = ???, y1 = ???, x2 = ???, y2 = ??? }) | x1 = ???, y1 = ???, x2 = ???, y2 = ??? }) | ||
</code> | </code> | ||
Line 532: | Line 532: | ||
* ''max'' (int, default: ''1''): The maximum number of positions to consider | * ''max'' (int, default: ''1''): The maximum number of positions to consider | ||
* ''min'' (int, default: ''max''): The minimum number of positions to consider | * ''min'' (int, default: ''max''): The minimum number of positions to consider | ||
- | * ''check_empty'' (boolean, default: ''false''): Whether to check if the wall already has a door | + | * ''check_distance'' (int, default: ''9999''): How far along the wall to look for another door |
* ''x1'' (int, default: ''0''): The minimum x coordinate | * ''x1'' (int, default: ''0''): The minimum x coordinate | ||
* ''y1'' (int, default: ''0''): The minimum y coordinate | * ''y1'' (int, default: ''0''): The minimum y coordinate | ||
Line 538: | Line 538: | ||
* ''y2'' (int, default: vault max): The maximum y coordinate | * ''y2'' (int, default: vault max): The maximum y coordinate | ||
- | This function checks a number of positions in the box between (''x1'', ''y1'') and (''x2'', ''y2''). The exact number of positions is chosen randomly from the range [''min'', ''max''] inclusive. Each position is checked to see if it on glyph in ''wall'', between two glyphs in ''floor''. If so, that glyph is deemed to be on a wall, and is considered to become a connection between the two rooms on either side of it. If ''check_empty'' is false, the connection is added if the immediate neighbours on the other two sides are glyphs in ''wall''. If ''check_empty'' is true, the entire wall until the first corner on each of the two sides must be composed only of glyphs in ''wall''. | + | This function checks a number of positions in the box between (''x1'', ''y1'') and (''x2'', ''y2''). The exact number of positions is chosen randomly from the range [''min'', ''max''] inclusive. Each position is checked to see if it on glyph in ''wall'', between two glyphs in ''floor''. If so, that glyph is deemed to be on a wall, and is considered to become a connection between the two rooms on either side of it. The connection will only be added if there are ''wall'' cells for at least ''check_distance'' cells on either side of the position. |
Some Example Situations: | Some Example Situations: | ||
Line 544: | Line 544: | ||
'O' is the position being considered | 'O' is the position being considered | ||
- | Original .x......x .x......x .x......x .x......x | + | Original .x.......x .x.......x .x.......x .x.......x .x.......x |
- | Situation: xxxxOxxxx xxx+Oxxxx xx+xOxxxx xxxxO..xx | + | Situation: xxxxOxxxxx xxx+Oxxxxx xx+xOxxxxx xxxxxO..xx xxxxOxx+xx |
- | x......x. x......x. x......x. x......x. | + | x.......x. x.......x. x.......x. x.......x. x.......x. |
- | Decision if ''check_empty'' is ''false'' | + | Decision if ''check_distance'' is ''0'' |
- | Accept Reject Accept Reject | + | Accept Reject Accept Reject Accept |
- | next to '+' next to '.' | + | next to '+' next to '.' |
- | Decision if ''check_empty'' is ''true'' | + | Decision if ''check_distance'' is ''2'' |
- | Accept Reject Reject Reject | + | Accept Reject Reject Reject Accept |
- | '+' on wall '+' on wall next to '.' | + | '+' on wall '+' on wall next to '.' '+' is too far |
+ | |||
+ | Decision if ''check_distance'' is ''9999'' | ||
+ | |||
+ | Accept Reject Reject Reject Reject | ||
+ | '+' on wall '+' on wall next to '.' '+' on wall | ||
==== smear_map ==== | ==== smear_map ==== |