diff --git a/code/__DEFINES/layers_planes.dm b/code/__DEFINES/layers_planes.dm
new file mode 100644
index 00000000000..8773c58e163
--- /dev/null
+++ b/code/__DEFINES/layers_planes.dm
@@ -0,0 +1,18 @@
+//Contains all our layer and plane defines
+
+//If you want more information on how byond renders things, look here http://www.byond.com/forum/?post=2042210
+
+#define PLANE_CLICKCATCHER -99
+
+#define PLANE_GAME 0 //This might need splitting into different planes later, but for now it will do
+
+#define PLANE_LIGHTING 15
+#define PLANE_EFFECTS_UNLIT 16
+
+#define PLANE_FULLSCREEN 18
+#define LAYER_DAMAGE 18.1
+#define LAYER_BLIND 18.2
+#define LAYER_CRIT 18.3
+
+#define PLANE_UI_BASE 19 //All the screen objects go here
+#define PLANE_UI_OBJECTS 20 //Your actual equipment being displayed
\ No newline at end of file
diff --git a/code/__HELPERS/icons.dm b/code/__HELPERS/icons.dm
index 4e76b773352..a73c41fe0e2 100644
--- a/code/__HELPERS/icons.dm
+++ b/code/__HELPERS/icons.dm
@@ -688,6 +688,7 @@ The _flatIcons list is a cache for generated icon files.
curblend = A.blend_mode
// Layers will be a sorted list of icons/overlays, based on the order in which they are displayed
+ // TODO: Needs to support overlays/underlays on different planes from parent
var/list/layers = list()
var/image/copy
// Add the atom's icon itself, without pixel_x/y offsets.
diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm
index ce70339a466..ffefa455b8a 100644
--- a/code/__HELPERS/unsorted.dm
+++ b/code/__HELPERS/unsorted.dm
@@ -495,14 +495,15 @@ Turf and target are seperate in case you want to teleport some distance from a t
return y
-/proc/anim(turf/location,target as mob|obj,a_icon,a_icon_state as text,flick_anim as text,sleeptime = 0,direction as num)
+/proc/anim(turf/location, atom/movable/target, a_icon, a_icon_state as text, flick_anim as text, sleeptime = 0, direction as num)
//This proc throws up either an icon or an animation for a specified amount of time.
//The variables should be apparent enough.
var/atom/movable/overlay/animation = new(location)
if(direction)
animation.dir = direction
animation.icon = a_icon
- animation.layer = target:layer+1
+ animation.layer = target.layer+1
+ animation.plane = target.plane
if(a_icon_state)
animation.icon_state = a_icon_state
else
diff --git a/code/_onclick/_defines.dm b/code/_onclick/_defines.dm
deleted file mode 100644
index 3c76c35e807..00000000000
--- a/code/_onclick/_defines.dm
+++ /dev/null
@@ -1 +0,0 @@
-#define CLICKCATCHER_PLANE -99
\ No newline at end of file
diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm
index 26838de68c3..2837f152faa 100644
--- a/code/_onclick/click.dm
+++ b/code/_onclick/click.dm
@@ -325,7 +325,7 @@
/obj/screen/click_catcher
icon = 'icons/mob/screen_gen.dmi'
icon_state = "click_catcher"
- plane = CLICKCATCHER_PLANE
+ plane = PLANE_CLICKCATCHER
mouse_opacity = 2
screen_loc = "CENTER-7,CENTER-7"
diff --git a/code/_onclick/hud/alert.dm b/code/_onclick/hud/alert.dm
index f8974e1b31c..6344fc927a1 100644
--- a/code/_onclick/hud/alert.dm
+++ b/code/_onclick/hud/alert.dm
@@ -37,9 +37,12 @@
if(new_master)
var/old_layer = new_master.layer
+ var/old_plane = new_master.plane
new_master.layer = FLOAT_LAYER
+ new_master.plane = PLANE_UI_OBJECTS
alert.overlays += new_master
new_master.layer = old_layer
+ new_master.plane = old_plane
alert.icon_state = "template" // We'll set the icon to the client's ui pref in reorganize_alerts()
alert.master = new_master
else
diff --git a/code/_onclick/hud/blob_overmind.dm b/code/_onclick/hud/blob_overmind.dm
index 6357d556d40..d7f14b54ebf 100644
--- a/code/_onclick/hud/blob_overmind.dm
+++ b/code/_onclick/hud/blob_overmind.dm
@@ -125,7 +125,7 @@
blobpwrdisplay.icon_state = "block"
blobpwrdisplay.screen_loc = ui_health
blobpwrdisplay.mouse_opacity = 0
- blobpwrdisplay.layer = 20
+ blobpwrdisplay.plane = PLANE_UI_BASE
infodisplay += blobpwrdisplay
healths = new /obj/screen/healths/blob()
diff --git a/code/_onclick/hud/fullscreen.dm b/code/_onclick/hud/fullscreen.dm
index a0a74545db8..391d72f8561 100644
--- a/code/_onclick/hud/fullscreen.dm
+++ b/code/_onclick/hud/fullscreen.dm
@@ -1,8 +1,3 @@
-#define FULLSCREEN_LAYER 18
-#define DAMAGE_LAYER FULLSCREEN_LAYER + 0.1
-#define BLIND_LAYER DAMAGE_LAYER + 0.1
-#define CRIT_LAYER BLIND_LAYER + 0.1
-
/mob
var/list/screens = list()
@@ -63,7 +58,7 @@
icon = 'icons/mob/screen_full.dmi'
icon_state = "default"
screen_loc = "CENTER-7,CENTER-7"
- layer = FULLSCREEN_LAYER
+ plane = PLANE_FULLSCREEN
mouse_opacity = 0
var/severity = 0
@@ -74,19 +69,19 @@
/obj/screen/fullscreen/brute
icon_state = "brutedamageoverlay"
- layer = DAMAGE_LAYER
+ layer = LAYER_DAMAGE
/obj/screen/fullscreen/oxy
icon_state = "oxydamageoverlay"
- layer = DAMAGE_LAYER
+ layer = LAYER_DAMAGE
/obj/screen/fullscreen/crit
icon_state = "passage"
- layer = CRIT_LAYER
+ layer = LAYER_CRIT
/obj/screen/fullscreen/blind
icon_state = "blackimageoverlay"
- layer = BLIND_LAYER
+ layer = LAYER_BLIND
/obj/screen/fullscreen/impaired
icon_state = "impairedoverlay"
@@ -109,9 +104,4 @@
/obj/screen/fullscreen/high
icon = 'icons/mob/screen_gen.dmi'
screen_loc = "WEST,SOUTH to EAST,NORTH"
- icon_state = "druggy"
-
-#undef FULLSCREEN_LAYER
-#undef BLIND_LAYER
-#undef DAMAGE_LAYER
-#undef CRIT_LAYER
+ icon_state = "druggy"
\ No newline at end of file
diff --git a/code/_onclick/hud/other_mobs.dm b/code/_onclick/hud/other_mobs.dm
index e1bacf6922d..482ed7e8df7 100644
--- a/code/_onclick/hud/other_mobs.dm
+++ b/code/_onclick/hud/other_mobs.dm
@@ -31,11 +31,8 @@
name = "Faith"
icon_state = "deity_power"
screen_loc = ui_deitypower
- layer = 20
/obj/screen/deity_follower_display
name = "Followers"
icon_state = "deity_followers"
- screen_loc = ui_deityfollowers
- layer = 20
-
+ screen_loc = ui_deityfollowers
\ No newline at end of file
diff --git a/code/_onclick/hud/robot.dm b/code/_onclick/hud/robot.dm
index b13623a9bfd..77064c1a79a 100644
--- a/code/_onclick/hud/robot.dm
+++ b/code/_onclick/hud/robot.dm
@@ -197,7 +197,7 @@
A.screen_loc = "CENTER[x]:16,SOUTH+[y]:7"
else
A.screen_loc = "CENTER+[x]:16,SOUTH+[y]:7"
- A.layer = 20
+ A.plane = PLANE_UI_OBJECTS //need to move this to module init eventually
x++
if(x == 4)
diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm
index 2fc47ab95be..fc9868b4d4e 100644
--- a/code/_onclick/hud/screen_objects.dm
+++ b/code/_onclick/hud/screen_objects.dm
@@ -9,7 +9,7 @@
/obj/screen
name = ""
icon = 'icons/mob/screen_gen.dmi'
- layer = 20
+ plane = PLANE_UI_BASE
unacidable = 1
appearance_flags = APPEARANCE_UI
var/obj/master = null //A reference to the object in the slot. Grabs or items, generally.
@@ -29,7 +29,6 @@
maptext_width = 480
/obj/screen/swap_hand
- layer = 19
name = "swap hand"
/obj/screen/swap_hand/Click()
@@ -51,7 +50,6 @@
var/slot_id // The indentifier for the slot. It has nothing to do with ID cards.
var/icon_empty // Icon when empty. For now used only by humans.
var/icon_full // Icon when contains an item. For now used only by humans.
- layer = 19
/obj/screen/inventory/Click()
// At this point in client Click() code we have passed the 1/10 sec check and little else
@@ -86,9 +84,11 @@
..()
if(!active_overlay)
active_overlay = image("icon"=icon, "icon_state"="hand_active")
+ active_overlay.plane = PLANE_UI_BASE
if(!handcuff_overlay)
var/state = (slot_id == slot_r_hand) ? "markus" : "gabrielle"
handcuff_overlay = image("icon"='icons/mob/screen_gen.dmi', "icon_state"=state)
+ handcuff_overlay.plane = PLANE_UI_OBJECTS
overlays.Cut()
@@ -136,7 +136,6 @@
name = "drop"
icon = 'icons/mob/screen_midnight.dmi'
icon_state = "act_drop"
- layer = 19
/obj/screen/drop/Click()
usr.drop_item_v()
@@ -285,7 +284,6 @@
name = "resist"
icon = 'icons/mob/screen_midnight.dmi'
icon_state = "act_resist"
- layer = 19
/obj/screen/resist/Click()
if(isliving(usr))
@@ -379,7 +377,9 @@
/obj/screen/zone_sel/update_icon(mob/user)
overlays.Cut()
- overlays += image('icons/mob/screen_gen.dmi', "[selecting]")
+ var/image/overlay = image('icons/mob/screen_gen.dmi', "[selecting]")
+ overlay.plane = PLANE_UI_BASE
+ overlays += overlay
user.zone_selected = selecting
/obj/screen/zone_sel/alien
@@ -393,23 +393,6 @@
/obj/screen/zone_sel/robot
icon = 'icons/mob/screen_cyborg.dmi'
-
-/obj/screen/flash
- name = "flash"
- icon_state = "blank"
- blend_mode = BLEND_ADD
- screen_loc = "WEST,SOUTH to EAST,NORTH"
- layer = 17
-
-/obj/screen/damageoverlay
- icon = 'icons/mob/screen_full.dmi'
- icon_state = "oxydamageoverlay0"
- name = "dmg"
- blend_mode = BLEND_MULTIPLY
- screen_loc = "CENTER-7,CENTER-7"
- mouse_opacity = 0
- layer = 18.1 //The black screen overlay sets layer to 18 to display it, this one has to be just on top.
-
/obj/screen/healths
name = "health"
icon_state = "health0"
diff --git a/code/_onclick/telekinesis.dm b/code/_onclick/telekinesis.dm
index 1fb7b369327..0257f18b15b 100644
--- a/code/_onclick/telekinesis.dm
+++ b/code/_onclick/telekinesis.dm
@@ -71,7 +71,7 @@ var/const/tk_maxrange = 15
flags = NOBLUDGEON | ABSTRACT
//item_state = null
w_class = 10
- layer = 20
+ plane = PLANE_UI_OBJECTS
var/last_throw = 0
var/atom/movable/focus = null
diff --git a/code/datums/action.dm b/code/datums/action.dm
index 59976843017..6d883261029 100644
--- a/code/datums/action.dm
+++ b/code/datums/action.dm
@@ -89,8 +89,8 @@
/datum/action/proc/ApplyIcon(obj/screen/movable/action_button/current_button)
current_button.overlays.Cut()
if(button_icon && button_icon_state)
- var/image/img
- img = image(button_icon, current_button, button_icon_state)
+ var/image/img = image(button_icon, current_button, button_icon_state)
+ img.plane = current_button.plane
img.pixel_x = 0
img.pixel_y = 0
current_button.overlays += img
@@ -131,10 +131,10 @@
..(current_button)
else if(target)
var/obj/item/I = target
- var/old = I.layer
- I.layer = FLOAT_LAYER //AAAH
+ var/old = I.plane
+ I.plane = current_button.plane
current_button.overlays += I
- I.layer = old
+ I.plane = old
/datum/action/item_action/toggle_light
name = "Toggle Light"
diff --git a/code/datums/diseases/transformation.dm b/code/datums/diseases/transformation.dm
index b814687318a..c1b1c3a3d46 100644
--- a/code/datums/diseases/transformation.dm
+++ b/code/datums/diseases/transformation.dm
@@ -53,7 +53,6 @@
if(istype(W, /obj/item/weapon/implant))
qdel(W)
continue
- W.layer = initial(W.layer)
W.loc = affected_mob.loc
W.dropped(affected_mob)
var/mob/living/new_mob = new new_form(affected_mob.loc)
diff --git a/code/game/atoms.dm b/code/game/atoms.dm
index 6dd095996f9..91eb0c71b23 100644
--- a/code/game/atoms.dm
+++ b/code/game/atoms.dm
@@ -1,5 +1,6 @@
/atom
layer = 2
+ plane = PLANE_GAME
var/level = 2
var/flags = 0
var/list/fingerprints
diff --git a/code/game/objects/effects/decals/misc.dm b/code/game/objects/effects/decals/misc.dm
index 0a627518e15..45847a3019a 100644
--- a/code/game/objects/effects/decals/misc.dm
+++ b/code/game/objects/effects/decals/misc.dm
@@ -2,7 +2,7 @@
name = "pointer"
icon = 'icons/mob/screen_gen.dmi'
icon_state = "arrow"
- layer = 16
+ plane = PLANE_EFFECTS_UNLIT
duration = 25
/obj/effect/overlay/temp/point/New(loc, set_invis = 0)
diff --git a/code/game/objects/effects/misc.dm b/code/game/objects/effects/misc.dm
index 4d621cf0fdd..1d48966e85e 100644
--- a/code/game/objects/effects/misc.dm
+++ b/code/game/objects/effects/misc.dm
@@ -13,6 +13,7 @@
icon_state = "blank"
anchored = 1
layer = 99
+ plane = PLANE_EFFECTS_UNLIT
mouse_opacity = 0
unacidable = 1//Just to be sure.
diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm
index f634e1eca8b..5f89293753d 100644
--- a/code/game/objects/items.dm
+++ b/code/game/objects/items.dm
@@ -367,22 +367,21 @@ var/global/image/fire_overlay = image("icon" = 'icons/effects/fire.dmi', "icon_s
return
/obj/item/proc/dropped(mob/user)
+ plane = initial(plane)
for(var/X in actions)
var/datum/action/A = X
A.Remove(user)
// called just as an item is picked up (loc is not yet changed)
/obj/item/proc/pickup(mob/user)
- return
-
// called when this item is removed from a storage item, which is passed on as S. The loc variable is already set to the new destination before this is called.
/obj/item/proc/on_exit_storage(obj/item/weapon/storage/S)
- return
+ plane = initial(plane)
// called when this item is added into a storage item, which is passed on as S. The loc variable is already set to the storage item.
/obj/item/proc/on_enter_storage(obj/item/weapon/storage/S)
- return
+ plane = PLANE_UI_OBJECTS
// called when "found" in pockets and storage items. Returns 1 if the search should end.
/obj/item/proc/on_found(mob/finder)
@@ -392,8 +391,8 @@ var/global/image/fire_overlay = image("icon" = 'icons/effects/fire.dmi', "icon_s
// user is mob that equipped it
// slot uses the slot_X defines found in setup.dm
// for items that can be placed in multiple slots
-// note this isn't called during the initial dressing of a player
/obj/item/proc/equipped(mob/user, slot)
+ plane = PLANE_UI_OBJECTS
for(var/X in actions)
var/datum/action/A = X
if(item_action_slot_check(slot, user)) //some items only give their actions buttons when in a specific slot.
diff --git a/code/game/objects/items/devices/chameleonproj.dm b/code/game/objects/items/devices/chameleonproj.dm
index 386de841e52..ec58ac01e80 100644
--- a/code/game/objects/items/devices/chameleonproj.dm
+++ b/code/game/objects/items/devices/chameleonproj.dm
@@ -36,7 +36,7 @@
user << "Scanned [target]."
var/obj/temp = new/obj()
temp.appearance = target.appearance
- temp.layer = initial(target.layer) // scanning things in your inventory
+ temp.plane = initial(target.plane) // scanning things in your inventory
saved_appearance = temp.appearance
/obj/item/device/chameleon/proc/toggle()
diff --git a/code/game/objects/items/weapons/storage/storage.dm b/code/game/objects/items/weapons/storage/storage.dm
index 9764781e8fc..d8cec1920c4 100644
--- a/code/game/objects/items/weapons/storage/storage.dm
+++ b/code/game/objects/items/weapons/storage/storage.dm
@@ -157,7 +157,6 @@
boxes.screen_loc = "[tx]:,[ty] to [mx],[my]"
for(var/obj/O in contents)
O.screen_loc = "[cx],[cy]"
- O.layer = 20
cx++
if(cx > mx)
cx = tx
@@ -176,7 +175,7 @@
ND.sample_object.mouse_opacity = 2
ND.sample_object.screen_loc = "[cx]:16,[cy]:16"
ND.sample_object.maptext = "[(ND.number > 1)? "[ND.number]" : ""]"
- ND.sample_object.layer = 20
+ ND.sample_object.plane = PLANE_UI_OBJECTS
cx++
if(cx > (4+cols))
cx = 4
@@ -186,7 +185,7 @@
O.mouse_opacity = 2 //This is here so storage items that spawn with contents correctly have the "click around item to equip"
O.screen_loc = "[cx]:16,[cy]:16"
O.maptext = ""
- O.layer = 20
+ O.plane = PLANE_UI_OBJECTS
cx++
if(cx > (4+cols))
cx = 4
@@ -342,7 +341,6 @@
if(ismob(loc))
var/mob/M = loc
W.dropped(M)
- W.layer = initial(W.layer)
W.loc = new_location
if(usr)
@@ -463,11 +461,11 @@
boxes.master = src
boxes.icon_state = "block"
boxes.screen_loc = "7,7 to 10,8"
- boxes.layer = 19
+ boxes.plane = PLANE_UI_BASE
closer = new /obj/screen/close()
closer.master = src
closer.icon_state = "backpack_close"
- closer.layer = 20
+ closer.plane = PLANE_UI_BASE
orient2hud()
diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm
index 012c704f2c3..59ead4befdf 100644
--- a/code/modules/admin/topic.dm
+++ b/code/modules/admin/topic.dm
@@ -1386,7 +1386,6 @@
M.unEquip(I)
if(I)
I.loc = M.loc
- I.layer = initial(I.layer)
I.dropped(M)
M.Paralyse(5)
@@ -1416,7 +1415,6 @@
M.unEquip(I)
if(I)
I.loc = M.loc
- I.layer = initial(I.layer)
I.dropped(M)
M.Paralyse(5)
@@ -1469,7 +1467,6 @@
M.unEquip(I)
if(I)
I.loc = M.loc
- I.layer = initial(I.layer)
I.dropped(M)
if(istype(M, /mob/living/carbon/human))
diff --git a/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm b/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm
index f00c99897d1..ad13524175d 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm
@@ -262,7 +262,9 @@
user.visible_message("[user] unwelds the vent.", "You unweld the vent.", "You hear welding.")
welded = 0
update_icon()
- pipe_vision_img = image(src, loc, layer = 20, dir = dir)
+ var/image/I = image(src, loc, dir = dir)
+ I.plane = PLANE_UI_OBJECTS
+ pipe_vision_img = I
return 0
else
return ..()
@@ -285,7 +287,9 @@
user.visible_message("[user] furiously claws at [src]!", "You manage to clear away the stuff blocking the vent", "You hear loud scraping noises.")
welded = 0
update_icon()
- pipe_vision_img = image(src, loc, layer = 20, dir = dir)
+ var/image/I = image(src, loc, dir = dir)
+ I.plane = PLANE_UI_OBJECTS
+ pipe_vision_img = I
playsound(loc, 'sound/weapons/bladeslice.ogg', 100, 1)
diff --git a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm
index cdefd24e240..7de7a1ac068 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm
@@ -308,7 +308,9 @@
user.visible_message("[user] unwelds the scrubber.", "You unweld the scrubber.", "You hear welding.")
welded = 0
update_icon()
- pipe_vision_img = image(src, loc, layer = 20, dir = dir)
+ var/image/I = image(src, loc, dir = dir)
+ I.plane = PLANE_UI_OBJECTS
+ pipe_vision_img = I
return 0
if (!istype(W, /obj/item/weapon/wrench))
return ..()
@@ -326,7 +328,9 @@
user.visible_message("[user] furiously claws at [src]!", "You manage to clear away the stuff blocking the scrubber.", "You hear loud scraping noises.")
welded = 0
update_icon()
- pipe_vision_img = image(src, loc, layer = 20, dir = dir)
+ var/image/I = image(src, loc, dir = dir)
+ I.plane = PLANE_UI_OBJECTS
+ pipe_vision_img = I
playsound(loc, 'sound/weapons/bladeslice.ogg', 100, 1)
diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm
index d808eef5e0f..740b8887d89 100644
--- a/code/modules/clothing/clothing.dm
+++ b/code/modules/clothing/clothing.dm
@@ -357,8 +357,10 @@ BLIND // can't see anything
I.transform *= 0.5 //halve the size so it doesn't overpower the under
I.pixel_x += 8
I.pixel_y -= 8
+ var/oldlayer = I.layer
I.layer = FLOAT_LAYER
overlays += I
+ I.layer = oldlayer
if(istype(loc, /mob/living/carbon/human))
@@ -492,7 +494,6 @@ BLIND // can't see anything
hastie.transform *= 2
hastie.pixel_x -= 8
hastie.pixel_y += 8
- hastie.layer = initial(hastie.layer)
overlays = null
usr.put_in_hands(hastie)
hastie = null
diff --git a/code/modules/events/anomaly_bluespace.dm b/code/modules/events/anomaly_bluespace.dm
index bfb574706cc..b4d9705223b 100644
--- a/code/modules/events/anomaly_bluespace.dm
+++ b/code/modules/events/anomaly_bluespace.dm
@@ -65,7 +65,7 @@
blueeffect.screen_loc = "WEST,SOUTH to EAST,NORTH"
blueeffect.icon = 'icons/effects/effects.dmi'
blueeffect.icon_state = "shieldsparkles"
- blueeffect.layer = 17
+ blueeffect.plane = PLANE_EFFECTS_UNLIT
blueeffect.mouse_opacity = 0
M.client.screen += blueeffect
sleep(20)
diff --git a/code/modules/flufftext/Hallucination.dm b/code/modules/flufftext/Hallucination.dm
index 70c2a6f2870..4dc75290766 100644
--- a/code/modules/flufftext/Hallucination.dm
+++ b/code/modules/flufftext/Hallucination.dm
@@ -635,7 +635,7 @@ var/list/non_fakeattack_weapons = list(/obj/item/weapon/gun/projectile, /obj/ite
if(!H.r_store) slots_free += ui_storage2
if(slots_free.len)
halitem.screen_loc = pick(slots_free)
- halitem.layer = 50
+ halitem.plane = PLANE_UI_OBJECTS
switch(rand(1,6))
if(1) //revolver
halitem.icon = 'icons/obj/guns/projectile.dmi'
diff --git a/code/modules/lighting/lighting_system.dm b/code/modules/lighting/lighting_system.dm
index cce8b0a8aef..f6071404626 100644
--- a/code/modules/lighting/lighting_system.dm
+++ b/code/modules/lighting/lighting_system.dm
@@ -27,7 +27,6 @@
*/
#define LIGHTING_CIRCULAR 1 //Comment this out to use old square lighting effects.
-#define LIGHTING_LAYER 15 //Drawing layer for lighting
#define LIGHTING_CAP 10 //The lumcount level at which alpha is 0 and we're fully lit.
#define LIGHTING_CAP_FRAC (255/LIGHTING_CAP) //A precal'd variable we'll use in turf/redraw_lighting()
#define LIGHTING_ICON 'icons/effects/alphacolors.dmi'
@@ -236,7 +235,7 @@
/atom/movable/light
icon = LIGHTING_ICON
icon_state = LIGHTING_ICON_STATE
- layer = LIGHTING_LAYER
+ plane = PLANE_LIGHTING
mouse_opacity = 0
blend_mode = BLEND_OVERLAY
invisibility = INVISIBILITY_LIGHTING
@@ -362,7 +361,6 @@
T.init_lighting()
T.update_lumcount(0)
-#undef LIGHTING_LAYER
#undef LIGHTING_CIRCULAR
#undef LIGHTING_ICON
#undef LIGHTING_ICON_STATE
diff --git a/code/modules/mining/equipment_locker.dm b/code/modules/mining/equipment_locker.dm
index 12ec53f1011..5f4f085c11a 100644
--- a/code/modules/mining/equipment_locker.dm
+++ b/code/modules/mining/equipment_locker.dm
@@ -252,7 +252,6 @@
new s.type(loc,s.max_amount)
s.use(s.max_amount)
s.loc = loc
- s.layer = initial(s.layer)
/obj/machinery/mineral/ore_redemption/power_change()
..()
@@ -962,7 +961,8 @@
var/client/C = user.client
for(var/turf/closed/mineral/M in minerals)
var/turf/F = get_turf(M)
- var/image/I = image('icons/turf/smoothrocks.dmi', loc = F, icon_state = M.scan_state, layer = 18)
+ var/image/I = image('icons/turf/smoothrocks.dmi', loc = F, icon_state = M.scan_state)
+ I.plane = PLANE_EFFECTS_UNLIT
C.images += I
spawn(30)
if(C)
@@ -980,7 +980,7 @@
C.icon_state = M.scan_state
/obj/effect/overlay/temp/mining_overlay
- layer = 20
+ plane = PLANE_EFFECTS_UNLIT
icon = 'icons/turf/smoothrocks.dmi'
anchored = 1
mouse_opacity = 0
@@ -1110,4 +1110,4 @@
component_parts += new /obj/item/weapon/stock_parts/matter_bin(null)
component_parts += new /obj/item/weapon/stock_parts/matter_bin(null)
component_parts += new /obj/item/weapon/stock_parts/console_screen(null)
- RefreshParts()
\ No newline at end of file
+ RefreshParts()
diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm
index 3a8e0dcaaa6..0beb14f8186 100644
--- a/code/modules/mob/inventory.dm
+++ b/code/modules/mob/inventory.dm
@@ -29,7 +29,6 @@
if(!l_hand)
W.loc = src //TODO: move to equipped?
l_hand = W
- W.layer = 20 //TODO: move to equipped?
W.equipped(src,slot_l_hand)
if(pulling == W)
stop_pulling()
@@ -47,7 +46,6 @@
if(!r_hand)
W.loc = src
r_hand = W
- W.layer = 20
W.equipped(src,slot_r_hand)
if(pulling == W)
stop_pulling()
@@ -92,7 +90,6 @@
return 1
else
W.loc = get_turf(src)
- W.layer = initial(W.layer)
W.dropped(src)
return 0
@@ -154,8 +151,6 @@
client.screen -= I
I.loc = loc
I.dropped(src)
- if(I)
- I.layer = initial(I.layer)
return 1
diff --git a/code/modules/mob/living/carbon/inventory.dm b/code/modules/mob/living/carbon/inventory.dm
index 00efe469b81..3dd183b486c 100644
--- a/code/modules/mob/living/carbon/inventory.dm
+++ b/code/modules/mob/living/carbon/inventory.dm
@@ -32,7 +32,6 @@
I.screen_loc = null // will get moved if inventory is visible
I.loc = src
I.equipped(src, slot)
- I.layer = 20
switch(slot)
if(slot_back)
diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm
index de6de0bd39b..c92626d4ed7 100644
--- a/code/modules/mob/living/living.dm
+++ b/code/modules/mob/living/living.dm
@@ -841,6 +841,7 @@ Sorry Giacom. Please don't be mad :(
I = image(r_hand.icon, A, r_hand.icon_state, A.layer + 1)
else // Attacked with a fist?
return
+ I.plane = PLANE_EFFECTS_UNLIT
// Who can see the attack?
var/list/viewing = list()
diff --git a/code/modules/mob/living/silicon/robot/inventory.dm b/code/modules/mob/living/silicon/robot/inventory.dm
index 02bbd168dc1..7e450f3a94a 100644
--- a/code/modules/mob/living/silicon/robot/inventory.dm
+++ b/code/modules/mob/living/silicon/robot/inventory.dm
@@ -48,7 +48,7 @@
if(!module_state_1)
O.mouse_opacity = initial(O.mouse_opacity)
module_state_1 = O
- O.layer = 20
+ O.plane = PLANE_UI_OBJECTS
O.screen_loc = inv1.screen_loc
contents += O
if(istype(module_state_1,/obj/item/borg/sight))
@@ -58,7 +58,7 @@
else if(!module_state_2)
O.mouse_opacity = initial(O.mouse_opacity)
module_state_2 = O
- O.layer = 20
+ O.plane = PLANE_UI_OBJECTS
O.screen_loc = inv2.screen_loc
contents += O
if(istype(module_state_2,/obj/item/borg/sight))
@@ -68,7 +68,7 @@
else if(!module_state_3)
O.mouse_opacity = initial(O.mouse_opacity)
module_state_3 = O
- O.layer = 20
+ O.plane = PLANE_UI_OBJECTS
O.screen_loc = inv3.screen_loc
contents += O
if(istype(module_state_3,/obj/item/borg/sight))
diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm
index e067091f826..3b92baf5c33 100644
--- a/code/modules/mob/living/silicon/robot/robot.dm
+++ b/code/modules/mob/living/silicon/robot/robot.dm
@@ -84,7 +84,6 @@
robot_modules_background = new()
robot_modules_background.icon_state = "block"
- robot_modules_background.layer = 19 //Objects that appear on screen are on layer 20, UI should be just below it.
ident = rand(1, 999)
update_icons()
diff --git a/code/modules/mob/living/simple_animal/friendly/drone/inventory.dm b/code/modules/mob/living/simple_animal/friendly/drone/inventory.dm
index cc56e9382a9..a354e355ae9 100644
--- a/code/modules/mob/living/simple_animal/friendly/drone/inventory.dm
+++ b/code/modules/mob/living/simple_animal/friendly/drone/inventory.dm
@@ -94,7 +94,6 @@
I.screen_loc = null // will get moved if inventory is visible
I.loc = src
I.equipped(src, slot)
- I.layer = 20
switch(slot)
if(slot_head)
diff --git a/code/modules/mob/living/simple_animal/friendly/drone/visuals_icons.dm b/code/modules/mob/living/simple_animal/friendly/drone/visuals_icons.dm
index 4b3e79d22f3..399b64b1401 100644
--- a/code/modules/mob/living/simple_animal/friendly/drone/visuals_icons.dm
+++ b/code/modules/mob/living/simple_animal/friendly/drone/visuals_icons.dm
@@ -37,7 +37,6 @@
hands_overlays += r_hand_image
if(client && hud_used && hud_used.hud_version != HUD_STYLE_NOHUD)
- r_hand.layer = 20
r_hand.screen_loc = ui_rhand
client.screen |= r_hand
@@ -54,7 +53,6 @@
hands_overlays += l_hand_image
if(client && hud_used && hud_used.hud_version != HUD_STYLE_NOHUD)
- l_hand.layer = 20
l_hand.screen_loc = ui_lhand
client.screen |= l_hand
diff --git a/code/modules/mob/living/ventcrawling.dm b/code/modules/mob/living/ventcrawling.dm
index d01b00ceaeb..6e07ba5cd28 100644
--- a/code/modules/mob/living/ventcrawling.dm
+++ b/code/modules/mob/living/ventcrawling.dm
@@ -92,8 +92,8 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/components/unary
for(var/X in totalMembers)
var/obj/machinery/atmospherics/A = X //all elements in totalMembers are necessarily of this type.
if(!A.pipe_vision_img)
- A.pipe_vision_img = image(A, A.loc, layer = 20, dir = A.dir)
- //20 for being above darkness
+ A.pipe_vision_img = image(A, A.loc, dir = A.dir)
+ A.pipe_vision_img.plane = PLANE_EFFECTS_UNLIT
pipes_shown += A.pipe_vision_img
if(client)
client.images += A.pipe_vision_img
diff --git a/code/modules/mob/mob_grab.dm b/code/modules/mob/mob_grab.dm
index c89cf9ac1a8..e9cbe67732b 100644
--- a/code/modules/mob/mob_grab.dm
+++ b/code/modules/mob/mob_grab.dm
@@ -12,7 +12,7 @@
var/allow_upgrade = 1
var/last_upgrade = 0
- layer = 21
+ plane = PLANE_UI_OBJECTS
item_state = "nothing"
w_class = 5
diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm
index 9a5aae78ea7..b1d1f59cb68 100644
--- a/code/modules/mob/transform_procs.dm
+++ b/code/modules/mob/transform_procs.dm
@@ -132,7 +132,6 @@
if (W)
W.loc = loc
W.dropped(src)
- W.layer = initial(W.layer)
//Make mob invisible and spawn animation
notransform = 1
diff --git a/code/modules/paperwork/photography.dm b/code/modules/paperwork/photography.dm
index 3edf26b56e8..519116763b6 100644
--- a/code/modules/paperwork/photography.dm
+++ b/code/modules/paperwork/photography.dm
@@ -201,7 +201,7 @@
var/atom/c = atoms[i]
for(j = sorted.len, j > 0, --j)
var/atom/c2 = sorted[j]
- if(c2.layer <= c.layer)
+ if(c2.layer <= c.layer)//needs updating to account for plane
break
sorted.Insert(j+1, c)
diff --git a/code/modules/power/singularity/collector.dm b/code/modules/power/singularity/collector.dm
index 304e5a37a1f..d5db982b15a 100644
--- a/code/modules/power/singularity/collector.dm
+++ b/code/modules/power/singularity/collector.dm
@@ -120,7 +120,6 @@ var/global/list/rad_collectors = list()
if (!Z)
return
Z.loc = get_turf(src)
- Z.layer = initial(Z.layer)
src.P = null
if(active)
toggle_power()
diff --git a/tgstation.dme b/tgstation.dme
index be56d6608f7..e67def99b9a 100644
--- a/tgstation.dme
+++ b/tgstation.dme
@@ -31,6 +31,7 @@
#include "code\__DEFINES\genetics.dm"
#include "code\__DEFINES\hud.dm"
#include "code\__DEFINES\is_helpers.dm"
+#include "code\__DEFINES\layers_planes.dm"
#include "code\__DEFINES\machines.dm"
#include "code\__DEFINES\math.dm"
#include "code\__DEFINES\misc.dm"
@@ -84,7 +85,6 @@
#include "code\_globalvars\lists\mobs.dm"
#include "code\_globalvars\lists\names.dm"
#include "code\_globalvars\lists\objects.dm"
-#include "code\_onclick\_defines.dm"
#include "code\_onclick\adjacent.dm"
#include "code\_onclick\ai.dm"
#include "code\_onclick\autoclick.dm"