mirror of
https://gitlab.com/Oreolek/black_phone.git
synced 2024-06-29 05:15:11 +03:00
33 lines
1.6 KiB
Markdown
33 lines
1.6 KiB
Markdown
|
# The Black Phone
|
||
|
### A walk through someone else's apartment
|
||
|
|
||
|
*Provided under the terms of MIT license, see LICENSE.txt*
|
||
|
|
||
|
#### Hacks and whistles
|
||
|
|
||
|
"Black phone" boasts a new technical feature: additional room exits.
|
||
|
|
||
|
This is something I greatly missed coming from INSTEAD.
|
||
|
I had to hack Undum and expose ("export") its `processClick` function so I could make an additional interface block.
|
||
|
|
||
|
The technical side is simple: my [Undum-commonjs](https://github.com/oreolek/undum-commonjs) fork exports `processClick` function.
|
||
|
Every situation that is a room (there are non-room situations, mind) has an array of `ways`.
|
||
|
This array has every other room this one connects to.
|
||
|
On entering a room, the `before` function calls for `update_ways` function that reads `ways` array and updates the UI.
|
||
|
It's not automatic but the game is small enough for this to work.
|
||
|
|
||
|
Undum has a bug: every "once" link becomes clickable again when you visit the same situation.
|
||
|
For example, you can save the game, load it again and click everything the second time.
|
||
|
|
||
|
The game exploits this because you can visit any room again and examine everything you missed.
|
||
|
|
||
|
There is also a slightly debatable UI hack: as every link is "once" link (it gets deactivated once it's called),
|
||
|
I've sped up every click by 250ms or so like this:
|
||
|
|
||
|
document.onmousedown = (e) ->
|
||
|
e.target.click()
|
||
|
|
||
|
A "click" in Javascript is an event of clicking the mouse button and releasing it.
|
||
|
The "mousedown" event is just clicking the button, not waiting for the release.
|
||
|
I didn't bother with intricacies, so the right mouse click is treated the same as the left one.
|