Duplicator: Difference between revisions
(Created page with "{{Element |zzt-oop name=Duplicator |id={{Byte|12}} |char={{CharSwatch|250}} |color={{ColorSwatch|fg=white|bg=black}} |category=Item |stats=yes |x-y step=Source Direction |cycle=(9-P2)*3 |p1=Duplication Timer |p2=Duplication Rate |destructible=no |effect on movement=Wall |uses zzt-oop color=Default only }} The '''duplicator''' is device that copies an element from its source direction to the tile in its opposite direction. The frequency at which it duplicates can be chan...") |
No edit summary |
||
| Line 40: | Line 40: | ||
When the duplication timer reaches 5, the timer is reset and the duplicator attempts to duplicate the element in the source direction. | When the duplication timer reaches 5, the timer is reset and the duplicator attempts to duplicate the element in the source direction. | ||
The duplication procedure first checks if a [[player]] (or player clone) is at the destination tile. If so, then the game has the player touch the source tile. This can cause the player to destroy the source tile if it is destructible on contact (e.g. if it's an item like a [[gem]] or an enemy like a [[tiger]]). This can also force other interactions such as the player going through a passage, though that will result in the "[[koopo bug]]" occurring. If a [[boulder]] or [[slider]] is at the source tile, then ZZT will crash (TODO: explain why concisely). | The duplication procedure first checks if a [[player]] (or player clone) is at the destination tile. If so, then the game has the player touch the source tile. This can cause the player to destroy the source tile if it is destructible on contact (e.g. if it's an item like a [[gem]] or an enemy like a [[tiger]]). This can also force other interactions such as the player going through a [[passage]], though that will result in the "[[koopo bug]]" occurring. If a [[boulder]] or [[slider]] is at the source tile, then ZZT will crash (TODO: explain why concisely). | ||
If a player is not at the destination tile, the game instead attempts to push the destination tile away. If the push is unsuccessful, then the duplicator plays its "blocked" sound and then does nothing. If the push is successful, then the contents of the source tile are copied to the destination and the duplication sound is played. If the source tile has stats, then all stats are carried over to the duplicate (including the code). | If a player is not at the destination tile, the game instead attempts to push the destination tile away. If the push is unsuccessful, then the duplicator plays its "blocked" sound and then does nothing. If the push is successful, then the contents of the source tile are copied to the destination and the duplication sound is played. If the source tile has stats, then all stats are carried over to the duplicate (including the code). | ||
Revision as of 20:53, 22 December 2025
| Duplicator | |
|---|---|
| ZZT-OOP name | Duplicator |
| Internal ID | 12 (0x0C) |
| Character | #char 250 · (0xFA) |
| Default color | white on black (0x0F) |
| Category | Item |
| Stats | |
| X/Y-step | Source Direction |
| Default cycle | (9-P2)*3 |
| P1 | Duplication Timer |
| P2 | Duplication Rate |
| Other traits | |
| Effect on movement | Wall |
| Destructible? | no |
| Uses ZZT-OOP color names? | Default only |
The duplicator is device that copies an element from its source direction to the tile in its opposite direction. The frequency at which it duplicates can be changed with the "duplication rate" parameter, with higher numbers resulting in faster duplication.
Every tick the duplicator increments its duplication timer by one, and then draws the tile according to the following table:
| P1 | Character |
|---|---|
| 1 | #char 250 · (0xFA) |
| 2 | #char 249 ∙ (0xF9) |
| 3 | #char 248 ° (0xF8) |
| 4 | #char 111 o (0x6F) |
| 5 | #char 79 O (0x4F) |
| Default | #char 250 · (0xFA) |
When the duplication timer reaches 5, the timer is reset and the duplicator attempts to duplicate the element in the source direction.
The duplication procedure first checks if a player (or player clone) is at the destination tile. If so, then the game has the player touch the source tile. This can cause the player to destroy the source tile if it is destructible on contact (e.g. if it's an item like a gem or an enemy like a tiger). This can also force other interactions such as the player going through a passage, though that will result in the "koopo bug" occurring. If a boulder or slider is at the source tile, then ZZT will crash (TODO: explain why concisely).
If a player is not at the destination tile, the game instead attempts to push the destination tile away. If the push is unsuccessful, then the duplicator plays its "blocked" sound and then does nothing. If the push is successful, then the contents of the source tile are copied to the destination and the duplication sound is played. If the source tile has stats, then all stats are carried over to the duplicate (including the code).
Note that every tick the duplicator sets its cycle according to the formula Cycle := (9 - P2) * 3, with P2 representing the "Duplication Rate," which limits the granularity and maximum speed of duplicators even when using external editors.
Duplicators support non-standard x/y-step values, but as always care should be taken to avoid out-of-bounds interactions.
| Elements | |
|---|---|
| Special | |
| Items | |
| Terrain | |
| Creatures | |
| Text | |