mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2025-12-31 20:53:34 +00:00
# Conflicts: # .travis.yml # _maps/map_files/MetaStation/z2.dmm # _maps/map_files/cyberiad/z2.dmm # code/game/atoms_movable.dm # code/game/machinery/camera/camera.dm # code/modules/mob/living/silicon/ai/ai.dm # code/modules/mob/living/silicon/ai/freelook/eye.dm
216 lines
5.8 KiB
Plaintext
216 lines
5.8 KiB
Plaintext
/obj/machinery/computer/camera_advanced
|
|
name = "advanced camera console"
|
|
desc = "Used to access the various cameras on the station."
|
|
icon_screen = "cameras"
|
|
icon_keyboard = "security_key"
|
|
var/mob/camera/aiEye/remote/eyeobj
|
|
var/mob/living/carbon/human/current_user = null
|
|
var/list/networks = list("SS13")
|
|
var/datum/action/innate/camera_off/off_action = new
|
|
var/datum/action/innate/camera_jump/jump_action = new
|
|
var/list/actions = list()
|
|
|
|
/obj/machinery/computer/camera_advanced/proc/CreateEye()
|
|
eyeobj = new()
|
|
eyeobj.origin = src
|
|
|
|
/obj/machinery/computer/camera_advanced/proc/GrantActions(mob/living/user)
|
|
if(off_action)
|
|
off_action.target = user
|
|
off_action.Grant(user)
|
|
actions += off_action
|
|
|
|
if(jump_action)
|
|
jump_action.target = user
|
|
jump_action.Grant(user)
|
|
actions += jump_action
|
|
|
|
/obj/machinery/computer/camera_advanced/proc/remove_eye_control(mob/living/user)
|
|
if(!user)
|
|
return
|
|
for(var/V in actions)
|
|
var/datum/action/A = V
|
|
A.Remove(user)
|
|
actions.Cut()
|
|
if(user.client)
|
|
user.reset_perspective(null)
|
|
eyeobj.RemoveImages()
|
|
eyeobj.eye_user = null
|
|
user.remote_control = null
|
|
user.remote_view = FALSE
|
|
|
|
current_user = null
|
|
user.unset_machine()
|
|
playsound(src, 'sound/machines/terminal_off.ogg', 25, 0)
|
|
|
|
/obj/machinery/computer/camera_advanced/check_eye(mob/user)
|
|
if((stat & (NOPOWER|BROKEN)) || !Adjacent(user) || !user.has_vision() || user.incapacitated())
|
|
user.unset_machine()
|
|
return 0
|
|
return 1
|
|
|
|
/obj/machinery/computer/camera_advanced/Destroy()
|
|
if(current_user)
|
|
current_user.unset_machine()
|
|
QDEL_NULL(eyeobj)
|
|
QDEL_LIST(actions)
|
|
return ..()
|
|
|
|
/obj/machinery/computer/camera_advanced/on_unset_machine(mob/M)
|
|
if(M == current_user)
|
|
remove_eye_control(M)
|
|
|
|
/obj/machinery/computer/camera_advanced/attack_hand(mob/user)
|
|
if(current_user)
|
|
to_chat(user, "The console is already in use!")
|
|
return
|
|
if(!iscarbon(user))
|
|
return
|
|
if(..())
|
|
return
|
|
user.set_machine(src)
|
|
|
|
if(!eyeobj)
|
|
CreateEye()
|
|
|
|
if(!eyeobj.eye_initialized)
|
|
var/camera_location
|
|
for(var/obj/machinery/camera/C in cameranet.cameras)
|
|
if(!C.can_use())
|
|
continue
|
|
if(C.network&networks)
|
|
camera_location = get_turf(C)
|
|
break
|
|
if(camera_location)
|
|
eyeobj.eye_initialized = 1
|
|
give_eye_control(user)
|
|
eyeobj.setLoc(camera_location)
|
|
else
|
|
// An abberant case - silent failure is obnoxious
|
|
to_chat(user, "<span class='warning'>ERROR: No linked and active camera network found.</span>")
|
|
user.unset_machine()
|
|
else
|
|
give_eye_control(user)
|
|
eyeobj.setLoc(eyeobj.loc)
|
|
|
|
|
|
/obj/machinery/computer/camera_advanced/proc/give_eye_control(mob/user)
|
|
GrantActions(user)
|
|
current_user = user
|
|
eyeobj.eye_user = user
|
|
eyeobj.name = "Camera Eye ([user.name])"
|
|
// This should be able to be excised once the full view refactor rolls out
|
|
user.remote_view = 1
|
|
user.remote_control = eyeobj
|
|
user.reset_perspective(eyeobj)
|
|
|
|
/mob/camera/aiEye/remote
|
|
name = "Inactive Camera Eye"
|
|
var/sprint = 10
|
|
var/cooldown = 0
|
|
var/acceleration = 1
|
|
var/mob/living/carbon/human/eye_user = null
|
|
var/obj/machinery/computer/camera_advanced/origin
|
|
var/eye_initialized = 0
|
|
var/visible_icon = 0
|
|
var/image/user_image = null
|
|
|
|
/mob/camera/aiEye/remote/Destroy()
|
|
eye_user = null
|
|
origin = null
|
|
return ..()
|
|
|
|
/mob/camera/aiEye/remote/RemoveImages()
|
|
..()
|
|
if(visible_icon)
|
|
var/client/C = GetViewerClient()
|
|
if(C)
|
|
C.images -= user_image
|
|
|
|
/mob/camera/aiEye/remote/GetViewerClient()
|
|
if(eye_user)
|
|
return eye_user.client
|
|
return null
|
|
|
|
/mob/camera/aiEye/remote/setLoc(T)
|
|
if(eye_user)
|
|
if(!isturf(eye_user.loc))
|
|
return
|
|
T = get_turf(T)
|
|
loc = T
|
|
if(use_static)
|
|
cameranet.visibility(src, GetViewerClient())
|
|
if(visible_icon)
|
|
if(eye_user.client)
|
|
eye_user.client.images -= user_image
|
|
user_image = image(icon,loc,icon_state,FLY_LAYER)
|
|
eye_user.client.images += user_image
|
|
|
|
/mob/camera/aiEye/remote/relaymove(mob/user,direct)
|
|
var/initial = initial(sprint)
|
|
var/max_sprint = 50
|
|
|
|
if(cooldown && cooldown < world.timeofday) // 3 seconds
|
|
sprint = initial
|
|
|
|
for(var/i = 0; i < max(sprint, initial); i += 20)
|
|
var/turf/step = get_turf(get_step(src, direct))
|
|
if(step)
|
|
src.setLoc(step)
|
|
|
|
cooldown = world.timeofday + 5
|
|
if(acceleration)
|
|
sprint = min(sprint + 0.5, max_sprint)
|
|
else
|
|
sprint = initial
|
|
|
|
/datum/action/innate/camera_off
|
|
name = "End Camera View"
|
|
button_icon_state = "camera_off"
|
|
|
|
/datum/action/innate/camera_off/Activate()
|
|
if(!target || !iscarbon(target))
|
|
return
|
|
var/mob/living/carbon/C = target
|
|
var/mob/camera/aiEye/remote/remote_eye = C.remote_control
|
|
var/obj/machinery/computer/camera_advanced/console = remote_eye.origin
|
|
console.remove_eye_control(target)
|
|
|
|
/datum/action/innate/camera_jump
|
|
name = "Jump To Camera"
|
|
button_icon_state = "camera_jump"
|
|
|
|
/datum/action/innate/camera_jump/Activate()
|
|
if(!target || !iscarbon(target))
|
|
return
|
|
var/mob/living/carbon/C = target
|
|
var/mob/camera/aiEye/remote/remote_eye = C.remote_control
|
|
var/obj/machinery/computer/camera_advanced/origin = remote_eye.origin
|
|
|
|
var/list/L = list()
|
|
|
|
for(var/obj/machinery/camera/cam in cameranet.cameras)
|
|
L.Add(cam)
|
|
|
|
camera_sort(L)
|
|
|
|
var/list/T = list()
|
|
|
|
for(var/obj/machinery/camera/netcam in L)
|
|
var/list/tempnetwork = netcam.network&origin.networks
|
|
if(tempnetwork.len)
|
|
T[text("[][]", netcam.c_tag, (netcam.can_use() ? null : " (Deactivated)"))] = netcam
|
|
|
|
|
|
playsound(origin, 'sound/machines/terminal_prompt.ogg', 25, 0)
|
|
var/camera = input("Choose which camera you want to view", "Cameras") as null|anything in T
|
|
var/obj/machinery/camera/final = T[camera]
|
|
playsound(origin, "terminal_type", 25, 0)
|
|
if(final)
|
|
playsound(origin, 'sound/machines/terminal_prompt_confirm.ogg', 25, 0)
|
|
remote_eye.setLoc(get_turf(final))
|
|
C.overlay_fullscreen("flash", /obj/screen/fullscreen/flash/noise)
|
|
C.clear_fullscreen("flash", 3) //Shorter flash than normal since it's an ~~advanced~~ console!
|
|
else
|
|
playsound(origin, 'sound/machines/terminal_prompt_deny.ogg', 25, 0)
|