mirror of
https://github.com/Sandstorm-Station/Sandstorm-Station-13.git
synced 2026-07-20 12:44:41 +01:00
fix camera circuit
This commit is contained in:
@@ -269,9 +269,10 @@
|
||||
inputs = list(
|
||||
"camera name" = IC_PINTYPE_STRING,
|
||||
"camera active" = IC_PINTYPE_BOOLEAN,
|
||||
"camera fast mode" = IC_PINTYPE_BOOLEAN,
|
||||
"camera network" = IC_PINTYPE_LIST
|
||||
)
|
||||
inputs_default = list("1" = "video camera circuit", "3" = list("rd"))
|
||||
inputs_default = list("1" = "video camera circuit", "4" = list("rd"))
|
||||
outputs = list()
|
||||
activators = list()
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
@@ -280,6 +281,8 @@
|
||||
var/obj/machinery/camera/camera
|
||||
var/updating = FALSE
|
||||
|
||||
var/update_speed = 10 // How often to update the camera
|
||||
|
||||
/obj/item/integrated_circuit/output/video_camera/New()
|
||||
..()
|
||||
camera = new(src)
|
||||
@@ -290,11 +293,11 @@
|
||||
QDEL_NULL(camera)
|
||||
return ..()
|
||||
|
||||
/obj/item/integrated_circuit/output/video_camera/proc/set_camera_status(var/status)
|
||||
/obj/item/integrated_circuit/output/video_camera/proc/set_camera_status(status)
|
||||
if(camera)
|
||||
camera.status = status
|
||||
GLOB.cameranet.updatePortableCamera(camera)
|
||||
power_draw_idle = camera.status ? 20 : 0
|
||||
power_draw_idle = camera.status ? (20 / (update_speed * 0.1)) : 0
|
||||
if(camera.status) // Ensure that there's actually power.
|
||||
if(!draw_idle_power())
|
||||
power_fail()
|
||||
@@ -303,7 +306,8 @@
|
||||
if(camera)
|
||||
var/cam_name = get_pin_data(IC_INPUT, 1)
|
||||
var/cam_active = get_pin_data(IC_INPUT, 2)
|
||||
var/list/new_network = get_pin_data(IC_INPUT, 3)
|
||||
update_speed = get_pin_data(IC_INPUT, 3) ? 5 : 10
|
||||
var/list/new_network = get_pin_data(IC_INPUT, 4)
|
||||
if(!isnull(cam_name))
|
||||
camera.c_tag = cam_name
|
||||
if(!isnull(new_network))
|
||||
@@ -319,13 +323,11 @@
|
||||
. = ..()
|
||||
update_camera_location(oldLoc)
|
||||
|
||||
#define VIDEO_CAMERA_BUFFER 10
|
||||
/obj/item/integrated_circuit/output/video_camera/proc/update_camera_location(oldLoc)
|
||||
oldLoc = get_turf(oldLoc)
|
||||
if(!QDELETED(camera) && !updating && oldLoc != get_turf(src))
|
||||
updating = TRUE
|
||||
addtimer(CALLBACK(src, .proc/do_camera_update, oldLoc), VIDEO_CAMERA_BUFFER)
|
||||
#undef VIDEO_CAMERA_BUFFER
|
||||
addtimer(CALLBACK(src, .proc/do_camera_update, oldLoc), update_speed)
|
||||
|
||||
/obj/item/integrated_circuit/output/video_camera/proc/do_camera_update(oldLoc)
|
||||
if(!QDELETED(camera) && oldLoc != get_turf(src))
|
||||
|
||||
Reference in New Issue
Block a user