Skip to content

Commit

Permalink
[MIRROR] Advanced camera consoles correctly deactivates when somethin…
Browse files Browse the repository at this point in the history
…g happens to it or the user (#1967)

* Advanced camera consoles correctly deactivates when something happens to it or the user

* Update camera_advanced.dm

---------

Co-authored-by: SyncIt21 <[email protected]>
Co-authored-by: Mal <[email protected]>
  • Loading branch information
3 people authored and StealsThePRs committed Apr 15, 2024
1 parent 453b13e commit 39ba0a1
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
4 changes: 3 additions & 1 deletion code/game/machinery/_machinery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -590,13 +590,15 @@
set_panel_open(!panel_open)

/obj/machinery/can_interact(mob/user)
if(QDELETED(user))
return FALSE

if((machine_stat & (NOPOWER|BROKEN)) && !(interaction_flags_machine & INTERACT_MACHINE_OFFLINE)) // Check if the machine is broken, and if we can still interact with it if so
return FALSE

if(SEND_SIGNAL(user, COMSIG_TRY_USE_MACHINE, src) & COMPONENT_CANT_USE_MACHINE_INTERACT)
return FALSE


if(isAdminGhostAI(user))
return TRUE //the Gods have unlimited power and do not care for things such as range or blindness

Expand Down
41 changes: 40 additions & 1 deletion code/game/machinery/computer/camera_advanced.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
icon_screen = "cameras"
icon_keyboard = "security_key"
light_color = COLOR_SOFT_RED
processing_flags = START_PROCESSING_MANUALLY

var/list/z_lock = list() // Lock use to these z levels
var/lock_override = NONE
var/mob/camera/ai_eye/remote/eyeobj
Expand Down Expand Up @@ -50,6 +52,20 @@
if(move_down_action)
actions += new move_down_action(src)

/obj/machinery/computer/camera_advanced/Destroy()
if(!QDELETED(current_user))
unset_machine(current_user)
if(eyeobj)
QDEL_NULL(eyeobj)
QDEL_LIST(actions)
current_user = null
return ..()

/obj/machinery/computer/camera_advanced/process()
if(!can_use(current_user) || (issilicon(current_user) && !current_user.has_unlimited_silicon_privilege))
unset_machine(current_user)
return PROCESS_KILL

/obj/machinery/computer/camera_advanced/connect_to_shuttle(mapload, obj/docking_port/mobile/port, obj/docking_port/stationary/dock)
for(var/i in networks)
networks -= i
Expand All @@ -73,6 +89,23 @@
/obj/machinery/proc/remove_eye_control(mob/living/user)
CRASH("[type] does not implement ai eye handling")

<<<<<<< HEAD

Check failure on line 92 in code/game/machinery/computer/camera_advanced.dm

View workflow job for this annotation

GitHub Actions / Run Linters

got '<<', expected one of: newline, '/', identifier
=======
/obj/machinery/computer/camera_advanced/proc/give_eye_control(mob/user)
if(isnull(user?.client))
return
GrantActions(user)
current_user = user
eyeobj.eye_user = user
eyeobj.name = "Camera Eye ([user.name])"
user.remote_control = eyeobj
user.reset_perspective(eyeobj)
eyeobj.setLoc(eyeobj.loc)
if(should_supress_view_changes)
user.client.view_size.supress()
begin_processing()

>>>>>>> 55a6a4a73c0 ([MIRROR] Advanced camera consoles correctly deactivates when something happens to it or the user (#1967))
/obj/machinery/computer/camera_advanced/remove_eye_control(mob/living/user)
if(isnull(user?.client))
return
Expand All @@ -90,9 +123,9 @@
eyeobj.eye_user = null
user.remote_control = null
current_user = null
unset_machine(user)
playsound(src, 'sound/machines/terminal_off.ogg', 25, FALSE)

<<<<<<< HEAD
/obj/machinery/computer/camera_advanced/check_eye(mob/user)
if(!can_use(user) || (issilicon(user) && !user.has_unlimited_silicon_privilege))
unset_machine(user)
Expand All @@ -103,10 +136,16 @@
QDEL_LIST(actions)
current_user = null
return ..()
=======
/obj/machinery/computer/camera_advanced/on_set_is_operational(old_value)
if(!is_operational)
unset_machine(current_user)
>>>>>>> 55a6a4a73c0 ([MIRROR] Advanced camera consoles correctly deactivates when something happens to it or the user (#1967))

/obj/machinery/computer/camera_advanced/proc/unset_machine(mob/M)
if(M == current_user)
remove_eye_control(M)
end_processing()

/obj/machinery/computer/camera_advanced/proc/can_use(mob/living/user)
return can_interact(user)
Expand Down

0 comments on commit 39ba0a1

Please sign in to comment.