From 9a8778b16f0a0e7c332e456c845f310992d3fd72 Mon Sep 17 00:00:00 2001 From: CitadelStationBot Date: Fri, 9 Jun 2017 20:11:51 -0500 Subject: [PATCH] Adds /image/proc/copy_overlays --- .../subsystem/processing/overlays.dm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/code/controllers/subsystem/processing/overlays.dm b/code/controllers/subsystem/processing/overlays.dm index 4e1d2d64d5..c856ab165b 100644 --- a/code/controllers/subsystem/processing/overlays.dm +++ b/code/controllers/subsystem/processing/overlays.dm @@ -161,7 +161,7 @@ PROCESSING_SUBSYSTEM_DEF(overlays) if(NOT_QUEUED_ALREADY && need_compile) //have we caught more pokemon? QUEUE_FOR_COMPILE -/atom/proc/copy_overlays(atom/other, cut_old = FALSE) //copys our_overlays from another atom +/atom/proc/copy_overlays(atom/other, cut_old) //copys our_overlays from another atom if(!other) if(cut_old) cut_overlays() @@ -190,3 +190,18 @@ PROCESSING_SUBSYSTEM_DEF(overlays) /image/proc/cut_overlays(x) overlays.Cut() + +/image/proc/copy_overlays(atom/other, cut_old) + if(!other) + if(cut_old) + cut_overlays() + return + + var/list/cached_other = other.our_overlays + if(cached_other) + if(cut_old || !overlays.len) + overlays = cached_other.Copy() + else + overlays |= cached_other + else if(cut_old) + cut_overlays()