Skip to content

Commit

Permalink
Fix latejoin cyborgs sometimes ending up in walls and such
Browse files Browse the repository at this point in the history
  • Loading branch information
Absolucy committed Jan 20, 2025
1 parent 7d69a0f commit 07bc9de
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions code/modules/jobs/job_types/cyborg.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,15 @@

/datum/job/cyborg/proc/get_random_open_turf_in_area()
var/list/turfs = get_area_turfs(/area/station/ai_monitored/turret_protected/ai_upload)
var/turf/open/target_turf = null
while(!target_turf)
var/turf/turf = pick(turfs)
if(!turf.density)
target_turf = turf
var/turf/open/target_turf
while(length(turfs))
var/turf/turf = pick_n_take(turfs)
if(!isfloorturf(turf) || turf.is_blocked_turf(exclude_mobs = TRUE))
continue
target_turf = turf
break
if(!target_turf)
CRASH("Failed to find eligible spawn turf for a cyborg!")
return target_turf

/datum/job/cyborg/after_spawn(mob/living/spawned, client/player_client)
Expand Down

0 comments on commit 07bc9de

Please sign in to comment.