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()