overmap POI spawn fix (#10332)

This commit is contained in:
Kashargul
2025-03-11 16:21:05 +01:00
committed by GitHub
parent 5ed8218eba
commit 98ccd0d5d0
2 changed files with 30 additions and 41 deletions
+17 -1
View File
@@ -49,7 +49,7 @@
var/unique_identifier //Define this for objs that we want to be able to rename. Needed to avoid compiler errors if not included.
/obj/effect/overmap/visitable/Initialize(mapload)
/obj/effect/overmap/visitable/Initialize(mapload, dyn_poi) // CHOMPEdit
. = ..()
if(. == INITIALIZE_HINT_QDEL)
return
@@ -65,6 +65,22 @@
forceMove(locate(start_x, start_y, global.using_map.overmap_z))
// CHOMPAdd Start
if(dyn_poi)
for(var/obj/effect/overmap/visitable/dynamic/poi/P in loc.contents) // If we've spawned on another poi, we'll try again once.
if(P == src)
continue
start_x = start_x || rand(OVERMAP_EDGE, global.using_map.overmap_size - OVERMAP_EDGE)
start_y = start_y || rand(OVERMAP_EDGE, global.using_map.overmap_size - OVERMAP_EDGE)
forceMove(locate(start_x, start_y, global.using_map.overmap_z))
break
var/sanity = 0
for(var/obj/effect/overmap/visitable/dynamic/poi/P in loc.contents)
sanity++
if(sanity > 1)
return INITIALIZE_HINT_QDEL
// CHOMPAdd End
if(!docking_codes)
docking_codes = "[ascii2text(rand(65,90))][ascii2text(rand(65,90))][ascii2text(rand(65,90))][ascii2text(rand(65,90))]"