OpenDream icon indicating copy to clipboard operation
OpenDream copied to clipboard

Creating an area with a loc doesnt reuse the existing instance

Open redmoogle opened this issue 2 years ago • 1 comments

OpenDream image Byond image

Notes: 0xb seems to be for map created loc doesnt seem to matter (maybe z level dependent)

Sample Code

/mob/verb/CreateAreaInstance()
	var/area/B = new /area/A(loc)
	var/area/C = new /area/A()

	usr << ref(B)
	usr << ref(C)

redmoogle avatar Jul 28 '23 22:07 redmoogle

Interesting note if the area exists it errors out image

with

/mob/verb/ReuseAreaInstance()
	var/turf/A = get_step(loc, 0)
	var/area/B = get_area(loc)
	usr << "A"
	B.contents -= A
	usr << "B"
	var/area/C = new /area/C(loc)
	usr << C
	C.contents += A
	usr << "C"
	usr << ref(get_area(loc))

redmoogle avatar Jul 28 '23 22:07 redmoogle