mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-02-05 22:28:18 +00:00
Fixes anomalies not spawning right (#22474)
* fix broken anomalies * Apply suggestions from code review Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com> --------- Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>
This commit is contained in:
@@ -15,26 +15,27 @@
|
||||
target_turf = find_targets(TRUE)
|
||||
|
||||
/datum/event/anomaly/proc/find_targets(warn_on_fail = FALSE)
|
||||
var/turf/target
|
||||
for(var/tries in 0 to TURF_FIND_TRIES)
|
||||
impact_area = findEventArea()
|
||||
if(!impact_area)
|
||||
if(warn_on_fail)
|
||||
CRASH("No valid areas for anomaly found.")
|
||||
else
|
||||
return
|
||||
stack_trace("No valid areas for anomaly found.")
|
||||
kill()
|
||||
return
|
||||
var/list/candidate_turfs = get_area_turfs(impact_area)
|
||||
while(length(candidate_turfs))
|
||||
var/turf/candidate = pick_n_take(candidate_turfs)
|
||||
if(!is_blocked_turf(candidate,TRUE))
|
||||
target = candidate
|
||||
target_turf = candidate
|
||||
break
|
||||
if(target_turf)
|
||||
break
|
||||
if(!target_turf)
|
||||
CRASH("Anomaly: Unable to find a valid turf to spawn the anomaly. Last area tried: [impact_area] - [impact_area.type]")
|
||||
stack_trace("Anomaly: Unable to find a valid turf to spawn the anomaly. Last area tried: [impact_area] - [impact_area.type]")
|
||||
kill()
|
||||
return
|
||||
|
||||
return target
|
||||
return target_turf
|
||||
|
||||
/datum/event/anomaly/announce(false_alarm)
|
||||
var/area/target = false_alarm ? findEventArea() : impact_area
|
||||
|
||||
Reference in New Issue
Block a user