mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-10 09:54:52 +00:00
Refactored advanced camera consoles (#1576)
This commit is contained in:
committed by
kevinz000
parent
c9e6257957
commit
33eb60747f
@@ -2,7 +2,6 @@
|
||||
name = "Human Observation Console"
|
||||
var/team = 0
|
||||
networks = list("SS13","Abductor")
|
||||
off_action = new/datum/action/innate/camera_off/abductor //specific datum
|
||||
var/datum/action/innate/teleport_in/tele_in_action = new
|
||||
var/datum/action/innate/teleport_out/tele_out_action = new
|
||||
var/datum/action/innate/teleport_self/tele_self_action = new
|
||||
@@ -23,29 +22,37 @@
|
||||
eyeobj.icon_state = "camera_target"
|
||||
|
||||
/obj/machinery/computer/camera_advanced/abductor/GrantActions(mob/living/carbon/user)
|
||||
off_action.target = user
|
||||
off_action.Grant(user)
|
||||
..()
|
||||
|
||||
jump_action.target = user
|
||||
jump_action.Grant(user)
|
||||
//TODO : add null checks
|
||||
tele_in_action.target = console.pad
|
||||
tele_in_action.Grant(user)
|
||||
if(tele_in_action)
|
||||
tele_in_action.target = console.pad
|
||||
tele_in_action.Grant(user)
|
||||
actions += tele_in_action
|
||||
|
||||
tele_out_action.target = console
|
||||
tele_out_action.Grant(user)
|
||||
if(tele_out_action)
|
||||
tele_out_action.target = console
|
||||
tele_out_action.Grant(user)
|
||||
actions += tele_out_action
|
||||
|
||||
tele_self_action.target = console.pad
|
||||
tele_self_action.Grant(user)
|
||||
if(tele_self_action)
|
||||
tele_self_action.target = console.pad
|
||||
tele_self_action.Grant(user)
|
||||
actions += tele_self_action
|
||||
|
||||
vest_mode_action.target = console
|
||||
vest_mode_action.Grant(user)
|
||||
if(vest_mode_action)
|
||||
vest_mode_action.target = console
|
||||
vest_mode_action.Grant(user)
|
||||
actions += vest_mode_action
|
||||
|
||||
vest_disguise_action.target = console
|
||||
vest_disguise_action.Grant(user)
|
||||
if(vest_disguise_action)
|
||||
vest_disguise_action.target = console
|
||||
vest_disguise_action.Grant(user)
|
||||
actions += vest_disguise_action
|
||||
|
||||
set_droppoint_action.target = console
|
||||
set_droppoint_action.Grant(user)
|
||||
if(set_droppoint_action)
|
||||
set_droppoint_action.target = console
|
||||
set_droppoint_action.Grant(user)
|
||||
actions += set_droppoint_action
|
||||
|
||||
/obj/machinery/computer/camera_advanced/abductor/proc/IsScientist(mob/living/carbon/human/H)
|
||||
var/datum/species/abductor/S = H.dna.species
|
||||
@@ -56,30 +63,6 @@
|
||||
return
|
||||
return ..()
|
||||
|
||||
/datum/action/innate/camera_off/abductor/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/abductor/origin = remote_eye.origin
|
||||
origin.current_user = null
|
||||
origin.jump_action.Remove(C)
|
||||
origin.tele_in_action.Remove(C)
|
||||
origin.tele_out_action.Remove(C)
|
||||
origin.tele_self_action.Remove(C)
|
||||
origin.vest_mode_action.Remove(C)
|
||||
origin.vest_disguise_action.Remove(C)
|
||||
origin.set_droppoint_action.Remove(C)
|
||||
C.reset_perspective(null)
|
||||
if(C.client)
|
||||
C.client.images -= remote_eye.user_image
|
||||
for(var/datum/camerachunk/chunk in remote_eye.visibleCameraChunks)
|
||||
chunk.remove(remote_eye)
|
||||
remote_eye.eye_user = null
|
||||
C.remote_control = null
|
||||
C.unset_machine()
|
||||
Remove(C)
|
||||
|
||||
/datum/action/innate/teleport_in
|
||||
name = "Send To"
|
||||
button_icon_state = "beam_down"
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
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()
|
||||
|
||||
light_color = LIGHT_COLOR_RED
|
||||
|
||||
@@ -17,10 +18,31 @@
|
||||
eyeobj.origin = src
|
||||
|
||||
/obj/machinery/computer/camera_advanced/proc/GrantActions(mob/living/user)
|
||||
off_action.target = user
|
||||
off_action.Grant(user)
|
||||
jump_action.target = user
|
||||
jump_action.Grant(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)
|
||||
if(user.client)
|
||||
user.reset_perspective(null)
|
||||
eyeobj.RemoveImages()
|
||||
eyeobj.eye_user = null
|
||||
user.remote_control = null
|
||||
|
||||
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_unlimited_silicon_privilege) || user.eye_blind || user.incapacitated() )
|
||||
@@ -35,7 +57,7 @@
|
||||
|
||||
/obj/machinery/computer/camera_advanced/on_unset_machine(mob/M)
|
||||
if(M == current_user)
|
||||
off_action.Activate()
|
||||
remove_eye_control(M)
|
||||
|
||||
/obj/machinery/computer/camera_advanced/attack_hand(mob/user)
|
||||
if(current_user)
|
||||
@@ -69,7 +91,7 @@
|
||||
/obj/machinery/computer/camera_advanced/attack_robot(mob/user)
|
||||
return attack_hand(user)
|
||||
|
||||
obj/machinery/computer/camera_advanced/attack_ai(mob/user)
|
||||
/obj/machinery/computer/camera_advanced/attack_ai(mob/user)
|
||||
return //AIs would need to disable their own camera procs to use the console safely. Bugs happen otherwise.
|
||||
|
||||
|
||||
@@ -92,13 +114,20 @@ obj/machinery/computer/camera_advanced/attack_ai(mob/user)
|
||||
var/eye_initialized = 0
|
||||
var/visible_icon = 0
|
||||
var/image/user_image = null
|
||||
|
||||
|
||||
/mob/camera/aiEye/remote/update_remote_sight(mob/living/user)
|
||||
user.see_invisible = SEE_INVISIBLE_LIVING //can't see ghosts through cameras
|
||||
user.sight = 0
|
||||
user.see_in_dark = 2
|
||||
return 1
|
||||
|
||||
/mob/camera/aiEye/remote/RemoveImages()
|
||||
..()
|
||||
if(visible_icon)
|
||||
var/client/C = GetViewerClient()
|
||||
if(C)
|
||||
C.images -= user_image
|
||||
|
||||
/mob/camera/aiEye/remote/Destroy()
|
||||
eye_user = null
|
||||
origin = null
|
||||
@@ -115,7 +144,8 @@ obj/machinery/computer/camera_advanced/attack_ai(mob/user)
|
||||
return
|
||||
T = get_turf(T)
|
||||
loc = T
|
||||
GLOB.cameranet.visibility(src)
|
||||
if(use_static)
|
||||
GLOB.cameranet.visibility(src)
|
||||
if(visible_icon)
|
||||
if(eye_user.client)
|
||||
eye_user.client.images -= user_image
|
||||
@@ -149,19 +179,8 @@ obj/machinery/computer/camera_advanced/attack_ai(mob/user)
|
||||
return
|
||||
var/mob/living/C = target
|
||||
var/mob/camera/aiEye/remote/remote_eye = C.remote_control
|
||||
remote_eye.origin.current_user = null
|
||||
remote_eye.origin.jump_action.Remove(C)
|
||||
if(C.client)
|
||||
C.reset_perspective(null)
|
||||
if(remote_eye.visible_icon)
|
||||
C.client.images -= remote_eye.user_image
|
||||
for(var/datum/camerachunk/chunk in remote_eye.visibleCameraChunks)
|
||||
chunk.remove(remote_eye)
|
||||
remote_eye.eye_user = null
|
||||
C.remote_control = null
|
||||
C.unset_machine()
|
||||
Remove(C)
|
||||
playsound(remote_eye.origin, 'sound/machines/terminal_off.ogg', 25, 0)
|
||||
var/obj/machinery/computer/camera_advanced/console = remote_eye.origin
|
||||
console.remove_eye_control(target)
|
||||
|
||||
/datum/action/innate/camera_jump
|
||||
name = "Jump To Camera"
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
var/obj/item/weapon/construction/rcd/internal/RCD //Internal RCD. The computer passes user commands to this in order to avoid massive copypaste.
|
||||
circuit = /obj/item/weapon/circuitboard/computer/base_construction
|
||||
off_action = new/datum/action/innate/camera_off/base_construction
|
||||
jump_action = null
|
||||
var/datum/action/innate/aux_base/switch_mode/switch_mode_action = new //Action for switching the RCD's build modes
|
||||
var/datum/action/innate/aux_base/build/build_action = new //Action for using the RCD
|
||||
var/datum/action/innate/aux_base/airlock_type/airlock_mode_action = new //Action for setting the airlock type
|
||||
@@ -88,22 +89,43 @@
|
||||
return ..()
|
||||
|
||||
/obj/machinery/computer/camera_advanced/base_construction/GrantActions(mob/living/user)
|
||||
off_action.target = user
|
||||
off_action.Grant(user)
|
||||
switch_mode_action.target = src
|
||||
switch_mode_action.Grant(user)
|
||||
build_action.target = src
|
||||
build_action.Grant(user)
|
||||
airlock_mode_action.target = src
|
||||
airlock_mode_action.Grant(user)
|
||||
window_action.target = src
|
||||
window_action.Grant(user)
|
||||
fan_action.target = src
|
||||
fan_action.Grant(user)
|
||||
turret_action.target = src
|
||||
turret_action.Grant(user)
|
||||
..()
|
||||
|
||||
if(switch_mode_action)
|
||||
switch_mode_action.target = src
|
||||
switch_mode_action.Grant(user)
|
||||
actions += switch_mode_action
|
||||
|
||||
if(build_action)
|
||||
build_action.target = src
|
||||
build_action.Grant(user)
|
||||
actions += build_action
|
||||
|
||||
if(airlock_mode_action)
|
||||
airlock_mode_action.target = src
|
||||
airlock_mode_action.Grant(user)
|
||||
actions += airlock_mode_action
|
||||
|
||||
if(window_action)
|
||||
window_action.target = src
|
||||
window_action.Grant(user)
|
||||
actions += window_action
|
||||
|
||||
if(fan_action)
|
||||
fan_action.target = src
|
||||
fan_action.Grant(user)
|
||||
actions += fan_action
|
||||
|
||||
if(turret_action)
|
||||
turret_action.target = src
|
||||
turret_action.Grant(user)
|
||||
actions += turret_action
|
||||
|
||||
eyeobj.invisibility = 0 //When the eye is in use, make it visible to players so they know when someone is building.
|
||||
|
||||
/obj/machinery/computer/camera_advanced/base_construction/remove_eye_control(mob/living/user)
|
||||
..()
|
||||
eyeobj.invisibility = INVISIBILITY_MAXIMUM //Hide the eye when not in use.
|
||||
|
||||
/datum/action/innate/aux_base //Parent aux base action
|
||||
var/mob/living/C //Mob using the action
|
||||
@@ -138,23 +160,6 @@
|
||||
/datum/action/innate/camera_off/base_construction
|
||||
name = "Log out"
|
||||
|
||||
/datum/action/innate/camera_off/base_construction/Activate()
|
||||
if(!owner || !owner.remote_control)
|
||||
return
|
||||
|
||||
var/mob/camera/aiEye/remote/base_construction/remote_eye =owner.remote_control
|
||||
|
||||
var/obj/machinery/computer/camera_advanced/base_construction/origin = remote_eye.origin
|
||||
origin.switch_mode_action.Remove(target)
|
||||
origin.build_action.Remove(target)
|
||||
origin.airlock_mode_action.Remove(target)
|
||||
origin.window_action.Remove(target)
|
||||
origin.fan_action.Remove(target)
|
||||
origin.turret_action.Remove(target)
|
||||
remote_eye.invisibility = INVISIBILITY_MAXIMUM //Hide the eye when not in use.
|
||||
|
||||
..()
|
||||
|
||||
//*******************FUNCTIONS*******************
|
||||
|
||||
/datum/action/innate/aux_base/build
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
var/list/visibleCameraChunks = list()
|
||||
var/mob/living/silicon/ai/ai = null
|
||||
var/relay_speech = FALSE
|
||||
var/use_static = TRUE
|
||||
|
||||
// Use this when setting the aiEye's location.
|
||||
// It will also stream the chunk that the new loc is in.
|
||||
@@ -21,7 +22,8 @@
|
||||
return
|
||||
T = get_turf(T)
|
||||
loc = T
|
||||
GLOB.cameranet.visibility(src)
|
||||
if(use_static)
|
||||
GLOB.cameranet.visibility(src)
|
||||
if(ai.client)
|
||||
ai.client.eye = src
|
||||
update_parallax_contents()
|
||||
@@ -38,6 +40,11 @@
|
||||
return ai.client
|
||||
return null
|
||||
|
||||
/mob/camera/aiEye/proc/RemoveImages()
|
||||
if(use_static)
|
||||
for(var/datum/camerachunk/chunk in visibleCameraChunks)
|
||||
chunk.remove(src)
|
||||
|
||||
/mob/camera/aiEye/Destroy()
|
||||
ai = null
|
||||
return ..()
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
desc = "A computer used for remotely handling slimes."
|
||||
networks = list("SS13")
|
||||
circuit = /obj/item/weapon/circuitboard/computer/xenobiology
|
||||
off_action = new/datum/action/innate/camera_off/xenobio
|
||||
var/datum/action/innate/slime_place/slime_place_action = new
|
||||
var/datum/action/innate/slime_pick_up/slime_up_action = new
|
||||
var/datum/action/innate/feed_slime/feed_slime_action = new
|
||||
@@ -45,23 +44,27 @@
|
||||
eyeobj.icon_state = "camera_target"
|
||||
|
||||
/obj/machinery/computer/camera_advanced/xenobio/GrantActions(mob/living/user)
|
||||
off_action.target = user
|
||||
off_action.Grant(user)
|
||||
..()
|
||||
|
||||
jump_action.target = user
|
||||
jump_action.Grant(user)
|
||||
if(slime_up_action)
|
||||
slime_up_action.target = src
|
||||
slime_up_action.Grant(user)
|
||||
actions += slime_up_action
|
||||
|
||||
slime_up_action.target = src
|
||||
slime_up_action.Grant(user)
|
||||
if(slime_place_action)
|
||||
slime_place_action.target = src
|
||||
slime_place_action.Grant(user)
|
||||
actions += slime_place_action
|
||||
|
||||
slime_place_action.target = src
|
||||
slime_place_action.Grant(user)
|
||||
if(feed_slime_action)
|
||||
feed_slime_action.target = src
|
||||
feed_slime_action.Grant(user)
|
||||
actions += feed_slime_action
|
||||
|
||||
feed_slime_action.target = src
|
||||
feed_slime_action.Grant(user)
|
||||
|
||||
monkey_recycle_action.target = src
|
||||
monkey_recycle_action.Grant(user)
|
||||
if(monkey_recycle_action)
|
||||
monkey_recycle_action.target = src
|
||||
monkey_recycle_action.Grant(user)
|
||||
actions += monkey_recycle_action
|
||||
|
||||
/obj/machinery/computer/camera_advanced/xenobio/attackby(obj/item/O, mob/user, params)
|
||||
if(istype(O, /obj/item/weapon/reagent_containers/food/snacks/monkeycube))
|
||||
@@ -83,30 +86,6 @@
|
||||
return
|
||||
..()
|
||||
|
||||
/datum/action/innate/camera_off/xenobio/Activate()
|
||||
if(!target || !isliving(target))
|
||||
return
|
||||
var/mob/living/C = target
|
||||
var/mob/camera/aiEye/remote/xenobio/remote_eye = C.remote_control
|
||||
var/obj/machinery/computer/camera_advanced/xenobio/origin = remote_eye.origin
|
||||
origin.current_user = null
|
||||
origin.jump_action.Remove(C)
|
||||
origin.slime_place_action.Remove(C)
|
||||
origin.slime_up_action.Remove(C)
|
||||
origin.feed_slime_action.Remove(C)
|
||||
origin.monkey_recycle_action.Remove(C)
|
||||
//All of this stuff below could probably be a proc for all advanced cameras, only the action removal needs to be camera specific
|
||||
C.reset_perspective(null)
|
||||
if(C.client)
|
||||
C.client.images -= remote_eye.user_image
|
||||
for(var/datum/camerachunk/chunk in remote_eye.visibleCameraChunks)
|
||||
chunk.remove(remote_eye)
|
||||
remote_eye.eye_user = null
|
||||
C.remote_control = null
|
||||
C.unset_machine()
|
||||
Remove(C)
|
||||
|
||||
|
||||
/datum/action/innate/slime_place
|
||||
name = "Place Slimes"
|
||||
button_icon_state = "slime_down"
|
||||
|
||||
Reference in New Issue
Block a user