Merge pull request #9952 from mwerezak/camera-console-fix

Fixes #7910
This commit is contained in:
Chinsky
2015-06-28 19:42:00 +03:00
17 changed files with 48 additions and 99 deletions

View File

@@ -34,10 +34,12 @@
else else
return null return null
//return flags that should be added to the viewer's sight var.
//Otherwise return a negative number to indicate that the view should be cancelled.
/atom/proc/check_eye(user as mob) /atom/proc/check_eye(user as mob)
if (istype(user, /mob/living/silicon/ai)) // WHYYYY if (istype(user, /mob/living/silicon/ai)) // WHYYYY
return 1 return 0
return return -1
/atom/proc/on_reagent_change() /atom/proc/on_reagent_change()
return return

View File

@@ -236,6 +236,11 @@
//I guess that doesn't matter since they couldn't use it anyway? //I guess that doesn't matter since they couldn't use it anyway?
kick_viewers() kick_viewers()
/obj/machinery/camera/check_eye(mob/user)
if(!can_use()) return -1
if(isXRay()) return SEE_TURFS|SEE_MOBS|SEE_OBJS
return 0
//This might be redundant, because of check_eye() //This might be redundant, because of check_eye()
/obj/machinery/camera/proc/kick_viewers() /obj/machinery/camera/proc/kick_viewers()
for(var/mob/O in player_list) for(var/mob/O in player_list)

View File

@@ -22,11 +22,13 @@
check_eye(var/mob/user as mob) check_eye(var/mob/user as mob)
if (user.stat || ((get_dist(user, src) > 1 || !( user.canmove ) || user.blinded) && !istype(user, /mob/living/silicon))) //user can't see - not sure why canmove is here. if (user.stat || ((get_dist(user, src) > 1 || !( user.canmove ) || user.blinded) && !istype(user, /mob/living/silicon))) //user can't see - not sure why canmove is here.
return null return -1
if ( !current || !current.can_use() ) //camera doesn't work if(!current)
return 0
var/viewflag = current.check_eye(user)
if ( viewflag < 0 ) //camera doesn't work
reset_current() reset_current()
user.reset_view(current) return viewflag
return 1
ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 1) ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 1)
if(src.z > 6) return if(src.z > 6) return
@@ -88,7 +90,7 @@
if(src.z>6 || stat&(NOPOWER|BROKEN)) return if(src.z>6 || stat&(NOPOWER|BROKEN)) return
if(usr.stat || ((get_dist(usr, src) > 1 || !( usr.canmove ) || usr.blinded) && !istype(usr, /mob/living/silicon))) return if(usr.stat || ((get_dist(usr, src) > 1 || !( usr.canmove ) || usr.blinded) && !istype(usr, /mob/living/silicon))) return
reset_current() reset_current()
usr.check_eye(current) usr.reset_view(current)
return 1 return 1
else else
. = ..() . = ..()
@@ -124,8 +126,8 @@
if (!C.can_use() || user.stat || (get_dist(user, src) > 1 || user.machine != src || user.blinded || !( user.canmove ) && !istype(user, /mob/living/silicon))) if (!C.can_use() || user.stat || (get_dist(user, src) > 1 || user.machine != src || user.blinded || !( user.canmove ) && !istype(user, /mob/living/silicon)))
return 0 return 0
set_current(C) set_current(C)
user.reset_view(current)
check_eye(user) check_eye(user)
use_power(50)
return 1 return 1
//Camera control: moving. //Camera control: moving.
@@ -167,6 +169,7 @@
src.current = C src.current = C
if(current) if(current)
use_power = 2
var/mob/living/L = current.loc var/mob/living/L = current.loc
if(istype(L)) if(istype(L))
L.tracking_initiated() L.tracking_initiated()
@@ -177,6 +180,7 @@
if(istype(L)) if(istype(L))
L.tracking_cancelled() L.tracking_cancelled()
current = null current = null
use_power = 1
//Camera control: mouse. //Camera control: mouse.
/atom/DblClick() /atom/DblClick()

View File

@@ -1,67 +0,0 @@
/obj/machinery/computer/security
New()
if(network)
networks = list(network)
else
switch(department)
if("Security")
networks = list("Arrivals","SS13","Engineering","Research","Medbay","Tcomsat","Mess Hall","Security","Prison Wing","Atmospherics","Cargo","Command","Solars","Robotics","Chapel","Hydroponics", "Dormitory","Theatre","Library")
if("Engineering")
networks = list("Engineering","Tcomsat","Singularity","Atmospherics","Solars","Robotics")
if("Research")
networks = list("Research","Bomb Testing","Outpost")
if("Medbay")
networks = list("Medbay")
if("Cargo")
networks = list("Mine","Cargo")
if("Mining")
networks = list("Mine")
if("Thunderdome")
networks = list("thunder")
if("CREED")
networks = list("CREED")
/obj/machinery/computer/security/attack_hand(var/mob/user as mob)
if (stat & (NOPOWER|BROKEN))
return
user.machine = src
if(src.current)
user.reset_view(src.current)
var/list/L = new/list
for (var/obj/machinery/camera/C in world)
L.Add(C)
camera_network_sort(L)
var/list/D = new()
D["Cancel"] = "Cancel"
for (var/obj/machinery/camera/C in L)
if ( C.network in src.networks )
D[text("[]: [][]", C.network, C.c_tag, (C.can_use() ? null : " (Deactivated)"))] = C
var/t = input(user, "Which camera should you change to?") as null|anything in D
if(!t)
user.machine = null
user.reset_view(null)
return 0
var/obj/machinery/camera/C = D[t]
if (t == "Cancel")
user.cancel_camera()
return 0
if (C)
if ((get_dist(user, src) > 1 || user.machine != src || user.blinded || !( user.canmove ) || !( C.status )) && (!istype(user, /mob/living/silicon/ai)))
return 0
else
src.current = C
use_power(50)
user.reset_view(C)
spawn( 5 )
attack_hand(user)

View File

@@ -69,16 +69,16 @@
if(!interactable(user) || user.machine != src) if(!interactable(user) || user.machine != src)
if(user.machine == src) if(user.machine == src)
user.unset_machine() user.unset_machine()
return null return -1
var/datum/file/program/security/S = program var/datum/file/program/security/S = program
if( !istype(S) || !S.current || !S.current.status || !camnet ) if( !istype(S) || !S.current || !S.current.status || !camnet )
if( user.machine == src ) if( user.machine == src )
user.unset_machine() user.unset_machine()
return null return -1
user.reset_view(S.current) user.reset_view(S.current)
return 1 return 0
/* /*
List all files, including removable disks and data cards List all files, including removable disks and data cards

View File

@@ -142,7 +142,7 @@
c_tag = name c_tag = name
/obj/machinery/camera/spy/check_eye(var/mob/user as mob) /obj/machinery/camera/spy/check_eye(var/mob/user as mob)
return 1 return 0
/obj/item/device/radio/spy /obj/item/device/radio/spy
listening = 0 listening = 0

View File

@@ -166,7 +166,7 @@
if (stat != 2) if (stat != 2)
if (machine) if (machine)
if (!( machine.check_eye(src) )) if ( machine.check_eye(src) < 0)
reset_view(null) reset_view(null)
else else
if(client && !client.adminobs) if(client && !client.adminobs)

View File

@@ -245,7 +245,7 @@
if (stat != 2) if (stat != 2)
if (machine) if (machine)
if (!( machine.check_eye(src) )) if (machine.check_eye(src) < 0)
reset_view(null) reset_view(null)
else else
if(client && !client.adminobs) if(client && !client.adminobs)

View File

@@ -1308,3 +1308,8 @@
if((species.flags & NO_SLIP) || (shoes && (shoes.flags & NOSLIP))) if((species.flags & NO_SLIP) || (shoes && (shoes.flags & NOSLIP)))
return 0 return 0
..(slipped_on,stun_duration) ..(slipped_on,stun_duration)
/mob/living/carbon/human/reset_view(atom/A, update_hud = 1)
..()
if(update_hud)
handle_regular_hud_updates()

View File

@@ -1407,8 +1407,11 @@
client.screen |= global_hud.darkMask client.screen |= global_hud.darkMask
if(machine) if(machine)
if(!machine.check_eye(src)) var/viewflags = machine.check_eye(src)
reset_view(null) if(viewflags < 0)
reset_view(null, 0)
else if(viewflags)
sight |= viewflags
else else
var/isRemoteObserve = 0 var/isRemoteObserve = 0
if((mRemote in mutations) && remoteview_target) if((mRemote in mutations) && remoteview_target)
@@ -1416,7 +1419,7 @@
isRemoteObserve = 1 isRemoteObserve = 1
if(!isRemoteObserve && client && !client.adminobs) if(!isRemoteObserve && client && !client.adminobs)
remoteview_target = null remoteview_target = null
reset_view(null) reset_view(null, 0)
return 1 return 1
proc/process_glasses(var/obj/item/clothing/glasses/G) proc/process_glasses(var/obj/item/clothing/glasses/G)

View File

@@ -567,7 +567,7 @@
if (stat != 2) if (stat != 2)
if (machine) if (machine)
if (!( machine.check_eye(src) )) if (machine.check_eye(src) < 0)
reset_view(null) reset_view(null)
else else
if(client && !client.adminobs) if(client && !client.adminobs)

View File

@@ -33,8 +33,6 @@
var/now_pushing = null var/now_pushing = null
var/mob/living/cameraFollow = null
var/tod = null // Time of death var/tod = null // Time of death
var/update_slimes = 1 var/update_slimes = 1
var/silent = null // Can't talk. Value goes down every life proc. var/silent = null // Can't talk. Value goes down every life proc.

View File

@@ -390,7 +390,7 @@ var/list/ai_verbs_default = list(
if (!camera) if (!camera)
return null return null
user.reset_view(camera) user.reset_view(camera)
return 1 return 0
/mob/living/silicon/ai/restrained() /mob/living/silicon/ai/restrained()
return 0 return 0

View File

@@ -123,9 +123,9 @@
/mob/living/silicon/pai/check_eye(var/mob/user as mob) /mob/living/silicon/pai/check_eye(var/mob/user as mob)
if (!src.current) if (!src.current)
return null return -1
user.reset_view(src.current) user.reset_view(src.current)
return 1 return 0
/mob/living/silicon/pai/blob_act() /mob/living/silicon/pai/blob_act()
if (src.stat != 2) if (src.stat != 2)
@@ -185,9 +185,6 @@
return return
/mob/living/silicon/pai/proc/switchCamera(var/obj/machinery/camera/C) /mob/living/silicon/pai/proc/switchCamera(var/obj/machinery/camera/C)
if(istype(usr, /mob/living))
var/mob/living/U = usr
U.cameraFollow = null
if (!C) if (!C)
src.unset_machine() src.unset_machine()
src.reset_view(null) src.reset_view(null)

View File

@@ -285,7 +285,7 @@
if (src.stat != 2) if (src.stat != 2)
if (src.machine) if (src.machine)
if (!( src.machine.check_eye(src) )) if (src.machine.check_eye(src) < 0)
src.reset_view(null) src.reset_view(null)
else else
if(client && !client.adminobs) if(client && !client.adminobs)

View File

@@ -26,6 +26,7 @@
var/obj/nano_module/alarm_monitor = null var/obj/nano_module/alarm_monitor = null
var/sensor_mode = 0 //Determines the current HUD. var/sensor_mode = 0 //Determines the current HUD.
var/mob/living/cameraFollow = null
var/next_alarm_notice var/next_alarm_notice
var/list/datum/alarm/queued_alarms = new() var/list/datum/alarm/queued_alarms = new()
@@ -360,3 +361,8 @@
for(var/obj/machinery/camera/C in A.cameras()) for(var/obj/machinery/camera/C in A.cameras())
cameratext += "[(cameratext == "")? "" : "|"]<A HREF=?src=\ref[src];switchcamera=\ref[C]>[C.c_tag]</A>" cameratext += "[(cameratext == "")? "" : "|"]<A HREF=?src=\ref[src];switchcamera=\ref[C]>[C.c_tag]</A>"
src << "[A.alarm_name()]! ([(cameratext)? cameratext : "No Camera"])" src << "[A.alarm_name()]! ([(cameratext)? cameratext : "No Camera"])"
/mob/living/silicon/reset_view()
..()
if(cameraFollow)
cameraFollow = null

View File

@@ -566,12 +566,8 @@ var/list/slot_equipment_priority = list( \
/mob/verb/cancel_camera() /mob/verb/cancel_camera()
set name = "Cancel Camera View" set name = "Cancel Camera View"
set category = "OOC" set category = "OOC"
reset_view(null)
unset_machine() unset_machine()
if(istype(src, /mob/living)) reset_view(null)
var/mob/living/M = src
if(M.cameraFollow)
M.cameraFollow = null
/mob/Topic(href, href_list) /mob/Topic(href, href_list)
if(href_list["mach_close"]) if(href_list["mach_close"])