Skip to content

Commit

Permalink
camera changes
Browse files Browse the repository at this point in the history
  • Loading branch information
harryob committed Aug 22, 2023
1 parent a88a10b commit d001608
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 27 deletions.
21 changes: 1 addition & 20 deletions code/game/machinery/computer/camera_console.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
var/atom/movable/screen/map_view/cam_screen
var/atom/movable/screen/background/cam_background

/// All turfs within range of the currently active camera
var/list/range_turfs = list()

var/colony_camera_mapload = TRUE
var/admin_console = FALSE

Expand Down Expand Up @@ -64,7 +61,6 @@
qdel(cam_screen)
QDEL_NULL(cam_background)
qdel(cam_background)
range_turfs = null
last_camera_turf = null
concurrent_users = null
return ..()
Expand Down Expand Up @@ -191,11 +187,8 @@
var/list/visible_things = current.isXRay() ? range(current.view_range, cam_location) : view(current.view_range, cam_location)

var/list/visible_turfs = list()
range_turfs.Cut()
for(var/turf/visible_turf in visible_things)
range_turfs += visible_turf
if(visible_turf.get_lumcount() >= 0.5)
visible_turfs += visible_turf
visible_turfs += visible_turf

var/list/bbox = get_bbox_of_atoms(visible_turfs)
var/size_x = bbox[3] - bbox[1] + 1
Expand All @@ -205,16 +198,6 @@
cam_background.icon_state = "clear"
cam_background.fill_rect(1, 1, size_x, size_y)

START_PROCESSING(SSfastobj, src) // fastobj to somewhat keep pace with lighting updates

/obj/structure/machinery/computer/cameras/process()
if(current)
var/list/visible_turfs = list()
for(var/turf/visible_turf as anything in range_turfs)
if(visible_turf.get_lumcount() >= 0.5)
visible_turfs += visible_turf
cam_screen.vis_contents = visible_turfs

/obj/structure/machinery/computer/cameras/ui_close(mob/user)
var/user_ref = WEAKREF(user)
var/is_living = isliving(user)
Expand All @@ -226,10 +209,8 @@
if(length(concurrent_users) == 0 && is_living)
current = null
last_camera_turf = null
range_turfs = list()
if(use_power)
update_use_power(USE_POWER_IDLE)
STOP_PROCESSING(SSfastobj, src)
user.unset_interaction()

/obj/structure/machinery/computer/cameras/proc/show_camera_static()
Expand Down
20 changes: 13 additions & 7 deletions code/modules/defenses/sentry_computer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@
/// camera screen which shows a blank error
var/atom/movable/screen/background/cam_background

/// All turfs within range of the currently active camera
var/list/range_turfs = list()

/obj/item/device/sentry_computer/Initialize(mapload)
. = ..()
if(cell_type)
Expand All @@ -75,6 +72,16 @@
cam_background.assigned_map = map_name
cam_background.del_on_map_removal = FALSE

cam_plane_masters = list()

Check failure on line 75 in code/modules/defenses/sentry_computer.dm

View workflow job for this annotation

GitHub Actions / Run Linters

undefined var: "cam_plane_masters"
for(var/plane in subtypesof(/atom/movable/screen/plane_master) - /atom/movable/screen/plane_master/blackness)
var/atom/movable/screen/plane_master/instance = new plane()
instance.assigned_map = map_name
instance.del_on_map_removal = FALSE
if(instance.blend_mode_override)
instance.blend_mode = instance.blend_mode_override
instance.screen_loc = "[map_name]:CENTER"
cam_plane_masters += instance

Check failure on line 83 in code/modules/defenses/sentry_computer.dm

View workflow job for this annotation

GitHub Actions / Run Linters

undefined var: "cam_plane_masters"

faction_group = FACTION_LIST_MARINE
transceiver.forceMove(src)
transceiver.set_frequency(SENTRY_FREQ)
Expand Down Expand Up @@ -391,6 +398,8 @@
// Register map objects
user.client.register_map_obj(cam_background)
user.client.register_map_obj(cam_screen)
for(var/plane in cam_plane_masters)

Check failure on line 401 in code/modules/defenses/sentry_computer.dm

View workflow job for this annotation

GitHub Actions / Run Linters

undefined var: "cam_plane_masters"
user.client.register_map_obj(plane)
ui = new(user, src, "SentryGunUI", name)
ui.open()

Expand Down Expand Up @@ -474,12 +483,9 @@
var/list/guncamera_zone = range("[x_size]x[y_size]", target)

var/list/visible_turfs = list()
range_turfs.Cut()

for(var/turf/visible_turf in guncamera_zone)
range_turfs += visible_turf
if(visible_turf.get_lumcount() >= 0.5)
visible_turfs += visible_turf
visible_turfs += visible_turf

var/list/bbox = get_bbox_of_atoms(visible_turfs)
var/size_x = bbox[3] - bbox[1] + 1
Expand Down

0 comments on commit d001608

Please sign in to comment.