Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Viscontents Wrappers #297

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions code/__DEFINES/subsystems.dm
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@
#define INIT_ORDER_SOUNDS 83
#define INIT_ORDER_INSTRUMENTS 82
#define INIT_ORDER_GREYSCALE 81
#define INIT_ORDER_VIS 80
#define INIT_ORDER_DISCORD 78
#define INIT_ORDER_ACHIEVEMENTS 77
#define INIT_ORDER_STATION 74 //This is high priority because it manipulates a lot of the subsystems that will initialize after it.
Expand Down Expand Up @@ -180,7 +179,6 @@
#define FIRE_PRIORITY_IDLE_NPC 10
#define FIRE_PRIORITY_SERVER_MAINT 10
#define FIRE_PRIORITY_RESEARCH 10
#define FIRE_PRIORITY_VIS 10
#define FIRE_PRIORITY_AMBIENCE 10
#define FIRE_PRIORITY_GARBAGE 15
#define FIRE_PRIORITY_DATABASE 16
Expand Down
4 changes: 2 additions & 2 deletions code/__HELPERS/icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1303,7 +1303,7 @@ GLOBAL_LIST_EMPTY(transformation_animation_objects)

GLOB.transformation_animation_objects[src] = transformation_objects
for(var/A in transformation_objects)
vis_contents += A
add_viscontents(A)
if(reset_after)
addtimer(CALLBACK(src, PROC_REF(_reset_transformation_animation), filter_index),time)

Expand All @@ -1313,7 +1313,7 @@ GLOBAL_LIST_EMPTY(transformation_animation_objects)
/atom/movable/proc/_reset_transformation_animation(filter_index)
var/list/transformation_objects = GLOB.transformation_animation_objects[src]
for(var/A in transformation_objects)
vis_contents -= A
remove_viscontents(A)
qdel(A)
transformation_objects.Cut()
GLOB.transformation_animation_objects -= src
Expand Down
10 changes: 5 additions & 5 deletions code/_onclick/hud/picture_in_picture.dm
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
M = matrix()
M.Translate((max(4, width) - 0.75) * world.icon_size, (height + 0.25) * world.icon_size)
button_x.transform = M
vis_contents += button_x
add_viscontents(button_x)

if(!button_expand)
button_expand = new /atom/movable/screen/component_button(null, src)
Expand All @@ -77,7 +77,7 @@
M = matrix()
M.Translate(world.icon_size, (height + 0.25) * world.icon_size)
button_expand.transform = M
vis_contents += button_expand
add_viscontents(button_expand)

if(!button_shrink)
button_shrink = new /atom/movable/screen/component_button(null, src)
Expand All @@ -90,7 +90,7 @@
M = matrix()
M.Translate(2 * world.icon_size, (height + 0.25) * world.icon_size)
button_shrink.transform = M
vis_contents += button_shrink
add_viscontents(button_shrink)

/atom/movable/screen/movable/pic_in_pic/proc/add_background()
if((width > 0) && (height > 0))
Expand Down Expand Up @@ -122,11 +122,11 @@
refresh_view()

/atom/movable/screen/movable/pic_in_pic/proc/refresh_view()
vis_contents -= viewing_turfs
remove_viscontents(viewing_turfs)
if(!width || !height)
return
viewing_turfs = get_visible_turfs()
vis_contents += viewing_turfs
add_viscontents(viewing_turfs)

/atom/movable/screen/movable/pic_in_pic/proc/get_visible_turfs()
var/turf/T = get_turf(center)
Expand Down
4 changes: 2 additions & 2 deletions code/_onclick/hud/radial.dm
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ GLOBAL_LIST_EMPTY(radial_menus)
E.alpha = 255
E.mouse_opacity = MOUSE_OPACITY_ICON
E.cut_overlays()
E.vis_contents.Cut()
E.cut_viscontents()
if(choice_id == NEXT_PAGE_ID)
E.name = "Next Page"
E.next_page = TRUE
Expand Down Expand Up @@ -251,7 +251,7 @@ GLOBAL_LIST_EMPTY(radial_menus)
var/obj/effect/abstract/info/info_button = new(E, choice_datum.info)
info_button.plane = ABOVE_HUD_PLANE
info_button.layer = RADIAL_CONTENT_LAYER
E.vis_contents += info_button
E.add_viscontents(info_button)

/datum/radial_menu/New()
close_button = new
Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/hud/rendering/plane_master.dm
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
gas_heat_object = new /obj/effect/abstract/particle_emitter/heat(null, -1)
gas_heat_object.particles?.count = 250
gas_heat_object.particles?.spawning = 15
vis_contents += gas_heat_object
add_viscontents(gas_heat_object)

/atom/movable/screen/plane_master/area
name = "area plane"
Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/hud/robot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
static_inventory += using
robit.interfaceButton = using
if(robit.modularInterface)
using.vis_contents += robit.modularInterface
using.add_viscontents(robit.modularInterface)
var/atom/movable/screen/robot/modpc/tabletbutton = using
tabletbutton.robot = robit

Expand Down
6 changes: 3 additions & 3 deletions code/_onclick/hud/screen_objects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -452,15 +452,15 @@

if(hovering == choice)
return
vis_contents -= hover_overlays_cache[hovering]
remove_viscontents(hover_overlays_cache[hovering])
hovering = choice

var/obj/effect/overlay/zone_sel/overlay_object = hover_overlays_cache[choice]
if(!overlay_object)
overlay_object = new
overlay_object.icon_state = "[choice]"
hover_overlays_cache[choice] = overlay_object
vis_contents += overlay_object
add_viscontents(overlay_object)

/obj/effect/overlay/zone_sel
icon = 'icons/hud/screen_gen.dmi'
Expand All @@ -471,7 +471,7 @@

/atom/movable/screen/zone_sel/MouseExited(location, control, params)
if(!isobserver(usr) && hovering)
vis_contents -= hover_overlays_cache[hovering]
remove_viscontents(hover_overlays_cache[hovering])
hovering = null

/atom/movable/screen/zone_sel/proc/get_zone_at(icon_x, icon_y)
Expand Down
77 changes: 0 additions & 77 deletions code/controllers/subsystem/vis_overlays.dm

This file was deleted.

6 changes: 3 additions & 3 deletions code/controllers/subsystem/zas.dm
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ SUBSYSTEM_DEF(zas)
T.post_update_air_properties()
T.needs_air_update = 0
#ifdef ZASDBG
T.vis_contents -= zasdbgovl_mark
T.remove_viscontents(zasdbgovl_mark)
//updated++
#endif

Expand All @@ -277,7 +277,7 @@ SUBSYSTEM_DEF(zas)
T.post_update_air_properties()
T.needs_air_update = 0
#ifdef ZASDBG
T.vis_contents -= zasdbgovl_mark
T.remove_viscontents(zasdbgovl_mark)
//updated++
#endif

Expand Down Expand Up @@ -520,7 +520,7 @@ SUBSYSTEM_DEF(zas)
return
tiles_to_update += T
#ifdef ZASDBG
T.vis_contents += zasdbgovl_mark
T.add_viscontents(zasdbgovl_mark)
#endif
T.needs_air_update = 1

Expand Down
2 changes: 1 addition & 1 deletion code/datums/beam.dm
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
II.DrawBox(null,1,(length-N),32,32)//in the future if you want to improve this, remove the drawbox and instead use a 513 filter to cut away at the final object's icon
X.icon = II
else
X.vis_contents += visuals
X.add_viscontents(visuals)
X.transform = rot_matrix

//Calculate pixel offsets (If necessary)
Expand Down
4 changes: 2 additions & 2 deletions code/datums/components/aquarium.dm
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
generate_animation(reset = TRUE)

//Finally add it to to objects vis_contents
current_aquarium.vis_contents |= vc_obj
current_aquarium.distinct_add_viscontents(vc_obj)

/// Aquarium surface changed in some way, we need to recalculate base position and aninmation
/datum/component/aquarium_content/proc/on_surface_changed()
Expand All @@ -189,7 +189,7 @@
generate_animation()

/datum/component/aquarium_content/proc/remove_visual_from_aquarium()
current_aquarium.vis_contents -= vc_obj
current_aquarium.remove_viscontents(vc_obj)
if(base_layer)
current_aquarium.free_layer(base_layer)

Expand Down
2 changes: 1 addition & 1 deletion code/datums/components/mirage_border.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
var/turf/northeast = locate(clamp(x + (direction & EAST ? range : 0), 1, world.maxx), clamp(y + (direction & NORTH ? range : 0), 1, world.maxy), clamp(z, 1, world.maxz))
//holder.vis_contents += block(southwest, northeast) // This doesnt work because of beta bug memes
for(var/i in block(southwest, northeast))
holder.vis_contents += i
holder.add_viscontents(i)
if(direction & SOUTH)
holder.pixel_y -= world.icon_size * range
if(direction & WEST)
Expand Down
12 changes: 12 additions & 0 deletions code/game/area/areas.dm
Original file line number Diff line number Diff line change
Expand Up @@ -517,3 +517,15 @@ GLOBAL_LIST_EMPTY(teleportlocs)

for(var/datum/listener in airalarms + firealarms + firedoors)
SEND_SIGNAL(listener, COMSIG_FIRE_ALERT, code)

/area/add_viscontents(atom/A)
CRASH("Tried to mutate area vis_contents.")

/area/distinct_add_viscontents(atom/A)
CRASH("Tried to mutate area vis_contents.")

/area/remove_viscontents(atom/A)
CRASH("Tried to mutate area vis_contents.")

/area/cut_viscontents()
CRASH("Tried to mutate area vis_contents.")
21 changes: 16 additions & 5 deletions code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@
/// a very temporary list of overlays to add
var/list/add_overlays

///vis overlays managed by SSvis_overlays to automaticaly turn them like other overlays.
var/list/managed_vis_overlays
///overlays managed by [update_overlays][/atom/proc/update_overlays] to prevent removing overlays that weren't added by the same proc. Single items are stored on their own, not in a list.
var/list/managed_overlays

Expand Down Expand Up @@ -794,9 +792,6 @@
. |= UPDATE_ICON_STATE

if(updates & UPDATE_OVERLAYS)
if(LAZYLEN(managed_vis_overlays))
SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays)

var/list/new_overlays = update_overlays(updates)
if(managed_overlays)
cut_overlay(managed_overlays)
Expand Down Expand Up @@ -2225,3 +2220,19 @@
//Currently only changed by Observers to be hearing through their orbit target.
/atom/proc/hear_location()
return src

/// Add an atom or list of atoms to our vis_contents
/atom/proc/add_viscontents(atom/A)
src:vis_contents += A

/// Add an atom or list of atoms to our vis_contents, atoms already present will be ignored
/atom/proc/distinct_add_viscontents(atom/A)
src:vis_contents |= A

/// Remove an atom or list of atoms from our vis_contents
/atom/proc/remove_viscontents(atom/A)
src:vis_contents -= A

/// Cut our vis_contents
/atom/proc/cut_viscontents()
src:vis_contents:len = 0
2 changes: 1 addition & 1 deletion code/game/atoms_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@


vis_locs = null //clears this atom out of all viscontents
vis_contents.Cut()
cut_viscontents()

/atom/movable/proc/update_emissive_block()
if(!blocks_emissive)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/camera.dm
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
use_power(0)

/obj/machinery/computer/security/proc/show_camera_static()
cam_screen.vis_contents.Cut()
cam_screen.cut_viscontents()
cam_background.icon_state = "scanline2"
cam_background.fill_rect(1, 1, DEFAULT_MAP_SIZE, DEFAULT_MAP_SIZE)

Expand Down
8 changes: 4 additions & 4 deletions code/game/machinery/rotating_light.dm
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@

/obj/machinery/rotating_alarm/proc/set_color(color)
if (on)
vis_contents -= spin_effect
remove_viscontents(spin_effect)
if (isnull(spinning_lights_cache["[color]"]))
spinning_lights_cache["[color]"] = new /obj/effect/spinning_light()
spin_effect = spinning_lights_cache["[color]"]
Expand All @@ -89,18 +89,18 @@
alarm_light_color = RGB
spin_effect.set_color(color)
if (on)
vis_contents += spin_effect
add_viscontents(spin_effect)


/obj/machinery/rotating_alarm/proc/set_on()
vis_contents += spin_effect
add_viscontents(spin_effect)
set_light(1, 0.5, 2, 0.3, l_color = alarm_light_color)
on = TRUE
low_alarm = FALSE


/obj/machinery/rotating_alarm/proc/set_off()
vis_contents -= spin_effect
remove_viscontents(spin_effect)
set_light(0)
on = FALSE
low_alarm = FALSE
Loading