diff --git a/code/modules/keybindings/bindings_ai.dm b/code/modules/keybindings/bindings_ai.dm index 975b5ba81a96..1ad4cdc9d345 100644 --- a/code/modules/keybindings/bindings_ai.dm +++ b/code/modules/keybindings/bindings_ai.dm @@ -1,6 +1,59 @@ +/mob/living/silicon/ai/var/current_camera = 0 + /mob/living/silicon/ai/key_down(_key, client/user) - switch(_key) - if("4") - a_intent_change(INTENT_HOTKEY_LEFT) + if(user.keys_held["Shift"]) + if(text2num(_key) != null) + if(set_camera_by_index(user, text2num(_key))) + update_binded_camera(user) return - return ..() + return ..() + else + switch(_key) + if("4") + a_intent_change(INTENT_HOTKEY_LEFT) + return + if("N") + if(check_for_binded_cameras(user)) + current_camera_next(user) + update_binded_camera(user) + return + if("B") + if(check_for_binded_cameras(user)) + current_camera_back(user) + update_binded_camera(user) + return + return ..() + +/mob/living/silicon/ai/proc/check_for_binded_cameras(client/user) + if(!length(stored_locations)) + to_chat(user, "You have no stored camera positions") + return 0 + return 1 + +/mob/living/silicon/ai/proc/set_camera_by_index(client/user, var/camnum) + var/camnum_length = length(stored_locations) + if(camnum > camnum_length || (camnum == 0 && camnum_length < 10)) + to_chat(user, "You have no stored camera on [camnum] position") + return 0 + if(camnum == 0) + camnum = 10 + current_camera = camnum + return 1 + +/mob/living/silicon/ai/proc/update_binded_camera(client/user) + var/camname + camname = stored_locations[current_camera] + ai_goto_location(camname) + to_chat(user, "Now you on camera position: [camname]") + +/mob/living/silicon/ai/proc/current_camera_next(client/user) + if(current_camera >= length(stored_locations)) + current_camera = 1 + else + current_camera += 1 + +/mob/living/silicon/ai/proc/current_camera_back(client/user) + if(current_camera <= 1) + current_camera = length(stored_locations) + else + current_camera -= 1