Skip to content

Commit 24b53ed

Browse files
authored
Fixes Ambient Occlusion overlays getting stuck on turf change. (#903)
* fixes AO getting stuck when trying to unset itself * cleanup
1 parent dcc0b95 commit 24b53ed

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

code/modules/ambient_occlusion/turf_ao.dm

+9-10
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,19 @@
5858

5959
#define PROCESS_AO(TARGET, AO_VAR, NEIGHBORS, ALPHA, SHADOWER) \
6060
if (permit_ao && NEIGHBORS != AO_ALL_NEIGHBORS) { \
61-
if (NEIGHBORS != AO_ALL_NEIGHBORS) { \
62-
var/image/I = cache["ao-[NEIGHBORS]|[pixel_x]/[pixel_y]/[pixel_z]/[pixel_w]|[ALPHA]|[SHADOWER]"]; \
63-
if (!I) { \
64-
/* This will also add the image to the cache. */ \
65-
I = make_ao_image(NEIGHBORS, TARGET.pixel_x, TARGET.pixel_y, TARGET.pixel_z, TARGET.pixel_w, ALPHA, SHADOWER) \
66-
} \
67-
AO_VAR = I; \
61+
var/image/I = cache["ao-[NEIGHBORS]|[pixel_x]/[pixel_y]/[pixel_z]/[pixel_w]|[ALPHA]|[SHADOWER]"]; \
62+
if (!I) { \
63+
/* This will also add the image to the cache. */ \
64+
I = make_ao_image(NEIGHBORS, TARGET.pixel_x, TARGET.pixel_y, TARGET.pixel_z, TARGET.pixel_w, ALPHA, SHADOWER); \
6865
} \
69-
} \
70-
TARGET.add_overlay(AO_VAR, TRUE);
66+
AO_VAR = I; \
67+
TARGET.add_overlay(AO_VAR); \
68+
}
7169

7270
#define CUT_AO(TARGET, AO_VAR) \
7371
if (AO_VAR) { \
74-
TARGET.cut_overlay(AO_VAR, TRUE); \
72+
TARGET.cut_overlay(AO_VAR); \
73+
AO_VAR = null; \
7574
}
7675

7776
/proc/make_ao_image(corner, px = 0, py = 0, pz = 0, pw = 0, alpha, shadower)

0 commit comments

Comments
 (0)