01-15-2019, 08:11 PM
(This post was last modified: 01-23-2019, 08:54 PM by kyle2143. Edited 4 times in total.
Edit Reason: Change video
)
The security camera computer sucks and you all know it. You have to scroll through the whole list of cameras looking for one that sounds like where you want, as soon as you click it the menu moves all the way to the bottom so your point of reference is lost, pretty useless for all but a few specific scenarios.
This patch does several things:
1. Allows you to move between security cameras in the network similar to how the old AI movement worked. Use arrow keys, wasd, or ijkl to move from your current camera to the camera nearest to you in your chosen cardinal direction (N/S/E/W).
2. Improves the actual menu screen a great deal. Instead of an unparsable list of over a hundred entries where you can only see like 10 at a time, now you can see much more!. There is also a searchbar on top of the list that will allow you to see only the cameras you want.
3. I added a "favorites list" of cameras. It removes the selected camera from the main list, and moves it to a list on the right. Only 5 favorites allowed right now.
Images (resized)
Original:
New:
Video Demo: https://streamable.com/g4hw9
Notes:
- This only effects the security/wooden/detective camera computers, not the handheld computer monitors like you'll find around.
- While I think this screen is better than before. It's still rather bad/bare bones. I'm not really one for front end/UI work, especially html/js stuff. So here is a JSFiddle page of what I was using to test the web changes for anyone who wants to try their hand and improving it. It has most of the stuff that is in the new menu, but none of the chui stuff. https://jsfiddle.net/kyle2143/whmkfjc7/6/
Technical Notes:
- If you take the time to read the actual code, you may notice that the js I wrote for this is really ugly. Sorry, but I'm too afraid to try to clean it up and trying to do so would only lead to me getting way too angry and frustrated. I don't want to risk it.
- The camera movement calls from the arrow keys are in a debounce function, to cut down on topic calls. I set it to 50ms, could probably go lower. Essentially it just makes it so that you can't hold down a key and fire off 100 topic calls in a second.
- Similarly I debounced the js function for adding/removing favorites. This is probably completely unnecessary since the actual camera selecting is not debounced. (but it was that way in the original computer so I didn't change it).
- For camera movement. Keys pressed are checked client-side and server-side to validate and prevent extraneous topic calls.
- The camera movement code is mostly repurposed from how the AI movement works. The reason that I included the ai/move.dm file in this commit is because I added a new file for moving the security camera around, and it uses the same name as the proc in move.dm. It's my understanding that that has been removed in productions so it shouldn't matter really except for testing in 2016.
Bugs:
- Due to either me being too stupid or chui hating me too much, there was a bug with closing the chui screen. If you click the chui 'X' button at the top right, it closes the menu, but it doesn't send a 'close' topic call like the regular browser does. So I can't reset the player's eye back to themself.
- To get around said bug above, currently I added an 'X' anchor to click at the top right that will close it like normal. Unfortunately the 'can_close=0' option doesn't want to work for me. I suspect sabotage.
- EDIT: - Oh there is one other bug I forgot to mention. When using the AI movement mode, you can use the arrow keys to move around. Pressing the down or up arrow keys will move the scrollbar up and down. I couldn't really get it to stop. JS prevent_default doesn't seem to work in a JQuery delegate function.
https://github.com/goonstation/goonstati...6/pull/102
This patch does several things:
1. Allows you to move between security cameras in the network similar to how the old AI movement worked. Use arrow keys, wasd, or ijkl to move from your current camera to the camera nearest to you in your chosen cardinal direction (N/S/E/W).
2. Improves the actual menu screen a great deal. Instead of an unparsable list of over a hundred entries where you can only see like 10 at a time, now you can see much more!. There is also a searchbar on top of the list that will allow you to see only the cameras you want.
3. I added a "favorites list" of cameras. It removes the selected camera from the main list, and moves it to a list on the right. Only 5 favorites allowed right now.
Images (resized)
Original:
New:
Video Demo: https://streamable.com/g4hw9
Notes:
- This only effects the security/wooden/detective camera computers, not the handheld computer monitors like you'll find around.
- While I think this screen is better than before. It's still rather bad/bare bones. I'm not really one for front end/UI work, especially html/js stuff. So here is a JSFiddle page of what I was using to test the web changes for anyone who wants to try their hand and improving it. It has most of the stuff that is in the new menu, but none of the chui stuff. https://jsfiddle.net/kyle2143/whmkfjc7/6/
Technical Notes:
- If you take the time to read the actual code, you may notice that the js I wrote for this is really ugly. Sorry, but I'm too afraid to try to clean it up and trying to do so would only lead to me getting way too angry and frustrated. I don't want to risk it.
- The camera movement calls from the arrow keys are in a debounce function, to cut down on topic calls. I set it to 50ms, could probably go lower. Essentially it just makes it so that you can't hold down a key and fire off 100 topic calls in a second.
- Similarly I debounced the js function for adding/removing favorites. This is probably completely unnecessary since the actual camera selecting is not debounced. (but it was that way in the original computer so I didn't change it).
- For camera movement. Keys pressed are checked client-side and server-side to validate and prevent extraneous topic calls.
- The camera movement code is mostly repurposed from how the AI movement works. The reason that I included the ai/move.dm file in this commit is because I added a new file for moving the security camera around, and it uses the same name as the proc in move.dm. It's my understanding that that has been removed in productions so it shouldn't matter really except for testing in 2016.
Bugs:
- Due to either me being too stupid or chui hating me too much, there was a bug with closing the chui screen. If you click the chui 'X' button at the top right, it closes the menu, but it doesn't send a 'close' topic call like the regular browser does. So I can't reset the player's eye back to themself.
- To get around said bug above, currently I added an 'X' anchor to click at the top right that will close it like normal. Unfortunately the 'can_close=0' option doesn't want to work for me. I suspect sabotage.
- EDIT: - Oh there is one other bug I forgot to mention. When using the AI movement mode, you can use the arrow keys to move around. Pressing the down or up arrow keys will move the scrollbar up and down. I couldn't really get it to stop. JS prevent_default doesn't seem to work in a JQuery delegate function.
https://github.com/goonstation/goonstati...6/pull/102